Skip to content

Commit

Permalink
Changed to a new iOS version of Chat example over BLE.
Browse files Browse the repository at this point in the history
  • Loading branch information
Cheong2K committed Apr 9, 2014
1 parent d566d24 commit 53f8ba8
Show file tree
Hide file tree
Showing 28 changed files with 1,193 additions and 719 deletions.
339 changes: 0 additions & 339 deletions Examples/BLEChat_Central_iOS/BLE Chat.xcodeproj/project.pbxproj

This file was deleted.

1 change: 1 addition & 0 deletions Examples/BLEChat_Central_iOS/BLE/BLE.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

@property (nonatomic,assign) id <BLEDelegate> delegate;
@property (strong, nonatomic) NSMutableArray *peripherals;
@property (strong, nonatomic) NSMutableArray *peripheralsRssi;
@property (strong, nonatomic) CBCentralManager *CM;
@property (strong, nonatomic) CBPeripheral *activePeripheral;

Expand Down
8 changes: 7 additions & 1 deletion Examples/BLEChat_Central_iOS/BLE/BLE.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ @implementation BLE
@synthesize delegate;
@synthesize CM;
@synthesize peripherals;
@synthesize peripheralsRssi;
@synthesize activePeripheral;

static bool isConnected = false;
Expand Down Expand Up @@ -179,6 +180,8 @@ - (void) controlSetup

- (int) findBLEPeripherals:(int) timeout
{
NSLog(@"start finding");

if (self.CM.state != CBCentralManagerStatePoweredOn)
{
NSLog(@"CoreBluetooth not correctly initialized !");
Expand Down Expand Up @@ -420,8 +423,10 @@ - (void)centralManagerDidUpdateState:(CBCentralManager *)central

- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
if (!self.peripherals)
if (!self.peripherals) {
self.peripherals = [[NSMutableArray alloc] initWithObjects:peripheral,nil];
self.peripheralsRssi = [[NSMutableArray alloc] initWithObjects:RSSI, nil];
}
else
{
for(int i = 0; i < self.peripherals.count; i++)
Expand All @@ -440,6 +445,7 @@ - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeri
}

[self.peripherals addObject:peripheral];
[self.peripheralsRssi addObject:RSSI];

NSLog(@"New UUID, adding");
}
Expand Down
Loading

0 comments on commit 53f8ba8

Please sign in to comment.