Skip to content

Commit 4636310

Browse files
moved extern strings for uuids to new LeService class, readying for pods 1.0.0
1 parent 172aa02 commit 4636310

File tree

9 files changed

+71
-36
lines changed

9 files changed

+71
-36
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ DerivedData
2020
#CocoaPods
2121
Pods
2222
Podfile.lock
23-
*.podspec

Classes/LeDataService.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,9 @@
1212

1313
#import <Foundation/Foundation.h>
1414
#import <CoreBluetooth/CoreBluetooth.h>
15+
#import "LeService.h"
1516

1617

17-
/****************************************************************************/
18-
/* Service Characteristics */
19-
/****************************************************************************/
20-
extern NSString *kDataServiceUUIDString;
21-
extern NSString *kWriteCharacteristicUUIDString;
22-
extern NSString *kReadCharacteristicUUIDString;
23-
24-
extern NSString *kDataServiceEnteredBackgroundNotification;
25-
extern NSString *kDataServiceEnteredForegroundNotification;
2618

2719
/****************************************************************************/
2820
/* Protocol */
@@ -41,8 +33,8 @@ extern NSString *kDataServiceEnteredForegroundNotification;
4133
/****************************************************************************/
4234
@interface LeDataService : NSObject
4335

44-
- (id) initWithPeripheral:(CBPeripheral *)peripheral controller:(id<LeDataProtocol>)controller;
45-
- (void) setController:(id<LeDataProtocol>)controller;
36+
- (id) initWithPeripheral:(CBPeripheral *)peripheral delegate:(id<LeDataProtocol>)delegate;
37+
- (void) setDelegate:(id<LeDataProtocol>)delegate;
4638

4739
- (void) reset;
4840
- (void) start;

Classes/LeDataService.m

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@
1313
#import "LeDataService.h"
1414
#import "LeDiscovery.h"
1515

16-
NSString *XadowPeripheralNameString = @"Xadow BLE Slave";
17-
NSString *XadowDataServiceUUIDString = @"FFF0";
18-
NSString *XadowWriteCharacteristicUUIDString = @"FFF2";
19-
NSString *XadowReadCharacteristicUUIDString = @"FFF1";
20-
21-
NSString *RedbearPeripheralNameString = @"BLE Shield";
22-
NSString *RedbearDataServiceUUIDString = @"713D0000-503E-4C75-BA94-3148F18D941E";
23-
NSString *RedbearWriteCharacteristicUUIDString = @"713D0003-503E-4C75-BA94-3148F18D941E";
24-
NSString *RedbearReadCharacteristicUUIDString = @"713D0002-503E-4C75-BA94-3148F18D941E";
25-
26-
NSString *kDataServiceEnteredBackgroundNotification = @"kDataServiceEnteredBackgroundNotification";
27-
NSString *kDataServiceEnteredForegroundNotification = @"kDataServiceEnteredForegroundNotification";
2816

