-
-
Notifications
You must be signed in to change notification settings - Fork 240
feat: add bluetooth file transfers #483
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
base: master
Are you sure you want to change the base?
Conversation
|
What the transfer rate you were able to achieve? I think BLE is very slow - maybe 20kbps. is it worth it when we can use Wifi for much faster and stable communication? |
|
I think another thing worth consider is that the BLE stack of Arduino / esp-idf is quite large and can take up a significant amount of flash, especially when allowing BLE+Wifi to coexist. |
I have not measured it, and the protocol I implemented is far from optimized for maximum transfer rate. Espressif quotes 700 Kbps in good conditions, fwiw. In the video you can see that transferring a short article took around 2s—far less time than it took Crosspoint to index the file.
My experience with WiFi on the X4 has been far from stable. But the main reason I reached for BLE here is the quick and hassle-free connection: the use case I have in mind is on-the-go transmission of short articles, not syncing an entire collection, so not messing with my phone's WiFi connection/not wasting time associating and re-associating with networks seemed more worthwhile to me than shaving some time off an already acceptably fast transfer.
I did mention on the PR that this is why I am not using Espressif's stack, which indeed is prohibitively large. With NimBLE, this PR adds 6416 bytes to RAM use (+1.9%) and 202K to flash (+3.1%). |
|
Setting this to "ready for review" as I haven't received any further feedback. I've been running this for the past few days and it's been working well. I'm now preparing a submission to the Play Store. |
daveallie
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.
Thanks for the submission @aleksejspopovs! In the interest of ensuring that future travelers can improve upon this (and so that Longform doesn't have to be the only implementation), can you please include some documentation about the protocol (a link back to https://github.com/aleksejspopovs/longform/blob/main/app/docs/BLE%20Protocol.md would be enough).
As you mention, Longform isn't available yet, and while I'll look over the rest of the code and am comfortable adding this functionality to CrossPoint, I'd like to wait until Longform (or another implementation) is available before this is merged.
|
Makes sense, and thanks for taking a look! I just finished the Play Store submission, Google says it will be reviewed "in under seven days, or longer" 🙃 I'll let you know when that's done. In the next few days I'll add a link to the protocol docs and rebase&retest on top of 0.16.0. |
|
Is it feasible to make this use the standard bluetooth object exchange push which has been around since 1997? |
|
@tweitzel from the PR description:
|
Summary
This PR adds support for a very simple custom BLE protocol for receiving files from a phone. It is intended to be used with an Android app I'm also working on called Longform that can send arbitrary files over to the X4 but can also use the Accessibility API to scrape text from any app on your phone, so that you can quickly send an article from any app to your reader.
Here's a 35s demo:
P1212004.MP4
I figure this is not quite ready to merge yet given that Longform is not yet available on the Play Store, but getting there might still take me a bit because there's still a bit of polishing to be done and probably some work to be compliant with the store's requirements for apps using Accessibility APIs. So I wanted to share this branch here and see if there's any interest in this in the first place, or any feedback (is there a more standard BLE protocol I should be using here? did I fundamentally misunderstand anything about the architecture of Crosspoint?).
Additional Context
AI Usage
Did you use AI tools to help write this code? PARTIALLY
The code in this PR was written by hand with some AI autocomplete. (The Android app, which is not part of this PR, is 100% vibe-coded.)