Using the Bluetooth SIG Application Accelerator code and it does a good job of demonstrating the different concepts of bluetooth low energy. However, it mentions nothing about indications as opposed to notifications. I know that indications need to be acknowledged unlike notifications, and in the code I would do byte[] val = enabled ? BluetoothGattDescriptor.ENABLE_INDICATION_VALUE : BluetoothGattDescriptor.DISABLE_INDICATION_VALUE;
instead of byte[] val = enabled ? BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE : BluetoothGattDescriptor.DISABLE_NOTIFICATION_VALUE;
. Is there anything else I need to do? How exactly do I let the server know that I received the indication as that is required? Is there something I need to add in?
@Override
public void onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic)
{
notification_id++;
Log.d("BleWrapper","notification count = " + notification_id);
// characteristic's value was updated due to enabled notification, lets get this value
// the value itself will be reported to the UI inside getCharacteristicValue
getCharacteristicValue(characteristic);
// also, notify UI that notification are enabled for particular characteristic
mUiCallback.uiGotNotification(mBluetoothGatt, mBluetoothDevice, mBluetoothSelectedService, characteristic);
}