FMXXXX Protocols v2 - 7
FMXXXX Protocols v2 - 7
FMXXXX Protocols v2 - 7
V2.7
Contents
1.
2.
2.1
2.2
3.
3.1
3.2
4.
5.
6.
ENCODING ............................................................................................................................................................................................... 10
STRUCTURE ............................................................................................................................................................................................... 10
DECODING GPS POSITION .................................................................................................................................................................... 11
REMOTE CONFIGURATION......................................................................................................................................................................12
6.1
6.2
6.3
6.4
6.5
8.
1.
1.1
Because the smallest information amount that can be written is one bit, there can be some bits left unused
when result is byte array. Any unused bits should be left blank.
Codec ID
Number of Data
Data
Number of Data
1 Byte
1 Byte
1 Byte
1.2
Data
AVL Data
AVL Data
1.3
AVL Data
Timestamp
Priority
GPS Element
IO Element
8 Bytes
1 Byte
15 Bytes
...
Timestamp difference, in milliseconds, between the current time and midnight, January 1, 1970 UTC.
1.4
Priority
0
1
2
3
1.5
Low
High
Panic
Security
GPS Element
Longitude
Latitude
Altitude
Angle
Satellites
Speed
4 Bytes
4 Bytes
2 Bytes
2 Bytes
1 Byte
2 Bytes
X
Y
Altitude
Angle
Satellites
Speed
Longitude 1
Latitude1
In meters above sea level1
In degrees, 0 is north, increasing clock-wise 1
Number of visible satellites1
Speed in km/h. 0x0000 if GPS data is invalid1
Longitude and latitude are integer values built from degrees, minutes, seconds and milliseconds by formula.
m
s
ms
+
+
d +
p
60 3600 3600000
d
m
s
ms
p
Degrees
Minutes
Seconds
Milliseconds
Precision (10000000)
If longitude is in west or latitude in south, multiply result by 1. To determine if the coordinate is negative,
convert it to binary format and check the very first bit. If it is 0, coordinate is positive, if it is 1, coordinate is
negative. Example:
Received value: 20 9c ca 80
Converted to BIN: 00100000 10011100 11001010 10000000 first bit is 0, which means coordinate is positive
Convered to DEC: 547146368
For more information see two's compliment arithmetics.
N8th IO ID
N8th IO Value
8 Bytes
1st IO Value
8 Bytes
1 Byte
N8 of Eight Bytes
IO
1st IO ID
1 Byte
N4th IO Value
4 Bytes
1 Byte
N4th IO ID
1st IO Value
4 Bytes
1 Byte
N4 of Four Bytes
IO
1st IO ID
1 Byte
N2th IO Value
2 Bytes
1 Byte
N2th IO ID
1 Byte
1st IO Value
2 Bytes
N2 of Two Bytes
IO
1st IO ID
1 Byte
1 Byte
N1th IO Value
1st IO Value
1 Byte
1 Byte
1st IO ID
1 Byte
N1th IO ID
N1 of One Byte IO
1 Byte
1 Byte
N of Total IO
1 Byte
Event IO ID
IO element
1 Byte
1.6
Event IO ID if data is acquired on event this field defines which IO property has changed and generated
an event. If data cause is not event the value is 0.
If record is without valid coordinates (there were no GPS fix in the moment of data acquisition) Longitude, Latitude and Altitude
values are last valid fix, and Angle, Satellites and Speed are 0.
N
N1
N2
N4
N8
1.7
Example
Received data:
080400000113fc208dff000f14f650209cca80006f00d6040004000403010115031603000
1460000015d0000000113fc17610b000f14ffe0209cc580006e00c0050001000403010115
0316010001460000015e0000000113fc284945000f150f00209cd20000950108040000000
4030101150016030001460000015d0000000113fc267c5b000f150a50209cccc000930068
0400000004030101150016030001460000015b0004
08 Codec ID
04- Number of Data (4 records)
1st record data
00000113fc208dff Timestamp in milliseconds (1185345998335
1185345998,335 in Unix Timestamp = 25 Jul 2007 06:46:38 UTC)
00 Priority
GPS Element
0f14f650 Latitude 253032016 = 25,3032016 N
209cca80 Longitude 547146368 = 54,7146368 E
006f Altitude 111 meters
00d6 Angle 214
04 4 Visible sattelites
0004 4 km/h speed
IO Element
00 IO element ID of Event generated (in this case when 00
data generated not on event)
04 4 IO elements in record
03 3 IO elements, which length is 1 Byte
01 IO element ID = 01
01 1st IO elements value = 1
15 IO element ID = 21
03 21st IO elements value = 3
16 IO element ID = 22
03 22nd IO elements value = 3
00 0 IO elements, which value length is 2 Bytes
01 1 IO element, which value length is 4 Bytes
46 IO element ID = 70
0000015d 70th IO elements value = 349
2.
2.1
Four zeros
Data length
Data
CRC
2.2
Data length
Data Crc
First when module connects to server, module sends its IMEI. IMEI is sent the same way as encoding
barcode. First comes short identifying number of bytes written and then goes IMEI as text (bytes).
For example IMEI 123456789012345 would be sent as 000F313233343536373839303132333435
After receiving IMEI, server should determine if it would accept data from this module. If yes server will reply
to module 01 if not 00. Note that confirmation should be sent as binary packet.
Then module starts to send first AVL data packet. After server receives packet and parses it, server must
report to module number of data received as integer (four bytes).
If sent data number and reported by server doesnt match module resends sent data.
Example:
Module connects to server and sends IMEI:
000F313233343536373839303132333435
Server accepts the module:
01
Module sends data packet:
00000000000000FE
CRC
CodecId 08,
CRC of 'AVL data array'
NumberOfData 2.
(Encoded using continuous bit
stream. Last byte padded to align
to byte boundary)
0802...(data elements)...02
00008612
3.
3.1
UDP channel is a transport layer protocol above UDP/IP to add reliability to plain UDP/IP using
acknowledgment packets. The packet structure is as follows:
UDP datagram
UDP
channel
packet x N
Packet length
2 bytes
Packet Id
2 bytes
Packet Type
1 byte
Packet payload
m bytes
Data payload
Packet Type
0
Acknowledgment packet
Acknowledgment packet should have the same packet id as acknowledged data packet and empty data payload.
Acknowledgement should be sent in binary format.
Acknowledgment packet
3.2
Packet length
2 bytes
0x0003
Packet id
2 bytes
Packet type
1 byte
0x02
AVL data are sent encapsulated in UDP channel packets (Data payload field).
Module IMEI
Len 253,
Id 0xCAFE,
Packet type 01
(without ACK)
CodecId 08,
NumberOfData 2.
(Encoded using continuous bit
stream)
00FDCAFE01
DD000F3133343536373839303132333435
0802...(data elements)...02
Len 5,
Id 0xABCD,
Packet type 01 (without ACK)
0005ABCD01
DD02
4.
AVL data or events can be sent encapsulated in binary SMS. TP-DCS field of these SMS should indicate that
message contains 8-bit data (for example: TP-DCS can be 0x04).
SM data (TP-UD)
AVL data array
IMEI: 8 bytes
5.1
Encoding
To be able to compress 24 GPS data entries into one SMS (140 octets), the data is encoded extensively using
bit fields. Data packet can be interpreted as a bit stream, where all bits are numbered as follows:
Byte 1
Byte 2
Byte 3
Bytes 4-...
Bits 0-7
Bits 8-15
Bits 16-24
Bits 25-...
Bits in a byte are numbered starting from least significant bit. A field of 25 bits would consist of bits 0 to 24
where 0 is the least significant bit and bit 24 most significant bit.
5.2
Structure
SMS Data Structure
Size
(bits)
Field
Description
CodecId
CodecId = 4
35
Timestamp
ElementCount
GPSDataElement
ElementCount *
IMEI
The time of only the first GPS data element is specified in Timestamp field. Time corresponding to each further
element can be computed as elementTime = Timestamp + (1 hour * elementNumber).
GPSDataElement
Size
(bits)
Field
Description
ValidElement
10
GPSDataElement
Format of following data.
14
LongitudeDiff
14
LatitudeDiff
DifferentialCoo
rds == 0
5.3
DifferentialCoords
DifferentialCoords
== 1
ValidElement == 1
Longitude
Latitude
LongDegMult
LatDegMult
prevLongitude
prevLatitude
21
Longitude
20
Latitude
Speed
Speed in km/h.
When decoding GPS data with DifferentialCoords=1, Latitude and Longitude values can be computed as follows:
Longitude=prevLongitude LongitudeDiff + 213 1, Latitude=prevLatitude LatitudeDiff + 213 1.
If there were no previous non-differential positions, differential coordinates should be computed assuming
prevLongitude=prevLatitude=0.
When Longitude and Latitude values are known, longitude and latitude representation in degrees can be
computed as follows:
LongDeg =
Longitude * 360
180
2 21 1
LatDeg =
Latitude *180
90
2 20 1
11
6. REMOTE CONFIGURATION
FM2X00 and FM4X00 share the same configuration protocol, but
FM2X00 have only one profile (Profile No. 1). Sending configuration for
more than one profile for FM2X00 might cause it to stop responding.
6.1
Configuration process
To initiate configuration process, configuration server sends binary initiation SMS (Push SMS) containing
server host(ip address) and tcp port device should connect to and waits for TCP connection. Upon reception of
push SMS, device tries to establish TCP connection to configuration server using GPRS. If TCP connection
attempt succeeds, server sends out configuration data to device over established connection, device confirms
configuration reception and configures itself. If device doesn't connect to server in TcpWaitTimeout time, server
stops waiting for TCP connection, sends out configuration data using binary SMS, and waits for confirmation
SMS from device. If confirmation SMS doesn't arrive in specified time, server assumes that configuration process
failed.
Note: this is the preferred configuration procedure, but it is also possible to omit Push SMS and proceed
directly to configuration via binary SMS.
Configuration Server
Module
Push SMS
TCP connection
Configuration data
GPRS
connection
Confirmation
Done
12
6.2
Push SMS is sent to device to initiate configuration process. It contains authorization data, host and tcp
port of configuration server (device should connect to this address to retrieve new configuration data). When
sending push SMS, TP-Data-Coding-Scheme (TP-DCS) should be set to 0xF5 and TP-User-Data-HeaderIndicator (TP-UDHI) should be 1.
TP-UD
TP-UDH
Data(hex)
Description
060504
3 bytes
wdpPushPort
2 bytes
0000
2 bytes
LoginLength
1 byte
Login
LoginLength bytes
PasswordLength
1 byte
Password
HostLength
1 byte
ServerHost
HostLength bytes
ServerPort
2 bytes
APNLength
1 byte
Max 32 bytes
APNAddress
APNLength bytes
APN name.
If CHAP authentication is required append ':c',
for PAP authentication append ':p'. 2
GPRSLoginLength
1 byte
Max 30 bytes
GPRSLogin
GPRSLoginLength
bytes
GPRSPasswordLength
1 byte
Max 30 bytes
GPRSPassword
13
6.3
Configuration data is sent to device encoded in configuration packet, the configuration packet format is the
same whether configuring over GPRS or binary SMS.
Configuration packet
Length
Data(hex)
Param
Count
times
Description
PacketLength
2 bytes
PacketId
1 byte
ParamCount
2 bytes
ParamId
2 bytes
ParamValueLength 2 bytes
ParamValue
ParamValueLength bytes
...
6.4
Upon reception of push SMS, device tries to establish a TCP connection to configuration server. If
connection succeeds, configuration is done in following steps:
Device sends it's IMEI to server in following format:
IMEILength
2 bytes
IMEI
IMEILength bytes
PacketLength+2
bytes
following
PacketId
1 byte
PacketLength
2 bytes
Configuration done.
14
6.5
6.5.1
Since one SMS can transfer at most 140 bytes, configuration data have to be split into multiple SMS. Each
configuration SMS should have TP-Data-Coding-Scheme (TP-DCS) set to 0xF5 and TP-User-Data-HeaderIndicator (TP-UDHI) set to 1.
Configuration data
ConfigurationPacket
PacketLength+2 bytes
TP-UD
TP-UDH
Data(hex)
6.5.2
Length
Description
060504
3 bytes
wdpConfigPort
2 bytes
0000
2 bytes
LoginLength
1 byte
Login
LoginLength bytes
PasswordLength
1 byte
Password
PasswordLength bytes
TransferId
1 byte
Id unique for
configuration.
TotalParts
1 byte
CurrentPart
1 byte
ConfigurationData
all
messages
of
single
When device receives all configuration SMS, it assembles configuration data from parts. If received
configuration packet is valid, device sends confirmation SMS back to the server and configures itself. TP-DataCoding-Scheme (TP-DCS) of confirmation SMS is 0x04.
15
Confirmation SMS
TP-UD
6.6
Data(hex)
Length
Description
0xFF
1 byte
PacketId
1 byte
PacketLength
2 byte
WdpPushPort 0x07d1
0000
03
Login length 3
616161
Login 'aaa'
03
Password length 3
626262
Password 'bbb'
0b
Host length 11
3139322e3136382e312e31
Host '192.168.1.1'
aabb
Port 43707
0a
APN length 10
696e7465726e65743a63
04
75736572
01
61
16
000f
Length of IMEI 15
313233343536373839303132333435
IMEI '123456789012345'
PacketLength 146
8c
Packet id 0x8c
001b
Param count 27
03e8
Param id 1000
0001
30
03f2
Param id 1010
0001
31
03f3
Param id 1011
0002
3230
03f4
Param id 1012
0002
3031
03fc
Param id 1020
0001
30
0406
Param id 1030
0001
30
0407
Param id 1031
0001
17
30
0408
Param id 1032
0001
30
0409
Param id 1033
0001
30
040a
Param id 1034
0001
30
0410
Param id 1040
0001
30
0411
Param id 1041
0001
30
0412
Param id 1042
0001
30
0413
Param id 1043
0001
30
0414
Param id 1044
0001
30
041a
Param id 1050
0001
30
041b
Param id 1051
0001
30
041c
Param id 1052
0001
30
18
041d
Param id 1053
0001
30
041e
Param id 1054
0001
30
0424
Param id 1060
0001
30
0424
Param id 1061
0001
30
0425
Param id 1062
0001
30
0426
Param id 1063
0001
30
0426
Param id 1064
0001
30
0427
Param id 1065
0001
30
0cbd
Param id 3261
000c
2b3337303434343434343434
ParamValue '+37044444444'
0092
19
6.7
WdpConfigPort 0x07D5
0000
03
Login length 3
616161
Login 'aaa'
03
Password length 3
626262
Password 'bbb'
aa
TransferId 0xaa
02
Total parts 2
00
Current part 0
00928c05a503e800013003f200013103f300023230
03f40002313003fc00013004060001300407000130
04080001300409000130040a00013004100001300
41100013004120001300413000130041400013004
1a000130041b000130041c000130041d000130041e
000130042400013004250001300426000130
WdpConfigPort 0x07D5
0000
03
Login length 3
616161
Login 'aaa'
03
Password length 3
626262
Password 'bbb'
20
aa
TransferId 0xaa
02
Total parts 2
01
Current part 1
042700013004280001300cbd000c2b33373034343
43434343434
21
7.
BOOT <IMEI>,<APN>,<user>,<password>,<ip>:<port>,<filename>
Example: BOOT 353976010000001,banga,,,192.168.0.1:1234,boot.bin
When connected to the server, device sends its IMEI and required filename.
<IMEI>,<filename><CR><LF>
Example: 353976010000001,boot.bin<CR><LF>
Server checks is such file exists and sends its size and CRC in plain text format. If file does not exist, size is
zero.
Example: 11456,F0CD<CR><LF>
After that server is waiting for command START:
Example: START<CR><LF>
When it receives this command, server sends the file. During file transfer and after file transfer is complete
server is waiting for answer from device. Answers can be:
RESEND<CR><LF> device is asking to resend the file from beginning;
DOWNLOAD FAILED<CR><LF> device failed to receive file 10 times. After this command is sent,
device disconnects from server;
FLASHING FAILED<CR><LF> device received file but failed to flash ARM processor. After this
command is sent, device disconnects from server;
FLASHING SUCCEEDED<CR><LF> flashing procedure was successful. After this command is sent,
device disconnects from server;
<number><CR><LF> number indicates current flashing progress in percent.
Example: 57<CR><LF>
Please note that only unencrypted base firmware versions (extension *.bin) can be uploaded
to FMXXXX using the procedures above. Special firmware versions with extended
functionalities (extension *.e.bin) must be updated only via Teltonika RILS web application.
More information about the RILS web application can be found in FMXXXX User Manual.
22
8. CHANGE LOG
Nr.
Date
1
2
3
4
080821
081007
081023
081112
New
version
number
2.1
2.2
2.3
2.4
090811
2.5
6
7
091202
100107
2.6
2.7
Comments
1.5.2; 1.5.3; 1.8.2. 1.8.6 corrected
1.8; 1.9 chapters corrected
2 chapter revised CAN property explanation added.
Parameter and property list moved to User Manual document.
Updated remote configuration chapter.
Included coordinate decoding sample, minor fixes in sample
packet, FM2200 compatibility included.
Minor formatting fixes.
Shortened document name from FM2100, FM2200, FM4100
and FM4200 Protocols to FMXXXX Protocols. Major
formatting revision.
23