• There is a HID module for BLE that helps Espruino to emulate a HID device (like keyboard or media controller) itself.

    What I want to do is exactly the opposite:

    • I bought a cheap 1-button camera trigger for smartphones (that sends a "volume up" button command)

    • want to use it on my Espruino project as a remote switch, but how?

    I can:

    • find and connect it it via NRF.requestDevice (named "AB Shutter3" - prefix "AB" works)

      connected BluetoothRemoteGATTServer: {
      "device": BluetoothDevice: {
      "id": "2a:07:98:10:35:fb public",
      "rssi": -67,
      "data": new Uint8Array([2, 1, 5, 3, 2, 18, 24, 3, 25, 193, 3, 12, 9, 65, 66, 32, 83, 104, 117, 116, 116, 101, 114, 51]).buffer,
      "name": "AB Shutter3",
      "services": [
        "1812"
       ],
      "gatt":  ...
      },
      "connected": true, "handle": 1 }
      
    • find a a single service ( 1812) and fetch it

      service BluetoothRemoteGATTService: {
      "device": BluetoothDevice: {
      "id": "2a:07:98:10:35:fb public",
      "rssi": -67,
      "data": new Uint8Array([2, 1, 5, 3, 2, 18, 24, 3, 25, 193, 3, 12, 9, 65, 66, 32, 83, 104, 117, 116, 116, 101, 114, 51]).buffer,
      "name": "AB Shutter3",
      "services": [
        "1812"
       ],
      "gatt": BluetoothRemoteGATTServer: {
        "device":  ... ,
        "connected": true, "handle": 1 }
      },
      "uuid": "0x1812",
      "isPrimary": true, "start_handle": 15, "end_handle": 31 }
      
    • find a bunch of characteristics:

      {
      "uuid": "0x2a4e",
      "properties": { "broadcast": false, "read": true, "writeWithoutResponse": true, "write": false, "notify": false, "indicate": false, "authenticatedSignedWrites": false }
      }
      {
      "uuid": "0x2a4d",
      "properties": { "broadcast": false, "read": true, "writeWithoutResponse": false, "write": false, "notify": true, "indicate": false, "authenticatedSignedWrites": false }
      }
      {
      "uuid": "0x2a4d",
      "properties": { "broadcast": false, "read": true, "writeWithoutResponse": false, "write": false, "notify": true, "indicate": false, "authenticatedSignedWrites": false }
      }
      {
      "uuid": "0x2a4b",
      "properties": { "broadcast": false, "read": true, "writeWithoutResponse": false, "write": false,
      "notify": false, "indicate": false, "authenticatedSignedWrites": false }
      }
      {
      "uuid": "0x2a4a",
      "properties": { "broadcast": false, "read": true, "writeWithoutResponse": false, "write": false, "notify": false, "indicate": false, "authenticatedSignedWrites": false }
      }
      {
      "uuid": "0x2a4c",
      "properties": { "broadcast": false, "read": false, "writeWithoutResponse": true, "write": false, "notify": false, "indicate": false, "authenticatedSignedWrites": false }
      }
      

    The odd thing is:

    • 0x2a4d exists twice and is the only characteristic that will notify, so this is probably the one I'm looking for, but
    • c..on("characteristicvaluechanged",… and c.startNotifications() doesn't work
    • meaning it works, but the button does not notify anything

    When I pair it with my smartphone there is a dialog popping up first.
    Will there be something to happen first before both are connected?
    Like writing back to one of the other characteristics to say that we'd like to connect?

    Any hints or links appreciated.


    1 Attachment

    • IMG_4290.jpeg
About

Avatar for ChristianW @ChristianW started