Skip to content

Commit 17f76f2

Browse files
author
Cory Hymel
committed
Initial commit
1 parent c82822b commit 17f76f2

33 files changed

+4166
-4166
lines changed

BLEFramework/BLE/BLE.h

Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,70 @@
1-
2-
/*
3-
4-
Copyright (c) 2013 RedBearLab
5-
6-
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:
7-
8-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9-
10-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11-
12-
*/
13-
14-
#import <Foundation/Foundation.h>
15-
#if TARGET_OS_IPHONE
16-
#import <CoreBluetooth/CoreBluetooth.h>
17-
#else
18-
#import <IOBluetooth/IOBluetooth.h>
19-
#endif
20-
21-
@protocol BLEDelegate
22-
@optional
23-
-(void) bleDidConnect;
24-
-(void) bleDidDisconnect;
25-
-(void) bleDidUpdateRSSI:(NSNumber *) rssi;
26-
-(void) bleDidReceiveData:(unsigned char *) data length:(int) length;
27-
@required
28-
@end
29-
30-
@interface BLE : NSObject <CBCentralManagerDelegate, CBPeripheralDelegate> {
31-
32-
}
33-
34-
@property (nonatomic,assign) id <BLEDelegate> delegate;
35-
@property (strong, nonatomic) NSMutableArray *peripherals;
36-
@property (strong, nonatomic) CBCentralManager *CM;
37-
@property (strong, nonatomic) CBPeripheral *activePeripheral;
38-
39-
-(void) enableReadNotification:(CBPeripheral *)p;
40-
-(void) read;
41-
-(void) writeValue:(CBUUID *)serviceUUID characteristicUUID:(CBUUID *)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data;
42-
43-
-(BOOL) isConnected;
44-
-(void) write:(NSData *)d;
45-
-(void) readRSSI;
46-
47-
-(void) controlSetup;
48-
-(int) findBLEPeripherals:(int) timeout;
49-
-(void) connectPeripheral:(CBPeripheral *)peripheral;
50-
51-
-(UInt16) swap:(UInt16) s;
52-
-(const char *) centralManagerStateToString:(int)state;
53-
-(void) scanTimer:(NSTimer *)timer;
54-
-(void) printKnownPeripherals;
55-
-(void) printPeripheralInfo:(CBPeripheral*)peripheral;
56-
57-
-(void) getAllServicesFromPeripheral:(CBPeripheral *)p;
58-
-(void) getAllCharacteristicsFromPeripheral:(CBPeripheral *)p;
59-
-(CBService *) findServiceFromUUID:(CBUUID *)UUID p:(CBPeripheral *)p;
60-
-(CBCharacteristic *) findCharacteristicFromUUID:(CBUUID *)UUID service:(CBService*)service;
61-
62-
//-(NSString *) NSUUIDToString:(NSUUID *) UUID;
63-
-(NSString *) CBUUIDToString:(CBUUID *) UUID;
64-
65-
-(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2;
66-
-(int) compareCBUUIDToInt:(CBUUID *) UUID1 UUID2:(UInt16)UUID2;
67-
-(UInt16) CBUUIDToInt:(CBUUID *) UUID;
68-
-(BOOL) UUIDSAreEqual:(NSUUID *)UUID1 UUID2:(NSUUID *)UUID2;
69-
70-
@end
1+
2+
/*
3+
4+
Copyright (c) 2013 RedBearLab
5+
6+
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:
7+
8+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9+
10+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
11+
12+
*/
13+
14+
#import <Foundation/Foundation.h>
15+
#if TARGET_OS_IPHONE
16+
#import <CoreBluetooth/CoreBluetooth.h>
17+
#else
18+
#import <IOBluetooth/IOBluetooth.h>
19+
#endif
20+
21+
@protocol BLEDelegate
22+
@optional
23+
-(void) bleDidConnect;
24+
-(void) bleDidDisconnect;
25+
-(void) bleDidUpdateRSSI:(NSNumber *) rssi;
26+
-(void) bleDidReceiveData:(unsigned char *) data length:(int) length;
27+
@required
28+
@end
29+
30+
@interface BLE : NSObject <CBCentralManagerDelegate, CBPeripheralDelegate> {
31+
32+
}
33+
34+
@property (nonatomic,assign) id <BLEDelegate> delegate;
35+
@property (strong, nonatomic) NSMutableArray *peripherals;
36+
@property (strong, nonatomic) CBCentralManager *CM;
37+
@property (strong, nonatomic) CBPeripheral *activePeripheral;
38+
39+
-(void) enableReadNotification:(CBPeripheral *)p;
40+
-(void) read;
41+
-(void) writeValue:(CBUUID *)serviceUUID characteristicUUID:(CBUUID *)characteristicUUID p:(CBPeripheral *)p data:(NSData *)data;
42+
43+
-(BOOL) isConnected;
44+
-(void) write:(NSData *)d;
45+
-(void) readRSSI;
46+
47+
-(void) controlSetup;
48+
-(int) findBLEPeripherals:(int) timeout;
49+
-(void) connectPeripheral:(CBPeripheral *)peripheral;
50+
51+
-(UInt16) swap:(UInt16) s;
52+
-(const char *) centralManagerStateToString:(int)state;
53+
-(void) scanTimer:(NSTimer *)timer;
54+
-(void) printKnownPeripherals;
55+
-(void) printPeripheralInfo:(CBPeripheral*)peripheral;
56+
57+
-(void) getAllServicesFromPeripheral:(CBPeripheral *)p;
58+
-(void) getAllCharacteristicsFromPeripheral:(CBPeripheral *)p;
59+
-(CBService *) findServiceFromUUID:(CBUUID *)UUID p:(CBPeripheral *)p;
60+
-(CBCharacteristic *) findCharacteristicFromUUID:(CBUUID *)UUID service:(CBService*)service;
61+
62+
//-(NSString *) NSUUIDToString:(NSUUID *) UUID;
63+
-(NSString *) CBUUIDToString:(CBUUID *) UUID;
64+
65+
-(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2;
66+
-(int) compareCBUUIDToInt:(CBUUID *) UUID1 UUID2:(UInt16)UUID2;
67+
-(UInt16) CBUUIDToInt:(CBUUID *) UUID;
68+
-(BOOL) UUIDSAreEqual:(NSUUID *)UUID1 UUID2:(NSUUID *)UUID2;
69+
70+
@end

0 commit comments

Comments
 (0)