|
|
@@ -41,11 +41,13 @@
|
|
|
#define UNZIP_SUCCESS 1
|
|
|
#define UNZIP_NO_SPACE 2
|
|
|
#define UNZIP_FILE_DAMAGE 3
|
|
|
-@interface AppDelegateBase ()
|
|
|
|
|
|
|
|
|
|
|
|
-@property (nonatomic,strong) NSDate *forgroundDate;
|
|
|
+
|
|
|
+@interface AppDelegateBase ()
|
|
|
+
|
|
|
+
|
|
|
|
|
|
@end
|
|
|
@implementation AppDelegateBase
|
|
|
@@ -600,8 +602,9 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
|
|
|
});
|
|
|
|
|
|
- AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
+
|
|
|
#ifdef SCANNER_ORDER
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
[appDelegate saveUploadTasks];
|
|
|
#endif
|
|
|
}
|
|
|
@@ -2902,6 +2905,32 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
|
{
|
|
|
|
|
|
+
|
|
|
+ // 蓝牙扫描枪
|
|
|
+
|
|
|
+
|
|
|
+ self.manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
|
|
|
+ _cbReady = false;
|
|
|
+ _nDevices = [[NSMutableArray alloc]init];
|
|
|
+ _nServices = [[NSMutableArray alloc]init];
|
|
|
+ _nCharacteristics = [[NSMutableArray alloc]init];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ self.bAutoConnect=[defaults boolForKey:@"BLE_AutoReconnect"];
|
|
|
+ self.bAppBTOn=[defaults boolForKey:@"BLE_Enable"];
|
|
|
+ if(self.bAutoConnect)
|
|
|
+ {
|
|
|
+ self.strDeviceName = [defaults valueForKey:@"BLE_Name"];
|
|
|
+ self.strDeviceUUID = [defaults valueForKey:@"BLE_UUID"];
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// [defaults removeObjectForKey:@"BLE_AutoReconnect"];
|
|
|
+
|
|
|
+
|
|
|
#ifdef SCANNER_ORDER
|
|
|
//审核时连接测试数据库
|
|
|
|
|
|
@@ -3058,7 +3087,7 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
|
|
|
|
|
|
self.recent_model = [[NSMutableDictionary alloc]init];
|
|
|
- NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+// NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
bool offline = [defaults boolForKey:@"EnableOfflineMode"] ;
|
|
|
self.offline_mode = offline;
|
|
|
// Override point for customization after application launch.
|
|
|
@@ -3845,4 +3874,399 @@ void UncaughtExceptionHandler(NSException *exception) {
|
|
|
return nil;
|
|
|
}
|
|
|
#endif
|
|
|
+
|
|
|
+#pragma mark - core bluetooth
|
|
|
+
|
|
|
+-(void) disconnectDevice
|
|
|
+{
|
|
|
+ if(self.peripheral)
|
|
|
+ [self.manager cancelPeripheralConnection:self.peripheral];
|
|
|
+
|
|
|
+ if( self.bAppBTOn ==true)
|
|
|
+ [self scanBLE];
|
|
|
+}
|
|
|
+-(void)setBLEAutoReconnect:(bool) bAutoReconnect
|
|
|
+{
|
|
|
+ self.bAutoConnect = true;
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ [defaults removeObjectForKey:@"BLE_Name"];
|
|
|
+ [defaults removeObjectForKey:@"BLE_UUID"];
|
|
|
+ [defaults removeObjectForKey:@"BLE_AutoReconnect"];
|
|
|
+ if(bAutoReconnect&&self.peripheral)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ [defaults setValue:self.peripheral.name forKey: @"BLE_Name"];
|
|
|
+ [defaults setValue:self.peripheral.identifier.UUIDString forKey: @"BLE_UUID"];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ self.strDeviceName = nil;
|
|
|
+ self.strDeviceUUID=nil;
|
|
|
+ }
|
|
|
+
|
|
|
+ [defaults setBool:bAutoReconnect forKey:@"BLE_AutoReconnect"];
|
|
|
+
|
|
|
+ [defaults synchronize];
|
|
|
+}
|
|
|
+-(void) enableBLE:(bool) bEnable
|
|
|
+{
|
|
|
+ self.bAppBTOn =bEnable;
|
|
|
+
|
|
|
+ NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
|
|
|
+ [defaults removeObjectForKey:@"BLE_Enable"];
|
|
|
+ [defaults setBool:self.bAppBTOn forKey:@"BLE_Enable"];
|
|
|
+ [defaults synchronize];
|
|
|
+ if(bEnable)
|
|
|
+ [self scanBLE];
|
|
|
+ else
|
|
|
+ [self stopScanBLE];
|
|
|
+}
|
|
|
+
|
|
|
+-(void) scanBLE
|
|
|
+{
|
|
|
+
|
|
|
+
|
|
|
+ switch (self.manager.state) {
|
|
|
+ case CBManagerStatePoweredOn:
|
|
|
+ {
|
|
|
+ [self updateLog:@"Scanning..."];
|
|
|
+
|
|
|
+ [_manager scanForPeripheralsWithServices:/*@[[CBUUID UUIDWithString:@"FFF0"]]*/nil options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @false}];
|
|
|
+// [_manager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"FFF0"]] options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @true}];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case CBManagerStatePoweredOff:
|
|
|
+ [self updateLog:@"Please turn on bluetooth。"];
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+-(void) stopScanBLE
|
|
|
+{
|
|
|
+// self.bAppBTOn = false;
|
|
|
+ [self.manager stopScan];
|
|
|
+
|
|
|
+ if(self.self.peripheral)
|
|
|
+ [self.manager cancelPeripheralConnection:self.peripheral];
|
|
|
+ self.nDevices = [NSMutableArray new];
|
|
|
+ self.peripheral = nil;
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(OnUpdateDevicesList)])){
|
|
|
+ [_eventsFeedback OnUpdateDevicesList];
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+//检查蓝牙状态
|
|
|
+- (void)centralManagerDidUpdateState:(nonnull CBCentralManager *)central {
|
|
|
+ switch (central.state) {
|
|
|
+ case CBManagerStatePoweredOn:
|
|
|
+ {
|
|
|
+ [self updateLog:@"Bluetooth on."];
|
|
|
+ self.bBTAuthorize = true;
|
|
|
+ if(self.bAppBTOn)
|
|
|
+ {
|
|
|
+ [_manager scanForPeripheralsWithServices:/*@[[CBUUID UUIDWithString:@"FFF0"]]*/nil options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @false}];
|
|
|
+ }
|
|
|
+
|
|
|
+// [_manager scanForPeripheralsWithServices:@[[CBUUID UUIDWithString:@"FFF0"]] options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @true}];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case CBManagerStatePoweredOff:
|
|
|
+ [self updateLog:@"Bluetooth off."];
|
|
|
+ self.bBTAuthorize = true;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case CBManagerStateUnauthorized:
|
|
|
+ //蓝牙未授权
|
|
|
+
|
|
|
+ // app一定未授权,蓝牙是否开启不知
|
|
|
+ [self updateLog:@"Bluetooth Unauthorized."];
|
|
|
+
|
|
|
+ self.bBTAuthorize = false;
|
|
|
+
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(onStatusChanged:)])){
|
|
|
+ [_eventsFeedback onStatusChanged:@"Unauthorized"];
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+}
|
|
|
+-(void)updateLog:(NSString*) log
|
|
|
+{
|
|
|
+// NSLog(log);
|
|
|
+//
|
|
|
+// self.strBTLog=[self.strBTLog stringByAppendingString:[log stringByAppendingString:@"\n"]];
|
|
|
+
|
|
|
+ [self addlog:log];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//查到外设后,停止扫描,连接设备
|
|
|
+-(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
|
|
|
+{
|
|
|
+// NSLog(@"didDiscoverPeripheral");
|
|
|
+
|
|
|
+ NSArray* pservice = advertisementData[@"kCBAdvDataServiceUUIDs"];
|
|
|
+ if(pservice.count<=0)
|
|
|
+ return;
|
|
|
+ if(peripheral.name.length<=0)
|
|
|
+ return;
|
|
|
+// _peripheral = peripheral;
|
|
|
+// [_manager connectPeripheral:_peripheral options:nil];
|
|
|
+// [self.manager stopScan];
|
|
|
+// [_activity stopAnimating];
|
|
|
+ BOOL replace = NO;
|
|
|
+ // Match if we have this device from before
|
|
|
+ for (int i=0; i < _nDevices.count; i++) {
|
|
|
+ CBPeripheral *p = [_nDevices objectAtIndex:i];
|
|
|
+ if ([p isEqual:peripheral]) {
|
|
|
+ [_nDevices replaceObjectAtIndex:i withObject:peripheral];
|
|
|
+ replace = YES;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!replace) {
|
|
|
+ [_nDevices addObject:peripheral];
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Found device: %@ rssi: %@, UUID: %@ advertisementData: %@ ", peripheral, RSSI, peripheral.identifier, advertisementData]];
|
|
|
+ }
|
|
|
+
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(OnUpdateDevicesList)])){
|
|
|
+ [_eventsFeedback OnUpdateDevicesList];
|
|
|
+ }
|
|
|
+
|
|
|
+ if(self.bAutoConnect&& [self.strDeviceUUID isEqualToString:peripheral.identifier.UUIDString])
|
|
|
+ {
|
|
|
+ self.peripheral = peripheral;
|
|
|
+ NSString* log = [NSString stringWithFormat:@"Reconnect to device %@ ...", peripheral.name];
|
|
|
+ [self updateLog:log];
|
|
|
+ NSLog(@"Retrying");
|
|
|
+ [self.manager connectPeripheral:peripheral options:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+// if(peripheral.identifier == self.peripheral.identifier)
|
|
|
+// {
|
|
|
+// //重新连接
|
|
|
+// [_manager connectPeripheral:_peripheral options:nil];
|
|
|
+// }
|
|
|
+
|
|
|
+ //[_bluetoothTable reloadData];
|
|
|
+}
|
|
|
+
|
|
|
+//连接外设成功,开始发现服务
|
|
|
+- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral {
|
|
|
+ NSLog(@"%@", [NSString stringWithFormat:@"成功连接 peripheral: %@ with UUID: %@",peripheral,peripheral.identifier]);
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Connect peripheral: %@ with UUID: %@",peripheral,peripheral.identifier]];
|
|
|
+ [self.peripheral setDelegate:self];
|
|
|
+ [self.peripheral discoverServices:nil];
|
|
|
+
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(onStatusChanged:)])){
|
|
|
+ [_eventsFeedback onStatusChanged:@"Connected"];
|
|
|
+ }
|
|
|
+// [self updateLog:@"扫描服务"];
|
|
|
+}
|
|
|
+//连接外设失败
|
|
|
+-(void)centralManager:(CBCentralManager *)central didFailToConnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error
|
|
|
+{
|
|
|
+ NSLog(@"%@",error);
|
|
|
+ [self updateLog:@"Failed to connect device."];
|
|
|
+}
|
|
|
+-(void)peripheralDidUpdateRSSI:(CBPeripheral *)peripheral error:(NSError *)error
|
|
|
+{
|
|
|
+ NSLog(@"%s,%@",__PRETTY_FUNCTION__,peripheral);
|
|
|
+ int rssi = abs([peripheral.RSSI intValue]);
|
|
|
+ CGFloat ci = (rssi - 49) / (10 * 4.);
|
|
|
+ NSString *length = [NSString stringWithFormat:@"Found hotpoint:%@,distence:%.1fm",_peripheral,pow(10,ci)];
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Distence:%@", length]];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//已发现服务
|
|
|
+-(void) peripheral:(CBPeripheral *)peripheral didDiscoverServices:(NSError *)error{
|
|
|
+ [self updateLog:@"Found service."];
|
|
|
+ int i=0;
|
|
|
+ for (CBService *s in peripheral.services) {
|
|
|
+ [self.nServices addObject:s];
|
|
|
+ }
|
|
|
+ for (CBService *s in peripheral.services) {
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"%d :service UUID: %@(%@)",i,s.UUID.data,s.UUID]];
|
|
|
+ i++;
|
|
|
+ [peripheral discoverCharacteristics:nil forService:s];
|
|
|
+// if ([s.UUID isEqual:[CBUUID UUIDWithString:@"FFF0"]])
|
|
|
+// {
|
|
|
+// BOOL replace = NO;
|
|
|
+// // Match if we have this device from before
|
|
|
+// for (int i=0; i < _nDevices.count; i++) {
|
|
|
+// CBPeripheral *p = [_nDevices objectAtIndex:i];
|
|
|
+// if ([p isEqual:peripheral]) {
|
|
|
+// [_nDevices replaceObjectAtIndex:i withObject:peripheral];
|
|
|
+// replace = YES;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!replace) {
|
|
|
+// [_nDevices addObject:peripheral];
|
|
|
+//// [_bluetoothTable reloadData];
|
|
|
+// }
|
|
|
+// }
|
|
|
+ }
|
|
|
+}
|
|
|
+//已搜索到Characteristics
|
|
|
+-(void) peripheral:(CBPeripheral *)peripheral didDiscoverCharacteristicsForService:(CBService *)service error:(NSError *)error{
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"service:%@ (%@)",service.UUID.data ,service.UUID]];
|
|
|
+ for (CBCharacteristic *c in service.characteristics)
|
|
|
+ {
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Characteristic UUID: %@ (%@)",c.UUID.data,c.UUID]];
|
|
|
+
|
|
|
+ if(c.properties& CBCharacteristicPropertyWrite) //写
|
|
|
+// if ([c.UUID isEqual:[CBUUID UUIDWithString:@"FFF2"]])
|
|
|
+ {
|
|
|
+
|
|
|
+ _writeCharacteristic = c;
|
|
|
+ }
|
|
|
+ if (c.properties&CBCharacteristicPropertyNotify) // 通知
|
|
|
+// if ([c.UUID isEqual:[CBUUID UUIDWithString:@"FFF1"]])
|
|
|
+ {
|
|
|
+ [_peripheral readValueForCharacteristic:c];
|
|
|
+ [_peripheral setNotifyValue:YES forCharacteristic:c];
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+- (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral *)peripheral error:(NSError *)error {
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Disconnect device:[%@]", peripheral.name]];
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(onStatusChanged:)])){
|
|
|
+ [_eventsFeedback onStatusChanged:@"Disconnected"];
|
|
|
+ }
|
|
|
+
|
|
|
+ if ([self.peripheral.identifier.UUIDString isEqualToString:peripheral.identifier.UUIDString]) {
|
|
|
+ [self updateLog:@"Retrying..."];
|
|
|
+ NSLog(@"Retrying");
|
|
|
+ [self.manager connectPeripheral:peripheral options:nil];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
|
|
|
+{
|
|
|
+ NSLog(@"didUpdateValueForCharacteristic from Characteristic %@",characteristic.UUID);
|
|
|
+ NSData * data = characteristic.value;
|
|
|
+
|
|
|
+
|
|
|
+ NSString *datastring = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
|
|
+
|
|
|
+ datastring = [datastring stringByReplacingOccurrencesOfString:@"\r" withString:@""];
|
|
|
+
|
|
|
+ NSLog(datastring);
|
|
|
+
|
|
|
+
|
|
|
+ if((_eventsFeedback!=nil)&&([_eventsFeedback respondsToSelector:@selector(onDecodedData:)])){
|
|
|
+ [_eventsFeedback onDecodedData:datastring];
|
|
|
+ }
|
|
|
+
|
|
|
+ [self addlog:datastring];
|
|
|
+
|
|
|
+// if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:@"FF02"]]) {
|
|
|
+// NSData * data = characteristic.value;
|
|
|
+// Byte * resultByte = (Byte *)[data bytes];
|
|
|
+// for(int i=0;i<[data length];i++)
|
|
|
+// printf("testByteFF02[%d] = %d\n",i,resultByte[i]);
|
|
|
+// if (resultByte[1] == 0) {
|
|
|
+// }else if (resultByte[1] == 1) {
|
|
|
+// [self updateLog:@"未知错误"];
|
|
|
+// }else if (resultByte[1] == 2) {
|
|
|
+// [self updateLog:@"鉴权失败"];
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:@"FF04"]]) {
|
|
|
+// NSData * data = characteristic.value;
|
|
|
+// Byte * resultByte = (Byte *)[data bytes];
|
|
|
+// for(int i=0;i<[data length];i++)
|
|
|
+// printf("testByteFF04[%d] = %d\n",i,resultByte[i]);}
|
|
|
+// if ([characteristic.UUID isEqual:[CBUUID UUIDWithString:@"FF05"]]) {
|
|
|
+// NSData * data = characteristic.value;
|
|
|
+// Byte * resultByte = (Byte *)[data bytes];
|
|
|
+// for(int i=0;i<[data length];i++)
|
|
|
+// printf("testByteFF05[%d] = %d\n",i,resultByte[i]);
|
|
|
+// if (resultByte[0] == 0) {
|
|
|
+// // 设备加解锁状态 0 撤防 1 设防
|
|
|
+// [self updateLog:@"当前车辆撤防状态"];
|
|
|
+// }else if (resultByte[0] == 1) {
|
|
|
+// // 设备加解锁状态 0 撤防 1 设防
|
|
|
+// [self updateLog:@"当前车辆设防状态"];
|
|
|
+// }
|
|
|
+// }
|
|
|
+}
|
|
|
+//中心读取外设实时数据
|
|
|
+- (void)peripheral:(CBPeripheral *)peripheral didUpdateNotificationStateForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
|
|
|
+ if (error) {
|
|
|
+ NSLog(@"Error changing notification state: %@", error.localizedDescription);
|
|
|
+ }
|
|
|
+ // Notification has started
|
|
|
+ if (characteristic.isNotifying) {
|
|
|
+ [peripheral readValueForCharacteristic:characteristic];
|
|
|
+ } else { // Notification has stopped
|
|
|
+ // so disconnect from the peripheral
|
|
|
+ NSLog(@"Notification stopped on %@. Disconnecting", characteristic);
|
|
|
+ [self updateLog:[NSString stringWithFormat:@"Notification stopped on %@. Disconnecting", characteristic]];
|
|
|
+ [self.manager cancelPeripheralConnection:self.peripheral];
|
|
|
+ }
|
|
|
+}
|
|
|
+//用于检测中心向外设写数据是否成功
|
|
|
+-(void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
|
|
|
+{
|
|
|
+ if (error) {
|
|
|
+ NSLog(@"=======%@",error.userInfo);
|
|
|
+
|
|
|
+
|
|
|
+ [self updateLog:[RAConvertor dict2string:error.userInfo]];
|
|
|
+ }else{
|
|
|
+ NSLog(@"发送数据成功");
|
|
|
+ [self updateLog:@"Send data."];
|
|
|
+ }
|
|
|
+ /* When a write occurs, need to set off a re-read of the local CBCharacteristic to update its value */
|
|
|
+ [peripheral readValueForCharacteristic:characteristic];
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+//
|
|
|
+////#parammark tableview
|
|
|
+//
|
|
|
+//- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
|
+// return self.nDevices.count;
|
|
|
+//}
|
|
|
+//
|
|
|
+//- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
+// static NSString *CellIdentifier = @"Cell";
|
|
|
+// // UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
|
|
|
+// UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
|
|
+// if (!cell) {
|
|
|
+// cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
|
|
|
+// }
|
|
|
+//
|
|
|
+// CBPeripheral *p=self.nDevices[indexPath.item];
|
|
|
+// NSString* name = p.name;
|
|
|
+// if(name.length==0)
|
|
|
+// name=@"NO Name";
|
|
|
+// cell.textLabel.text = name;
|
|
|
+//
|
|
|
+// return cell;
|
|
|
+//}
|
|
|
+//-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
|
|
|
+//{
|
|
|
+// CBPeripheral *p=self.nDevices[indexPath.item];
|
|
|
+//
|
|
|
+// _peripheral = p;
|
|
|
+// [_manager connectPeripheral:_peripheral options:nil];
|
|
|
+//}
|
|
|
+
|
|
|
@end
|