Skip to content
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

fix for missing connection change event #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

farfromrefug
Copy link
Contributor

Hi realized that i had no disconnect events on windows. After debugging it i realized that my device was stored as 00000190a0c2 in _deviceMap but doing sender.bluetoothAddress.toString(16) in _onConnectionStatusChanged was only returning 190a0c2
This PR fixes this by appending zeros

// make sure we get the correct length by appending 000...
let deviceUuid = sender.bluetoothAddress.toString(16);
if (deviceUuid.length < 12) {
deviceUuid = Array(12 - deviceUuid.length + 1).join('0') + deviceUuid;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In _onAdvertisementWatcherReceived, the deviceUuid is generated by these two lines of code:

	let address = formatBluetoothAddress(e.bluetoothAddress);
	let deviceUuid = address.replace(/:/g, '');

The result is the same, so it doesn't matter which way it's done, but I'd prefer it to be consistent in the two places. Maybe add a new helper function?

@jasongin
Copy link
Owner

The CI is just complaining that node version 5 is no longer supported. Other versions succeeded. I need to remove version 5 (and 7) from appveyor.yml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants