I am advertising my peripheral's name and one of it's services in the advertising and scan response packets. I would also like to include a one bit updateable flag in my advertising packet whose value is based on the value of a characteristic (an A/D conversion). One idea I have is just to append a "+" or a "-" on the end of the local name (the peripheral.name string). Then update the device local name in the advertising packet dynamically. What would the code look like for this option?
Another idea I have is to include the peripheral's service data advertisement field in the advertisement data. But I'm not sure if service data's data field is setable programmatically or if the service data advertising field can be updated dynamically. Can this be done? How?
You can change the adv data dynamically. Please refer the below example project: