Skip to content

Conversation

@sensei-hacker
Copy link
Member

Summary

Add detailed debug logging throughout the BLE connection implementation to help diagnose connection issues, particularly on Windows where data is sent but not received.

Problem

Users report BLE connections on Windows that appear to connect successfully and start notifications, but no data is received (Sent: 27 bytes, Received: 0 bytes). Without detailed logging, it's impossible to diagnose where the data flow breaks down.

Changes

Added comprehensive logging for:

Connection Sequence:

  • Device request and discovery
  • GATT server connection
  • Notification setup and activation

Service & Characteristic Discovery:

  • All services found with UUIDs
  • Device type matching (CC2541, Nordic NRF, SpeedyBee)
  • All characteristic properties (read, write, notify, indicate)
  • Which characteristics are used for TX/RX

Data Transmission (Send):

  • Total bytes, chunk count
  • Per-chunk hex and ASCII data
  • Write timing for each chunk
  • Error handling with detailed error objects

Data Reception (Receive):

  • Bytes received with hex and ASCII output
  • Timestamps for each notification event
  • This is the key diagnostic - if no logs appear here, notifications aren't working

Error Handling:

  • Detailed error objects (message, name, code)
  • Connection state changes
  • Disconnect events with context

Testing

  • Code builds successfully
  • Logging format tested with sample data
  • Ready for user testing on Windows with BLE device

Use Case

When user connects BLE device:

  1. Open DevTools console (Ctrl+Shift+I)
  2. Connect to BLE device
  3. All connection steps logged with [BLE] prefix
  4. Identify exactly where data flow breaks

This will help identify root cause of Windows BLE receive issues.

Add detailed logging throughout the BLE connection implementation to help
diagnose connection issues, particularly on Windows where data is sent but
not received.

Logging added for:
- Connection sequence (device request, GATT connection, notifications)
- Service and characteristic discovery with properties
- Data transmission (send) with hex/ASCII output and timing
- Data reception (receive) with hex/ASCII output and timestamps
- Error conditions with detailed error objects
- Connection state changes and disconnection events

This will help identify why BLE connections on Windows send data successfully
but receive 0 bytes in return.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant