react-native-ble-manager 9.1.0 → 10.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ios/BleManager.m CHANGED
@@ -96,7 +96,7 @@ bool hasListeners;
96
96
  [self invokeAndClearDictionary:readCallbacks withKey:key usingParameters:@[[NSNull null], ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]]];
97
97
  } else {
98
98
  if (hasListeners) {
99
- [self sendEventWithName:@"BleManagerDidUpdateValueForCharacteristic" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic":characteristic.UUID.UUIDString, @"service":characteristic.service.UUID.UUIDString, @"value": ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]}];
99
+ [self sendEventWithName:@"BleManagerDidUpdateValueForCharacteristic" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic":characteristic.UUID.UUIDString.lowercaseString, @"service":characteristic.service.UUID.UUIDString.lowercaseString, @"value": ([characteristic.value length] > 0) ? [characteristic.value toArray] : [NSNull null]}];
100
100
  }
101
101
  }
102
102
  }
@@ -149,7 +149,7 @@ bool hasListeners;
149
149
  return;
150
150
  }
151
151
  if (hasListeners) {
152
- [self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString, @"isNotifying": @(false), @"domain": [error domain], @"code": @(error.code)}];
152
+ [self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString.lowercaseString, @"isNotifying": @(false), @"domain": [error domain], @"code": @(error.code)}];
153
153
  }
154
154
  }
155
155
 
@@ -178,7 +178,7 @@ bool hasListeners;
178
178
  }
179
179
  }
180
180
  if (hasListeners) {
181
- [self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString, @"isNotifying": @(characteristic.isNotifying)}];
181
+ [self sendEventWithName:@"BleManagerDidUpdateNotificationStateFor" body:@{@"peripheral": peripheral.uuidAsString, @"characteristic": characteristic.UUID.UUIDString.lowercaseString, @"isNotifying": @(characteristic.isNotifying)}];
182
182
  }
183
183
  }
184
184
 
