Shahzore Qureshi • about 12 years ago
Android - Unable to Pass Verification
I am able to send the verification key provided in the Quick Start guide to the device via writing to the verification characteristic. However, the device rejects the key. The error message is "Invalid Value". The key I am trying to send is BCF5AC4840.
Thanks in advance!
Shahzore
Comments are closed.

5 comments
mattgordon99 Manager • about 12 years ago
Could you please posta 'snippet" of your code so we can help you out?
Shahzore Qureshi • about 12 years ago
Sure! Thanks for helping me out!
Finding Characteristic Snippet:
// Loops through available GATT Services.
for (BluetoothGattService gattService : gattServices) {
uuid = gattService.getUuid().toString();
//VSN_SERVICE = "fffffff0-00f7-4000-b000-000000000000"
if (uuid.equalsIgnoreCase(SampleGattAttributes.VSN_SERVICE))
vbttnServiceFound = true;
List gattCharacteristics =
gattService.getCharacteristics();
// Loops through available Characteristics.
for (BluetoothGattCharacteristic gattCharacteristic : gattCharacteristics) {
uuid = gattCharacteristic.getUuid().toString();
if (vbttnServiceFound)
{
Log.i(TAG, "VSN Service found!");
if (uuid.equalsIgnoreCase(SampleGattAttributes.VSN_CHARACTERISTIC_VERIFICATION))
{
Log.i(TAG, "VSN Verification Characteristic found!");
//VSN Key = "BCF5AC4840"
gattCharacteristic.setValue(VSN_VERIFICATION_KEY);
mBluetoothLeService.writeCharacteristic(gattCharacteristic);
}
}
}
}
Writing Characteristic Snippet:
public void writeCharacteristic(BluetoothGattCharacteristic characteristic) {
if (mBluetoothAdapter == null || mBluetoothGatt == null) {
Log.w(TAG, "BluetoothAdapter not initialized");
return;
}
//This is an object of the android.bluetooth.BluetoothGatt Java class
mBluetoothGatt.writeCharacteristic(characteristic);
}
mdelac01 Manager • about 12 years ago
Hi shaq1nj,
I believe the issue is the way your verification string is defined.
Try defining the string as a byte array. The snippet below works.
...
byte[] value={ (byte)0xBC, (byte)0xF5, (byte)0xAC, (byte)0x48, (byte)0x40};
characteristic.setValue(value);
mBluetoothGatt.writeCharacteristic(characteristic);
...
Shahzore Qureshi • about 12 years ago
That worked! Thanks for your help!
mdelac01 Manager • about 12 years ago
Glad to help!