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

BluetoothGattCharacteristic needed to extract value on subscription #21

Closed
truizlop opened this issue May 11, 2017 · 3 comments
Closed
Assignees
Milestone

Comments

@truizlop
Copy link

First of all, I'd like to thank you for your contribution, it has been very easy to integrate and works very well so far.

I have a problem though. I'm pairing with a Heart Rate Monitor and this is the code I was using to extract the heart rate value from the BluetoothGattCharacteristic from the Android framework class:

int flag = characteristic.getProperties();
int format = (flag & 0x01) != 0 ?
                BluetoothGattCharacteristic.FORMAT_UINT16 :
                BluetoothGattCharacteristic.FORMAT_UINT8;
int heartRate = characteristic.getIntValue(format, 1);

However, when I receive a CommandChange on a subscription now, I don't have access to either the properties of the characteristic, or the characteristic itself, so I cannot extract the heart rate.

How should I proceed here? If it is not even possible with the current state of the library and its code needs to be modified, I can implement the necessary modifications if you provide some guidance.

@truizlop
Copy link
Author

By inspecting how CommandResult is created, I think it is not possible to do what I want to do. It should hold the BluetoothGattCharacteristic.

truizlop added a commit to truizlop/neatle that referenced this issue May 11, 2017
@mihakrajnc mihakrajnc self-assigned this May 12, 2017
@mihakrajnc mihakrajnc added this to the 0.9.3 milestone May 12, 2017
mihakrajnc added a commit that referenced this issue May 12, 2017
…scription.

Added format types to CommandResult.
tomazs added a commit that referenced this issue May 12, 2017
…trieval

Fixes #21: BluetoothGattCharacteristic needed to extract value on sub…
@tomazs
Copy link
Contributor

tomazs commented May 12, 2017

Fixed merged into master.

@mihakrajnc
Copy link
Contributor

A new release containing the changes has been published.

compile 'si.inova:neatle:0.9.3'

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

3 participants