Skip to content

Commit a75b60a

Browse files
committed
Disable isNotDisconnected, isDisconnected and isNotConnected functions
1 parent fa96bb4 commit a75b60a

File tree

3 files changed

+6
-147
lines changed

3 files changed

+6
-147
lines changed

src/android/BluetoothLePlugin.java

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3551,66 +3551,15 @@ private boolean isNotDescriptor(BluetoothGattDescriptor descriptor, BluetoothDev
35513551
}
35523552

35533553
private boolean isNotDisconnected(HashMap<Object, Object> connection, BluetoothDevice device, CallbackContext callbackContext) {
3554-
int state = Integer.valueOf(connection.get(keyState).toString());
3555-
3556-
//Determine whether the device is currently connected including connecting and disconnecting
3557-
//Certain actions like connect and reconnect can only be done while completely disconnected
3558-
if (state == BluetoothProfile.STATE_DISCONNECTED) {
3559-
return false;
3560-
}
3561-
3562-
JSONObject returnObj = new JSONObject();
3563-
3564-
addProperty(returnObj, keyError, errorIsNotDisconnected);
3565-
addProperty(returnObj, keyMessage, logIsNotDisconnected);
3566-
3567-
addDevice(returnObj, device);
3568-
3569-
callbackContext.error(returnObj);
3570-
35713554
return true;
35723555
}
35733556

35743557
private boolean isDisconnected(HashMap<Object, Object> connection, BluetoothDevice device, CallbackContext callbackContext) {
3575-
int state = Integer.valueOf(connection.get(keyState).toString());
3576-
3577-
//Determine whether the device is currently disconnected NOT including connecting and disconnecting
3578-
//Certain actions like disconnect can be done while connected, connecting, disconnecting
3579-
if (state != BluetoothProfile.STATE_DISCONNECTED) {
3580-
return false;
3581-
}
3582-
3583-
JSONObject returnObj = new JSONObject();
3584-
3585-
addProperty(returnObj, keyError, errorIsDisconnected);
3586-
addProperty(returnObj, keyMessage, logIsDisconnected);
3587-
3588-
addDevice(returnObj, device);
3589-
3590-
callbackContext.error(returnObj);
3591-
3592-
return true;
3558+
return false;
35933559
}
35943560

35953561
private boolean isNotConnected(HashMap<Object, Object> connection, BluetoothDevice device, CallbackContext callbackContext) {
3596-
int state = Integer.valueOf(connection.get(keyState).toString());
3597-
3598-
//Determine whether the device is currently disconnected including connecting and disconnecting
3599-
//Certain actions like read/write operations can only be done while completely connected
3600-
if (state == BluetoothProfile.STATE_CONNECTED) {
3601-
return false;
3602-
}
3603-
3604-
JSONObject returnObj = new JSONObject();
3605-
3606-
addProperty(returnObj, keyError, errorIsNotConnected);
3607-
addProperty(returnObj, keyMessage, logIsNotConnected);
3608-
3609-
addDevice(returnObj, device);
3610-
3611-
callbackContext.error(returnObj);
3612-
3613-
return true;
3562+
return false;
36143563
}
36153564

