Created
July 27, 2018 08:38
-
-
Save SunXiaoShan/1ef2d2133d573933c443e4aa3cfc953e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)peripheral:(CBPeripheral *)peripheral | |
didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic | |
error:(NSError *)error { | |
if (error) { | |
return; | |
} | |
if (characteristic.value == nil) { | |
return; | |
} | |
NSString *value = [[NSString alloc] initWithData:characteristic.value encoding:NSUTF8StringEncoding]; | |
if ([_delegate respondsToSelector:@selector(BLECentralComponentReceiveMessage:message:)]) { | |
__weak typeof(self) weakSelf = self; | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
[weakSelf.delegate BLECentralComponentReceiveMessage:self message:value]; | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment