mirror of
https://github.com/torlando-tech/columba
synced 2026-08-12 18:07:15 -04:00
test: improve rnode_interface.py coverage and fix PIN parsing
Test coverage improvements (26% -> 47%): - Add tests for _get_usb_bridge() success/failure cases - Add tests for _start_usb() VID/PID lookup, connection, callbacks - Add tests for _on_usb_connection_state_changed() callback - Add tests for USB VID/PID config attributes - Add tests for start() routing to correct implementation PIN parsing fix: - Fix CMD_BT_PIN parsing to use 4-byte big-endian integer format - Matches Kotlin KotlinUSBBridge implementation - Update test to verify correct frame structure Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
59f79fbc43
commit
07893238cd
2 changed files with 362 additions and 11 deletions
|
|
@ -1013,11 +1013,13 @@ class ColumbaRNodeInterface:
|
|||
RNS.log("RNode detected!", RNS.LOG_DEBUG)
|
||||
elif command == KISS.CMD_BT_PIN:
|
||||
# Bluetooth PIN response during pairing mode
|
||||
# PIN is sent as 6 ASCII digits
|
||||
if len(data_buffer) < 6:
|
||||
# PIN is sent as 4 bytes (big-endian 32-bit integer)
|
||||
if len(data_buffer) < 4:
|
||||
data_buffer += bytes([byte])
|
||||
if len(data_buffer) == 6:
|
||||
pin = data_buffer.decode('ascii')
|
||||
if len(data_buffer) == 4:
|
||||
# Parse as big-endian 32-bit integer
|
||||
pin_int = (data_buffer[0] << 24) | (data_buffer[1] << 16) | (data_buffer[2] << 8) | data_buffer[3]
|
||||
pin = f"{pin_int:06d}"
|
||||
RNS.log(f"RNode Bluetooth PIN: {pin}", RNS.LOG_INFO)
|
||||
# Notify USB bridge to surface PIN to UI
|
||||
if self.usb_bridge:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue