You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Wow, having identical UUIDs on the same service is something I haven't come across at all! The use of differing 128 bit UUIDs is a bit dodgy too.

    I just tried some simple code here and the UUID gets reported properly in my case:

    var gatt;
    NRF.connect("f0:c6:4a:e8:d2:50 random").then(function(g) {
      gatt = g;
      return gatt.getPrimaryService("6e400001-b5a3-f393-e0a9-e50e24dcca9e");
    }).then(function(service) {
      return service.getCharacteristics();
    }).then(function(c) {
      chars=c;
      print(JSON.stringify(c,null,2));
    }).then(function() {
      console.log("Done!");
    });
    /*[
      {
        "uuid": "6e400003-b5a3-f393-e0a9-e50e24dcca9e",
        "handle_value": 13,
        "handle_decl": 12,
        "properties": {
          "broadcast": false,
          "read": false,
          "writeWithoutResponse": false,
          "write": false,
          "notify": true,
          "indicate": false,
          "authenticatedSignedWrites": false
         }
       },
      {
        "uuid": "6e400002-b5a3-f393-e0a9-e50e24dcca9e",
        "handle_value": 16,
        "handle_decl": 15,
        "properties": {
          "broadcast": false,
          "read": false,
          "writeWithoutResponse": true,
          "write": true,
          "notify": false,
          "indicate": false,
          "authenticatedSignedWrites": false
         }
       }
     ]*/
    

    So I wonder whether you're hitting an issue with how 128 bit UUIDs are handled. Basically I think they're transmitted as 16 bit UUIDs plus a '128 bit ID index'. Espruino doesn't explicitly request the full 128 bit UUIDs (I'm not even sure how you do this) and expects you to supply them.

    You may find that just poking Espruino with the ID you're interested in is enough:

    .then(server => server.getPrimaryService('DE3A0001-7100-57EF-9190-F1BE84232730'))
    .then(s => {service=s;return service.getCharacteristic('803C3B1F-D300-1120-0530-33A62B7838C9')}) // <--------
    .then(service => service.getCharacteristics())
    

    So you request the characteristic, but don't use it. You might now see UUIDs reported properly.

    But as you say, Espruino doesn't support filtering by UUID with getCharacteristics() though.

    Honestly, I'd have thought that since the order of characteristics won't change, you could probably just use a simple getCharacteristics() and then reference the characteristics by their position in the returned array

About

Avatar for Gordon @Gordon started