The example project: Project #009: Dynamic Broadcaster - Changing Advertising Packets
Shows how to dynamically change packets for broadcasting/advertising. Merely change the project to advertise instead of broadcast, and the dynamic packet updating will be interfaced/changed in the exact same way for your case (minor changes may be needed to make sure the application code doesn't do something weird that you don't want like power saving modes, different state modes, etc.)
Not exactly; While advertising you can only do the advertisement I think.
But once connected, you can also still broadcast data to other devices (albeit without being able to connect to anyone else)
If you are using the advertisement packets to notify phones of data available, I would recommend just advertising with the "data available" flag set, get connected to and communicate, disconnect and go back to advertising with data available. But if you are using the flags as an indication for the phones to connect to the peripheral, then it is kind of pointless to keep broadcasting that data is available if it is busy transmitting data to a phone already.
A broadcast is just an advertisement packet that can't be responded to with scan requests or connection requests. An advertisement packet is a broadcast packet, but allows scan requests and connection requests.
Okay I will see how I can add this flag during advertisement. I am hoping that during advertisement I will create a service which would be advertised and the peripheral can connect and see if there is any data available or not. If there is data available then perhaps it can proceed towards bonding and storing the bond information
As shown in the above figure i am going to create a custom service for read only and that would have the flag information available
This service would be advertised along with the advertisement packet as is shown in the figure below -->
Hope this should provide the solution I am looking for.
1 of 1 people found this helpful
Yes. That should work well
Just as a note: Remember that when the device advertises, all phones scanning will see it, so if you have already connected with your phone app to read the data within a few seconds, you will want to have a period of "don't reconnect" to allow other phones/devices to connect and read the data if that is your application