I am currently trying to integrate an interface for the teltonika fmc640 on our server.
Quick introduction: The device sends its IMEI, server decides wether it declines the data packet or not (01 = accept, 00= decline) and if the servers responds with 01 the actual data packet gets send.
This is the official documentation (https://wiki.teltonika-gps.com/view/Teltonika_Data_Sending_Protocols) and this is the specific part
After receiving IMEI, the 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 a binary packet. I.e. 1 byte 0x01 or 0x00.
Then the module starts to send the first AVL data packet.
This is what I have tried so far to even check if sth is received. I get the IMEI correctly, "even" when I send it to url endpoint. But sadly none of the two client_response data works as the client_data is null everytime. As I dont have logs on the device itself I dont know if the response from the server is even correct.
import requests
import socket
HOST = '0.0.0.0'
PORT = 5097
server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
server_socket.bind((HOST, PORT))
server_socket.listen(5)
client_socket, client_address = server_socket.accept()
imei_data = client_socket.recv(1024)
# client_response = bytes([1])
client_response = b'\x01'
client_socket.send(client_response)
client_data = client_socket.recv(1024)
data = {
'clientData': client_data,
}
url = "our endpoint url"
response = requests.post(url, data=data)
Really don't know what is wrong here