Compare commits

...

2 commits

Author SHA1 Message Date
Gleb Tcivie 0281d0b990
Merge pull request #77
Handle broadcast IDs check in client details retrieval
2025-01-05 20:20:59 +02:00
Gleb Tcivie 0650382405 ```
Handle broadcast IDs in client details retrieval

Add a check for broadcast node IDs (4294967295 and 1) in the `_get_client_details` method to return a predefined `ClientDetails` instance. This prevents unnecessary database queries for broadcast IDs and ensures consistent handling of these special cases.
```
2025-01-05 20:20:16 +02:00

View file

@ -309,6 +309,8 @@ class MessageProcessor:
).set(mesh_packet.rx_rssi) ).set(mesh_packet.rx_rssi)
def _get_client_details(self, node_id: int) -> ClientDetails: def _get_client_details(self, node_id: int) -> ClientDetails:
if node_id == 4294967295 or node_id == 1: # FFFFFFFF or 1 (Broadcast)
return ClientDetails(node_id=node_id, short_name='Broadcast', long_name='Broadcast')
node_id_str = str(node_id) # Convert the integer to a string node_id_str = str(node_id) # Convert the integer to a string
with self.db_pool.connection() as conn: with self.db_pool.connection() as conn:
with conn.cursor() as cur: with conn.cursor() as cur: