Skip to content

Commit

Permalink
[Fix] android: remoteId was wrong (regression in 1.29.10)
Browse files Browse the repository at this point in the history
  • Loading branch information
chipweinberger committed Nov 30, 2023
1 parent 87bd86a commit c8c9eac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class FlutterBluePlusPlugin implements
private FlutterPluginBinding pluginBinding;
private ActivityPluginBinding activityBinding;

static final private String CCCD = "00002902-0000-1000-8000-00805f9b34fb";
static final private String CCCD = "2902";

private final Map<String, BluetoothGatt> mConnectedDevices = new ConcurrentHashMap<>();
private final Map<String, BluetoothGatt> mCurrentlyConnectingDevices = new ConcurrentHashMap<>();
Expand Down Expand Up @@ -894,7 +894,7 @@ public void onMethodCall(@NonNull MethodCall call,
}

// remember the data we are writing
String key = uuidStr(remoteId) + ":" + uuidStr(serviceUuid) + ":" + uuidStr(characteristicUuid);
String key = remoteId + ":" + serviceUuid + ":" + characteristicUuid;
mWriteChr.put(key, value);

// write characteristic
Expand Down Expand Up @@ -1024,7 +1024,7 @@ public void onMethodCall(@NonNull MethodCall call,
}

// remember the data we are writing
String key = remoteId + ":" + uuidStr(serviceUuid) + ":" + uuidStr(characteristicUuid) + ":" + uuidStr(descriptorUuid);
String key = remoteId + ":" + serviceUuid + ":" + characteristicUuid + ":" + descriptorUuid;
mWriteDesc.put(key, value);

// write descriptor
Expand Down Expand Up @@ -1136,7 +1136,7 @@ public void onMethodCall(@NonNull MethodCall call,
}

// remember the data we are writing
String key = remoteId + ":" + uuidStr(serviceUuid) + ":" + uuidStr(characteristicUuid) + ":" + uuidStr(CCCD);
String key = remoteId + ":" + serviceUuid + ":" + characteristicUuid + ":" + CCCD;
mWriteDesc.put(key, bytesToHex(descriptorValue));

// write descriptor
Expand Down Expand Up @@ -2088,7 +2088,7 @@ public void onCharacteristicWrite(BluetoothGatt gatt, BluetoothGattCharacteristi
String characteristicUuid = uuidStr(characteristic.getUuid());

// what data did we write?
String key = uuidStr(remoteId) + ":" + uuidStr(serviceUuid) + ":" + uuidStr(characteristicUuid);
String key = remoteId + ":" + serviceUuid + ":" + characteristicUuid;
String value = mWriteChr.get(key) != null ? mWriteChr.get(key) : "";
mWriteChr.remove(key);

Expand Down Expand Up @@ -2148,7 +2148,7 @@ public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descri
String descriptorUuid = uuidStr(descriptor.getUuid());

// what data did we write?
String key = remoteId + ":" + uuidStr(serviceUuid) + ":" + uuidStr(characteristicUuid) + ":" + uuidStr(descriptorUuid);
String key = remoteId + ":" + serviceUuid + ":" + characteristicUuid + ":" + descriptorUuid;
String value = mWriteDesc.get(key) != null ? mWriteDesc.get(key) : "";
mWriteDesc.remove(key);

Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/FlutterBluePlusPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#define Log(LEVEL, FORMAT, ...) [self log:LEVEL format:@"[FBP-iOS] " FORMAT, ##__VA_ARGS__]

NSString * const CCCD = @"00002902-0000-1000-8000-00805f9b34fb";
NSString * const CCCD = @"2902";

@interface ServicePair : NSObject
@property (strong, nonatomic) CBService *primary;
Expand Down

0 comments on commit c8c9eac

Please sign in to comment.