asdasdasd i hate bluetooth with a PASSION

This commit is contained in:
2026-05-15 18:43:03 +10:00
parent 46ae344c0c
commit dfc9cd820d
4 changed files with 54 additions and 6 deletions

View File

@@ -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: