0

I am currently building a server for GPS tracking using Teltonika Codec 8 protocol. While I have read all the relevant documentation, I am facing an issue where I am unable to move to the next record beyond record 13. I have received the IMEI and AVL packet successfully, but the protocol seems to be stuck at record 13.

**Code: **

`def handle_client(conn, addr):

print(f"[NEW CONNECTION] {addr} connected.")

connected = True

while connected:
    imei = conn.recv(1024)
    print(imei)

    try:


        message = '\x01'

        message = message.encode('utf-8')

        conn.send(message)
        connected = False

    except socket.error as e:

        print(f"Error sending reply. Maybe it's not our device {addr}: {e}")
        connected = False



    try:

        data = conn.recv(1024)

        recieved = binascii.hexlify(data)

        print(data)
        print(recieved)

        decodethis(recieved)

        record = getrecord(recieved)

        message = "0000" + str(record).zfill(4)
        print(record)


        message = message.encode('utf-8')

        conn.send(message)
        conn.close()
        connected = False

    except socket.error as e:
        print(f"Error receiving data from {addr}: {e}")
        print("Error Occured.")
        connected = False

        break

conn.close()`

I have consulted the documentation and found that I need to send "00000013" to inform the protocol that I have received the 13th record. However, I am unsure how to proceed with this. Could someone please provide me with some guidance or sample code to help me move to the next record beyond record 13?

Followed these links: https://community.teltonika-gps.com/4965/how-to-read-data-from-teltonika-fmb001-with-a-python-script https://wiki.teltonika-networks.com/view/VCode#Codec_8

Devices: FMB110 FMB140

Thank you in advance for any assistance you can provide.

1 Answers1

0

Do you ask what response send to device for inform it that 13 records are received? Probably You need to send 4 bytes 0x0000000B which means 13 decimal.

Piotr
  • 71
  • 1
  • 5