LADX: more tracker support (#4355)

* init

* oops
This commit is contained in:
threeandthreee
2025-04-05 12:39:31 -04:00
committed by GitHub
parent 4571ed7e2f
commit c2d8f2443e
3 changed files with 29 additions and 20 deletions

View File

@@ -184,6 +184,7 @@ class MagpieBridge:
ws = None
features = []
slot_data = {}
has_sent_slot_data = False
def use_entrance_tracker(self):
return "entrances" in self.features \
@@ -199,7 +200,7 @@ class MagpieBridge:
logger.info(
f"Connected, supported features: {message['features']}")
self.features = message["features"]
await self.send_handshAck()
if message["type"] == "sendFull":
@@ -207,8 +208,6 @@ class MagpieBridge:
await self.send_all_inventory()
if "checks" in self.features:
await self.send_all_checks()
if "slot_data" in self.features and self.slot_data:
await self.send_slot_data(self.slot_data)
if self.use_entrance_tracker():
await self.send_gps(diff=False)
@@ -220,7 +219,7 @@ class MagpieBridge:
if the_id == "0x2A7":
return "0x2A1-1"
return the_id
async def send_handshAck(self):
if not self.ws:
return
@@ -288,17 +287,17 @@ class MagpieBridge:
return await self.gps_tracker.send_entrances(self.ws, diff)
async def send_slot_data(self, slot_data):
async def send_slot_data(self):
if not self.ws:
return
logger.debug("Sending slot_data to magpie.")
message = {
"type": "slot_data",
"slot_data": slot_data
"slot_data": self.slot_data
}
await self.ws.send(json.dumps(message))
self.has_sent_slot_data = True
async def serve(self):
async with websockets.serve(lambda w: self.handler(w), "", 17026, logger=logger):