Variable doesn't change in NRF.setServices

Posted on
  • Hi All,

    I have the following code that does not do what I want:

    ...
    NRF.setServices({
      0x180A : { // Device information
        0x2A25 : { // Serial Number
          readable: true,
          value : [getSerial() + '#' + count_str]
      }}
    });
    ...
    

    The variable count_str is a counter as string that gets incremented every time I connect in a "NRF.on('connect', function()". I can see that the counter string increments correctly (puck console), but when I check the services and characteristics that the Puck advertises via Android, I see only the initial value of the counter string (#00000 - Serial Number) and not the updated one.
    I am not aware if this is maybe a caching problem of Android? Do I have to do anything else to receive the updated counter string?

    Thanks

  • I think once you have set the services up at the start, you probably want to use NRF.updateServices every time they change

  • Great! I have missed that. Works like a charm now.

    Thanks a lot

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Variable doesn't change in NRF.setServices

Posted by Avatar for user71506 @user71506

Actions