Avatar for Zakaton

Zakaton

Member since Jul 2019 • Last active Sep 2020
  • 1 conversations
  • 8 comments

Most recent activity

  • in Interfacing
    Avatar for Zakaton

    Are there any tools besides the nRF Connect app I can use to debug this further?

    Also is there anyone I can pay to figure this out?

  • in Interfacing
    Avatar for Zakaton

    The weirdest thing happened - when I enabled the sensors from my desktop browser (which triggers the device to stream sensor/gesture data), the CCCD's changed to 0x0100 (some are still 0, but the ones I need to be notified of changed to 0x0100).

    I'm still not getting notifications, but I'll keep playing with it.

  • in Interfacing
    Avatar for Zakaton

    I flashed the latest build and now I don't get errors when I set characteristic.handle_cccd = 0;, but I still don't get any notifications.

    And thank you so much for taking the time to help out so far

  • in Interfacing
    Avatar for Zakaton

    It turns out the CCCD value for all the Notify characteristics are 0, which triggers the "CCCD Handle Not Found" error. I'm not sure if that's an invalid CCCD or it is but it triggers the error because 0 is considered a false value.

  • in Interfacing
    Avatar for Zakaton

    There was no handle_cccd property before, so I tried to set it manually via characteristic.hande_cccd = 0x1.

    const BoseAR = {
      SERVICE_UUID: "0000fdd2-0000-1000-8000-00805f9b34fb",
      
      CHARACTERISTIC_UUIDs: {
        GESTURE_INFORMATION: "a0384f52-f95a-4bcd-b898-7b9ceec92dad",
        GESTURE_CONFIGURATION: "21e550af-f780-477b-9334-1f983296f1d7",
        GESTURE_DATA: "9014dd4e-79ba-4802-a275-894d3b85ac74",
        
        SENSOR_INFOMRATION: "855cb3e7-98ff-42a6-80fc-40b32a2221c1",
        SENSOR_CONFIGURATION: "5af38af6-000e-404b-9b46-07f77580890b",
        SENSOR_DATA: "56a72ab8-4988-4cc8-a752-fbd1d54a953d",
      },
      
      GESTURE_IDs: {
          129 : 'double tap',
          130 : 'head nod',
          131 : 'head shake',
    
          192 : 'unknown gesture 192',
          193 : 'unknown gesture 193',
          194 : 'unknown gesture 194',
      },
      getGestureNameByGestureId: function (GESTURE_ID) {
        return this.GESTURE_IDs[GESTURE_ID];
      },
      getGestureIdByGestureName: function(GESTURE_NAME) {
        return Object.keys(this.GESTURE_IDs).find(GESTU­RE_ID => {
          return this.GESTURE_IDs[GESTURE_ID] == GESTURE_NAME;
        });
      },
      
      _ableGesture : function(gestureName, enabled) {
        const _gestureId = this.getGestureIdByGestureName(gestureNa­me);
        if(this.isConnected()) {
          return this.characteristics.GESTURE_CONFIGURATI­ON.readValue().then(dataView => {
            for(let offset = 0; offset < dataView.byteLength; offset+=2) {
              const gestureId = dataView.getUint8(offset);
              if(gestureId == _gestureId) {
                dataView.setUint8(offset+1, enabled);
              }
            }
            return this.characteristics.GESTURE_CONFIGURATI­ON.writeValue(dataView.buffer);
          });
        }
      },
      enableGesture : function(gestureName) {
        return this._ableGesture(gestureName, true);
      },
      disableGesture : function(gestureName) {
        return this._ableGesture(gestureName, false);
      },
      
      SENSOR_NAMEs: [
        'accelerometer',
        'gyroscope',
        'rotation',
        'game rotation'
      ],
      SENSOR_SAMPLE_PERIODs: [
        320,
        160,
        80,
        40,
        20
      ],
      ACCURACY_NAMEs: [
        'unreliable',
        'low',
        'medium',
        'high'
      ],
      
      connect: function() {
        return NRF.requestDevice({
          filters: [{services: [this.SERVICE_UUID]}],
        }).then(device => {
          this.device = device;
          return device.gatt.connect();
        }).then(server => {
          this.server = server;
          return server.startBonding();
        }).then(() => {
          return this.server.getPrimaryService(this.SERVI­CE_UUID);
        }).then(service => {
          this.service = service;
          this.characteristics = {};
          return Object.keys(this.CHARACTERISTIC_UUIDs).r­educe((promise, CHARACTERISTIC_NAME) => {
            const CHARACTERISTIC_UUID = this.CHARACTERISTIC_UUIDs[CHARACTERISTIC­_NAME];
            return promise.then(() => {
              return this.service.getCharacteristic(CHARACTER­ISTIC_UUID).then(characteristic => {
                console.log(CHARACTERISTIC_NAME);
                
                this.characteristics[CHARACTERISTIC_NAME­] = characteristic;
                switch(CHARACTERISTIC_NAME) {
                    
                  case 'GESTURE_INFORMATION':
                    break;
                  case 'GESTURE_CONFIGURATION':
                    break;
                  case 'GESTURE_DATA':
                    break;
                    
                  case 'SENSOR_INFOMRATION':
                    break;
                  case 'SENSOR_CONFIGURATION':
                    break;
                  case 'SENSOR_DATA':
                    break;
                    
                  default:
                    break;
                }
                
                if(characteristic.properties.notify) {
                  //characteristic.handle_cccd = 0x1;
                  characteristic.on('characteristicvaluech­anged', event => {
                    console.log(event);
                  });
                  
                  return characteristic.startNotifications();
                }
              });
            });
          }, Promise.resolve([]));
        }).then(() => {
          console.log("FINISHED");
        });
      },
      isConnected : function() {
        return this.device && this.device.gatt && this.device.gatt.connected;
      },
      disconnect : function() {
        if(this.isConnected()) {
          this.device.gatt.disconnect();
        }
      },
    };
    
    
    BoseAR.connect();
    
  • in Interfacing
    Avatar for Zakaton

    I'm writing a port of the Bose AR Web SDK to Bangle.js. Right now I'm able to connect to the BLE device, get the service/characteristics and read/write values, but I get a CCCD Handle not found error when I run characteristic.startNotifications() on the characteristics with the notify property.

    I looked it up and it seems to look for a handle_cccd property on the characteristic so I looked it up and found the cccd 0x1 and assigned it to the characteristics' characteristic.handle_cccd property, and the error stopped. However I still don't get any notifications when adding an eventListener via characteristic.on('characteristicvaluech­anged', callback).

  • in ESP32
    Avatar for Zakaton

    Thanks for the help! (I work with @ukaton) You've been very helpful!

    We were able to access the motion sensor and some of the pressure sensors and make a simple demo we posted over on Twitter:

    https://twitter.com/ConcreteSciFi/status­/1152324107427442688

    However, due to the lack of support for the ESP32 atm, we think it's best to switch to another platform. We'd like to use a lot more features on the ESP32, and we'll definitely switch back to Espruino in the future when appropriate. We love what your platform stands for.

Actions