Skip to content

Commit 50867bc

Browse files
committed
Clean up.
1 parent 06a0c6c commit 50867bc

File tree

5 files changed

+16
-37
lines changed

5 files changed

+16
-37
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
contents.xcworkspacedata
2+
Examples/BLE RGB/BLE RGB.xcodeproj/project.xcworkspace/xcuserdata
3+
xcuserdata
4+
project.xcworkspace

Examples/BLE Select/BLE/BLE.m

+3-12
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ - (int) findBLEPeripherals:(int) timeout
201201

202202
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;
203203
{
204-
done = false;
205-
206204
[[self delegate] bleDidDisconnect];
207205

208206
isConnected = false;
@@ -456,11 +454,8 @@ - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPerip
456454

457455
self.activePeripheral = peripheral;
458456
[self.activePeripheral discoverServices:nil];
459-
[self getAllServicesFromPeripheral:peripheral];
460457
}
461458

462-
static bool done = false;
463-
464459
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
465460
{
466461
if (!error)
@@ -475,13 +470,9 @@ - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForServi
475470

476471
if ([service.UUID isEqual:s.UUID])
477472
{
478-
if (!done)
479-
{
480-
[self enableReadNotification:activePeripheral];
481-
[[self delegate] bleDidConnect];
482-
isConnected = true;
483-
done = true;
484-
}
473+
[self enableReadNotification:activePeripheral];
474+
[[self delegate] bleDidConnect];
475+
isConnected = true;
485476

486477
break;
487478
}

Examples/BLEChat_Central_iOS/BLE/BLE.m

+4-13
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
/*
33
4-
Copyright (c) 2013 RedBearLab
4+
Copyright (c) 2013-2014 RedBearLab
55
66
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
77
@@ -204,8 +204,6 @@ - (int) findBLEPeripherals:(int) timeout
204204

205205
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;
206206
{
207-
done = false;
208-
209207
[[self delegate] bleDidDisconnect];
210208

211209
isConnected = false;
@@ -462,11 +460,8 @@ - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPerip
462460

463461
self.activePeripheral = peripheral;
464462
[self.activePeripheral discoverServices:nil];
465-
[self getAllServicesFromPeripheral:peripheral];
466463
}
467464

468-
static bool done = false;
469-
470465
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
471466
{
472467
if (!error)
@@ -481,13 +476,9 @@ - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForServi
481476

482477
if ([service.UUID isEqual:s.UUID])
483478
{
484-
if (!done)
485-
{
486-
[self enableReadNotification:activePeripheral];
487-
[[self delegate] bleDidConnect];
488-
isConnected = true;
489-
done = true;
490-
}
479+
[self enableReadNotification:activePeripheral];
480+
[[self delegate] bleDidConnect];
481+
isConnected = true;
491482

492483
break;
493484
}

Examples/BLEChat_Central_iOS/SimpleChat/RBLViewController.m

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ -(void) bleDidConnect
114114
[activityIndicator stopAnimating];
115115
self.navigationItem.leftBarButtonItem.enabled = YES;
116116
[self.navigationItem.leftBarButtonItem setTitle:@"Disconnect"];
117+
118+
NSLog(@"bleDidConnect");
117119
}
118120

119121
- (void)didReceiveMemoryWarning

Examples/SimpleControls_iOS/SimpleControls/BLE/BLE.m

+3-12
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,6 @@ - (int) findBLEPeripherals:(int) timeout
201201

202202
- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error;
203203
{
204-
done = false;
205-
206204
[[self delegate] bleDidDisconnect];
207205

208206
isConnected = false;
@@ -456,11 +454,8 @@ - (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPerip
456454

457455
self.activePeripheral = peripheral;
458456
[self.activePeripheral discoverServices:nil];
459-
[self getAllServicesFromPeripheral:peripheral];
460457
}
461458

462-
static bool done = false;
463-
464459
- (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error
465460
{
466461
if (!error)
@@ -475,13 +470,9 @@ - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForServi
475470

476471
if ([service.UUID isEqual:s.UUID])
477472
{
478-
if (!done)
479-
{
480-
[self enableReadNotification:activePeripheral];
481-
[[self delegate] bleDidConnect];
482-
isConnected = true;
483-
done = true;
484-
}
473+
[self enableReadNotification:activePeripheral];
474+
[[self delegate] bleDidConnect];
475+
isConnected = true;
485476

486477
break;
487478
}

0 commit comments

Comments
 (0)