-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Fix missing callback #4509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix missing callback #4509
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant Websocket
Caller->>Websocket: send(data, cb)
Websocket->>Websocket: Attempt to send data
alt Send successful
Websocket->>Websocket: Update bytesSent
else Send failed
Websocket->>Websocket: Catch error
end
alt cb is provided
Websocket->>Caller: Invoke cb(error or null, bytesSent)
end
Websocket-->>Caller: Return { bytesSent }
sequenceDiagram
participant Caller
participant WebBluetooth
Caller->>WebBluetooth: send(data, cb)
alt No writable characteristic
WebBluetooth->>Caller: Invoke cb(error, 0)
WebBluetooth-->>Caller: Return { bytesSent: 0, resultCode }
else Writable characteristic available
WebBluetooth->>WebBluetooth: Await lastWrite
WebBluetooth->>WebBluetooth: Write data
WebBluetooth->>WebBluetooth: Update lastWrite and bytesSent
alt Write successful
WebBluetooth->>Caller: Invoke cb(null, bytesSent)
else Write failed
WebBluetooth->>Caller: Invoke cb(error, 0)
end
WebBluetooth-->>Caller: Return { bytesSent, resultCode }
end
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
7b72504 to
472b210
Compare
744fa0b to
beb4724
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/js/protocols/WebBluetooth.js(1 hunks)
🔇 Additional comments (2)
src/js/protocols/WebBluetooth.js (2)
346-346: LGTM! Callback parameter added correctly.The method signature properly adds the optional callback parameter, aligning with the PR objective.
348-356: LGTM! Proper error handling for unavailable write characteristic.The early return case correctly invokes the callback with an appropriate error object and logs the error for debugging.
nerdCopter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- approving untested
|
Stuck at |
242240c to
5a5b2ce
Compare
|
|
Preview URL: https://5a5b2ce4.betaflight-configurator.pages.dev |
|
Have rebased and works here 😕 Web Bluetooth is experimental on this platform. See https://github.com/WebBluetoothCG/web-bluetooth/blob/main/implementation-status.md
main-CoWdMYL5.js:3863 [PORTHANDLER] Requesting permission for webbluetooth device...
main-CoWdMYL5.js:3863 [PORTHANDLER] webbluetooth device added: Object
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] User selected Bluetooth device from permissions: bluetooth_1
main-CoWdMYL5.js:3863 [PORTHANDLER] Permission granted for webbluetooth device: Object
main-CoWdMYL5.js:3863 [PORTHANDLER] Automatically selected device is 'bluetooth_1' - suggested: Object
main-CoWdMYL5.js:3863 [PORTHANDLER] Found bluetooth port(s) Array(1)
main-CoWdMYL5.js:3863 [PORTHANDLER] Automatically selected device is 'bluetooth_1' - suggested: Object
main-CoWdMYL5.js:3896 [SERIAL-BACKEND] Connecting to: bluetooth_1
DarkTheme-CNJ5iv5u.js:468 [SERIAL] Using bluetooth protocol (based on port path: bluetooth_1)
DarkTheme-CNJ5iv5u.js:468 [SERIAL] Protocol switched successfully to: WebBluetooth
DarkTheme-CNJ5iv5u.js:468 [SERIAL] Connecting to port: bluetooth_1 with options: Object
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] Opening connection with ID: bluetooth_1, Baud: 115200
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] Connecting to GATT Server
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] Get primary services
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] Connected to service: 0000abf0-0000-1000-8000-00805f9b34fb
DarkTheme-CNJ5iv5u.js:468 [BLUETOOTH] Connection opened with ID: undefined, Baud: 115200
main-CoWdMYL5.js:3896 [SERIAL-BACKEND] Requesting configuration data |
|
I'm testing on mobile, don't have Bluetooth on my desktop... I'll have to set up remote debugging again tomorrow |
|
Tested SPBE F405MINI and F7V3 |



Summary by CodeRabbit