0

I am new to this. I am trying to work on an iOS application where i can to exchange data to multiple Bluetooth LE slaves.

I am able to connect and read from the multiple slaves. But the problem is i can only write (sound buzzer) to only one of them (the latest slave to be connected).

I am using the code provided in http://processors.wiki.ti.com/index.php/Category:IPhone4SBLEDemo

How is it possible to sound buzzer for all connected devices?

ViewController.m

- (IBAction)TIBLEUISoundBuzzerButton:(id)sender {
[t soundBuzzer:0x02 p:[t activePeripheral]]; //Sound buzzer with 0x02 as data value

Keyfob.m

-(void) soundBuzzer:(Byte)buzVal p:(CBPeripheral *)p {
NSData *d = [[NSData alloc] initWithBytes:&buzVal length:TI_KEYFOB_PROXIMITY_ALERT_WRITE_LEN];
[self writeValue:TI_KEYFOB_PROXIMITY_ALERT_UUID characteristicUUID:TI_KEYFOB_PROXIMITY_ALERT_PROPERTY_UUID p:p data:d];}
Cheng
  • 239
  • 3
  • 13
  • Could you please show me how to connect to multiple devices in the same time? Thanks – NTNT Mar 20 '15 at 03:22

1 Answers1

1

I have found the answer to my own question. By making use of didRetrieveConnectedPeripherals, i can write data to all connected devices simultaneously. Hopefully this can help whoever is looking for the same answer. Thank you!

-(void)centralManager:(CBCentralManager *)central didRetrieveConnectedPeripherals:(NSArray *)peripherals {

for(CBPeripheral *peripheral in peripherals) {//(soundbuzzer) }}
Cheng
  • 239
  • 3
  • 13