7 Replies Latest reply on Jul 13, 2016 7:03 AM by noahko

    Discovering BLE services on Edison

    Tomas0413

      Hi, I need to write and read to Edison over Bluetooth.

       

      I was able to configure BLE and I can connect to Edison, however, when I try service discovery - nothing happens.

      I use noble and I tried these examples:

      https://github.com/sandeepmistry/bleno/tree/master/examples/pizza

       

      https://github.com/zdennis/bleno-peripheral

       

       

      This is how I enable BLE on Edison:

       

      bluetooth_rfkill_event &

      rfkill unblock bluetooth

      hciconfig dev

      hciconfig hci0 up

       

      I can scan and see devices listed:

       

      # hcitool lescan

      LE Scan ...

      2C:B4:3A:0F:71:DB (unknown)

      B8:78:2E:4F:38:6E (unknown)

      B8:78:2E:4F:38:6E (unknown)

      2C:B4:3A:0F:71:DB (unknown)

       

      This is what I see when I start "Door service" written by Zach Dennis:

       

      # DEBUG=door,bleno,hci-ble,l2cap-ble node ./peripheral.js

        hci-ble hciBle = /home/tomas/node_modules/bleno/lib/linux/../../build/Release/hci-ble +0ms

        l2cap-ble l2capBle = /home/tomas/node_modules/bleno/lib/linux/../../build/Release/l2cap-ble +0ms

        l2cap-ble handles = [

        {},

        {

          "type": "service",

          "uuid": "1800",

          "startHandle": 1,

          "endHandle": 5

        },

        {

          "type": "characteristic",

          "uuid": "2a00",

          "properties": 2,

          "secure": 0,

          "startHandle": 2,

          "valueHandle": 3

        },

        {

          "type": "characteristicValue",

          "handle": 3,

          "value": "Buffer('7562696c696e7578', 'hex')"

        },

        {

          "type": "characteristic",

          "uuid": "2a01",

          "properties": 2,

          "secure": 0,

          "startHandle": 4,

          "valueHandle": 5

        },

        {

          "type": "characteristicValue",

          "handle": 5,

          "value": "Buffer('8000', 'hex')"

        }

      ] +31ms

        door Using allowed file at /home/tomas/door-service/bleno-peripheral-master/allowed.json +0ms

        door Using door open command: /bin/date +10ms

        door Starting Door peripheral (DD613893991A4C4F9115709BF14A4FD7) on platform: +8ms linux

        hci-ble startAdvertising: name = undefined, serviceUuids = [

        "DD613893991A4C4F9115709BF14A4FD7"

      ] +165ms

        hci-ble startAdvertisingWithEIRData: advertisement data = 0201051106d74f4af19b7015914f4c1a99933861dd, scan data = +6ms

        bleno advertisingStart: null +0ms

        door bleno.advertisingStart success +17ms

        l2cap-ble handles = [

        {},

        {

          "type": "service",

          "uuid": "1800",

          "startHandle": 1,

          "endHandle": 5

        },

        {

          "type": "characteristic",

          "uuid": "2a00",

          "properties": 2,

          "secure": 0,

          "startHandle": 2,

          "valueHandle": 3

        },

        {

          "type": "characteristicValue",

          "handle": 3,

          "value": "Buffer('7562696c696e7578', 'hex')"

        },

        {

          "type": "characteristic",

          "uuid": "2a01",

          "properties": 2,

          "secure": 0,

          "startHandle": 4,

          "valueHandle": 5

        },

        {

          "type": "characteristicValue",

          "handle": 5,

          "value": "Buffer('8000', 'hex')"

        },

        {

          "type": "service",

          "uuid": "DD613893991A4C4F9115709BF14A4FD7",

          "startHandle": 6,

          "endHandle": 9

        },

        {

          "type": "characteristic",

          "uuid": "fffffffffffffffffffffffffffffff1",

          "properties": 22,

          "secure": 0,

          "startHandle": 7,

          "valueHandle": 8

        },

        {

          "type": "characteristicValue",

          "handle": 8,

          "value": null

        },

        {

          "type": "descriptor",

          "handle": 9,

          "uuid": "2902",

          "properties": 14,

          "secure": 0,

          "value": "Buffer('0000', 'hex')"

        }

      ] +88ms

        bleno servicesSet +25ms

        hci-ble buffer = "adapterState poweredOn\n" +48ms

        hci-ble line = adapterState poweredOn +1ms

        hci-ble adapterState = poweredOn +1ms

        bleno stateChange poweredOn +24ms

        door bleno.stateChange: poweredOn +47ms

        l2cap-ble buffer = "bind success\nlisten success\n" +45ms

        l2cap-ble line = bind success +1ms

        l2cap-ble line = listen success +2ms

        l2cap-ble buffer = "accept 4A:3B:70:6B:4F:74\n" +8s

        l2cap-ble line = accept 4A:3B:70:6B:4F:74 +0ms

        bleno accept 4A:3B:70:6B:4F:74 +8s

        l2cap-ble buffer = "security low\ndata 029e00\n" +206ms

        l2cap-ble line = security low +1ms

        l2cap-ble line = data 029e00 +0ms

        l2cap-ble handing request: 029e00 +2ms

        l2cap-ble response: 039e00 +2ms

        l2cap-ble send: 039e00 +9ms

        l2cap-ble buffer = "data 0801000500002a\n" +1s

        l2cap-ble line = data 0801000500002a +0ms

        l2cap-ble handing request: 0801000500002a +1ms

        l2cap-ble read by type: startHandle = 0x1, endHandle = 0x5, uuid = 0x2a00 +5ms

        l2cap-ble response: 090a03007562696c696e7578 +1ms

        l2cap-ble send: 090a03007562696c696e7578 +0ms


      I use iPhone app (I tried few of them) to connect to Edison, but I can't use the services:

       

      IMG_2774.PNG


      Has anyone else been able to create BLE service and successfully use it? I don't need to use Node.js, I can also use python or anything that runs on Edison.