chore: mark iRacing parser as stub (shared memory, not UDP)
This commit is contained in:
@@ -8,25 +8,13 @@ def get_parser():
|
||||
|
||||
|
||||
class IRacingParser:
|
||||
"""
|
||||
iRacing uses shared memory (IRSDK Memory-Mapped File), NOT UDP.
|
||||
This parser is a stub - it does NOT work with UDP input.
|
||||
Requires IRSDK mmap reader (not yet implemented).
|
||||
"""
|
||||
def game_id(self) -> str:
|
||||
return "iracing"
|
||||
|
||||
def parse(self, data: bytes, addr: tuple) -> TelemetryData:
|
||||
td = TelemetryData(game_id="iracing", timestamp=time.time())
|
||||
td.raw = {"raw_hex": data.hex(), "length": len(data), "addr": f"{addr[0]}:{addr[1]}"}
|
||||
|
||||
if len(data) < 100:
|
||||
return td
|
||||
|
||||
try:
|
||||
td.speed_mph = struct.unpack_from("<f", data, 36)[0]
|
||||
td.speed_kmh = td.speed_mph * 1.60934
|
||||
td.rpm = struct.unpack_from("<f", data, 48)[0]
|
||||
td.gear = struct.unpack_from("<i", data, 56)[0]
|
||||
td.throttle = struct.unpack_from("<f", data, 4)[0]
|
||||
td.brake = struct.unpack_from("<f", data, 8)[0]
|
||||
td.steering = struct.unpack_from("<f", data, 0)[0]
|
||||
except struct.error:
|
||||
pass
|
||||
|
||||
return td
|
||||
return TelemetryData(game_id="iracing", timestamp=time.time(), raw={"note": "iRacing uses shared memory, not UDP"})
|
||||
|
||||
Reference in New Issue
Block a user