[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Reg: Procedure for sending commands to gpsd over control socket.
From: |
RAJESH DASARI |
Subject: |
Reg: Procedure for sending commands to gpsd over control socket. |
Date: |
Thu, 6 Feb 2020 12:41:54 +0530 |
Hi ,
We are using Trimble Acutime 360 TSIP GPS device in our linux machine
and it is connected to /dev/ttyS5 .
I am starting the gpsd with the below command.
/usr/sbin/gpsd -F /var/run/gpsd/gpsd.sock -n -N -D 15 /dev/ttyS5
I am trying to reset the GPS device with the control socket, for that
i have below script.
import binascii
import socket
import sys
import time
import os
print("Connecting...")
#GPS_time_req = b'&/dev/ttyS5=\x25'
GPS_time_req = b'!/dev/ttyS5=\x10\x25\x10\x03\n'
#GPS_time_req = b'!/dev/ttyS5=\x10\x21\x10\x03\n'
#GPS_time_req = b'\x10\x21\x10\x03\n'
if os.path.exists("/var/run/gpsd/gpsd.sock"):
client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
client.connect("/var/run/gpsd/gpsd.sock")
print("Ready.")
try:
print ( 'sending "%s"' % GPS_time_req.hex() )
hexBytes = GPS_time_req.hex()
print ("encoded bytes ", hexBytes.encode('iso-8859-1') )
client.send( hexBytes.encode('iso-8859-1'))
time.sleep(15)
response = client.recv(4096)
num_bytes = len(response)
print ( 'number of bytes ', num_bytes)
print ( 'data bytes ', response )
except KeyboardInterrupt as k:
print("Shutting down.")
client.close()
else:
print("Couldn't Connect!")
print("Done")
but when i execute the above command , i am getting the below output .
python gps.test.py
Connecting...
Ready.
sending "212f6465762f74747953353d102510030a"
encoded bytes b'212f6465762f74747953353d102510030a'
number of bytes 6
data bytes b'ERROR\n'
Please find the attached file for the output from the gpsd when the
above script is executed. I tried sending different control packets
to GPS device over the control socket but i am getting ERROR response
always.
Could you guys please let me know , is sending the commands to the gps
device over control socket is supported ? if it not supported could
you suggest any other way. If it is supported could you please let me
know the exact procedure.
I also tried sending the command the command directly to the device
like echo -ne '\x10\x25\x10\x03' > /dev/ttyS5 but i didn't notice any
reset logs on gpsd side to notify that gpsd is actually rebooting.
Thanks,
Rajesh Dasari.
output
Description: Binary data
- Reg: Procedure for sending commands to gpsd over control socket.,
RAJESH DASARI <=