Hello! I am having some issues getting updated values from a characteristic that my Central Manager is subscribed to. I am successfully setting up the subscribe as my Peripheral Manager does get the delegate call that there is a new subscriber to my characteristic. So i know the connection is there. I am able to write data from the Central Manager to the Peripheral successfully as well. The issue is getting the Peripheral to update a value on the characteristic that the Central Manager will read. Let me give a little more detail.
self.characteristicCreateInteraction = [[CBMutableCharacteristic alloc]
initWithType:createInteractionUUID
properties:CBCharacteristicPropertyRead | CBCharacteristicPropertyWrite | CBCharacteristicPropertyNotify
value:nil
permissions:CBAttributePermissionsWriteable | CBAttributePermissionsReadable
];
to which on the Central Manager I setup the subscribe
//Central Manager peripheral:didDiscoverCharacteristicsForService:error:
[aPeripheral setNotifyValue:true forCharacteristic:aChar];
After i setup the subscription, I write a value from the Central Manager to the Peripheral
//Central Manager
[self.aCperipheral writeValue:mainData1 forCharacteristic:aChar type:CBCharacteristicWriteWithoutResponse];
The Peripheral Manager gets the didReceiveWriteRequest delegate call and retrieves the data with no problems. Here is the important part. Within that didReceiveWriteRequest method, I am trying to update the value of the characteristic.
//Peripheral Manager
[peripheral updateValue:writeBackData forCharacteristic:self.characteristicCreateInteraction onSubscribedCentrals:nil];
Going back to the Central Manager, I get the peripheral:didUpdateNotificationStateForCharacteristic:error: delegate call, but not the didUpdateValueForCharacteristic call. In the didUpdateNotificationStateForCharacteristic call, the Characteristic returns a true isNotifying property. I then request a read of that Characteristic.
//Central Manager
[self.aCperipheral readValueForCharacteristic:characteristic];
Back to the Peripheral Manager to respond to the read request. Within this request response, I add a small piece of data to the request value. When i send this request, the Central Manager's didUpdateValueForCharacteristic gets called (YAY! but not really), the characteristics value within this delegate call is the data that i packed up in the response, NOT the data i used in the updateValue:forCharacteristic:onSubscribedCentrals:. The only data I see go across this characteristic (from Peripheral Manager to Central Manager) is the data i put in the request response. I never see any notification (didUpdateValueForCharacteristic calls) or any data (put in the updateValue:forCharacteristic:...) at any point in time.
Any tips or thoughts as to why this might be?
Sorry for the wall of text, I wanted to be thorough and chronicle each step in the process so that if indeed i was missing something or doing something wrong, it would be obvious. Any help or tips would be greatly appreciated! If you need anymore info I would be glad to provide it.
Thanks for your time!
Michael