Git Product home page Git Product logo

Comments (8)

sandeepmistry avatar sandeepmistry commented on August 12, 2024

@mhle please provide debug logs, by setting the DEBUG env var to *.

I'm thinking the adapter is not responding to the HCI reset command, but we'll see what the debug logs say.

from node-bluetooth-hci-socket.

boredSinan avatar boredSinan commented on August 12, 2024

I have the same problem with my BLE USB Dongle (chipset: CSR8510 A10).

My code always communicates with the dongle only every 2nd time!!
I found out that although 'this._isUp' is true, it still does not work. The function noble.on() won't run.

In the following you can see the debug output for the case when there is no communication with the dongle:

image

Thank you for your helps..

from node-bluetooth-hci-socket.

boredSinan avatar boredSinan commented on August 12, 2024

And here is the debug output when there is a communication to the dongle:

image

from node-bluetooth-hci-socket.

boredSinan avatar boredSinan commented on August 12, 2024

I am still trying to solve this problem. It is strange, that SanDeep's "enter-exit.js" code always runs.
My code is based on "enter-exit.js", so I do not understand why I got this problem? Because I did not change the code in its basic functionality.

Here is the debug output of "enter-exit.js" to compare with those above.
image

from node-bluetooth-hci-socket.

sandeepmistry avatar sandeepmistry commented on August 12, 2024

@boredSinan looks like the adapter is still scanning when you start you app the 2nd time, and then doesn't respond to any HCI commands after the reset command.

How are you exiting your app? noble tries to stop scanning on exit here: https://github.com/sandeepmistry/noble/blob/master/lib/hci-socket/bindings.js#L96

Another thing to try is, adding a delay here, to give the adapter some time before we send other HCI commands: https://github.com/sandeepmistry/noble/blob/master/lib/hci-socket/bindings.js#L96

setTimeout(function() {
  this._isUp = true;
}.bind(this), 500);

PS: I like the coloured screenshots, but please also copy/paste the test next time, it's easier to search etc.

from node-bluetooth-hci-socket.

boredSinan avatar boredSinan commented on August 12, 2024

Thanks a lot Sandeep, for your suggestions.
I found out my problem: There is the following function in my code:

//Wait function in ms
function pauseMs(millis) {
var date = new Date();
var curDate = null;
do {
curDate = new Date();
}
while (curDate - date < millis);
}

And the problem always occured when I closed the Node.js application at the same time as the code was running the pauseMs() function (this function was called several times in my code). Because of that, the onExit() function could not be executed.

Now I don't close the Node.js application at the same time as the application is paused (because of pauseMs()), there are no problems anymore!

from node-bluetooth-hci-socket.

sandeepmistry avatar sandeepmistry commented on August 12, 2024

@boredSinan cool, thanks for following up!

@mhle any updates from my request in #13 (comment)

from node-bluetooth-hci-socket.

sandeepmistry avatar sandeepmistry commented on August 12, 2024

Closing due to lack of activity.

from node-bluetooth-hci-socket.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.