asdasdasd i hate bluetooth with a PASSION
This commit is contained in:
@@ -112,6 +112,16 @@ class BluetoothHandler:
|
||||
print("Advertising Bluetooth...")
|
||||
self.ble.gap_advertise(100_000, self.advertising_payload(name="MeshNode", services=[SERVICE_UUID]))
|
||||
|
||||
def send_packet(self, packet_type: int, data: dict):
|
||||
if not self.connections:
|
||||
print("No connected devices to send to.")
|
||||
return
|
||||
|
||||
payload = struct.pack("<B", packet_type) + str(data).encode()
|
||||
|
||||
for conn_handle in self.connections:
|
||||
self.ble.gatts_notify(conn_handle, self.tx_handle, payload)
|
||||
|
||||
def irq(self, event, data):
|
||||
print(f"BLUETOOTH IRQ | EVENT: {event}, DATA: {data}")
|
||||
if event == IRQ_CONNECT:
|
||||
|
||||
Reference in New Issue
Block a user