enforce id char
This commit is contained in:
parent
e9f62ab28e
commit
98025e8600
1 changed files with 8 additions and 0 deletions
|
|
@ -1248,6 +1248,10 @@ class BluezeroGATTServer:
|
|||
self._log("Server already running", "WARNING")
|
||||
return
|
||||
|
||||
# Ensure identity is set before starting
|
||||
if not self.identity_bytes:
|
||||
raise RuntimeError("Identity must be set before starting GATT server. Call set_identity() first.")
|
||||
|
||||
self._log(f"Starting GATT server with device name '{device_name}'...")
|
||||
|
||||
# Reset events
|
||||
|
|
@ -1387,6 +1391,10 @@ class BluezeroGATTServer:
|
|||
self.identity_characteristic = self.peripheral_obj.characteristics[-1]
|
||||
self._log(f"Added Identity characteristic: {self.identity_char_uuid}", "DEBUG")
|
||||
|
||||
# Set the identity value (guaranteed to be available by start() precondition)
|
||||
self.identity_characteristic.set_value(list(self.identity_bytes))
|
||||
self._log(f"Identity characteristic set to: {self.identity_bytes.hex()}")
|
||||
|
||||
# Save TX characteristic reference
|
||||
if len(self.peripheral_obj.characteristics) >= 2:
|
||||
self.tx_characteristic = self.peripheral_obj.characteristics[1] # chr_id=2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue