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

Device information service issue

Why does the value of characteristic Firmware Revision, Model Number and Serial Number all have the same value?

Did update value for characteristic <CBCharacteristic: 0x282b1f9c0, UUID = Model Number String, properties = 0x2, value = {length = 19, bytes = 0xffffffffffffffffffffffff48a51234cfa3c8}, notifying = YES>, new value: 19 bytes, error: nil

Did update value for characteristic <CBCharacteristic: 0x282b1fa20, UUID = Serial Number String, properties = 0x2, value = {length = 11, bytes = 0xffffffff48a51234cfa3c8}, notifying = YES>, new value: 11 bytes, error: nil

Did update value for characteristic <CBCharacteristic: 0x282b1fa80, UUID = Firmware Revision String, properties = 0x2, value = {length = 15, bytes = 0xffffffffffffffff48a51234cfa3c8}, notifying = YES>, new value: 15 bytes, error: nil

What am I doing wrong?

And decoding the UTF-8 string does not give me the same string as I get in nRFConnect? In nRFConnect I do get the right ASCII string values.

 

Parents
  • In your nRFConnect app, you must be reading e.g. the Firmware Revision String from som other service and char than in my app. 

    I discover service UUID 180A and read char UUID 2A26, but get different values than the nRFConnect app.

    If I do not initialize the DSI then I still get the same value  value = {length = 11, bytes = 0xffffffff48a51234cfa3c8}. 

    What could be wrong?

    Could you please share snippet of iOS code from the nrfconnect app?

  • Hi,

    Our iOS developers had a look at the code that you provided privately, and they suggest that maybe you are using a call to readValue(for:) slightly wrong. It will not read the value immediately, as it is an asynchronous call. Rather, you have to wait for the callback of peripheral(_:didUpdateValueFor:error:). So if after the readValue(for:) call you try to read out values immediately, the values that you read out would be expected to be garbage.

    It is difficult for us to say if this is indeed the case, though, as it depends on how your code snippets are used, and whether or not there are other relevant pieces of code that we have not received.

    Regards,
    Terje

Reply
  • Hi,

    Our iOS developers had a look at the code that you provided privately, and they suggest that maybe you are using a call to readValue(for:) slightly wrong. It will not read the value immediately, as it is an asynchronous call. Rather, you have to wait for the callback of peripheral(_:didUpdateValueFor:error:). So if after the readValue(for:) call you try to read out values immediately, the values that you read out would be expected to be garbage.

    It is difficult for us to say if this is indeed the case, though, as it depends on how your code snippets are used, and whether or not there are other relevant pieces of code that we have not received.

    Regards,
    Terje

Children
No Data
Related