Skip to content

karticr/Teltonika_FMBXXX_TCP_Server

Repository files navigation

Contributors Forks Stargazers Issues MIT License LinkedIn


Logo

Teltonika FMBXXX Tracker server

Python based tcp server to recieve and control teltonika fmb devices
Explore the docs »
Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage

About The Project

Teltonika FMBXXX server This project is a basic server that gets data from the teltonica devices and prints them its a basic tcp server that can handle multiple clients. Documentation for building a ready made tcp server for controlling/ getting data out of the teltonica trackers was hard for me so i programmed this so that you could build your server off this.

Communication is based on documentation from the teltonika wiki teltonika tcp protocols.

Communicating with teltonika devices

once the tracker is setup with the server ip and port with tcp communication on the configurator. The tracker will open a connection to the server and send its IMEI.

  • The first two bytes being the length of the IMEI number followed by the number. Once the server recieves the IMEI number it has to decide whether to accept the server by sending a reply or not.
  • 01 to accept and 00 to reject.
  • this server is designed to accept all incoming connections, but you can easily add in a database of imei numbers to filter the connections.
  • after accepting the connection the tracker will start sending datapackets with information thats set on the i/o settings on the configurator, set the variables you want sent to atleast low, for the tracker to send it to the server.
  • after accepting this data the server must reply back to the server with the number of data received as a four byte integer otherwise the tracker will reset the connection this is done using the avlDecoder.py its a class that parses the incoming data which is in codec 8 (teltonika tcp protocols.) and returns a dictinary that has all the details along with the number of data the tracker sent
  • dict variable with the key ('no_record_i') has to be encoded into 4 byte integer and sent back to the server which is done on the main.py using the mResponse function
  • this server loops over to get the data from the trackers do what you want with the dict response
  • Getting started

  • set the port you want to use on the main.py program
  • simply run the main.py
  • this will start the server and the server will print incoming data from the fmb devices periodically
  • Usage

    I have also programed and compiled diffrent programs and datasets that can be useful for your application

  • (Avl Ids) is a json list of all the avl varable ids and what they mean
  • (msgEncode.py) contains a class to encode messages into variouse differnt codecs that teltonica supports
    • msgToCodec12 is a function to convert messages into codec 12. codec 12 is used by the teltonica devices to accept sms/gprs commands
    • controlling outputs, getting io information, etc
    • all the available commands that the devices support are here msgEncode.py
    • inorder to encode the message simply call the msgToCodec12 function with the gprs command
    • and you can forward the return result from the above function to the tracker by using conn on main.py and
  • AvlDecoder decodes incoming codec 8 messages from the tracker into a dict with
    • codec id
    • no of records (this has to be sent back to the tracker as an acknowledgement)
    • crc-16 (crc-16/IBM)
    • latitude, longitude, altitude, angle, no of satellites, speed
    • io data (the input output 1 wire and other sensor information)
  • IO_decoder decodes the i/o information from the codec 18 message from the server
  • avlMatcher converts the avl ids into understandable variables using the avlIds.json
  • About

    teltonika fmb tcp control server

    Resources

    License

    Stars

    Watchers

    Forks

    Releases

    No releases published

    Packages

    No packages published

    Languages