Skip to content

Commit 53f8ba8

Browse files
committed
Changed to a new iOS version of Chat example over BLE.
1 parent d566d24 commit 53f8ba8

28 files changed

+1193
-719
lines changed

Examples/BLEChat_Central_iOS/BLE Chat.xcodeproj/project.pbxproj

-339
This file was deleted.

Examples/BLEChat_Central_iOS/BLE/BLE.h

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
@property (nonatomic,assign) id <BLEDelegate> delegate;
3535
@property (strong, nonatomic) NSMutableArray *peripherals;
36+
@property (strong, nonatomic) NSMutableArray *peripheralsRssi;
3637
@property (strong, nonatomic) CBCentralManager *CM;
3738
@property (strong, nonatomic) CBPeripheral *activePeripheral;
3839

Examples/BLEChat_Central_iOS/BLE/BLE.m

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ @implementation BLE
1919
@synthesize delegate;
2020
@synthesize CM;
2121
@synthesize peripherals;
22+
@synthesize peripheralsRssi;
2223
@synthesize activePeripheral;
2324

2425
static bool isConnected = false;
@@ -179,6 +180,8 @@ - (void) controlSetup
179180

180181
- (int) findBLEPeripherals:(int) timeout
181182
{
183+
NSLog(@"start finding");
184+
182185
if (self.CM.state != CBCentralManagerStatePoweredOn)
183186
{
184187
NSLog(@"CoreBluetooth not correctly initialized !");
@@ -420,8 +423,10 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central
420423

421424
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
422425
{
423-
if (!self.peripherals)
426+
if (!self.peripherals) {
424427
self.peripherals = [[NSMutableArray alloc] initWithObjects:peripheral,nil];
428+
self.peripheralsRssi = [[NSMutableArray alloc] initWithObjects:RSSI, nil];
429+
}
425430
else
426431
{
427432
for(int i = 0; i < self.peripherals.count; i++)
@@ -440,6 +445,7 @@ - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeri
440445
}
441446

442447
[self.peripherals addObject:peripheral];
448+
[self.peripheralsRssi addObject:RSSI];
443449

444450
NSLog(@"New UUID, adding");
445451
}

0 commit comments

Comments
 (0)