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

ScanRecord passing into Beacon object #80

Open
dominolog opened this issue Aug 22, 2018 · 3 comments
Open

ScanRecord passing into Beacon object #80

dominolog opened this issue Aug 22, 2018 · 3 comments

Comments

@dominolog
Copy link

It would be valuable to have ScanRecord object passed in Beacon object. Currently there is only the raw byte[] buffer - it is difficult to extract vender specific information from raw data.

@pwittchen
Copy link
Owner

Hi @dominolog,

Thanks for the nice idea. Right now, there is just array of bytes because BluetoothAdapter.LeScanCallback provides it by default. It's possible to return ScanRecord object as well, but we need to provide a method to convert bytes into this object. As far as I see ScanRecord doesn't have anything like that in the public API, but I'm pretty sure it must be hidden somewhere in the source of files in android.bluetooth.le package. Once I figure it out, I'll add this. Of course PRs are welcome, if you want this feature quicker :).

Regards,
Piotr

@pwittchen
Copy link
Owner

I've added this feature on scanresult-in-beacon branch, but it works LollipopScanStrategy only for now. It means it will work for Lollipop Android version or higher. I'm not sure if it's possible to add it in PreLollipopScanStrategy with the API provided before Lollipop. Right now, ScanResult in Beacon class will be null in Android version older than Lollipop. You can test and investigate it on the feature branch.

@pwittchen
Copy link
Owner

Sorry, I've added ScanResult instead of ScanRecord, but ScanRecord can be extracted from it and it still works for Lollipop or higher only. I'll investigate it further.

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

No branches or pull requests

2 participants