Processing SMS from GPS trackers using GSM modems
After the message receiving plug-in receives a message, it passes the message to the parser for processing. The purpose of the parser is to split the incoming text message into several separate values. When a text message is received, it appears in the main window of the program and looks like this:
[790477207XX] – text message sender
<CR><LF> - ASCII carriage return and line feed characters
<CR><LF> - the text of the message ends with the ASCII carriage return and line feed characters.
The format of the message text depends on the tracker model. We will take a text message in the following format as an example:
All values in this text message are separated by the “@” character.
You can use the “ASCII Data Parser” parser from the installation package to parse it. You should enable this parser on the “Request Analysis Filter” tab (fig. 1).
Fig.1 GPS tracker SMS. Selecting the parser
Then you should open the Parser configuration dialog box (fig. 2) using the “Configure” button.
Fig .2 GPS tracker SMS. Parser configuration
Use start/end indicators to split packets – enabled.
Specify #0D#0A in the “Packet-end indicator”. It corresponds to the hexadecimal codes of the ASCII <CR> and <LF> characters.
Fig.3 GPS tracker SMS. Parser configuration
Enable the “Detect client ID” option on the next tab. This option informs the parser that the sender's ID (phone number) is transferred before the text message and the parser will automatically assign it to the parser variable named CLIENTID.
If necessary, you can configure a filter that will filter out unnecessary messages. You can find detailed information about this feature in the help file.
You should specify the fields the text message contains on the “Data parsing” tab (fig. 4).
Fig.4 GPS tracker SMS. Parser configuration
You should add the description of all values you want to extract from the message to the tree of parser variables. You can see one of the values in figure 4.
- Variable name – this name will be used later in the filter and data export plug-ins. The name may contain only Latin letters.
- Data processing type – this option determines how the parser should extract the value from the message text. All values are separated by a special character in this example. So select the corresponding data processing type.
- Data type - defines the data type of the extracted value. IMEI is a string of characters in this example, which corresponds to the String type. The variables will be later processed depending on the selected data type: strings will be trimmed, date and time will be formatted.
- Positive integers – Word
- Positive and negative intergers – Integer
- Real-valued numbers – Float
- Date – Date
- Time – Time
- Date and time – Datatime
- Default value – this value will be used when there is no such value in the text message or it is impossible to convert it into the selected data type. The default value must correspond to the selected data type. For example, you cannot specify the default value for integers that consists not of digits.
- Field separator – specify the value separator for the previously selected data processing type. It is the “@” character in this example.
- Number - this number is the position of the value in the text message. The number of the first value is one.
Add the descriptions of all values that you need to extract from the text message in this way. The order the values are listed in the tree does not matter.
Fig.5 GPS tracker SMS. Parser variables
Use the “Date and time” field on the “Data format” tab (fig. 6) to specify the date and time format for the value extracted from the text message. This format will be used to convert the date and time string into the value of the Datetime type. If the format is specified incorrectly, an error message will appear in the program. You can find the detailed description of the characters that can be used in the date and time format in the help file.
Fig.6 GPS tracker SMS. Format options
You should check the parser after you configure it.
1. To do it, click the “OK” button to save the changes.
2. Enable the DDE server data export plug-in (fig. 7)
Fig.7 GPS tracker SMS. Data export plug-in
3. Click the “OK” button to save the changes.
4. Wait till a new text message is received and displayed in the main window of the program.
5. Open the Program options dialog box and double-click the DDE server data export plug-in. Switch to the “Active variables” tab in the DDE server dialog box (fig. 8). This list must contain the configured variables of the parser and their values. Here you can check whether the parser is configured correctly and change its options if necessary.
Fig.8 GPS tracker SMS. Active variables