-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slowness in subsequent connections (managed) #28
Comments
Hi, Sorry for the late reply! I haven't encountered the issue you are describing in my applications. I am however looking at the code you posted and noticed this: var isAvailable = false;
if (window.bluetooth !== undefined) {
window.bluetooth.isEnabled(
function (isOk) { // sucess callback
if (isOk) {
isAvailable = isOk;
}
else {
isAvailable = false;
console.log("Bluetooth not available. Maybe it's not active on the device?");
}
},
function () { // error callback
isAvailable = false;
console.log("Something went wrong. Couldn't check bluetooth availability.");
});
if (isAvailable)
{
// isAvailable is always going to be false
}
} The You could try something like: function onState(isAvailable) {
// do whatever!
}
window.bluetooth.isEnabled(
function(isEnabled) {
onState(isEnabled);
},
function(err) {
// log errors
onState(false);
}); Hope this helps, |
Thanks Taneli, That may be the cause for the slowness? I mean, I haven't had problems Thanks! On 16/09/2014 06:44, Taneli Hartikainen wrote:
|
Hi!
Well, I've been using this in one project and now I'm having (customer pointed this out for us) issues with slowness in the comunication phone <-> bluetooth device.
When it first connects, no problem, it takes about 1 sec most cases to connect. When I disconnect and get back, it also does it quickly. But if I go again and connect it can take up to 15 sec to connect again... Same code, some functions. The only difference is that it is not the first connection. My workflow can be synthesized like the listing below. I use pirometro.connectBluetooth() to start it all and connectBluetooth.disconnectBluetooth() to disconnect.
I'm a bit clueless on this one.
}
The text was updated successfully, but these errors were encountered: