-
Notifications
You must be signed in to change notification settings - Fork 23
bluetooth advertisement support #23
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: main
Are you sure you want to change the base?
Conversation
|
it needs more work for review... just fyi im looking at it. if you have any suggestions or feedback let me know. |
|
I'd like to contribute advertisement support but based on the filtering discussion #24; I'm concerned I may be spending time on something that won't be something you're interested in. without any additional feedback on this, I am holding on additional effort. |
|
Sorry, I didn't look at this because it was closed. In the future, if you mark a work-in-progress PR as "draft" instead of closing it I'll be better able to review it. Supporting host advertising is an appropriate thing for The biggest platform issue an advertising API is going to have is with CoreBluetooth (iOS/MacOS), which has the following wrinkles:
I'd suggest using the existing |
|
I do not have a Mac as of now but would be interested in helping with Linux and Windows implementations.
huh. crazy limitation. |
That's fine, we can release an unstable version of the feature without Mac support. I just want to make sure the limitations of the Apple APIs are considered when designing the |
|
please apologize the mess; concepts are there, I'm still using the methods I originally placed in some example code I've yet to refactor. Are you thinking something like this on the Adapter? I think just passing ManufacturerData would be more appropriate than AdvertismentData?; those other fields are not applicable. |
|
Yes, that API is what I was thinking. We might also need a
I’m not sure where you got that idea? Any of the fields in AdvertisingData can be included in an advertisement. In fact, as I mentioned above, ManufacturerData is not one of the allowed fields in CoreBluetooth. |
|
https://stackoverflow.com/questions/63175411/ios-omits-manufacturer-data-from-advertisement-in-background-mode I don't plan to advertise a name or service. Was just thinking control of the raw data would be a sufficient interface. corebluetooth made basic BLE advertisements unusable. Do you see doing acrobatics to accomplish "advertisements" via GATT? trying to receive advertisements in the background is basic need and I'd like my devices to work with corebluetooth. now come to find I'm likely going to need a custom solution to get the data... |
Yes, CoreBluetooth is extremely locked-down for security and power management reasons. It's really designed for only two scenarios:
And right now
You mostly don't have access to or the ability to manipulate the raw data of the advertisement packets with OS APIs (might be possible on Linux, definitely not the others). Even on Windows you have to construct an abstract
I don't know your use-case, but if you want to work with CoreBluetooth your best bet is usually to just use GATT services. |
this is what using the api looks like -- or let me know where I've gone wrong; the other fields don't apply in my case (just a normal non-connectable advertisement). |
|
I know the documentation says only LocalName and UUIDsKey are supported. The code does work with AdvDataManufacturer on the my macbook. The manufacterer company_id comes through and the next two bytes are incorrect; usually F5 followed by another byte that doesn't match the data sent. Right now the advertisement creates a peripheral_manager per advertisement. I wonder if a lazy_static and shared manager might make more sense. the advertisements are working but not always... and if the machine sleeps; it doesn't continue scanning on wake. I changed my hardware to read the data it needed from the later bytes and I'm happy to see it working. I may look at linux next. ownership; the guard is taking the ownership of the advertisement in the corebluetooth now. let me know if you have other thoughts. its wip; there's cruft in there. |
|
The linux scanning I'm having trouble getting the advertisements. Both my windows and macos machines are showing advertisements regularly (about every second) and the linux machine shows the first one and then doesn't report anymore. I added the code for the advertisements but I can't test it or move forward while I'm unable to get the advertisements. the linux implementation makes the inner on Adapter pub; I'm not sure what to do with the adapter... |
thanks for the library. I found I was able to see my devices; I wanted to communicate with them.
I'd like to communicate with you too and see if this makes sense or if you have other ideas on implementation?
Let me know if you have any thoughts on what I've got setup so far. the windows implementation is the only implementation that works now.
I'm trying to understand why I'm getting these full errors:
I will keep playing. There's dead code and junk in there (ignore the Adapter modifications that was testing); it's a work in progress. :)