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

Characteristic Notification #16

Open
jbmolle opened this issue Mar 29, 2017 · 0 comments
Open

Characteristic Notification #16

jbmolle opened this issue Mar 29, 2017 · 0 comments

Comments

@jbmolle
Copy link

jbmolle commented Mar 29, 2017

Hi,
I try to set characteristic notification with:
BluetoothLEController.getInstance().setReadCharacteristic(MY_CHARACTERISTIC_UUID_AS_STRING);
But that doesn't work, onDataChanged(BluetoothCharacteristic characteristic) is not called.
Following the Bluetooth Smart standard on Android, you also need to write to the descriptor which is not done in the library.
I've downloaded the library from Github and did the following modification:
for (BluetoothGattDescriptor descriptor : descriptors) { if (descriptor.getUuid().equals(Descriptor.CLIENT_CHARACTERISTIC_CONFIGURATION)) { BluetoothLEController.getInstance().setReadCharacteristic(MY_CHARACTERISTIC_UUID_AS_STRING); descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); mBluetoothGatt.writeDescriptor(descriptor); } }
And then I become the notifications. Either you should change this directly in the library or you could send back mBluetoothGatt in onDiscoveringCharacteristics so we can write to the descriptor ourselves.
Let me know what you think about it.
Best,
JB

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

No branches or pull requests

1 participant