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

Add Estimote nearable support #35

Merged
merged 15 commits into from
Feb 10, 2019

Conversation

ShaunPlummer
Copy link
Contributor

Add packet parsing and scanning support for Estimote 'Sticker Beacons' advertising 'Nearable' frames.

Allow the manufacturer specific portion of the BLE advert data to be parsed for Nearables information. Including identifier, hardware and firmware version, temperature and movement state.
Account for the scanner passing a subset of the advert data for parsing
Update scanner to allow Estimote Nearables to be returned in results.
With basic device filtering using the identifier support in the existing
estimote device filter
@@ -168,6 +168,7 @@ def process_packet(self, pkt):
if not ( \
((self.mode & ScannerMode.MODE_IBEACON) and (pkt[19:23] == b"\x4c\x00\x02\x15")) or \
((self.mode & ScannerMode.MODE_EDDYSTONE) and (pkt[19:21] == b"\xaa\xfe")) or \
((self.mode & ScannerMode.MODE_ESTIMOTE) and (pkt[23:25] == b"\x5d\x01")) or \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if reusing the same device filter and scan mode setting would be acceptable or not.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 90.939% when pulling ce05975 on ShaunPlummer:feat/addNearableSupport into 7276e47 on citruz:master.

@coveralls
Copy link

coveralls commented Jan 29, 2019

Coverage Status

Coverage increased (+0.07%) to 91.489% when pulling 2728a3c on ShaunPlummer:feat/addNearableSupport into 15a83e9 on citruz:master.

@ShaunPlummer
Copy link
Contributor Author

What's the coverage threshold for the project?

@citruz
Copy link
Owner

citruz commented Feb 4, 2019

Thank you for your contribution!
I have one comment regarding your code. You added another function call to parse_packet, even though the Estimote Nearable packet is also using a length-tag-value structure. Please adapt your code to use the parse_ltv_packet method. In the loop over the frames, you can check for the manufacturer specific data tag (0xff) and compare the first to bytes to the ESTIMOTE_MANUFACTURER_BYTES constant.

@ShaunPlummer
Copy link
Contributor Author

I've updated the PR to iterate over the advert data elements and check for a manufacturer specific type, moving the LTV struct into the parser. I also believe this could stand to be more generic.

@citruz citruz changed the base branch from master to release1.4.0 February 10, 2019 18:53
@citruz citruz merged commit 7ea8dd5 into citruz:release1.4.0 Feb 10, 2019
@citruz
Copy link
Owner

citruz commented Feb 10, 2019

Great, thanks! I merged your changes into a release branch where I will integrate this PR and #36.

@citruz citruz mentioned this pull request Feb 10, 2019
@citruz
Copy link
Owner

citruz commented Feb 10, 2019

I merged #35 and #36 and refactored all beacon definitions to use the generic ltv parser. The tests look fine, but since I don't have the hardware at hand, I cannot test the actual scanner.
Please verify that I didn't break anything during refactoring by checking out the release1.4.0 branch. As soon as you confirm that everything works as expected, I will finalize the release.
Thanks!

@ShaunPlummer
Copy link
Contributor Author

Apologies for the delay in replying. I've tested the release1.4.0 branch and everything is working.

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.

None yet

3 participants