36163565
private boolean wasConnected(String address, CallbackContext callbackContext) {

src/ios/BluetoothLePlugin.m

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3260,60 +3260,15 @@ - (NSMutableDictionary *) wasNeverConnected:(NSUUID *)address :(CDVInvokedUrlCom
32603260
}
32613261

32623262
- (BOOL) isNotDisconnected:(CBPeripheral *)peripheral :(CDVInvokedUrlCommand *)command {
3263-
if (peripheral.state == CBPeripheralStateDisconnected) {
3264-
return false;
3265-
}
3266-
3267-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3268-
3269-
[self addDevice:peripheral :returnObj];
3270-
3271-
[returnObj setValue:errorIsNotDisconnected forKey:keyError];
3272-
[returnObj setValue:logIsNotDisconnected forKey:keyMessage];
3273-
3274-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3275-
[pluginResult setKeepCallbackAsBool:false];
3276-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3277-
32783263
return true;
32793264
}
32803265

32813266
- (BOOL) isDisconnected:(CBPeripheral*)peripheral :(CDVInvokedUrlCommand *)command {
3282-
if (peripheral.state != CBPeripheralStateDisconnected) {
3283-
return false;
3284-
}
3285-
3286-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3287-
3288-
[self addDevice:peripheral :returnObj];
3289-
3290-
[returnObj setValue:errorIsDisconnected forKey:keyError];
3291-
[returnObj setValue:logIsDisconnected forKey:keyMessage];
3292-
3293-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3294-
[pluginResult setKeepCallbackAsBool:false];
3295-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3296-
3297-
return true;
3267+
return false;
32983268
}
32993269

33003270
- (BOOL) isNotConnected:(CBPeripheral *)peripheral :(CDVInvokedUrlCommand *)command {
3301-
if (peripheral.state == CBPeripheralStateConnected) {
3302-
return false;
3303-
}
3304-
3305-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3306-
3307-
[self addDevice:peripheral :returnObj];
3308-
3309-
[returnObj setValue:errorIsNotConnected forKey:keyError];
3310-
[returnObj setValue:logIsNotConnected forKey:keyMessage];
3311-
3312-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3313-
[pluginResult setKeepCallbackAsBool:false];
3314-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3315-
3316-
return true;
3271+
return false;
33173272
}
33183273

33193274
- (BOOL) isNotAddress:(NSUUID *)address :(CDVInvokedUrlCommand *)command {

src/osx/BluetoothLePlugin.m

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,60 +3202,15 @@ - (NSMutableDictionary *) wasNeverConnected:(NSUUID *)address :(CDVInvokedUrlCom
32023202
}
32033203

32043204
- (BOOL) isNotDisconnected:(CBPeripheral *)peripheral :(CDVInvokedUrlCommand *)command {
3205-
if (peripheral.state == CBPeripheralStateDisconnected) {
3206-
return false;
3207-
}
3208-
3209-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3210-
3211-
[self addDevice:peripheral :returnObj];
3212-
3213-
[returnObj setValue:errorIsNotDisconnected forKey:keyError];
3214-
[returnObj setValue:logIsNotDisconnected forKey:keyMessage];
3215-
3216-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3217-
[pluginResult setKeepCallbackAsBool:false];
3218-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3219-
32203205
return true;
32213206
}
32223207

32233208
- (BOOL) isDisconnected:(CBPeripheral*)peripheral :(CDVInvokedUrlCommand *)command {
3224-
if (peripheral.state != CBPeripheralStateDisconnected) {
3225-
return false;
3226-
}
3227-
3228-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3229-
3230-
[self addDevice:peripheral :returnObj];
3231-
3232-
[returnObj setValue:errorIsDisconnected forKey:keyError];
3233-
[returnObj setValue:logIsDisconnected forKey:keyMessage];
3234-
3235-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3236-
[pluginResult setKeepCallbackAsBool:false];
3237-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3238-
3239-
return true;
3209+
return false;
32403210
}
32413211

32423212
- (BOOL) isNotConnected:(CBPeripheral *)peripheral :(CDVInvokedUrlCommand *)command {
3243-
if (peripheral.state == CBPeripheralStateConnected) {
3244-
return false;
3245-
}
3246-
3247-
NSMutableDictionary* returnObj = [NSMutableDictionary dictionary];
3248-
3249-
[self addDevice:peripheral :returnObj];
3250-
3251-
[returnObj setValue:errorIsNotConnected forKey:keyError];
3252-
[returnObj setValue:logIsNotConnected forKey:keyMessage];
3253-
3254-
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:returnObj];
3255-
[pluginResult setKeepCallbackAsBool:false];
3256-
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
3257-
3258-
return true;
3213+
return false;
32593214
}
32603215

32613216
- (BOOL) isNotAddress:(NSUUID *)address :(CDVInvokedUrlCommand *)command {

0 commit comments

Comments
 (0)