Sending Codec12 commands using Hercules

From Wiki Knowledge Base | Teltonika GPS
General Technical Questions > Sending Codec12 commands using Hercules

Description

Hercules SETUP utility is useful serial port terminal (RS-485 or RS-232 terminal), UDP/IP terminal and TCP/IP Client Server terminal.It was created for HW group internal use only, but today it's includes many functions in one utility and it's Freeware! With our original devices (Serial/Ethernet Converter, RS-232/Ethernet Buffer or I/O Controller) it can be used for the UDP Config.

Setting up for connection with Hercules Software

GPRS settings.png

1. Press GPRS tab

  • GPRS Context field requires you to enter your SIM providers' APN settings. Make sure to fill this in based on the SIM provider you are using with your Teltonika device.

More information about GPRS panel and it's parameters for each device can be found here:

TST100 | TFT100 | GH5200 | TMT250

Server settings.png

2. In GPRS->Server settings -> Domain field, External IP of your PC must be entered. There are several ways to find out your machine's external IP address:

  • Visit the link provided to find out external IP address via website: pingEU
  • If you do not want to use a website you can find your IP through Windows Command Prompt.
  • Open Start WindowsSTART.png Click the Windows logo in the bottom-left corner of the screen, or press the ⊞ Win key. You can search for Command Prompt on all supported versions of Windows.
  • In the Command Prompt enter the following: nslookup myip.opendns.com resolver1.opendns.com

Example window:

External IP dnslookup.png

  • Copy Non-Authoritative answer Address
  • Paste Non-Authoritative answer Address in Teltonika Configurator Server settings -> Domain field
  • In Port field, enter an open port.

If it is unknown if the port is open, to check if the port is open click pingEU and enter external IP address and port and click Go button.

Ping.png

Example window:

ServersettingsHercules.png

  • Save settings to the device

Hercules Software

1. Click TCP Server
2. Enter Port and click Listen

  • When device connects to Hercules, device IMEI is sent and is displayed in Received data window

4. Tick HEX box
5. Enter Codec 12 command 000000000000000F0C010500000007676574696E666F0100004312 getinfo (in example below)
6. Click Send button
Note: To make device connect to Hercules faster, click any button, that has an event configured. In the example below, a button was pressed to send an SMS message.

Hercules Codec12a.gif


How to create a HEX command

getinfo command 000000000000000F0C010500000007676574696E666F0100004312

  • Data size is calculated by the sum of bytes from Codec ID to Command Quantity 2. In this case it is 15 (DEC) or F (HEX)bytes.
  • CRC-16 is calculated also by the sum of bytes from Codec ID to Command Quantity 2.
  • To find out CRC-16 go to CRC-16 calculator page
  • In HEX field enter the following 0C010500000007676574696E666F01 getinfo All bytes in HEX from Codec ID to Command Quantity 2
  • Find CRC-16-IBM table
  • Reversed 0xA001 Little Endian (DCBA) shows CRC-16, which is 43 12
CRC-16-IBM
(Bisync, Modbus, USB, ANSI X3.28, many others; also known as CRC-16 and CRC-16-ANSI)
Generator Type Big Endian (ABCD) Little Endian (DCBA)
Normal 0x8005 FE 8D 8D FE
Reversed 0xA001 12 43 43 12
Reversed Reciprocal 0xC002 64 22 22 64

Hexadecimal stream of GPRS command and answer in these examples are given in hexadecimal form. The different fields of messages are separate into different table columns for better readability and some of them are converted to ASCII values for better understanding.

Example: Sending getinfo SMS command via GPRS Codec12

Server request in hexadecimal stream:
000000000000000F0C010500000007676574696E666F0100004312

Parsed:

Server Command
Server Command Part HEX Code Part
Zero Bytes 00 00 00 00
Data Size 00 00 00 0F
Codec ID 0C
Command Quantity 1 01
Command Type 05
Command Size 00 00 00 07
Command 67 65 74 69 6E 66 6F
Command Quantity 2 01
CRC-16 00 00 43 12

Note: that Server Command converted from HEX to ASCII means getinfo

Example:

When creating getstatus Codec 12 command:

  • Codec 12 in HEX is 0C 1 byte
  • Command Quantity 1 is 01 1 byte
  • Command Type is 05 1 byte
  • Command Size is 00 00 00 09, because getstatus converted in HEX is 9 bytes. 4 bytes
  • Command getstatus converted to HEX format is 67 65 74 73 74 61 74 75 73 9 bytes
  • Command Quantity 2 is 01 1 byte
  • CRC-16 converted from 0C01050000000967657473746174757301 is 00 00 8C D7 is 4 bytes


Server Command
Server Command Part HEX Code Part
Zero Bytes 00 00 00 00
Data Size 00 00 00 11
Codec ID 0C
Command Quantity 1 01
Command Type 05
Command Size 00 00 00 09
Command 67 65 74 73 74 61 74 75 73
Command Quantity 2 01
CRC-16 00 00 8C D7