Skip to content

Commit eca73a5

Browse files
committed
Disable disconnect error and callbacks
1 parent a75b60a commit eca73a5

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

src/android/BluetoothLePlugin.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4019,17 +4019,17 @@ public void onConnectionStateChange(BluetoothGatt gatt, int status, int newState
40194019
pluginResult.setKeepCallback(true);
40204020
callbackContext.sendPluginResult(pluginResult);
40214021
} else if (newState == BluetoothProfile.STATE_DISCONNECTED) {
4022-
//Device was disconnected
4023-
CallbackContext[] callbacks = GetCallbacks(connection);
4024-
addProperty(returnObj, keyError, errorIsDisconnected);
4025-
addProperty(returnObj, keyMessage, logIsDisconnected);
4026-
4027-
for (CallbackContext callback : callbacks) {
4028-
callback.error(returnObj);
4029-
}
4030-
4031-
returnObj.remove(keyError);
4032-
returnObj.remove(keyMessage);
4022+
// //Device was disconnected
4023+
// CallbackContext[] callbacks = GetCallbacks(connection);
4024+
// addProperty(returnObj, keyError, errorIsDisconnected);
4025+
// addProperty(returnObj, keyMessage, logIsDisconnected);
4026+
//
4027+
// for (CallbackContext callback : callbacks) {
4028+
// callback.error(returnObj);
4029+
// }
4030+
//
4031+
// returnObj.remove(keyError);
4032+
// returnObj.remove(keyMessage);
40334033

40344034
//Save the old discovered state
40354035
Object discoveredState = connection.get(keyDiscoveredState);

src/ios/BluetoothLePlugin.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,18 +2232,18 @@ - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPe
22322232
return;
22332233
}
22342234

2235-
NSArray* callbacks = [self getCallbacks:connection];
2236-
for (NSString* callback in callbacks) {
2237-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
2238-
2239-
[self addDevice:peripheral :returnObj];
2240-
[returnObj setValue:errorIsDisconnected forKey:keyError];
2241-
[returnObj setValue:logIsDisconnected forKey:keyMessage];
2242-
2243-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
2244-
[pluginResult setKeepCallbackAsBool:false];
2245-
[self.commandDelegate sendPluginResult:pluginResult callbackId:callback];
2246-
}
2235+
// NSArray* callbacks = [self getCallbacks:connection];
2236+
// for (NSString* callback in callbacks) {
2237+
// NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
2238+
//
2239+
// [self addDevice:peripheral :returnObj];
2240+
// [returnObj setValue:errorIsDisconnected forKey:keyError];
2241+
// [returnObj setValue:logIsDisconnected forKey:keyMessage];
2242+
//
2243+
// CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
2244+
// [pluginResult setKeepCallbackAsBool:false];
2245+
// [self.commandDelegate sendPluginResult:pluginResult callbackId:callback];
2246+
// }
22472247

22482248
//Get connect callback
22492249
NSString* callback = [connection objectForKey:operationConnect];

src/osx/BluetoothLePlugin.m

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2242,18 +2242,18 @@ - (void)centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPe
22422242
return;
22432243
}
22442244

2245-
NSArray* callbacks = [self getCallbacks:connection];
2246-
for (NSString* callback in callbacks) {
2247-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
2248-
2249-
[self addDevice:peripheral :returnObj];
2250-
[returnObj setValue:errorIsDisconnected forKey:keyError];
2251-
[returnObj setValue:logIsDisconnected forKey:keyMessage];
2252-
2253-
CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
2254-
[pluginResult setKeepCallbackAsBool:false];
2255-
[self.commandDelegate sendPluginResult:pluginResult callbackId:callback];
2256-
}
2245+
// NSArray* callbacks = [self getCallbacks:connection];
2246+
// for (NSString* callback in callbacks) {
2247+
// NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
2248+
//
2249+
// [self addDevice:peripheral :returnObj];
2250+
// [returnObj setValue:errorIsDisconnected forKey:keyError];
2251+
// [returnObj setValue:logIsDisconnected forKey:keyMessage];
2252+
//
2253+
// CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
2254+
// [pluginResult setKeepCallbackAsBool:false];
2255+
// [self.commandDelegate sendPluginResult:pluginResult callbackId:callback];
2256+
// }
22572257

22582258
//Get connect callback
22592259
NSString* callback = [connection objectForKey:operationConnect];

0 commit comments

Comments
 (0)