SensorServer icon indicating copy to clipboard operation
SensorServer copied to clipboard

Cannot read GPS data

Open Manouel96 opened this issue 1 year ago • 2 comments

When I am trying to read the GPS data with websocket with python, showing the gps is connected both on the server app and the terminal app but no data is coming out. The GPS permission is allowed in the app settings, and the GPS is on.

Capture

The full code:

import websocket import json

def on_message(ws, message): data = json.loads(message) x = data["longitude"]

print("x = ", x)

def on_error(ws, error): print("error occurred ", error)

def on_close(ws, close_code, reason): print("connection closed : ", reason)

def on_open(ws): print("connected")

def connect(url): ws = websocket.WebSocketApp(url, on_open=on_open, on_message=on_message, on_error=on_error, on_close=on_close)

ws.run_forever()

connect("ws://172.20.10.2:8080/gps")

Manouel96 avatar Jul 10 '24 00:07 Manouel96