|
|
|
@ -232,7 +232,7 @@ class Channel: |
|
|
|
|
|
|
|
|
|
|
|
class MeshtDevice: |
|
|
|
def __init__(self, transport, device_uuid, skip_init = False, test_client = False): |
|
|
|
def __init__(self, transport, device_uuid, skip_init = False, test_client = False, udp_packet = False): |
|
|
|
self.transport = transport |
|
|
|
self.channels = [] |
|
|
|
self.lora_config = None |
|
|
|
@ -243,6 +243,7 @@ class MeshtDevice: |
|
|
|
self.device_uuid = device_uuid |
|
|
|
self.skip_init = skip_init |
|
|
|
self.test_client = test_client |
|
|
|
self.udp_packet = udp_packet |
|
|
|
|
|
|
|
async def start(self): |
|
|
|
await self.transport.start() |
|
|
|
@ -284,6 +285,11 @@ class MeshtDevice: |
|
|
|
if self.test_client: |
|
|
|
parseBytesToProtobuf(data) |
|
|
|
return {}, b"" |
|
|
|
|
|
|
|
if self.udp_packet: |
|
|
|
#mqtt или udp пакеты мы ЖЕСТКО перекодируем словно так и надо |
|
|
|
dec = pb.decode(data, MESHPACKET_SCHEMA) |
|
|
|
data = pb.encode({"packet": dec}, FROMRADIO_SCHEMA) |
|
|
|
|
|
|
|
fr = pb.decode(data, FROMRADIO_SCHEMA) |
|
|
|
fr["device_uuid"] = self.device_uuid |
|
|
|
|