BLE Scan not returning name of the device

Posted on
  • I am scanning BLE peripheries using NRF.findDevices() /NRF.requestDevice() calls. None of the methods returning the local-name/ name of the discovered devices.

    I am using latest BangleJS firmware V.08

    NRF.findDevices(function(devices) {
    :  console.log(devices);
    :}, 1000);
    =undefined
    [
      BluetoothDevice: {
        "id": "1d:0d:90:b3:74:f1 private-nonresolvable",
        "rssi": -55,
        "data": new Uint8Array([24, 255, 6, 0, 1, 9, 33, 10, 80, 19, 206, 177, 8, 16, 65, 66, 72, 73, 78, 65, 86, 45, 80, 67, 56]).buffer,
        "manufacturer": 6,
        "manufacturerData": new Uint8Array([1, 9, 33, 10, 80, 19, 206, 177, 8, 16, 65, 66, 72, 73, 78, 65, 86, 45, 80, 67, 56]).buffer
       },
      BluetoothDevice: {
        "id": "f0:d1:ff:48:71:b7 random",
        "rssi": -56,
        "data": new Uint8Array([2, 1, 6, 3, 3, 170, 254, 21, 22, 170, 254, 0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).buffer,
        "services": [
          "feaa"
         ],
        "serviceData": {
          "feaa": new Uint8Array([0, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]).buffer
         }
       }
     ]
    > 
    

    But my device is advertising the name. I can see in noble.js scan output

      id: 'f0d1ff4871b7',
      uuid: 'f0d1ff4871b7',
      address: 'f0:d1:ff:48:71:b7',
      addressType: 'random',
      connectable: false,
      advertisement:
       { localName: 'BBC micro:bit [zevov]',
         txPowerLevel: undefined,
         manufacturerData: undefined,
         serviceData: [ [Object] ],
         serviceUuids: [ 'feaa' ],
         solicitationServiceUuids: [],
         serviceSolicitationUuids: [] },
      rssi: -30,
      services: null,
      state: 'disconnected' }
    Peripheral {
      _noble:
       Noble {
         initialized: true,
         address: '00:1a:7d:da:71:13',
         _state: 'poweredOn',
         _bindings:
          NobleBindings {
            _state: 'poweredOn',
            _addresses: [Object],
            _addresseTypes: [Object],
            _connectable: [Object],
            _pendingConnectionUuid: null,
            _connectionQueue: [],
            _handles: {},
            _gatts: {},
            _aclStreams: {},
            _signalings: {},
            _hci: [Hci],
            _gap: [Gap],
            _events: [Object],
            _eventsCount: 21,
            onSigIntBinded: [Function: bound ],
            _scanServiceUuids: [] },
         _peripherals:
          { '1d0d90b374f1': [Peripheral],
            f0d1ff4871b7: [Peripheral],
            cf937c826f4b: [Circular] },
         _services: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} },
         _characteristics: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} },
         _descriptors: { '1d0d90b374f1': {}, f0d1ff4871b7: {}, cf937c826f4b: {} },
         _discoveredPeripheralUUids: [ '1d0d90b374f1', 'f0d1ff4871b7', 'cf937c826f4b' ],
         _events:
          [Object: null prototype] {
            warning: [Function: bound ],
            newListener: [Function: bound ],
            stateChange: [Function],
            discover: [Function] },
         _eventsCount: 4,
         _allowDuplicates: undefined },
      id: 'cf937c826f4b',
      uuid: 'cf937c826f4b',
      address: 'cf:93:7c:82:6f:4b',
      addressType: 'random',
      connectable: true,
      advertisement:
       { localName: 'DS-D6 6f4b',
         txPowerLevel: undefined,
         manufacturerData: undefined,
         serviceData: [],
         serviceUuids: [ '6e400001b5a3f393e0a9e50e24dcca9e' ],
         solicitationServiceUuids: [],
         serviceSolicitationUuids: [] },
      rssi: -86,
      services: null,
      state: 'disconnected' }
    
    

    I dont have a clue!! I want to show the name of the device in search so that I can select the device based on name.

  • I see the device name with NRF.findDevice() and setConnect() sometimes but not always.

  • setConnect?

    What does NRF Connect say about the micro:bit - it'd be interesting to see the 'RAW' data.

    Theres definitely no 'name' in the data that Espruino is receiving there. So there are two options I guess:

    • Micro:bit isn't transmitting very often and is also alternating advertising packets, so you need to make sure you scan for longer in order to get a packet that contains the name - I see you actually explicitly lowered the scan time to 1 sec, so raising that again might help.
    • Micro:bit is only transmitting the name in a 'scan response' packet, so you need to start an 'active' scan with active:true: http://www.espruino.com/Reference#l_NRF_¬≠findDevices
  • Sorry for typo.. I mean setScan(). I understand why microbit is not appearing. Now I can see the device are coming in scan results.

  • Just so others know if they have this issue, how did you fix it?

  • Nothing, it started appearing automatically :)

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

BLE Scan not returning name of the device

Posted by Avatar for Abhigkar @Abhigkar

Actions