Connection problems with javascript API

edited February 2018 in General
After changing my code to javascript, I experience some errors, mainly

noble warning: unknown handle XX disconnected!

What is the number XX related to? is it an error? I have seen 32, 34, 35, 67.

Also sometimes i get:
noble: unknown peripheral d048de5db6c0 connected!
or
noble: unknown peripheral d048de5db6c0 disconnected!

I am trying to connect a few sensors. It was 4 sensors in range and I was trying to use 1 or 2 BTLE interfaces. Both internal laptop one and BT dongle both give this errors.

UPDATE: I see that if I connect to the sensors one by one, I can connect 2 simultaneously to an interface. The third will time out (I set the timer to 20seconds). But if I use another interface, I can keep connecting, always 2 maximum per interface (I tested with the internal bt adapter and 2 bt dongles i have).

Comments

  • edited February 2018
    Those are internal errors from Noble.  The Noble devs can provide more insight into what those error messages mean.

    You should be able to connect to more than 2 devices per adapter; connecting 4 to an adapter shouldn't be an issue.

    • What code are you running to connect to a list of devices?  
    • Who is the manufacturer of the BT adapters you are using?
  • Ok, I have found something more. I tried with the multi_devices example, putting 4 devices and it connects to all 4. Then, I basically took the same code but this time the address (only one) to connect to comes from command line.

    If I start 4 processes, each one for each of the previously said 4 addresses, there are two scenarios (either of which work):

    1) If i start all processes at once, either no one connects, or first two connect and start giving some errors:

     noble: unknown peripheral null connected!
    Error: Command Disallowed (0xc)
        at NobleBindings.onLeConnComplete (/home/aribes/Projects/wear/sensor_manager/node_modules/noble/lib/hci-socket/bindings.js:220:13)
        at emitOne (events.js:116:13)
        at Hci.emit (events.js:211:7)
        at Hci.processCmdStatusEvent (/home/aribes/Projects/wear/sensor_manager/node_modules/noble/lib/hci-socket/hci.js:676:12)
        at Hci.onSocketData (/home/aribes/Projects/wear/sensor_manager/node_modules/noble/lib/hci-socket/hci.js:471:12)
        at emitOne (events.js:116:13)

    2) if I start the processes one by one, waiting for the previous to be connected, then only the first two connect successfuly, the third stays forever in "connecting" state.

    The dongle I am using is an ASUS BT400.
  • Is each process using a different HCI device?
  • No, each process uses the same HCI device. In fact, I realized that maximum two processes can access to the same HCI interface, the third one starts giving problems. 

    I guess it is a limitation of the noble library and/or any of the underlying system libs, but I hope it can be overcome in some way.

    ps. Is python sdk using a different underlying lib? I say because in my python implementation, I could connect 4 sensors using 4 processes with the same HCI interface.
  • No, as stated in the other thread, every linux ble library uses BlueZ.

    Is there any particular reason why you are using multiple processes to connect to multiple boards instead of having 1 process connect to multiple devices?  In general, each process should be using its own HCI device.
  • It is due to the architecture I am using. The design of one process per sensor is because I have a sensor manager process that scans for sensors and manages connections. In python it was better to have separated processes because I can use better the CPU, and in case of connection problems, the manager can just kill the process and respawn.

    Yes, I could redesign and use one nodejs process per HCI interface, and the manager just send requests for connection to them, but I wanted to avoid it if possible.
This discussion has been closed.