I am working with the example-gatt-server.py script that comes with bluez on my linux board. I want to add notification to one of my custom characteristics. For that I need to define the Client Characteristic Configuration Descriptor and add it to my custom characteristic. Here is how I am doing this -
class ClientCharacteristicConfigurationDescriptor(Descriptor):
CCCD_UUID = '2902'
def __init__(self, bus, index, characteristic):
self.value = array.array('B')
self.value = self.value.tolist()
#self.value = []
Descriptor.__init__(
self, bus, index,
self.CCCD_UUID,
['read', 'write'],
characteristic)
def ReadValue(self):
print("I am reading CCCD value")
print(self.value)
return self.value
def WriteValue(self, value):
print("I am writing CCCD value")
print type(value)
#self.value = value
print(value)
This code was inspired by the CharacteristicUserDescriptionDescriptor class that already comes defined in the example-gatt-server file. The above code gives me errors while reading or writing. It doesn't even print the "I am reading CCCD value" statement. What am I missing here?
Thanks!