munim-bluetooth 0.4.1 → 0.4.2
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/HybridMunimBluetooth.swift +16 -13
- package/package.json +1 -1
|
@@ -1328,17 +1328,20 @@ class HybridMunimBluetooth: HybridMunimBluetoothSpec {
|
|
|
1328
1328
|
|
|
1329
1329
|
private func hexStringToData(_ hex: String) -> Data? {
|
|
1330
1330
|
var data = Data()
|
|
1331
|
-
var hex = hex
|
|
1331
|
+
var hex = hex.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
1332
1332
|
|
|
1333
1333
|
if hex.count % 2 != 0 {
|
|
1334
1334
|
hex = "0" + hex
|
|
1335
1335
|
}
|
|
1336
1336
|
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
let
|
|
1340
|
-
let
|
|
1341
|
-
|
|
1337
|
+
var index = hex.startIndex
|
|
1338
|
+
while index < hex.endIndex {
|
|
1339
|
+
let nextIndex = hex.index(index, offsetBy: 2)
|
|
1340
|
+
guard let byte = UInt8(hex[index..<nextIndex], radix: 16) else {
|
|
1341
|
+
return nil
|
|
1342
|
+
}
|
|
1343
|
+
data.append(byte)
|
|
1344
|
+
index = nextIndex
|
|
1342
1345
|
}
|
|
1343
1346
|
|
|
1344
1347
|
return data.isEmpty ? nil : data
|
|
@@ -1525,13 +1528,13 @@ class HybridMunimBluetooth: HybridMunimBluetoothSpec {
|
|
|
1525
1528
|
advertisingData[CBAdvertisementDataLocalNameKey] = localName
|
|
1526
1529
|
}
|
|
1527
1530
|
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1531
|
+
var serviceUUIDs: [String] = []
|
|
1532
|
+
serviceUUIDs.append(contentsOf: data.incompleteServiceUUIDs16 ?? [])
|
|
1533
|
+
serviceUUIDs.append(contentsOf: data.completeServiceUUIDs16 ?? [])
|
|
1534
|
+
serviceUUIDs.append(contentsOf: data.incompleteServiceUUIDs32 ?? [])
|
|
1535
|
+
serviceUUIDs.append(contentsOf: data.completeServiceUUIDs32 ?? [])
|
|
1536
|
+
serviceUUIDs.append(contentsOf: data.incompleteServiceUUIDs128 ?? [])
|
|
1537
|
+
serviceUUIDs.append(contentsOf: data.completeServiceUUIDs128 ?? [])
|
|
1535
1538
|
|
|
1536
1539
|
if !serviceUUIDs.isEmpty {
|
|
1537
1540
|
advertisingData[CBAdvertisementDataServiceUUIDsKey] = serviceUUIDs.map { CBUUID(string: $0) }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "munim-bluetooth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"description": "A comprehensive React Native Bluetooth library for BLE central/peripheral, Android Classic Bluetooth, LE L2CAP, Apple Multipeer Connectivity, and Expo support",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|