How can I send a GPRS command to traccar server manually, meaning using a PC software tool.

José Fernandez4 years ago

Hello, I am about to order a Coban GPS306B device, I know they use the GPRS protocol. While I am waiting for the device, I was wondering if someone in this forum could help me to simulate or emulate the device by sending certain desired gps tracker commands to traccar server manually.
for example I saw this command in the GPRS protocol manual:

imei:353451044508750,001,0809231929,13554900601,F,055403.000,A,2233.1870,N,11354.3067,E,0.00,30.1,65.43,1,0,10.5%,0.%,28;

I have a tool such as "packet sender" but I don't know what to insert as value in order for it to communicate with traccar server over 5001 port.
thanks in advance

Anton Tananaev4 years ago

There are some scripts in the tools folder in the repository.

José Fernandez4 years ago

I found something that could be useful. Thank you so much Anton. Your help is always appreciated. I've read so far plenty of issues threads in this forum and you always respond to help, thanks again.

David4 years ago

Hi José, could you share it because it can be useful to me? Thank you

David4 years ago

Hi Jose, I find it interesting what you were asking .. could you please share it

José Fernandez4 years ago

David here is the script I found, the way is helping me is by making me realize that it is a socket programming script which sends a similar command I want to try to the port 5001. honestly i thought the network packet that had to be sent was more complicated since it wasn't an http request like anything else, that's why i asked the question.However thanks to Anton i figured that is just a socket program which sends udp packets following this example below

#!/usr/bin/python

import socket
import binascii

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("localhost", 5001))
#s.send(binascii.unhexlify('68680f0504035889905831401700df1a00000d0a'))
s.send("imei:123456789012345,tracker,151030080103,,F,000101.000,A,5443.3834,N,02512.9071,E,0.00,0;")

while True:
    print s.recv(1024)

s.close()
David4 years ago

Thanks Jose. But I don't understand the programming :-(

José Fernandez4 years ago

Well first of all the language is Python probably you already noticed that. I don't know Python however i can tell from the code that is the line s = socket.socket(socket.AF_INET, socket.SOCK_STREAM is just to create a socket, then s.connect(("localhost", 5001)) is to stablish the connection with the traccar server through the port '5001'. the other line s.send("imei:1234567.....) is the string command being sent to the server simulating the tracker that uses the GPRS protocol. so the string sent to the server imei:1234567....E,0.00,0; is actually a sample of what a tracker may send to traccar server which can include the latitude and longitude info. you would have to read the GPRS protocol to determine what strings you can be using to send to the server using the script i have shown you above.

David4 years ago

thanks José for explaining me line by line

David4 years ago

how to read the GPRS protocols of a device

Pratik4 years ago

I want to know how to send GPRS custom command to my GPS device which is connected with the traccar server

muhamedoufia year ago

Hi @Pratik that exactly what I want to make send the command to device connected to traccar using the previous code , and with out using the api implementation in traccar