Problem getting PrimaryService on Awox BLE Bulb

Posted on
  • Hi all,
    since i got my 2 Pucks, i am doing some experiment with BLE devices.
    I was tempted and i've bought an Awox BLE Color Bulb, but i'm having problem getting Primary Services.
    I am only able to use the first Primary Service "33160fb9-5b27-4e70-b0f8-ff411e3ae078" and its characteristic "217887f8-0af2-4002-9c05-24c9ecf71600", where sending 0 or 1 will turn the bulb off/on.
    There are at least 2 other Primary Service (discovered with nRF Connect), 1 for warm light brightness and 1 for RGB lights.
    Trying to use one of these, i receive the error on command gatt.PrimaryService("fff6fe25-469d-42bc-­9179-b3a093f19032")

    Uncaught Error: Unhandled promise rejection: Error: Too many custom UUIDs already
    

    If i try gatt.PrimaryServices(), i get this

    [
      BluetoothRemoteGATTService {
        "uuid": "0x1800",
        "isPrimary": true, "start_handle": 1, "end_handle": 11 },
      BluetoothRemoteGATTService {
        "uuid": "0x1801",
        "isPrimary": true, "start_handle": 12, "end_handle": 15 },
      BluetoothRemoteGATTService {
        "uuid": "0x180a",
        "isPrimary": true, "start_handle": 16, "end_handle": 30 },
      BluetoothRemoteGATTService {
        "uuid": "0x0000[vendor]",
        "isPrimary": true, "start_handle": 31, "end_handle": 49 },
      BluetoothRemoteGATTService {
        "uuid": "0x0000[vendor]",
        "isPrimary": true, "start_handle": 50, "end_handle": 64 },
      BluetoothRemoteGATTService {
        "uuid": "0x0000[vendor]",
        "isPrimary": true, "start_handle": 65, "end_handle": 85 },
      BluetoothRemoteGATTService {
        "uuid": "0x0000[vendor]",
        "isPrimary": true, "start_handle": 86, "end_handle": 65535 }
     ]
    

    Actually, yesterday i could correctly see at least the first PrimaryService UUID ("33160fb9-5b27-4e70-b0f8-ff411e3ae078")­, so the only way i found to access other services is using gatt.PrimaryServices() and then use the array index of the service i need instead of using for example gatt.PrimaryService("fff6fe25-469d-42bc-­9179-b3a093f19032")

    This is the portion of the (dirty) code i am using, just for testing purpose

    function connectToBulb(){
      console.log("Connecting to bulb...");
      
      NRF.connect("98:7b:f3:77:a4:23").then(fu­nction(g){
        connected = true;
        digitalPulse(LED3, 1, 500);
        gatt = g;
        return gatt.getPrimaryServices();
      }).then(function(service){
        return service[4].getCharacteristics(); // Equals to "fff6fe25-469d-42bc-9179-b3a093f19032"
      }).then(function(c){
        c[1].writeValue(0x7F); // Equals to "d8da934c-3d8f-4bdf-9230-f61295b69570"
      });
    }
    

    while using gatt.PrimaryService("fff6fe25-469d-42bc-­9179-b3a093f19032") or gatt.getCharacteristic("d8da934c-3d8f-4b­df-9230-f61295b69570") are returning me the mentioned error.

    Am i doing something wrong?

  • c[1].writeValue(0x7F); <- can it be should just escape the value? c[1].writeValue('0x7F');

  • No that's not the problem, because i get the error on line 8 (of the "original" code, the code i posted is the workaround)

    return gatt.getPrimaryService("fff6fe25-469d-42­bc-9179-b3a093f19032");
    
  • Could you try just taking the battery out and re-adding it to your Puck, then trying again?

    The nRF52 chip can only have a certain number of long UUIDs in memory at once - and annoyingly I don't think they can be removed once added.

    I'll see about increasing the number of usable UUIDs in the next version - that should help a lot. Otherwise it's hard to know what to do - I could add a function that let you explicitly restart the Bluetooth subsystem, but by the time Puck.js has got to getPrimaryService and realises there is not more storage for UUIDs, it's a bit late for it to do a restart automatically :)

  • Thanks @Gordon!
    I guessed it could be a limitation also because that bulb has a lot of custom UUIDs.
    I will try the battery trick but in this case i think it will be better to use array index as i already did, so i am sure i will point to the right service/characteristic.

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

Problem getting PrimaryService on Awox BLE Bulb

Posted by Avatar for Fabio978 @Fabio978

Actions