|
|
@@ -213,7 +213,7 @@
|
|
|
|
|
|
if ([str isDigit]) {
|
|
|
int dataToWrite = [str intValue];
|
|
|
- data = [NSData dataWithBytes:&dataToWrite length:sizeof(dataToWrite)];
|
|
|
+ data = [NSData dataWithBytes:&dataToWrite length:1];
|
|
|
} else {
|
|
|
data = [str dataUsingEncoding:NSASCIIStringEncoding];
|
|
|
}
|
|
|
@@ -262,7 +262,8 @@
|
|
|
[self sendData:[self getChrInfo:kBLEChrStSSIDArg] str:ssid];
|
|
|
}
|
|
|
|
|
|
--(void)readCharacteristicUUID:(NSString *)uuid
|
|
|
+-(void)readAndNotifyCharacteristicUUID:(NSString *)uuid
|
|
|
+ isNotify:(BOOL)isNotify
|
|
|
{
|
|
|
|
|
|
for (CBService *service in _conDevice.peripheralRef.services) {
|
|
|
@@ -271,11 +272,17 @@
|
|
|
|
|
|
if ([characteristic.UUID.UUIDString isEquestToIgnoreCase:[self getGatewayDicUUIDForKey:uuid]]) {
|
|
|
|
|
|
- [_conDevice.peripheralRef readValueForCharacteristic:characteristic];
|
|
|
+ if (isNotify) {
|
|
|
+
|
|
|
+ [_conDevice.peripheralRef setNotifyValue:YES forCharacteristic:characteristic];
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ [_conDevice.peripheralRef readValueForCharacteristic:characteristic];
|
|
|
+ }
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -504,7 +511,7 @@
|
|
|
|
|
|
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error {
|
|
|
|
|
|
- NSLog(@"Incoming: [%@] %@", [self getChrName:characteristic],[self asciiStringValue:characteristic]);
|
|
|
+ NSLog(@"Incoming: [%@] %@ %@", [self getChrName:characteristic],[self asciiStringValue:characteristic], [self hexStringValue:characteristic]);
|
|
|
|
|
|
if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
|
|
|
[self getServiceUUID:kBLEChrRdConInfo]]) {
|
|
|
@@ -524,7 +531,7 @@
|
|
|
//dhcp 읽음
|
|
|
else if ([[self getStrUUID:characteristic] isEquestToIgnoreCase:
|
|
|
[self getServiceUUID:kBLEChrStDHCPArg]]) {
|
|
|
-
|
|
|
+
|
|
|
if( _delegate && [_delegate respondsToSelector:@selector(BLEWiFiDHCPRead:)] ) {
|
|
|
[_delegate BLEWiFiDHCPRead:nil];
|
|
|
}
|