CustomiOSApi 1.11
CommPortBLE.h
1//
2// CommPortBLE.h
3// CustomiOSApi
4//
5// Created by CUSTOM on 03/07/13.
6// Copyright (c) 2013 CUSTOM. All rights reserved.
7//
8
9#import "CommPort.h"
10#import <CoreBluetooth/CoreBluetooth.h>
11
12extern NSString* const CU_SERVICE_UUID;
13extern NSString* const CU_CARACHTERISTIC_UUID_TX;
14extern NSString* const CU_CARACHTERISTIC_UUID_RX;
15extern NSInteger const CU_BLE_WRITE_PACKETSIZE;
16
17//Hide it in the documentation
18// @cond PRIVATE
19@interface CommPortBLE : CommPort
20{
21@public
22
23
24
25@protected
26
27@private
28
29
30
31 enum CommPortStatus commPortStatusBLE;
32
33 NSMutableArray *iplistArrayBLE;
34 NSMutableData* dataRXBLE;
35
36 Boolean bConnected;
37 Boolean bDisconnected;
38 Boolean bDiscServices;
39 Boolean bDiscCharacteristicsForService;
40 Boolean bWriteFinish;
41 Boolean bNotification;
42 Boolean bMtuSet;
43
44 //CBCentralManager *centralManager;
45 CBPeripheralManager *peripheralManager;
46 CBPeripheral *blePeripheral;
47 CBUUID *deviceUUID;
48
49 CBCharacteristic *bleTx;
50 CBCharacteristic *bleRx;
51
52 NSString *strServiceUUID;
53 NSString *strCharacteristicTxUUID;
54 NSString *strCharacteristicRxUUID;
55 NSString *strServiceUUIDToFind;
56
57 int iWritePackSize;
58
59 int iWriteWithoutWaitSleepms;
60}
61
62//***********************************************
63// PRIVATE FUNCTIONS
64//***********************************************
65- (NSArray *) EnumBLEDevices:(NSInteger)searchTimeout :(NSString *)strBleGattServiceUUIDToFind :(NSError**)error;
66- (int) BluetoothLowEnergyConnect:(CBPeripheral *)bleperipheral :(NSInteger)iBleTxMaxSize :(NSInteger)iBleTxSleep :(NSString *)strBleGattServiceUUID :(NSString *)strGattCarTx :(NSString *)strGattCarRx :(NSError**)error;
67- (Boolean)InitBLE;
68- (void) BleConnect:(CBPeripheral *)bleperipheral :(NSInteger)iBleTxMaxSize :(NSInteger)iBleTxSleep :(NSString *)strBleGattServiceUUID :(NSString *)strGattCarTx :(NSString *)strGattCarRx :(NSError**)error;
69
70- (void) BLEDisconnect:(NSError**)error;
71- (void) BLEWrite:(NSData *)data :(NSError**)error;
72- (void) BLEWrite:(const uint8_t *)buf :(int)length :(NSError**)error;
73- (NSData *) BLERead:(NSInteger)rxBufferSize :(NSError**)error;
74
75@end