-
Hi, Error: `
` |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @tammoweb , It's not clear from the code snippet above how you're accessing the NTRIP service, but a few observations...
Once you have the relevant login credentials and region code, try using the gnssntripclient installed with pygnssutils e.g.: python3 -m pip install --upgrade pygnssutils
gnssntripclient --server ppntrip.services.u-blox.com --port 2102 --https 1 --mountpoint EU --datatype spartn --ntripuser your-thingstream-client-id --ntrippassword "yourthingstreampassword" --spartndecode 1 --spartnkey abcd1234 --verbosity 2 2024-09-25 11:18:34.182 - INFO - pygnssutils.gnssntripclient - Streaming spartn data from ppntrip.services.u-blox.com:2102/EU ...
2024-09-25 11:18:34.183 - INFO - pygnssutils.gnssntripclient - Message received: SPARTN-1X-OCB-GLO
2024-09-25 11:18:34.183 - INFO - pygnssutils.gnssntripclient - Message received: SPARTN-1X-OCB-BEI
2024-09-25 11:18:34.184 - INFO - pygnssutils.gnssntripclient - Message received: SPARTN-1X-OCB-GAL
2024-09-25 11:18:34.184 - INFO - pygnssutils.gnssntripclient - Message received: SPARTN-1X-OCB-GPS
... etc. (use To use the |
Beta Was this translation helpful? Give feedback.
-
Hi @semuadmin, thanks for your quick response. I use the read_data method as an NTRIP client. The class is assigned user, password, etc. when instantiated. def read_data(self):
while True:
time.sleep(0.1)
logging.info("Mountpoint: Main loop started.")
caster = self.caster
port = int(self.port)
if caster is None or port is None:
logging.error("Mountpoint: Caster settings incorrect!")
sys.exit(0)
if (self.user == "" or
self.password == ""):
logging.error("Mountpoint: User and/or password are missing!")
sys.exit(0)
reconnectTry = 1
maxReconnections = 1
try:
while reconnectTry <= maxReconnections:
print(self.getName(), ": NTRIP main loop")
found_header = False
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
error_indicator = self._socket.connect_ex((caster, port))
if error_indicator == 0:
self._socket.settimeout(10)
self._socket.sendall(self.getMountPointBytes())
while not found_header:
casterResponse = self._socket.recv(4096)
header_lines = casterResponse.decode('utf-8').split("\r\n")
for line in header_lines:
if line == "":
if not found_header:
found_header = True
else:
continue
for line in header_lines:
if line.find("SOURCETABLE") >= 0:
logging.warning("Mountpoint: Mountpoint does not exist!")
sys.exit(0)
elif line.find("401 Unauthorized") >= 0:
logging.warning("Mountpoint: Unauthorized request!")
sys.exit(0)
elif line.find("404 Not found") >= 0:
logging.warning("Mountpoint: Mountpoint does not exist!")
sys.exit(0)
elif line.find("ICY 200 OK") >= 0:
self._socket.sendall(self.getGGABytes())
elif line.find("HTTP/1.0 200 OK") >= 0:
self._socket.sendall(self.getGGABytes())
elif line.find("HTTP/1.1 200 OK") >= 0:
self._socket.sendall(self.getGGABytes())
try:
basedate = 451169309
key = "abcd1234"
parser = SPARTNReader(self._socket, decode=1, key=key, basedate=basedate)
while True:
try:
raw_data, parsed_data = parser.read()
if parsed_data is not None:
print(parsed_data)
except Exception as e:
print(e)
continue
except socket.timeout:
print(self.getName() + ": Exception 'socket.timeout'")
self._socket.close() # See: https://docs.python.org/3/howto/sockets.html
time.sleep(60)
break
except socket.error:
print(self.getName() + ": Exception 'socket.error'")
self._socket.close()
time.sleep(60)
break
time.sleep(5)
except KeyboardInterrupt:
if self._socket:
self._socket.close()
except Exception as e:
print("General exception:")
print(e)
if self._socket:
self._socket.close()
time.sleep(60)
continue
if self._socket:
self._socket.close()
time.sleep(5) Your tip with instantiation outside the loop solved the "Unknown protocol" problem. But I still get the following error message:
|
Beta Was this translation helpful? Give feedback.
The
authInd
attribute is part of the SPARTN transport layer and is only present if the payload is encrypted i.e.eaf=1
. As I mention above, in the case of the ThingStream PointPerfect SPARTN NTRIP service the payload is NOT encrypted soSPARTNMessage.authInd
will not exist. I'm unclear why the code would be attempting to access it. Are you using the latest version of pyspartn (v1.0.3)?(very early versions of pyspartn did have a problem with NTRIP streams but this was resolved way back in v.0.2.1-alpha)