• I've started building a web app that can connect to the bangle and send commands via bluetooth. All works well when using the built in service/characteristic:

    const bluetoothServiceUUID: BluetoothServiceUUID = '6e400001-b5a3-f393-e0a9-e50e24dcca9e';
    const bluetoothCharacteristicUUID: BluetoothCharacteristicUUID = '6e400002-b5a3-f393-e0a9-e50e24dcca9e';
    

    however my aim is to stream accelerometer data from the watch, so I've been trying to write a watch app that exposes a custom service/characteristic to do this.

    This is my first espruino device and my first use of web bluetooth - but as a start and following the code from this puck project: https://github.com/AkosLukacs/PuckStreamĀ­ing/blob/master/src/PuckStreaming.js I've written a really simple watch app that I expected to expose a service that I can just read a value from -

    function onInit() {
      NRF.setServices({
        '92c1b5b8-e824-4938-bbed-672529103e56': {
          '92c1b5b8-e825-4938-bbed-672529103e56': {
            notify: true,
            readable: true,
            broadcast: true,
            value: "Hello"
          }
        }
      });
      E.showMessage("Waiting..","Bluetooth Connection");
    }
    
    onInit();
    

    Opening the app on the watch and then attempting to use this service and characteristic from the web app I get:

    No Services matching UUID 92c1b5b8-e824-4938-bbed-672529103e56 found in Device.
    

    Please can someone point me in the right direction as to why this isn't working?

  • You have to disconnect from the device for service advertisements to actually update.
    Just tested your above snippet, and the new service shows up in nRF Connect, and does have a value of "Hello".
    Get nRF Connect for your phone, makes quick checks really easy.

  • @AkosLukacs Thanks for the reply! It seems I am on the right lines then - however

    'I have to disconnect from the device for the service advertisements to actually update'

    Maybe there is something wrong in my fundamental understanding - I have saved the watch app into the device storage, I run the app on the watch with no devices connected, then attempt to connect to the watch. By disconnect do you mean completely unpair and then repair? I'll give that a try!

    I'll definitely take your advice and get that app, it sounds like it could be really useful.

About

Avatar for AkosLukacs @AkosLukacs started