I'm creating a new CBMutableCharacteristic for use in a Bluetooth app I'm making. I got some code from a tutorial, which looks like this:
_customCharacteristic = [[CBMutableCharacteristic alloc] initWithType:characteristicUUID properties:CBCharacteristicPropertyNotify value:nil permissions:CBAttributePermissionsReadable];
where _customCharacteristic
is my CBMutableCharacteristic.
However, I want to initialize my _customCharacteristic
with other properties, such as CBCharacteristicPropertyRead
and CBCharacteristicPropertyWrite
. The same is true for the permissions: I want to also give it CBAttributePermissionsWriteable
.
I can have both multiple properties and permissions for each characteristic. However, I don't know how to initialize my CBMutableCharacteristic in this way.
Its an enum, whose different values can be ORed bitwisely, so you can use the characteristic properties and permissions together:
CBMutableCharacteristic *_customCharacteristic = [[CBMutableCharacteristic alloc] initWithType:characteristicUUID properties:CBCharacteristicPropertyNotify+CBCharacteristicPropertyRead
value:nil permissions:CBAttributePermissionsReadable|CBAttributePermissionsWriteable];