Commit 00482f73 authored by Chengzhao Li's avatar Chengzhao Li
Browse files

- add more code to clean() function

parent 2586b0fb
......@@ -76,9 +76,21 @@ static NCMCBluetoothLEManager *_sharedNCMCBluetoothLEManager = nil;
self.centralService = nil;
self.peripheralService = nil;
self.session = nil;
if (self.centralManager != nil) {
[self.centralManager setDelegate:nil];
}
self.centralManager = nil;
if (self.peripheralManager != nil) {
[self.peripheralManager setDelegate:nil];
[self.peripheralManager removeAllServices];
}
self.peripheralManager = nil;
self.isDeviceReady = NO;
self.concurrentBluetoothLEDelegateQueue = nil;
self.serialDataSendingQueue = nil;
}
-(void)setupDispatchQueue
......@@ -306,6 +318,8 @@ static NCMCBluetoothLEManager *_sharedNCMCBluetoothLEManager = nil;
}
}
}
[info.peripheral setDelegate:nil];
[self.centralManager cancelPeripheralConnection:info.peripheral];
}
}
......@@ -318,9 +332,10 @@ static NCMCBluetoothLEManager *_sharedNCMCBluetoothLEManager = nil;
if (dataToSend == nil) {
dataToSend = [[NSMutableArray alloc]init];
}
NSArray *msgs = [self makeMsg:data byCapability:[info.peripheral maximumWriteValueLengthForType: CBCharacteristicWriteWithResponse]];
Boolean isReliable = ((mode == NCMCSessionSendDataReliable) ? YES : NO);
CBCharacteristicWriteType capabilityType = isReliable ? CBCharacteristicWriteWithResponse : CBCharacteristicWriteWithoutResponse;
NSArray *msgs = [self makeMsg:data byCapability:[info.peripheral maximumWriteValueLengthForType: capabilityType]];
dispatch_async(self.serialDataSendingQueue, ^{
for (NSData *msg in msgs) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment