Skip to content

Commit

Permalink
[Fix] Descriptor primary/secondary service support on iOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nebkat committed Nov 7, 2024
1 parent de86390 commit 153c6ba
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ios/Classes/FlutterBluePlusPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -1919,17 +1919,19 @@ - (NSDictionary *)bmBluetoothService:(CBPeripheral *)peripheral service:(CBServi
- (NSDictionary*)bmBluetoothCharacteristic:(CBPeripheral *)peripheral
characteristic:(CBCharacteristic *)characteristic
{
ServicePair *pair = [self getServicePair:peripheral characteristic:characteristic];

// descriptors
NSMutableArray *descriptors = [NSMutableArray new];
for (CBDescriptor *d in [characteristic descriptors])
{
// See: BmBluetoothDescriptor
NSDictionary* desc = @{
@"remote_id": [peripheral.identifier UUIDString],
@"service_uuid": [d.characteristic.service.UUID uuidStr],
@"service_index": d.characteristic.service.hash,
@"secondary_service_uuid": [NSNull null],
@"secondary_service_index": [NSNull null],
@"service_uuid": [pair.primary.UUID uuidStr],
@"service_index": pair.primary.hash,
@"secondary_service_uuid": pair.secondary ? [pair.secondary.UUID uuidStr] : [NSNull null],
@"secondary_service_index": pair.secondary ? pair.secondary.hash : [NSNull null],
@"characteristic_uuid": [d.characteristic.UUID uuidStr],
@"characteristic_index": d.characteristic.hash,
@"descriptor_uuid": [d.UUID uuidStr],
Expand All @@ -1938,8 +1940,6 @@ - (NSDictionary*)bmBluetoothCharacteristic:(CBPeripheral *)peripheral
[descriptors addObject:desc];
}

ServicePair *pair = [self getServicePair:peripheral characteristic:characteristic];

CBCharacteristicProperties props = characteristic.properties;

// See: BmCharacteristicProperties
Expand Down

0 comments on commit 153c6ba

Please sign in to comment.