In my application I want to connect to two CBPeripheral but after the connection is established and notifications are enabled I can send data only to the device that was last connect. I suspect that this is due to I have to create separated CBPeripheralDelegates in order to handle the communication.
because each time I connect peripheral I set peripheral.delegate.self.
Any help guys how to pass the peripheral delegate into another class so I can read/write from each device ?
Part of my connection code with CBPeripheral:
if (!operationLocked)
{
if ([self isArrayEmpty])
{
return FAILED;
} else {
//I am calling this recursively
CBPeripheral *deviceToConnect = [_devicesToConnect objectAtIndex:0];
deviceToConnect.delegate = self;
operationLocked = true;
[_centralManager connectPeripheral:deviceToConnect options:nil];
return SUCESS;
}}...and so on