2917
@interface LeDataService() <CBPeripheralDelegate> {
3018
@private
@@ -59,14 +47,14 @@ @implementation LeDataService
5947
/****************************************************************************/
6048
/* Init */
6149
/****************************************************************************/
62-
- (id) initWithPeripheral:(CBPeripheral *)peripheral controller:(id<LeDataProtocol>)controller
50+
- (id) initWithPeripheral:(CBPeripheral *)peripheral delegate:(id<LeDataProtocol>)delegate
6351
{
6452
self = [super init];
6553
if (self) {
6654

6755
servicePeripheral = peripheral;
6856
[servicePeripheral setDelegate:self];
69-
peripheralDelegate = controller;
57+
peripheralDelegate = delegate;
7058

7159
kPeripheralUUIDString = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, peripheral.UUID);
7260

@@ -115,10 +103,9 @@ - (void) reset
115103
/****************************************************************************/
116104
/* Service Interactions */
117105
/****************************************************************************/
118-
- (void) setController:(id<LeDataProtocol>)controller
106+
- (void) setDelegate:(id<LeDataProtocol>)delegate
119107
{
120-
peripheralDelegate = controller;
121-
108+
peripheralDelegate = delegate;
122109
}
123110

124111
- (void) start

Classes/LeService.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// LeService.h
3+
//
4+
//
5+
// Created by Jacob on 2/11/14.
6+
//
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
/****************************************************************************/
12+
/* Service Characteristics */
13+
/****************************************************************************/
14+
extern NSString *XadowPeripheralNameString;
15+
extern NSString *XadowDataServiceUUIDString;
16+
extern NSString *XadowWriteCharacteristicUUIDString;
17+
extern NSString *XadowReadCharacteristicUUIDString;
18+
19+
extern NSString *RedbearPeripheralNameString;
20+
extern NSString *RedbearDataServiceUUIDString;
21+
extern NSString *RedbearWriteCharacteristicUUIDString;
22+
extern NSString *RedbearReadCharacteristicUUIDString;
23+
24+
extern NSString *kDataServiceEnteredBackgroundNotification;
25+
extern NSString *kDataServiceEnteredForegroundNotification;
26+
27+
28+
@interface LeService : NSObject
29+
30+
@end

Classes/LeService.m

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// LeService.m
3+
//
4+
//
5+
// Created by Jacob on 2/11/14.
6+
//
7+
//
8+
9+
#import "LeService.h"
10+
11+
NSString *XadowPeripheralNameString = @"Xadow BLE Slave";
12+
NSString *XadowDataServiceUUIDString = @"FFF0";
13+
NSString *XadowWriteCharacteristicUUIDString = @"FFF2";
14+
NSString *XadowReadCharacteristicUUIDString = @"FFF1";
15+
16+
NSString *RedbearPeripheralNameString = @"BLE Shield";
17+
NSString *RedbearDataServiceUUIDString = @"713D0000-503E-4C75-BA94-3148F18D941E";
18+
NSString *RedbearWriteCharacteristicUUIDString = @"713D0003-503E-4C75-BA94-3148F18D941E";
19+
NSString *RedbearReadCharacteristicUUIDString = @"713D0002-503E-4C75-BA94-3148F18D941E";
20+
21+
NSString *kDataServiceEnteredBackgroundNotification = @"kDataServiceEnteredBackgroundNotification";
22+
NSString *kDataServiceEnteredForegroundNotification = @"kDataServiceEnteredForegroundNotification";
23+
24+
25+
@implementation LeService
26+
27+
@end

OpenBLE.podspec

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Pod::Spec.new do |s|
2424

2525
s.source = { :git => "https://github.com/OpenBLE/OpenBLE.git", :tag => s.version.to_s }
2626

27-
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
27+
s.source_files = 'Classes', 'Classes/**/*.{h,m}'
2828

29-
s.resources = 'Resources/**/*.storyboard'
30-
s.framework = 'CoreBluetooth'
29+
s.resources = 'Resources/**/*.storyboard'
30+
s.framework = 'CoreBluetooth'
3131

3232
s.requires_arc = true
3333

examples/OpenBle/OpenBLE/DetailViewController.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import "LeDataService.h"
1111
#import "LeDiscovery.h"
1212

13-
@interface DetailViewController : UIViewController <LeDiscoveryDelegate>
13+
@interface DetailViewController : UIViewController <LeDiscoveryDelegate, LeDataProtocol>
1414

1515
@property (weak, nonatomic) IBOutlet UITextView *response;
1616
@property (weak, nonatomic) IBOutlet UITextField *input;

examples/OpenBle/OpenBLE/DetailViewController.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ - (void) viewDidLoad
4444
ScannerViewController *rootController =(ScannerViewController*)[navController.viewControllers objectAtIndex:0];
4545

4646
//Create a new DataService with peripheral, and tell it to report to us
47-
self.currentlyDisplayingService = [[LeDataService alloc] initWithPeripheral:(CBPeripheral*)rootController.currentPeripheral controller:self];
47+
self.currentlyDisplayingService = [[LeDataService alloc] initWithPeripheral:(CBPeripheral*)rootController.currentPeripheral delegate:self];
4848

4949
//start the service
5050
[currentlyDisplayingService start];
@@ -66,7 +66,7 @@ - (void) dealloc
6666
{
6767
//nil delegates so nothing points to us
6868
[[LeDiscovery sharedInstance] setDiscoveryDelegate:nil];
69-
[currentlyDisplayingService setController:nil];
69+
[currentlyDisplayingService setDelegate:nil];
7070
}
7171

7272

examples/OpenBle/Podfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
platform :ios, '6.0'
22

3-
pod 'OpenBLE', '>= 0.1.0'
3+
pod 'OpenBLE', '>= 1.0.0'
44
pod 'TPKeyboardAvoiding'

0 commit comments

Comments
 (0)