from bleak import BleakScanner, BleakClient import asyncio import struct from dataclasses import dataclass from enum import Enum NODE_BLUETOOTH_SERVICE_UUID = "E1898FF7-5063-4441-a6eb-526073B00001" NODE_BLUETOOTH_RX_UUID = "E1898FF7-5063-4441-a6eb-526073B00002" NODE_BLUETOOTH_TX_UUID = "E1898FF7-5063-4441-a6eb-526073B00003" class BluetoothPacketType(Enum): SEND_MESSAGE = 1 GET_INFO = 2 @dataclass class BluetoothPacket: packet_type: BluetoothPacketType data: dict class MeshNode: def __init__(self, client: BleakClient, app): self.client = client self.app = app self.name = "None" self.rx_queue = asyncio.Queue() async def get_client_info(self): await self.transmit_bluetooth_packet(BluetoothPacket( BluetoothPacketType.GET_INFO, None )) def serialize_msg(self, packet: BluetoothPacket): final = bytes() final += struct.pack("