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
1. Press GPRS tab
More information about GPRS panel and it's parameters for each device can be found here: |
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:
Example window:
If it is unknown if the port is open, to check if the port is open click Example window:
|
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.
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 is43 12
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
, becausegetstatus
converted in HEX is 9 bytes. 4 bytes - Command
getstatus
converted to HEX format is67 65 74 73 74 61 74 75 73
9 bytes - Command Quantity 2 is
01
1 byte - CRC-16 converted from
0C01050000000967657473746174757301
is00 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 |