├── Sample
├── Podfile
├── ReactiveCoreBluetooth
│ ├── en.lproj
│ │ ├── InfoPlist.strings
│ │ └── MainStoryboard.storyboard
│ ├── Default.png
│ ├── Default@2x.png
│ ├── Default-568h@2x.png
│ ├── AppDelegate.h
│ ├── ViewController.h
│ ├── main.m
│ ├── ReactiveCoreBluetooth-Prefix.pch
│ ├── ReactiveCoreBluetooth-Info.plist
│ ├── AppDelegate.m
│ └── ViewController.m
├── ReactiveCoreBluetooth.xcworkspace
│ └── contents.xcworkspacedata
├── ReactiveCoreBluetooth.xcodeproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── project.pbxproj
└── Podfile.lock
├── ReactiveCoreBluetooth
├── ReactiveCoreBluetooth.h
├── CacheObject.h
├── CacheObject.m
├── BluetoothLEPeripheral.h
├── BluetoothLEService.h
├── BluetoothLEPeripheral.m
└── BluetoothLEService.m
├── .gitignore
├── ReactiveCoreBluetooth.podspec
├── LICENSE
└── README.md
/Sample/Podfile:
--------------------------------------------------------------------------------
1 | platform :ios, '6.0'
2 |
3 | pod 'ReactiveCocoa'
4 |
5 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MattCBowman/ReactiveCoreBluetooth/HEAD/Sample/ReactiveCoreBluetooth/Default.png
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MattCBowman/ReactiveCoreBluetooth/HEAD/Sample/ReactiveCoreBluetooth/Default@2x.png
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/MattCBowman/ReactiveCoreBluetooth/HEAD/Sample/ReactiveCoreBluetooth/Default-568h@2x.png
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/ReactiveCoreBluetooth.h:
--------------------------------------------------------------------------------
1 | //
2 | // ReactiveCoreBluetooth.h
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Matt Bowman on 7/24/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import "BluetoothLEService.h"
10 | #import "BluetoothLEPeripheral.h"
11 | #import "CacheObject.h"
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS X
2 | .DS_Store
3 |
4 | # Xcode
5 | build/
6 | *.pbxuser
7 | !default.pbxuser
8 | *.mode1v3
9 | !default.mode1v3
10 | *.mode2v3
11 | !default.mode2v3
12 | *.perspectivev3
13 | !default.perspectivev3
14 | xcuserdata
15 | *.xccheckout
16 | profile
17 | *.moved-aside
18 | DerivedData
19 | *.hmap
20 | *.xccheckout
21 |
22 | # CocoaPods
23 | Pods
--------------------------------------------------------------------------------
/Sample/Podfile.lock:
--------------------------------------------------------------------------------
1 | PODS:
2 | - ReactiveCocoa (2.1.8):
3 | - ReactiveCocoa/Core
4 | - ReactiveCocoa/no-arc
5 | - ReactiveCocoa/Core (2.1.8):
6 | - ReactiveCocoa/no-arc
7 | - ReactiveCocoa/no-arc (2.1.8)
8 |
9 | DEPENDENCIES:
10 | - ReactiveCocoa
11 |
12 | SPEC CHECKSUMS:
13 | ReactiveCocoa: 0db710a0afa1c627a64470e5c912a3870d4854ae
14 |
15 | COCOAPODS: 0.28.0
16 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // ReactiveCoreBluetoothSampleApp
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/ViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.h
3 | // ReactiveCoreBluetoothSampleApp
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface ViewController : UIViewController
12 | @property (weak, nonatomic) IBOutlet UITableView *tableView;
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/CacheObject.h:
--------------------------------------------------------------------------------
1 | //
2 | // CacheObject.h
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CacheObject : NSObject
12 |
13 | @property (nonatomic) NSDate* expirationDate;
14 | @property (nonatomic) id object;
15 |
16 | -(id) initWithObject:(id) obj andLifespan:(NSTimeInterval)lifespan;
17 |
18 | -(BOOL)isExpired;
19 |
20 | @end
21 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/ReactiveCoreBluetooth-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'ReactiveCoreBluetoothSampleApp' target in the 'ReactiveCoreBluetooth' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_5_0
8 | #warning "This project uses features only available in iOS SDK 5.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
16 | #ifdef DEBUG
17 | #define DebugLog(...) NSLog(@"%s (%d) %@", __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__])
18 | #else
19 | #define DebugLog(...)
20 | #endif
21 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/CacheObject.m:
--------------------------------------------------------------------------------
1 | //
2 | // CacheObject.m
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import "CacheObject.h"
10 |
11 | @implementation CacheObject
12 |
13 | -(id) initWithObject:(id) obj andLifespan:(NSTimeInterval)lifespan
14 | {
15 | self = [super init];
16 |
17 | if (self)
18 | {
19 | self.expirationDate = [NSDate dateWithTimeIntervalSinceNow:lifespan];
20 | self.object = obj;
21 | }
22 |
23 | return self;
24 | }
25 |
26 | -(BOOL) isExpired
27 | {
28 | NSDate* now = [NSDate date];
29 | if ([now compare:self.expirationDate] == NSOrderedDescending)
30 | {
31 | return YES;
32 | }
33 | else
34 | {
35 | return NO;
36 | }
37 | }
38 |
39 | @end
40 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/BluetoothLEPeripheral.h:
--------------------------------------------------------------------------------
1 | //
2 | // BluetoothLEPeripheral.h
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Linlinqi on 13-11-19.
6 | // Copyright (c) 2013年 Linlinqi Studio. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class RACSubject;
13 |
14 | @interface BluetoothLEPeripheral : NSObject
15 |
16 | @property (nonatomic, strong) RACSubject* discoveredServicesSignal;
17 | @property (nonatomic, strong) RACSubject* discoveredCharacteristicsSignal;
18 | @property (nonatomic, strong) RACSubject* wroteValueSignal;
19 | @property (nonatomic, strong) RACSubject* updatedValueSignal;
20 |
21 | @property (nonatomic, strong) CBPeripheral* device;
22 |
23 | - (id)initWithPeripheral:(CBPeripheral *)peripheral;
24 | - (CBPeripheralState)state;
25 |
26 | @end
27 |
28 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 | git_tag = "0.0.5"
3 | s.name = "ReactiveCoreBluetooth"
4 | s.version = git_tag
5 | s.summary = "Reactive Extensions for CoreBluetooth."
6 | s.homepage = "https://github.com/MattCBowman/ReactiveCoreBluetooth"
7 | s.license = { :type => 'MIT', :file => 'LICENSE' }
8 | s.author = {
9 | 'Matt Bowman' => 'matt@citrrus.com',
10 | }
11 | s.source = { :git => 'https://github.com/MattCBowman/ReactiveCoreBluetooth.git', :tag => git_tag }
12 | s.platform = :ios
13 | s.ios.deployment_target = '6.0'
14 | s.source_files = 'ReactiveCoreBluetooth/*.{h,m}'
15 | s.framework = 'CoreBluetooth'
16 | s.requires_arc = true
17 | s.dependency 'ReactiveCocoa'
18 | end
19 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2013 Citrrus, LLC
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/BluetoothLEService.h:
--------------------------------------------------------------------------------
1 | //
2 | // BluetoothService.h
3 | // Bluetooth Test App
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import
12 |
13 | @interface BluetoothLEService : NSObject
14 | @property (nonatomic) RACSignal* availableDevicesSignal;
15 | @property (nonatomic) RACSignal* scanningForDevicesSignal;
16 | @property (nonatomic) RACSignal* bluetoothStateSignal;
17 | @property (nonatomic) RACSignal* peripheralConnectedSignal;
18 | @property (nonatomic) RACSignal* peripheralDisconnectedSignal;
19 |
20 | @property (nonatomic) NSTimeInterval cacheDurationForDevices;
21 | @property (nonatomic) NSTimeInterval cachePollingInterval;
22 |
23 | @property (nonatomic) BOOL connectOnDiscovery;
24 |
25 | -(void) stopScanningForDevices;
26 | -(void) scanForAvailableDevices;
27 | -(void) scanForAvailableDevicesWithServices:(NSArray *)serviceUUIDs;
28 | -(void) connectDevice:(CBPeripheral *)device;
29 | -(void) disconnectDevice:(CBPeripheral *)device;
30 |
31 | @end
32 |
33 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/ReactiveCoreBluetooth-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.citrrus.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIMainStoryboardFile
28 | MainStoryboard
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // ReactiveCoreBluetoothSampleApp
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 |
11 | @implementation AppDelegate
12 |
13 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
14 | {
15 | // Override point for customization after application launch.
16 | return YES;
17 | }
18 |
19 | - (void)applicationWillResignActive:(UIApplication *)application
20 | {
21 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
22 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
23 | }
24 |
25 | - (void)applicationDidEnterBackground:(UIApplication *)application
26 | {
27 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
28 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
29 | }
30 |
31 | - (void)applicationWillEnterForeground:(UIApplication *)application
32 | {
33 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
34 | }
35 |
36 | - (void)applicationDidBecomeActive:(UIApplication *)application
37 | {
38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
39 | }
40 |
41 | - (void)applicationWillTerminate:(UIApplication *)application
42 | {
43 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
44 | }
45 |
46 | @end
47 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/BluetoothLEPeripheral.m:
--------------------------------------------------------------------------------
1 | //
2 | // BluetoothLEPeripheral.m
3 | // ReactiveCoreBluetooth
4 | //
5 | // Created by Linlinqi on 13-11-19.
6 | // Copyright (c) 2013年 Linlinqi Studio. All rights reserved.
7 | //
8 |
9 | #import "BluetoothLEPeripheral.h"
10 | #import
11 |
12 | @interface BluetoothLEPeripheral()
13 |
14 | @end
15 |
16 | @implementation BluetoothLEPeripheral
17 |
18 | - (id)initWithPeripheral:(CBPeripheral *)peripheral {
19 | self = [super init];
20 | if (self) {
21 | peripheral.delegate = self;
22 | _device = peripheral;
23 | [self setupSignals];
24 | }
25 | return self;
26 | }
27 |
28 | - (CBPeripheralState)state {
29 | return _device.state;
30 | }
31 |
32 | - (void)setupSignals {
33 | _discoveredServicesSignal = [RACSubject subject];
34 | _discoveredCharacteristicsSignal = [RACSubject subject];
35 | _wroteValueSignal = [RACSubject subject];
36 | _updatedValueSignal = [RACSubject subject];
37 | }
38 |
39 | #pragma mark - CBperipheral delegate
40 |
41 | - (void)peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error {
42 | if (error) {
43 | [_discoveredServicesSignal sendError:error];
44 | } else {
45 | [_discoveredServicesSignal sendNext:peripheral];
46 | }
47 | }
48 |
49 | - (void)peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error {
50 | if (error) {
51 | [_discoveredCharacteristicsSignal sendError:error];
52 | } else {
53 | [_discoveredCharacteristicsSignal sendNext:service];
54 | }
55 | }
56 |
57 | - (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
58 | if (error) {
59 | [_wroteValueSignal sendError:error];
60 | } else {
61 | [_wroteValueSignal sendNext:characteristic];
62 | }
63 | }
64 |
65 | - (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
66 | if (error) {
67 | [_updatedValueSignal sendError:error];
68 | } else {
69 | [_updatedValueSignal sendNext:characteristic];
70 | }
71 | }
72 |
73 | @end
74 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/ViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // ViewController.m
3 | // ReactiveCoreBluetoothSampleApp
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import "ViewController.h"
10 | #import "ReactiveCoreBluetooth.h"
11 | #import
12 |
13 | @interface ViewController ()
14 |
15 | @property (nonatomic) NSArray* blueToothDevices;
16 | @property (nonatomic) BluetoothLEService* bluetoothService;
17 | @property (nonatomic) NSString* blueToothStatus;
18 | @end
19 |
20 | @implementation ViewController
21 |
22 | - (void)viewDidLoad
23 | {
24 | [super viewDidLoad];
25 |
26 | self.blueToothDevices = @[];
27 |
28 | self.bluetoothService = [[BluetoothLEService alloc] init];
29 |
30 | [RACObserve(self, blueToothDevices) subscribeNext:^(id x) {
31 | [self.tableView reloadData];
32 | }];
33 |
34 | [self.bluetoothService.availableDevicesSignal subscribeNext:^(NSArray* x) {
35 | self.blueToothDevices = x;
36 | }];
37 |
38 | [RACObserve(self, blueToothStatus) subscribeNext:^(id x) {
39 | [self.tableView reloadData];
40 | }];
41 |
42 | [self.bluetoothService.bluetoothStateSignal subscribeNext:^(NSNumber* x) {
43 | CBCentralManagerState state = (CBCentralManagerState)[x integerValue];
44 |
45 | switch (state)
46 | {
47 | case CBCentralManagerStatePoweredOff:
48 | self.blueToothStatus = @"Off";
49 | break;
50 | case CBCentralManagerStatePoweredOn:
51 | self.blueToothStatus = @"On";
52 | [self.bluetoothService scanForAvailableDevices];
53 | break;
54 | case CBCentralManagerStateResetting:
55 | self.blueToothStatus = @"Resetting";
56 | break;
57 | case CBCentralManagerStateUnauthorized:
58 | self.blueToothStatus = @"Unauthorized";
59 | break;
60 | case CBCentralManagerStateUnknown:
61 | self.blueToothStatus = @"Unknown";
62 | break;
63 | case CBCentralManagerStateUnsupported:
64 | self.blueToothStatus = @"Unsupported";
65 | break;
66 | default:
67 | self.blueToothStatus = @"Error: State Unknown";
68 | break;
69 | }
70 | }];
71 |
72 | [self.bluetoothService.peripheralConnectedSignal subscribeNext:^(CBPeripheral* device) {
73 | NSLog(@"Connected to %@", device.name);
74 | }];
75 |
76 | [self.bluetoothService.peripheralDisconnectedSignal subscribeNext:^(CBPeripheral* device) {
77 | NSLog(@"Disconnected from %@", device.name);
78 | }];
79 |
80 | [self.tableView reloadData];
81 | }
82 |
83 | #pragma mark - TableViewDataSource methods
84 | -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView
85 | {
86 | return 2;
87 | }
88 |
89 | -(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
90 | {
91 | if (section == 0)
92 | {
93 | return 1;
94 | }
95 | else
96 | {
97 | return [self.blueToothDevices count];
98 | }
99 | }
100 |
101 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
102 | {
103 | UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"BluetoothDeviceCell"];
104 |
105 | if (indexPath.section == 0)
106 | {
107 | cell.textLabel.text = self.blueToothStatus;
108 | cell.detailTextLabel.text = @"";
109 | }
110 | else
111 | {
112 | CBPeripheral* peripheral = [self.blueToothDevices objectAtIndex:indexPath.row];
113 |
114 | cell.textLabel.text = peripheral.name;
115 | cell.detailTextLabel.text = [NSString stringWithFormat:@"%@", peripheral.isConnected ? @"Connected" : @""];
116 | }
117 | return cell;
118 | }
119 |
120 | -(NSString*) tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
121 | {
122 | if (section == 0)
123 | {
124 | return @"Bluetooth Status";
125 | }
126 | else
127 | {
128 | return @"Bluetooth LE Devices";
129 | }
130 | }
131 |
132 | #pragma mark -
133 | -(void) refreshData:(UIRefreshControl *)refreshControl
134 | {
135 | [self.tableView reloadData];
136 | [refreshControl endRefreshing];
137 | }
138 |
139 | @end
140 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Synopsis
2 |
3 | **_NOTE:_** Apple's CoreBluetooth library, which this project uses, only supports Bluetooth LE 4.0+. We're hoping to get future updates that support other versions of Bluetooth.
4 |
5 | ReactiveCoreBluetooth is a library that wraps Apple's [CoreBluetooth](http://developer.apple.com/library/ios/#documentation/CoreBluetooth/Reference/CoreBluetooth_Framework/_index.html) framework by providing [ReactiveCocoa](https://github.com/ReactiveCocoa/ReactiveCocoa) signals instead of delegates. This library is currently a work-in-progress that provides basic Bluetooth LE device management. There is a sample app included in this repo that shows how to make use of this wrapper.
6 |
7 | ## Code Example
8 |
9 | #import "ReactiveCoreBluetooth.h"
10 |
11 | @property (nonatomic) BluetoothLEService* bluetoothLEService;
12 |
13 | -(void) viewDidLoad
14 | {
15 | self.bluetoothLEService = [[BluetoothLEService alloc] init];
16 |
17 | [bluetoothLEService.availableDevicesSignal subscribeNext:^(NSArray* devices) {
18 | for (CBPeripheral* p in devices)
19 | {
20 | NSLog(@"%@", p.name);
21 | }
22 | }];
23 |
24 | [bluetoothLEService.peripheralConnectedSignal subscribeNext:^(CBPeripheral* device) {
25 | NSLog(@"Connected to %@", device.name);
26 | }];
27 |
28 | [bluetoothLEService.peripheralDisconnectedSignal subscribeNext:^(CBPeripheral* device) {
29 | NSLog(@"Disconnected from %@", device.name);
30 | }];
31 |
32 | [bluetoothLEService.scanningForDevicesSignal subscribeNext:^(NSNumber* x) {
33 | BOOL isScanning = [x boolValue];
34 | if (isScanning)
35 | {
36 | NSLog("Scanning for devices...");
37 | }
38 | else
39 | {
40 | NSLog("Not scanning for devices.");
41 | }
42 | }];
43 |
44 | [bluetoothLEService.bluetoothStateSignal subscribeNext:^(NSNumber* x) {
45 | CBCentralManagerState state = (CBCentralManagerState)[x integerValue];
46 | NSString* status;
47 | switch (state)
48 | {
49 | case CBCentralManagerStatePoweredOff:
50 | status = @"Off";
51 | break;
52 | case CBCentralManagerStatePoweredOn:
53 | status = @"On";
54 | break;
55 | case CBCentralManagerStateResetting:
56 | status = @"Resetting";
57 | break;
58 | case CBCentralManagerStateUnauthorized:
59 | status = @"Unauthorized";
60 | break;
61 | case CBCentralManagerStateUnknown:
62 | status = @"Unknown";
63 | break;
64 | case CBCentralManagerStateUnsupported:
65 | status = @"Unsupported";
66 | break;
67 | default:
68 | status = @"Error: State Unknown";
69 | break;
70 | }
71 |
72 | NSLog(@"Bluetooth status: %@", status);
73 | }];
74 |
75 | [bluetoothLEService scanForAvailableDevices];
76 | }
77 |
78 | ## Motivation
79 |
80 | We prefer to use ReactiveCocoa signals and blocks to manage asynchronous eventing instead of delegates. If you don't like implementing delegates everywhere, this is the Bluetooth LE library for you!
81 |
82 | ## Installation
83 |
84 | Add the following line to your Podfile:
85 |
86 | pod 'ReactiveCoreBluetooth'
87 |
88 | Then run the following in the same directory as your Podfile:
89 |
90 | pod install
91 |
92 | ## API Reference
93 |
94 | ### Scanning for Devices
95 |
96 | To start scanning for devices, call `scanForAvailableDevices`. You can listen on the `scanningForDevicesSignal` to determine if the device is currently scanning. To receive notifications about when the list of available devices changes, listen on the `availableDevicesSignal`. To stop scanning for devices, call `stopScanningForDevices`.
97 |
98 | ### Device Connect and Disconnect
99 |
100 | To capture device connections, subscribe to the `peripheralConnectedSignal`. To capture device disconnections, subscribe to the `peripheralDisconnectedSignal`.
101 |
102 | ### Bluetooth Status
103 |
104 | Listen on the `bluetoothStateSignal`.
105 |
106 | ### Manually set cache settings
107 |
108 | The `cacheDurationForDevices` setting allows you to change how long to wait while trying to connect to a device. The default is 5 seconds.
109 |
110 | The `cachePollingInterval` setting allows you to change how frequently the cache is polled for expired devices. The default is 3 seconds.
111 |
112 | ### Connect on Discovery
113 |
114 | The `connectOnDiscovery` setting allows you to specify whether you want to connect to the device before it is added to the available devices signal. Some BLE devices need a connection to provide a name, while others might behave differently or cease advertising themselves once a connection is initiated.
115 |
116 | ## Contributors
117 |
118 | Matt Bowman (matt at citrrus dot com)
119 |
120 | ## License
121 |
122 | Copyright 2013 Citrrus, LLC.
123 |
124 | Licensed under the MIT license.
125 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth/en.lproj/MainStoryboard.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
30 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/ReactiveCoreBluetooth/BluetoothLEService.m:
--------------------------------------------------------------------------------
1 | //
2 | // BluetoothService.m
3 | // Bluetooth Test App
4 | //
5 | // Created by Matt Bowman on 7/23/13.
6 | // Copyright (c) 2013 Citrrus, LLC. All rights reserved.
7 | //
8 |
9 | #import "BluetoothLEService.h"
10 | #import "CacheObject.h"
11 |
12 | @interface BluetoothLEService()
13 | {
14 | RACSubject* _availableDevicesSignal;
15 | RACSubject* _scanningForDevicesSignal;
16 | RACSubject* _bluetoothStateSignal;
17 | RACSubject* _peripheralConnectedSignal;
18 | RACSubject* _peripheralDisconnectedSignal;
19 | }
20 |
21 | @property (nonatomic) CBCentralManager* cbManager;
22 | @property (atomic) NSMutableArray* pendingDevices;
23 | @property (atomic) NSMutableArray* availableDevices;
24 | @property (nonatomic) RACSignal* expireKnownDevicesSignal;
25 |
26 | @end
27 |
28 | @implementation BluetoothLEService
29 |
30 | @synthesize availableDevicesSignal = _availableDevicesSignal;
31 | @synthesize scanningForDevicesSignal = _scanningForDevicesSignal;
32 | @synthesize bluetoothStateSignal = _bluetoothStateSignal;
33 | @synthesize peripheralConnectedSignal = _peripheralConnectedSignal;
34 | @synthesize peripheralDisconnectedSignal = _peripheralDisconnectedSignal;
35 |
36 | #pragma mark -
37 | #pragma mark NSObject Lifecycle Methods
38 |
39 | -(id) init
40 | {
41 | self = [super init];
42 | if (self)
43 | {
44 | self.pendingDevices = [[NSMutableArray alloc] init];
45 | self.availableDevices = [[NSMutableArray alloc] init];
46 | self.cbManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
47 | self.cacheDurationForDevices = 5;
48 | self.cachePollingInterval = 3;
49 | self.connectOnDiscovery = YES;
50 |
51 | [self initializeSignals];
52 | }
53 |
54 | return self;
55 | }
56 |
57 | #pragma mark -
58 | #pragma mark Public Methods
59 |
60 | -(void) stopScanningForDevices
61 | {
62 | [self.cbManager stopScan];
63 | [_scanningForDevicesSignal sendNext:@(NO)];
64 | }
65 |
66 | -(void) scanForAvailableDevices
67 | {
68 | [self scanForAvailableDevicesWithServices:nil];
69 | }
70 |
71 | -(void) scanForAvailableDevicesWithServices:(NSArray *)serviceUUIDs
72 | {
73 | [_scanningForDevicesSignal sendNext:@(YES)];
74 | NSDictionary *options = @{CBCentralManagerScanOptionAllowDuplicatesKey:@(YES)};
75 | [self.cbManager scanForPeripheralsWithServices:serviceUUIDs
76 | options:options];
77 | }
78 |
79 | -(void) connectDevice:(CBPeripheral *)device {
80 | [self.cbManager connectPeripheral:device options:nil];
81 | }
82 |
83 | -(void) disconnectDevice:(CBPeripheral *)device {
84 | [self.cbManager cancelPeripheralConnection:device];
85 | }
86 |
87 | #pragma mark -
88 | #pragma mark Internal Helper Methods
89 |
90 | -(void) initializeSignals
91 | {
92 | _availableDevicesSignal = [RACSubject subject];
93 | _bluetoothStateSignal = [RACSubject subject];
94 | _scanningForDevicesSignal = [RACSubject subject];
95 | _peripheralConnectedSignal = [RACSubject subject];
96 | _peripheralDisconnectedSignal = [RACSubject subject];
97 | self.expireKnownDevicesSignal = [RACSignal interval:self.cachePollingInterval
98 | onScheduler:[RACScheduler mainThreadScheduler]];
99 |
100 | [self.expireKnownDevicesSignal subscribeNext:^(id x) {
101 | NSMutableArray *devicesToKeep = [[NSMutableArray alloc] init];
102 | BOOL devicesExpired = NO;
103 |
104 | for (CacheObject* obj in self.pendingDevices)
105 | {
106 | if (!obj.isExpired)
107 | {
108 | [devicesToKeep addObject:obj];
109 | }
110 | else
111 | {
112 | devicesExpired = YES;
113 | }
114 | }
115 |
116 | if (devicesExpired)
117 | {
118 | self.pendingDevices = devicesToKeep;
119 | }
120 |
121 | devicesToKeep = [[NSMutableArray alloc] init];
122 | BOOL devicesDisconnected = NO;
123 |
124 | for (CacheObject* obj in self.availableDevices)
125 | {
126 | CBPeripheral* p = (CBPeripheral*)obj.object;
127 | if (p.isConnected)
128 | {
129 | [devicesToKeep addObject:obj];
130 | }
131 | else
132 | {
133 | devicesDisconnected = YES;
134 | }
135 | }
136 |
137 | if (devicesDisconnected)
138 | {
139 | self.availableDevices = devicesToKeep;
140 | [_availableDevicesSignal sendNext:[self devices]];
141 | }
142 | }];
143 | }
144 |
145 | -(NSArray*) devices
146 | {
147 | NSMutableArray* devices = [[NSMutableArray alloc] init];
148 | for (CacheObject *obj in self.availableDevices)
149 | {
150 | [devices addObject:obj.object];
151 | }
152 |
153 | return [NSArray arrayWithArray:devices];
154 | }
155 |
156 | -(CacheObject*) isDeviceAvailable:(CBPeripheral*) peripheral
157 | {
158 | return [self isPeripheral:peripheral inArray:self.availableDevices];
159 | }
160 |
161 | -(CacheObject*) isDevicePendingConnection:(CBPeripheral*)peripheral
162 | {
163 | return [self isPeripheral:peripheral inArray:self.pendingDevices];
164 | }
165 |
166 | -(CacheObject *) isPeripheral:(CBPeripheral *) peripheral inArray:(NSArray *)array
167 | {
168 | for (CacheObject *obj in array)
169 | {
170 | CBPeripheral* p = (CBPeripheral*)obj.object;
171 | if (p.UUID == peripheral.UUID)
172 | {
173 | return obj;
174 | }
175 | }
176 |
177 | return nil;
178 | }
179 |
180 | #pragma mark -
181 | #pragma mark CBCentralManagerDelegate Methods
182 |
183 | -(void)centralManagerDidUpdateState:(CBCentralManager *)central
184 | {
185 | [_bluetoothStateSignal sendNext:@(central.state)];
186 | }
187 |
188 | -(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
189 | {
190 | if (peripheral)
191 | {
192 | CacheObject* pendingPeripheral = [self isDevicePendingConnection:peripheral];
193 | CacheObject* availablePeripheral = [self isDeviceAvailable:peripheral];
194 |
195 | if (!availablePeripheral)
196 | {
197 | if (pendingPeripheral)
198 | {
199 | pendingPeripheral.expirationDate = [NSDate dateWithTimeIntervalSinceNow:self.cacheDurationForDevices];
200 | }
201 | else if(self.connectOnDiscovery)
202 | {
203 | CacheObject *obj = [[CacheObject alloc] initWithObject:peripheral andLifespan:self.cacheDurationForDevices];
204 | [self.pendingDevices addObject:obj];
205 | [self.cbManager connectPeripheral:peripheral options:nil];
206 | }
207 | else
208 | {
209 | CacheObject *obj = [[CacheObject alloc] initWithObject:peripheral andLifespan:self.cacheDurationForDevices];
210 | [self.availableDevices addObject:obj];
211 | [_availableDevicesSignal sendNext:[self devices]];
212 | }
213 | }
214 | }
215 | }
216 |
217 | -(void) centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
218 | {
219 | [_peripheralConnectedSignal sendNext:peripheral];
220 | if (peripheral && peripheral.name)
221 | {
222 | CacheObject* pendingPeripheral = [self isDevicePendingConnection:peripheral];
223 | CacheObject* connectedPeripheral = [self isDeviceAvailable:peripheral];
224 |
225 | if (pendingPeripheral)
226 | {
227 | [self.pendingDevices removeObject:pendingPeripheral];
228 | }
229 |
230 | if (connectedPeripheral)
231 | {
232 | connectedPeripheral.expirationDate = [NSDate dateWithTimeIntervalSinceNow:self.cacheDurationForDevices];
233 | }
234 | else
235 | {
236 | CacheObject *obj = [[CacheObject alloc] initWithObject:peripheral andLifespan:self.cacheDurationForDevices];
237 | [self.availableDevices addObject:obj];
238 | [_availableDevicesSignal sendNext:[self devices]];
239 | }
240 | }
241 | }
242 |
243 | -(void) centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
244 | {
245 | [_peripheralDisconnectedSignal sendNext:peripheral];
246 | if (peripheral && peripheral.name)
247 | {
248 | CacheObject* pendingPeripheral = [self isDevicePendingConnection:peripheral];
249 | CacheObject* connectedPeripheral = [self isDeviceAvailable:peripheral];
250 |
251 | if (pendingPeripheral)
252 | {
253 | [self.pendingDevices removeObject:pendingPeripheral];
254 | }
255 |
256 | if (connectedPeripheral)
257 | {
258 | [self.availableDevices removeObject:connectedPeripheral];
259 | [_availableDevicesSignal sendNext:[self devices]];
260 | }
261 | }
262 | }
263 |
264 | -(void) centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
265 | {
266 | if (peripheral && peripheral.name)
267 | {
268 | CacheObject* pendingPeripheral = [self isDevicePendingConnection:peripheral];
269 | CacheObject* connectedPeripheral = [self isDeviceAvailable:peripheral];
270 |
271 | if (pendingPeripheral)
272 | {
273 | [self.pendingDevices removeObject:pendingPeripheral];
274 | }
275 |
276 | if (connectedPeripheral)
277 | {
278 | [self.availableDevices removeObject:connectedPeripheral];
279 | [_availableDevicesSignal sendNext:[self devices]];
280 | }
281 | }
282 | }
283 |
284 | @end
285 |
--------------------------------------------------------------------------------
/Sample/ReactiveCoreBluetooth.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 633DDB1517A0769E00B5C077 /* ReactiveCoreBluetooth.podspec in Resources */ = {isa = PBXBuildFile; fileRef = 633DDB1317A0769E00B5C077 /* ReactiveCoreBluetooth.podspec */; };
11 | 633DDB1617A0769E00B5C077 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = 633DDB1417A0769E00B5C077 /* README.md */; };
12 | 633DDB1817A07C3200B5C077 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = 633DDB1717A07C3200B5C077 /* LICENSE */; };
13 | 8148F971179EF6F9005A414E /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8148F970179EF6F9005A414E /* CoreBluetooth.framework */; };
14 | 8148F98917A02184005A414E /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8148F98617A02184005A414E /* AppDelegate.m */; };
15 | 8148F98A17A02184005A414E /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8148F98817A02184005A414E /* ViewController.m */; };
16 | 8148F98E17A0219E005A414E /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8148F98C17A0219E005A414E /* MainStoryboard.storyboard */; };
17 | 8148F99217A021B9005A414E /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8148F98F17A021B9005A414E /* main.m */; };
18 | 8148F99717A021E4005A414E /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8148F99417A021E4005A414E /* Default-568h@2x.png */; };
19 | 8148F99817A021E4005A414E /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 8148F99517A021E4005A414E /* Default.png */; };
20 | 8148F99917A021E4005A414E /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 8148F99617A021E4005A414E /* Default@2x.png */; };
21 | 8148F99C17A021F8005A414E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 8148F99A17A021F8005A414E /* InfoPlist.strings */; };
22 | 81900303187705D800350A0A /* BluetoothLEPeripheral.m in Sources */ = {isa = PBXBuildFile; fileRef = 819002FE187705D800350A0A /* BluetoothLEPeripheral.m */; };
23 | 81900304187705D800350A0A /* BluetoothLEService.m in Sources */ = {isa = PBXBuildFile; fileRef = 81900300187705D800350A0A /* BluetoothLEService.m */; };
24 | 81900305187705D800350A0A /* CacheObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 81900302187705D800350A0A /* CacheObject.m */; };
25 | 81F90515179EF5A600E90276 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81F90514179EF5A600E90276 /* UIKit.framework */; };
26 | 81F90517179EF5A600E90276 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81F90516179EF5A600E90276 /* Foundation.framework */; };
27 | 81F90519179EF5A600E90276 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 81F90518179EF5A600E90276 /* CoreGraphics.framework */; };
28 | 88CA746782CE43CEA1DE65BB /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 58CF7B80FA1C44E795F2D919 /* libPods.a */; };
29 | /* End PBXBuildFile section */
30 |
31 | /* Begin PBXFileReference section */
32 | 58CF7B80FA1C44E795F2D919 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
33 | 633DDB1317A0769E00B5C077 /* ReactiveCoreBluetooth.podspec */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = ReactiveCoreBluetooth.podspec; path = ../ReactiveCoreBluetooth.podspec; sourceTree = ""; };
34 | 633DDB1417A0769E00B5C077 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = README.md; path = ../README.md; sourceTree = ""; };
35 | 633DDB1717A07C3200B5C077 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../LICENSE; sourceTree = ""; };
36 | 8148F970179EF6F9005A414E /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
37 | 8148F98517A02184005A414E /* ViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewController.h; path = ReactiveCoreBluetooth/ViewController.h; sourceTree = SOURCE_ROOT; };
38 | 8148F98617A02184005A414E /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = ReactiveCoreBluetooth/AppDelegate.m; sourceTree = SOURCE_ROOT; };
39 | 8148F98717A02184005A414E /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = ReactiveCoreBluetooth/AppDelegate.h; sourceTree = SOURCE_ROOT; };
40 | 8148F98817A02184005A414E /* ViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ViewController.m; path = ReactiveCoreBluetooth/ViewController.m; sourceTree = SOURCE_ROOT; };
41 | 8148F98D17A0219E005A414E /* en */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = en; path = ReactiveCoreBluetooth/en.lproj/MainStoryboard.storyboard; sourceTree = SOURCE_ROOT; };
42 | 8148F98F17A021B9005A414E /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = ReactiveCoreBluetooth/main.m; sourceTree = SOURCE_ROOT; };
43 | 8148F99017A021B9005A414E /* ReactiveCoreBluetooth-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ReactiveCoreBluetooth-Prefix.pch"; path = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Prefix.pch"; sourceTree = SOURCE_ROOT; };
44 | 8148F99117A021B9005A414E /* ReactiveCoreBluetooth-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "ReactiveCoreBluetooth-Info.plist"; path = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Info.plist"; sourceTree = SOURCE_ROOT; };
45 | 8148F99417A021E4005A414E /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default-568h@2x.png"; path = "ReactiveCoreBluetooth/Default-568h@2x.png"; sourceTree = SOURCE_ROOT; };
46 | 8148F99517A021E4005A414E /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = ReactiveCoreBluetooth/Default.png; sourceTree = SOURCE_ROOT; };
47 | 8148F99617A021E4005A414E /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Default@2x.png"; path = "ReactiveCoreBluetooth/Default@2x.png"; sourceTree = SOURCE_ROOT; };
48 | 8148F99B17A021F8005A414E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = ReactiveCoreBluetooth/en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; };
49 | 819002FD187705D800350A0A /* BluetoothLEPeripheral.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BluetoothLEPeripheral.h; sourceTree = ""; };
50 | 819002FE187705D800350A0A /* BluetoothLEPeripheral.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BluetoothLEPeripheral.m; sourceTree = ""; };
51 | 819002FF187705D800350A0A /* BluetoothLEService.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BluetoothLEService.h; sourceTree = ""; };
52 | 81900300187705D800350A0A /* BluetoothLEService.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BluetoothLEService.m; sourceTree = ""; };
53 | 81900301187705D800350A0A /* CacheObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CacheObject.h; sourceTree = ""; };
54 | 81900302187705D800350A0A /* CacheObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CacheObject.m; sourceTree = ""; };
55 | 819003061877062500350A0A /* ReactiveCoreBluetooth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactiveCoreBluetooth.h; sourceTree = ""; };
56 | 81F90511179EF5A600E90276 /* ReactiveCoreBluetooth.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ReactiveCoreBluetooth.app; sourceTree = BUILT_PRODUCTS_DIR; };
57 | 81F90514179EF5A600E90276 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
58 | 81F90516179EF5A600E90276 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
59 | 81F90518179EF5A600E90276 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
60 | FCFEF8C442014C7F82E8EC0D /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = SOURCE_ROOT; };
61 | /* End PBXFileReference section */
62 |
63 | /* Begin PBXFrameworksBuildPhase section */
64 | 81F9050E179EF5A600E90276 /* Frameworks */ = {
65 | isa = PBXFrameworksBuildPhase;
66 | buildActionMask = 2147483647;
67 | files = (
68 | 8148F971179EF6F9005A414E /* CoreBluetooth.framework in Frameworks */,
69 | 81F90515179EF5A600E90276 /* UIKit.framework in Frameworks */,
70 | 81F90517179EF5A600E90276 /* Foundation.framework in Frameworks */,
71 | 81F90519179EF5A600E90276 /* CoreGraphics.framework in Frameworks */,
72 | 88CA746782CE43CEA1DE65BB /* libPods.a in Frameworks */,
73 | );
74 | runOnlyForDeploymentPostprocessing = 0;
75 | };
76 | /* End PBXFrameworksBuildPhase section */
77 |
78 | /* Begin PBXGroup section */
79 | 819002FC187705D800350A0A /* ReactiveCoreBluetooth */ = {
80 | isa = PBXGroup;
81 | children = (
82 | 819003061877062500350A0A /* ReactiveCoreBluetooth.h */,
83 | 819002FD187705D800350A0A /* BluetoothLEPeripheral.h */,
84 | 819002FE187705D800350A0A /* BluetoothLEPeripheral.m */,
85 | 819002FF187705D800350A0A /* BluetoothLEService.h */,
86 | 81900300187705D800350A0A /* BluetoothLEService.m */,
87 | 81900301187705D800350A0A /* CacheObject.h */,
88 | 81900302187705D800350A0A /* CacheObject.m */,
89 | );
90 | name = ReactiveCoreBluetooth;
91 | path = ../ReactiveCoreBluetooth;
92 | sourceTree = "";
93 | };
94 | 81F90508179EF5A600E90276 = {
95 | isa = PBXGroup;
96 | children = (
97 | 819002FC187705D800350A0A /* ReactiveCoreBluetooth */,
98 | 81F9051A179EF5A600E90276 /* SampleApp */,
99 | 81F90513179EF5A600E90276 /* Frameworks */,
100 | 81F90512179EF5A600E90276 /* Products */,
101 | 633DDB1317A0769E00B5C077 /* ReactiveCoreBluetooth.podspec */,
102 | 633DDB1417A0769E00B5C077 /* README.md */,
103 | 633DDB1717A07C3200B5C077 /* LICENSE */,
104 | FCFEF8C442014C7F82E8EC0D /* Pods.xcconfig */,
105 | );
106 | sourceTree = "";
107 | };
108 | 81F90512179EF5A600E90276 /* Products */ = {
109 | isa = PBXGroup;
110 | children = (
111 | 81F90511179EF5A600E90276 /* ReactiveCoreBluetooth.app */,
112 | );
113 | name = Products;
114 | sourceTree = "";
115 | };
116 | 81F90513179EF5A600E90276 /* Frameworks */ = {
117 | isa = PBXGroup;
118 | children = (
119 | 8148F970179EF6F9005A414E /* CoreBluetooth.framework */,
120 | 81F90514179EF5A600E90276 /* UIKit.framework */,
121 | 81F90516179EF5A600E90276 /* Foundation.framework */,
122 | 81F90518179EF5A600E90276 /* CoreGraphics.framework */,
123 | 58CF7B80FA1C44E795F2D919 /* libPods.a */,
124 | );
125 | name = Frameworks;
126 | sourceTree = "";
127 | };
128 | 81F9051A179EF5A600E90276 /* SampleApp */ = {
129 | isa = PBXGroup;
130 | children = (
131 | 8148F98C17A0219E005A414E /* MainStoryboard.storyboard */,
132 | 8148F98517A02184005A414E /* ViewController.h */,
133 | 8148F98817A02184005A414E /* ViewController.m */,
134 | 8148F98617A02184005A414E /* AppDelegate.m */,
135 | 8148F98717A02184005A414E /* AppDelegate.h */,
136 | 81F9051B179EF5A600E90276 /* Supporting Files */,
137 | );
138 | name = SampleApp;
139 | path = BluetoothTestApp;
140 | sourceTree = "";
141 | };
142 | 81F9051B179EF5A600E90276 /* Supporting Files */ = {
143 | isa = PBXGroup;
144 | children = (
145 | 8148F99A17A021F8005A414E /* InfoPlist.strings */,
146 | 8148F99417A021E4005A414E /* Default-568h@2x.png */,
147 | 8148F99517A021E4005A414E /* Default.png */,
148 | 8148F99617A021E4005A414E /* Default@2x.png */,
149 | 8148F98F17A021B9005A414E /* main.m */,
150 | 8148F99017A021B9005A414E /* ReactiveCoreBluetooth-Prefix.pch */,
151 | 8148F99117A021B9005A414E /* ReactiveCoreBluetooth-Info.plist */,
152 | );
153 | name = "Supporting Files";
154 | sourceTree = "";
155 | };
156 | /* End PBXGroup section */
157 |
158 | /* Begin PBXNativeTarget section */
159 | 81F90510179EF5A600E90276 /* ReactiveCoreBluetooth */ = {
160 | isa = PBXNativeTarget;
161 | buildConfigurationList = 81F90534179EF5A700E90276 /* Build configuration list for PBXNativeTarget "ReactiveCoreBluetooth" */;
162 | buildPhases = (
163 | 8E07ABEE3CF64BA98A060A7A /* Check Pods Manifest.lock */,
164 | 81F9050D179EF5A600E90276 /* Sources */,
165 | 81F9050E179EF5A600E90276 /* Frameworks */,
166 | 81F9050F179EF5A600E90276 /* Resources */,
167 | A5E922AE3AA346AE85348924 /* Copy Pods Resources */,
168 | );
169 | buildRules = (
170 | );
171 | dependencies = (
172 | );
173 | name = ReactiveCoreBluetooth;
174 | productName = BluetoothTestApp;
175 | productReference = 81F90511179EF5A600E90276 /* ReactiveCoreBluetooth.app */;
176 | productType = "com.apple.product-type.application";
177 | };
178 | /* End PBXNativeTarget section */
179 |
180 | /* Begin PBXProject section */
181 | 81F90509179EF5A600E90276 /* Project object */ = {
182 | isa = PBXProject;
183 | attributes = {
184 | LastUpgradeCheck = 0460;
185 | ORGANIZATIONNAME = "Citrrus, LLC";
186 | };
187 | buildConfigurationList = 81F9050C179EF5A600E90276 /* Build configuration list for PBXProject "ReactiveCoreBluetooth" */;
188 | compatibilityVersion = "Xcode 3.2";
189 | developmentRegion = English;
190 | hasScannedForEncodings = 0;
191 | knownRegions = (
192 | en,
193 | );
194 | mainGroup = 81F90508179EF5A600E90276;
195 | productRefGroup = 81F90512179EF5A600E90276 /* Products */;
196 | projectDirPath = "";
197 | projectRoot = "";
198 | targets = (
199 | 81F90510179EF5A600E90276 /* ReactiveCoreBluetooth */,
200 | );
201 | };
202 | /* End PBXProject section */
203 |
204 | /* Begin PBXResourcesBuildPhase section */
205 | 81F9050F179EF5A600E90276 /* Resources */ = {
206 | isa = PBXResourcesBuildPhase;
207 | buildActionMask = 2147483647;
208 | files = (
209 | 8148F98E17A0219E005A414E /* MainStoryboard.storyboard in Resources */,
210 | 8148F99717A021E4005A414E /* Default-568h@2x.png in Resources */,
211 | 8148F99817A021E4005A414E /* Default.png in Resources */,
212 | 8148F99917A021E4005A414E /* Default@2x.png in Resources */,
213 | 8148F99C17A021F8005A414E /* InfoPlist.strings in Resources */,
214 | 633DDB1517A0769E00B5C077 /* ReactiveCoreBluetooth.podspec in Resources */,
215 | 633DDB1617A0769E00B5C077 /* README.md in Resources */,
216 | 633DDB1817A07C3200B5C077 /* LICENSE in Resources */,
217 | );
218 | runOnlyForDeploymentPostprocessing = 0;
219 | };
220 | /* End PBXResourcesBuildPhase section */
221 |
222 | /* Begin PBXShellScriptBuildPhase section */
223 | 8E07ABEE3CF64BA98A060A7A /* Check Pods Manifest.lock */ = {
224 | isa = PBXShellScriptBuildPhase;
225 | buildActionMask = 2147483647;
226 | files = (
227 | );
228 | inputPaths = (
229 | );
230 | name = "Check Pods Manifest.lock";
231 | outputPaths = (
232 | );
233 | runOnlyForDeploymentPostprocessing = 0;
234 | shellPath = /bin/sh;
235 | shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n";
236 | showEnvVarsInLog = 0;
237 | };
238 | A5E922AE3AA346AE85348924 /* Copy Pods Resources */ = {
239 | isa = PBXShellScriptBuildPhase;
240 | buildActionMask = 2147483647;
241 | files = (
242 | );
243 | inputPaths = (
244 | );
245 | name = "Copy Pods Resources";
246 | outputPaths = (
247 | );
248 | runOnlyForDeploymentPostprocessing = 0;
249 | shellPath = /bin/sh;
250 | shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n";
251 | showEnvVarsInLog = 0;
252 | };
253 | /* End PBXShellScriptBuildPhase section */
254 |
255 | /* Begin PBXSourcesBuildPhase section */
256 | 81F9050D179EF5A600E90276 /* Sources */ = {
257 | isa = PBXSourcesBuildPhase;
258 | buildActionMask = 2147483647;
259 | files = (
260 | 8148F98917A02184005A414E /* AppDelegate.m in Sources */,
261 | 81900303187705D800350A0A /* BluetoothLEPeripheral.m in Sources */,
262 | 81900304187705D800350A0A /* BluetoothLEService.m in Sources */,
263 | 8148F98A17A02184005A414E /* ViewController.m in Sources */,
264 | 8148F99217A021B9005A414E /* main.m in Sources */,
265 | 81900305187705D800350A0A /* CacheObject.m in Sources */,
266 | );
267 | runOnlyForDeploymentPostprocessing = 0;
268 | };
269 | /* End PBXSourcesBuildPhase section */
270 |
271 | /* Begin PBXVariantGroup section */
272 | 8148F98C17A0219E005A414E /* MainStoryboard.storyboard */ = {
273 | isa = PBXVariantGroup;
274 | children = (
275 | 8148F98D17A0219E005A414E /* en */,
276 | );
277 | name = MainStoryboard.storyboard;
278 | sourceTree = "";
279 | };
280 | 8148F99A17A021F8005A414E /* InfoPlist.strings */ = {
281 | isa = PBXVariantGroup;
282 | children = (
283 | 8148F99B17A021F8005A414E /* en */,
284 | );
285 | name = InfoPlist.strings;
286 | sourceTree = "";
287 | };
288 | /* End PBXVariantGroup section */
289 |
290 | /* Begin XCBuildConfiguration section */
291 | 81F90532179EF5A700E90276 /* Debug */ = {
292 | isa = XCBuildConfiguration;
293 | buildSettings = {
294 | ALWAYS_SEARCH_USER_PATHS = NO;
295 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
296 | CLANG_CXX_LIBRARY = "libc++";
297 | CLANG_ENABLE_OBJC_ARC = YES;
298 | CLANG_WARN_CONSTANT_CONVERSION = YES;
299 | CLANG_WARN_EMPTY_BODY = YES;
300 | CLANG_WARN_ENUM_CONVERSION = YES;
301 | CLANG_WARN_INT_CONVERSION = YES;
302 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
303 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
304 | COPY_PHASE_STRIP = NO;
305 | GCC_C_LANGUAGE_STANDARD = gnu99;
306 | GCC_DYNAMIC_NO_PIC = NO;
307 | GCC_OPTIMIZATION_LEVEL = 0;
308 | GCC_PREPROCESSOR_DEFINITIONS = (
309 | "DEBUG=1",
310 | "$(inherited)",
311 | );
312 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
313 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
314 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
315 | GCC_WARN_UNUSED_VARIABLE = YES;
316 | HEADER_SEARCH_PATHS = ../ReactiveCoreBluetooth;
317 | "HEADER_SEARCH_PATHS[arch=*]" = "";
318 | IPHONEOS_DEPLOYMENT_TARGET = 6.1;
319 | ONLY_ACTIVE_ARCH = YES;
320 | SDKROOT = iphoneos;
321 | };
322 | name = Debug;
323 | };
324 | 81F90533179EF5A700E90276 /* Release */ = {
325 | isa = XCBuildConfiguration;
326 | buildSettings = {
327 | ALWAYS_SEARCH_USER_PATHS = NO;
328 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
329 | CLANG_CXX_LIBRARY = "libc++";
330 | CLANG_ENABLE_OBJC_ARC = YES;
331 | CLANG_WARN_CONSTANT_CONVERSION = YES;
332 | CLANG_WARN_EMPTY_BODY = YES;
333 | CLANG_WARN_ENUM_CONVERSION = YES;
334 | CLANG_WARN_INT_CONVERSION = YES;
335 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
336 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
337 | COPY_PHASE_STRIP = YES;
338 | GCC_C_LANGUAGE_STANDARD = gnu99;
339 | GCC_WARN_ABOUT_RETURN_TYPE = YES;
340 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
341 | GCC_WARN_UNUSED_VARIABLE = YES;
342 | HEADER_SEARCH_PATHS = ../ReactiveCoreBluetooth;
343 | IPHONEOS_DEPLOYMENT_TARGET = 6.1;
344 | OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
345 | SDKROOT = iphoneos;
346 | VALIDATE_PRODUCT = YES;
347 | };
348 | name = Release;
349 | };
350 | 81F90535179EF5A700E90276 /* Debug */ = {
351 | isa = XCBuildConfiguration;
352 | baseConfigurationReference = FCFEF8C442014C7F82E8EC0D /* Pods.xcconfig */;
353 | buildSettings = {
354 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
355 | GCC_PREFIX_HEADER = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Prefix.pch";
356 | INFOPLIST_FILE = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Info.plist";
357 | PRODUCT_NAME = ReactiveCoreBluetooth;
358 | WRAPPER_EXTENSION = app;
359 | };
360 | name = Debug;
361 | };
362 | 81F90536179EF5A700E90276 /* Release */ = {
363 | isa = XCBuildConfiguration;
364 | baseConfigurationReference = FCFEF8C442014C7F82E8EC0D /* Pods.xcconfig */;
365 | buildSettings = {
366 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
367 | GCC_PREFIX_HEADER = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Prefix.pch";
368 | INFOPLIST_FILE = "ReactiveCoreBluetooth/ReactiveCoreBluetooth-Info.plist";
369 | PRODUCT_NAME = ReactiveCoreBluetooth;
370 | WRAPPER_EXTENSION = app;
371 | };
372 | name = Release;
373 | };
374 | /* End XCBuildConfiguration section */
375 |
376 | /* Begin XCConfigurationList section */
377 | 81F9050C179EF5A600E90276 /* Build configuration list for PBXProject "ReactiveCoreBluetooth" */ = {
378 | isa = XCConfigurationList;
379 | buildConfigurations = (
380 | 81F90532179EF5A700E90276 /* Debug */,
381 | 81F90533179EF5A700E90276 /* Release */,
382 | );
383 | defaultConfigurationIsVisible = 0;
384 | defaultConfigurationName = Release;
385 | };
386 | 81F90534179EF5A700E90276 /* Build configuration list for PBXNativeTarget "ReactiveCoreBluetooth" */ = {
387 | isa = XCConfigurationList;
388 | buildConfigurations = (
389 | 81F90535179EF5A700E90276 /* Debug */,
390 | 81F90536179EF5A700E90276 /* Release */,
391 | );
392 | defaultConfigurationIsVisible = 0;
393 | defaultConfigurationName = Release;
394 | };
395 | /* End XCConfigurationList section */
396 | };
397 | rootObject = 81F90509179EF5A600E90276 /* Project object */;
398 | }
399 |
--------------------------------------------------------------------------------