This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

UUID change on the fly

Hi,

I have a 128bit UUID on the ad block which I need to change on the fly to another 128bit UUID.

I tried different solutions and searched for a good example, however I have not found one that would be a clear example how to do it.
I am not very proficient in C, so I have some issues with the details.

The operation should be able to be done even if a client is connected.
Some examples I tried make an error 18 if a connection is active.

Would there be a good and clear code example that will make:
1.  Stop advertising
2.  End and clear any connection if active
3.  Change 128bit UUID to another 128bit UUID in advertisement
4.  Start advertising with a new 128bit UUID

Thank you!

Parents
  • I solved the problem by making the following:

    1.  Have multiple UUIDs in their own arrays.

    2.  In advertising_init, I have an IF conditional for choosing the UUID I want to use in different situations.

    3.  When I need to change the UUID, I set a variable which controls the UUID selection in advertising_init.

    4.  Then I check if a connection is active.
         If so, end the connection and wait for the event telling this has happened.
         In this event code I trigger a flag variable which makes the next step.
         If no connection is active, I do the next step directly.

    5.  Stop advertising, run advertising_init again, new UUID is selected, start advertising.

    This way the new UUID comes active almost instantly and I achieve what I was looking for.

Reply
  • I solved the problem by making the following:

    1.  Have multiple UUIDs in their own arrays.

    2.  In advertising_init, I have an IF conditional for choosing the UUID I want to use in different situations.

    3.  When I need to change the UUID, I set a variable which controls the UUID selection in advertising_init.

    4.  Then I check if a connection is active.
         If so, end the connection and wait for the event telling this has happened.
         In this event code I trigger a flag variable which makes the next step.
         If no connection is active, I do the next step directly.

    5.  Stop advertising, run advertising_init again, new UUID is selected, start advertising.

    This way the new UUID comes active almost instantly and I achieve what I was looking for.

Children
No Data
Related