This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BLE custom service - signing in for notifications - problam

Hello!

I have a custom service that has a characteristic which has the ability to send notifications when 

someone is registered to them.

this is my service table as i defined it:

// Service - PhreeHID
{GATT_ATTRIBUTE_FLAGS_READABLE, aetPrimaryService128, (Byte_t *)&PhreeHID_Service_UUID}, //0
// Charechteristic - Phree report 1 (short version - buttons, X,Y) //
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicDeclaration128, (Byte_t *)&Phree_Report_Declaration}, //1
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128, (Byte_t *)&Phree_Report_Value}, //2
// Descriptor - Client charachteristic configuration //
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicDescriptor16, (Byte_t *)&Client_Characteristic_Configuration}, //3
// Descriptor -Phree report reference //
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicDescriptor128, (Byte_t *)&Phree_Report_Reference_Descriptor}, //4
// Charechteristic - Phree report 2 (Long version - buttons, x, y, z, pressure, azimuth, altitude, twist, Vx, Vy, Vz) //
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicDeclaration128, (Byte_t *)&Phree_Report_Declaration}, //5
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128, (Byte_t *)&Phree_Report_Value}, //6
// Descriptor - Client charachteristic configuration //
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicDescriptor16, (Byte_t *)&Client_Characteristic_Configuration}, //7
// Descriptor -Phree report reference //
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicDescriptor128, (Byte_t *)&Phree_Report_Reference_Descriptor}, //8
// Charechteristic - Phree report map //
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicDeclaration128, (Byte_t *)&Phree_Report_Map_Declaration}, //9
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicValue128, (Byte_t *)&Phree_Report_Map_Value}, //10
// Charechteristic - Phree sketch mode //
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicDeclaration128, (Byte_t *)&Phree_Sketch_Mode_Declaration}, //11
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128, (Byte_t *)&Phree_Sketch_Mode_Value}, //12
// Descriptor - Client charachteristic configuration //
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicDescriptor16, (Byte_t *)&Client_Characteristic_Configuration}, //13
// Charechteristic - Phree SDK Icon //
{GATT_ATTRIBUTE_FLAGS_READABLE, aetCharacteristicDeclaration128, (Byte_t *)&Phree_SDK_Icon_Declaration}, //14
{GATT_ATTRIBUTE_FLAGS_READABLE_WRITABLE, aetCharacteristicValue128, (Byte_t *)&Phree_SDK_Icon_Value}, //15

i am talking specifically about the sketchmode characteristic and its CCD (//13) .

This is the code snippet that I run on the Android side. I get 0 on the call to getPermissions and false on the call to writeDescriptor. I should get permission value 17 if the descriptor is defined with read and write permissions.

BluetoothGattDescriptor descriptor = characteristic.getDescriptor(
           UUID.fromString(SampleGattAttributes.CLIENT_CHARACTERISTIC_CONFIG));
if(descriptor != null) {
    Log.i(TAG,"Permissions: "+descriptor.getPermissions());
    descriptor.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE);
    boolean result = mBluetoothGatt.writeDescriptor(descriptor);

}

Can you please advise about how to define the custom service properly so i can register my android for notifications?