@@ -253,7 +253,7 @@ bool hasListeners;
253
253
  @synchronized(peripherals) {
254
254
  for (CBPeripheral *p in peripherals) {
255
255
 
256
- NSString* other = p.identifier.UUIDString;
256
+ NSString* other = p.identifier.UUIDString.lowercaseString;
257
257
 
258
258
  if ([uuid isEqualToString:other]) {
259
259
  peripheral = p;
@@ -981,7 +981,7 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
981
981
  for(int i=0; i < service.characteristics.count; i++)
982
982
  {
983
983
  CBCharacteristic *c = [service.characteristics objectAtIndex:i];
984
- if ((c.properties & prop) != 0x0 && [c.UUID.UUIDString isEqualToString: UUID.UUIDString]) {
984
+ if ((c.properties & prop) != 0x0 && [c.UUID.UUIDString.lowercaseString isEqualToString: UUID.UUIDString.lowercaseString]) {
985
985
  NSLog(@"Found %@", UUID);
986
986
  return c;
987
987
  }
@@ -996,7 +996,7 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
996
996
  for(int i=0; i < service.characteristics.count; i++)
997
997
  {
998
998
  CBCharacteristic *c = [service.characteristics objectAtIndex:i];
999
- if ([c.UUID.UUIDString isEqualToString: UUID.UUIDString]) {
999
+ if ([c.UUID.UUIDString.lowercaseString isEqualToString: UUID.UUIDString.lowercaseString]) {
1000
1000
  NSLog(@"Found %@", UUID);
1001
1001
  return c;
1002
1002
  }
@@ -1048,10 +1048,10 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
1048
1048
  {
1049
1049
  NSString* err = [NSString stringWithFormat:@"Could not find service with UUID %@ on peripheral with UUID %@",
1050
1050
  serviceUUIDString,
1051
- peripheral.identifier.UUIDString];
1051
+ peripheral.identifier.UUIDString.lowercaseString];
1052
1052
  NSLog(@"Could not find service with UUID %@ on peripheral with UUID %@",
1053
1053
  serviceUUIDString,
1054
- peripheral.identifier.UUIDString);
1054
+ peripheral.identifier.UUIDString.lowercaseString);
1055
1055
  callback(@[err]);
1056
1056
  return nil;
1057
1057
  }
@@ -1070,11 +1070,11 @@ RCT_EXPORT_METHOD(requestMTU:(NSString *)deviceUUID mtu:(NSInteger)mtu callback:
1070
1070
 
1071
1071
  if (!characteristic)
1072
1072
  {
1073
- NSString* err = [NSString stringWithFormat:@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@", characteristicUUIDString,serviceUUIDString, peripheral.identifier.UUIDString];
1073
+ NSString* err = [NSString stringWithFormat:@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@", characteristicUUIDString,serviceUUIDString, peripheral.identifier.UUIDString.lowercaseString];
1074
1074
  NSLog(@"Could not find characteristic with UUID %@ on service with UUID %@ on peripheral with UUID %@",
1075
1075
  characteristicUUIDString,
1076
1076
  serviceUUIDString,
1077
- peripheral.identifier.UUIDString);
1077
+ peripheral.identifier.UUIDString.lowercaseString);
1078
1078
  callback(@[err]);
1079
1079
  return nil;
1080
1080
  }
@@ -8,7 +8,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
8
8
 
9
9
  -(NSString *)uuidAsString {
10
10
  if (self.identifier.UUIDString) {
11
- return self.identifier.UUIDString;
11
+ return [self.identifier.UUIDString lowercaseString];
12
12
  } else {
13
13
  return @"";
14
14
  }
@@ -18,7 +18,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
18
18
  -(NSDictionary *)asDictionary {
19
19
  NSString *uuidString = NULL;
20
20
  if (self.identifier.UUIDString) {
21
- uuidString = self.identifier.UUIDString;
21
+ uuidString = [self.identifier.UUIDString lowercaseString];
22
22
  } else {
23
23
  uuidString = @"";
24
24
  }
@@ -112,7 +112,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
112
112
 
113
113
  for (CBUUID *key in [serviceData allKeys]) {
114
114
  if ([serviceData objectForKey:key]) {
115
- [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[key UUIDString]];
115
+ [serviceData setObject:dataToArrayBuffer([serviceData objectForKey:key]) forKey:[[key UUIDString] lowercaseString]];
116
116
  [serviceData removeObjectForKey:key];
117
117
  }
118
118
  }
@@ -129,7 +129,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
129
129
  serviceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:serviceUUIDs.count];
130
130
 
131
131
  for (CBUUID *uuid in serviceUUIDs) {
132
- [serviceUUIDStrings addObject:[uuid UUIDString]];
132
+ [serviceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
133
133
  }
134
134
 
135
135
  // replace the UUID list with list of strings
@@ -145,7 +145,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
145
145
  solicitiedServiceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:solicitiedServiceUUIDs.count];
146
146
 
147
147
  for (CBUUID *uuid in solicitiedServiceUUIDs) {
148
- [solicitiedServiceUUIDStrings addObject:[uuid UUIDString]];
148
+ [solicitiedServiceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
149
149
  }
150
150
 
151
151
  // replace the UUID list with list of strings
@@ -161,7 +161,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
161
161
  overflowServiceUUIDStrings = [[NSMutableArray alloc] initWithCapacity:overflowServiceUUIDs.count];
162
162
 
163
163
  for (CBUUID *uuid in overflowServiceUUIDs) {
164
- [overflowServiceUUIDStrings addObject:[uuid UUIDString]];
164
+ [overflowServiceUUIDStrings addObject:[[uuid UUIDString] lowercaseString]];
165
165
  }
166
166
 
167
167
  // replace the UUID list with list of strings
@@ -188,11 +188,13 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
188
188
 
189
189
  // This can move into the CBPeripherial Extension
190
190
  for (CBService *service in [self services]) {
191
- [serviceList addObject:[[service UUID] UUIDString]];
191
+ NSMutableDictionary *serviceDictionary = [NSMutableDictionary new];
192
+ [serviceDictionary setObject:[[[service UUID] UUIDString] lowercaseString] forKey:@"uuid"];
193
+ [serviceList addObject:serviceDictionary];
192
194
  for (CBCharacteristic *characteristic in service.characteristics) {
193
195
  NSMutableDictionary *characteristicDictionary = [NSMutableDictionary new];
194
- [characteristicDictionary setObject:[[service UUID] UUIDString] forKey:@"service"];
195
- [characteristicDictionary setObject:[[characteristic UUID] UUIDString] forKey:@"characteristic"];
196
+ [characteristicDictionary setObject:[[[service UUID] UUIDString] lowercaseString] forKey:@"service"];
197
+ [characteristicDictionary setObject:[[[characteristic UUID] UUIDString] lowercaseString] forKey:@"characteristic"];
196
198
 
197
199
  if ([characteristic value] && [[characteristic value] length] > 0) {
198
200
  [characteristicDictionary setObject:dataToArrayBuffer([characteristic value]) forKey:@"value"];
@@ -209,7 +211,7 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
209
211
  NSMutableArray *descriptorList = [NSMutableArray new];
210
212
  for (CBDescriptor *descriptor in characteristic.descriptors) {
211
213
  NSMutableDictionary *descriptorDictionary = [NSMutableDictionary new];
212
- [descriptorDictionary setObject:[[descriptor UUID] UUIDString] forKey:@"uuid"];
214
+ [descriptorDictionary setObject:[[[descriptor UUID] UUIDString] lowercaseString] forKey:@"uuid"];
213
215
  if ([descriptor value]) { // should always have a value?
214
216
  [descriptorDictionary setObject:[descriptor value] forKey:@"value"];
215
217
  }
@@ -227,50 +229,50 @@ static char ADVERTISEMENT_RSSI_IDENTIFER;
227
229
 
228
230
  }
229
231
 
230
- -(NSArray *) decodeCharacteristicProperties: (CBCharacteristic *) characteristic {
231
- NSMutableArray *props = [NSMutableArray new];
232
+ -(NSDictionary *) decodeCharacteristicProperties: (CBCharacteristic *) characteristic {
233
+ NSMutableDictionary *props = [NSMutableDictionary new];
232
234
 
233
235
  CBCharacteristicProperties p = [characteristic properties];
234
236
 
235
237
  // NOTE: props strings need to be consistent across iOS and Android
236
238
  if ((p & CBCharacteristicPropertyBroadcast) != 0x0) {
237
- [props addObject:@"Broadcast"];
239
+ [props setValue:@"Broadcast" forKey:@"Broadcast"];
238
240
  }
239
241
 
240
242
  if ((p & CBCharacteristicPropertyRead) != 0x0) {
241
- [props addObject:@"Read"];
243
+ [props setValue:@"Read" forKey:@"Read"];
242
244
  }
243
245
 
244
246
  if ((p & CBCharacteristicPropertyWriteWithoutResponse) != 0x0) {
245
- [props addObject:@"WriteWithoutResponse"];
247
+ [props setValue:@"WriteWithoutResponse" forKey:@"WriteWithoutResponse"];
246
248
  }
247
249
 
248
250
  if ((p & CBCharacteristicPropertyWrite) != 0x0) {
249
- [props addObject:@"Write"];
251
+ [props setValue:@"Write" forKey:@"Write"];
250
252
  }
251
253
 
252
254
  if ((p & CBCharacteristicPropertyNotify) != 0x0) {
253
- [props addObject:@"Notify"];
255
+ [props setValue:@"Notify" forKey:@"Notify"];
254
256
  }
255
257
 
256
258
  if ((p & CBCharacteristicPropertyIndicate) != 0x0) {
257
- [props addObject:@"Indicate"];
259
+ [props setValue:@"Indicate" forKey:@"Indicate"];
258
260
  }
259
261
 
260
262
  if ((p & CBCharacteristicPropertyAuthenticatedSignedWrites) != 0x0) {
261
- [props addObject:@"AuthenticateSignedWrites"];
263
+ [props setValue:@"AuthenticateSignedWrites" forKey:@"AuthenticateSignedWrites"];
262
264
  }
263
265
 
264
266
  if ((p & CBCharacteristicPropertyExtendedProperties) != 0x0) {
265
- [props addObject:@"ExtendedProperties"];
267
+ [props setValue:@"ExtendedProperties" forKey:@"ExtendedProperties"];
266
268
  }
267
269
 
268
270
  if ((p & CBCharacteristicPropertyNotifyEncryptionRequired) != 0x0) {
269
- [props addObject:@"NotifyEncryptionRequired"];
271
+ [props setValue:@"NotifyEncryptionRequired" forKey:@"NotifyEncryptionRequired"];
270
272
  }
271
273
 
272
274
  if ((p & CBCharacteristicPropertyIndicateEncryptionRequired) != 0x0) {
273
- [props addObject:@"IndicateEncryptionRequired"];
275
+ [props setValue:@"IndicateEncryptionRequired" forKey:@"IndicateEncryptionRequired"];
274
276
  }
275
277
 
276
278
  return props;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ble-manager",
3
- "version": "9.1.0",
3
+ "version": "10.0.0",
4
4
  "description": "A BLE module for react native.",
5
5
  "repository": {
6
6
  "type": "git",