munim-bluetooth 0.3.26 → 0.4.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/CHANGELOG.md +16 -0
- package/README.md +476 -74
- package/android/gradle.properties +2 -2
- package/android/src/main/AndroidManifest.xml +3 -1
- package/android/src/main/cpp/cpp-adapter.cpp +4 -1
- package/android/src/main/java/com/munimbluetooth/BluetoothPermissionUtils.kt +40 -0
- package/android/src/main/java/com/munimbluetooth/HybridMunimBluetooth.kt +2116 -217
- package/android/src/main/java/com/munimbluetooth/MunimBluetoothBackgroundService.kt +591 -56
- package/app.plugin.js +155 -0
- package/ios/HybridMunimBluetooth.swift +2123 -298
- package/ios/MunimBluetoothEventEmitter.swift +68 -8
- package/lib/commonjs/index.js +272 -11
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +243 -11
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts +310 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +219 -5
- package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
- package/nitro.json +9 -3
- package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +96 -96
- package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +8 -8
- package/nitrogen/generated/android/c++/JBackgroundSessionOptions.hpp +8 -8
- package/nitrogen/generated/android/c++/JBluetoothCapabilities.hpp +105 -0
- package/nitrogen/generated/android/c++/JBluetoothPhy.hpp +61 -0
- package/nitrogen/generated/android/c++/JBluetoothPhyOption.hpp +61 -0
- package/nitrogen/generated/android/c++/JBondState.hpp +64 -0
- package/nitrogen/generated/android/c++/JDescriptorValue.hpp +69 -0
- package/nitrogen/generated/android/c++/JExtendedAdvertisingOptions.hpp +131 -0
- package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +35 -11
- package/nitrogen/generated/android/c++/JGATTDescriptor.hpp +85 -0
- package/nitrogen/generated/android/c++/JGATTService.hpp +33 -9
- package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +422 -12
- package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +29 -0
- package/nitrogen/generated/android/c++/JL2CAPChannel.hpp +66 -0
- package/nitrogen/generated/android/c++/JMultipeerDiscoveryInfoEntry.hpp +61 -0
- package/nitrogen/generated/android/c++/JMultipeerEncryptionPreference.hpp +61 -0
- package/nitrogen/generated/android/c++/JMultipeerPeer.hpp +93 -0
- package/nitrogen/generated/android/c++/JMultipeerPeerState.hpp +61 -0
- package/nitrogen/generated/android/c++/JMultipeerSessionOptions.hpp +105 -0
- package/nitrogen/generated/android/c++/JPhyStatus.hpp +62 -0
- package/nitrogen/generated/android/c++/JScanOptions.hpp +8 -8
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +19 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BackgroundSessionOptions.kt +27 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothCapabilities.kt +111 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhy.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BluetoothPhyOption.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/BondState.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/DescriptorValue.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ExtendedAdvertisingOptions.kt +111 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +25 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTDescriptor.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +23 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +138 -22
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/L2CAPChannel.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerDiscoveryInfoEntry.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerEncryptionPreference.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeer.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerPeerState.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MultipeerSessionOptions.kt +81 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/PhyStatus.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +17 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +15 -0
- package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +2 -0
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +61 -5
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +494 -49
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +42 -0
- package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +254 -0
- package/nitrogen/generated/ios/swift/BluetoothCapabilities.swift +89 -0
- package/nitrogen/generated/ios/swift/BluetoothPhy.swift +44 -0
- package/nitrogen/generated/ios/swift/BluetoothPhyOption.swift +44 -0
- package/nitrogen/generated/ios/swift/BondState.swift +48 -0
- package/nitrogen/generated/ios/swift/DescriptorValue.swift +44 -0
- package/nitrogen/generated/ios/swift/ExtendedAdvertisingOptions.swift +243 -0
- package/nitrogen/generated/ios/swift/Func_void_BluetoothCapabilities.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_BondState.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_DescriptorValue.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_L2CAPChannel.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_PhyStatus.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__string.swift +46 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_MultipeerPeer_.swift +46 -0
- package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +25 -1
- package/nitrogen/generated/ios/swift/GATTDescriptor.swift +71 -0
- package/nitrogen/generated/ios/swift/GATTService.swift +25 -1
- package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +29 -0
- package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +556 -23
- package/nitrogen/generated/ios/swift/L2CAPChannel.swift +52 -0
- package/nitrogen/generated/ios/swift/MultipeerDiscoveryInfoEntry.swift +34 -0
- package/nitrogen/generated/ios/swift/MultipeerEncryptionPreference.swift +44 -0
- package/nitrogen/generated/ios/swift/MultipeerPeer.swift +63 -0
- package/nitrogen/generated/ios/swift/MultipeerPeerState.swift +44 -0
- package/nitrogen/generated/ios/swift/MultipeerSessionOptions.swift +136 -0
- package/nitrogen/generated/ios/swift/PhyStatus.swift +34 -0
- package/nitrogen/generated/shared/c++/BluetoothCapabilities.hpp +131 -0
- package/nitrogen/generated/shared/c++/BluetoothPhy.hpp +80 -0
- package/nitrogen/generated/shared/c++/BluetoothPhyOption.hpp +80 -0
- package/nitrogen/generated/shared/c++/BondState.hpp +84 -0
- package/nitrogen/generated/shared/c++/DescriptorValue.hpp +95 -0
- package/nitrogen/generated/shared/c++/ExtendedAdvertisingOptions.hpp +138 -0
- package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +9 -3
- package/nitrogen/generated/shared/c++/GATTDescriptor.hpp +93 -0
- package/nitrogen/generated/shared/c++/GATTService.hpp +7 -2
- package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +29 -0
- package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +61 -2
- package/nitrogen/generated/shared/c++/L2CAPChannel.hpp +92 -0
- package/nitrogen/generated/shared/c++/MultipeerDiscoveryInfoEntry.hpp +87 -0
- package/nitrogen/generated/shared/c++/MultipeerEncryptionPreference.hpp +80 -0
- package/nitrogen/generated/shared/c++/MultipeerPeer.hpp +102 -0
- package/nitrogen/generated/shared/c++/MultipeerPeerState.hpp +80 -0
- package/nitrogen/generated/shared/c++/MultipeerSessionOptions.hpp +114 -0
- package/nitrogen/generated/shared/c++/PhyStatus.hpp +88 -0
- package/package.json +22 -11
- package/src/index.ts +416 -31
- package/src/specs/munim-bluetooth.nitro.ts +298 -14
|
@@ -18,13 +18,25 @@ public extension GATTService {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `GATTService`.
|
|
20
20
|
*/
|
|
21
|
-
init(uuid: String, characteristics: [GATTCharacteristic]) {
|
|
21
|
+
init(uuid: String, characteristics: [GATTCharacteristic], includedServices: [String]?) {
|
|
22
22
|
self.init(std.string(uuid), { () -> bridge.std__vector_GATTCharacteristic_ in
|
|
23
23
|
var __vector = bridge.create_std__vector_GATTCharacteristic_(characteristics.count)
|
|
24
24
|
for __item in characteristics {
|
|
25
25
|
__vector.push_back(__item)
|
|
26
26
|
}
|
|
27
27
|
return __vector
|
|
28
|
+
}(), { () -> bridge.std__optional_std__vector_std__string__ in
|
|
29
|
+
if let __unwrappedValue = includedServices {
|
|
30
|
+
return bridge.create_std__optional_std__vector_std__string__({ () -> bridge.std__vector_std__string_ in
|
|
31
|
+
var __vector = bridge.create_std__vector_std__string_(__unwrappedValue.count)
|
|
32
|
+
for __item in __unwrappedValue {
|
|
33
|
+
__vector.push_back(std.string(__item))
|
|
34
|
+
}
|
|
35
|
+
return __vector
|
|
36
|
+
}())
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
28
40
|
}())
|
|
29
41
|
}
|
|
30
42
|
|
|
@@ -37,4 +49,16 @@ public extension GATTService {
|
|
|
37
49
|
var characteristics: [GATTCharacteristic] {
|
|
38
50
|
return self.__characteristics.map({ __item in __item })
|
|
39
51
|
}
|
|
52
|
+
|
|
53
|
+
@inline(__always)
|
|
54
|
+
var includedServices: [String]? {
|
|
55
|
+
return { () -> [String]? in
|
|
56
|
+
if bridge.has_value_std__optional_std__vector_std__string__(self.__includedServices) {
|
|
57
|
+
let __unwrapped = bridge.get_std__optional_std__vector_std__string__(self.__includedServices)
|
|
58
|
+
return __unwrapped.map({ __item in String(__item) })
|
|
59
|
+
} else {
|
|
60
|
+
return nil
|
|
61
|
+
}
|
|
62
|
+
}()
|
|
63
|
+
}
|
|
40
64
|
}
|
|
@@ -18,21 +18,50 @@ public protocol HybridMunimBluetoothSpec_protocol: HybridObject {
|
|
|
18
18
|
func getAdvertisingData() throws -> Promise<AdvertisingDataTypes>
|
|
19
19
|
func stopAdvertising() throws -> Void
|
|
20
20
|
func setServices(services: [GATTService]) throws -> Void
|
|
21
|
+
func updateCharacteristicValue(serviceUUID: String, characteristicUUID: String, value: String, notify: Bool?) throws -> Promise<Void>
|
|
21
22
|
func isBluetoothEnabled() throws -> Promise<Bool>
|
|
22
23
|
func requestBluetoothPermission() throws -> Promise<Bool>
|
|
24
|
+
func getCapabilities() throws -> Promise<BluetoothCapabilities>
|
|
23
25
|
func startScan(options: ScanOptions?) throws -> Void
|
|
24
26
|
func stopScan() throws -> Void
|
|
25
27
|
func connect(deviceId: String) throws -> Promise<Void>
|
|
26
28
|
func disconnect(deviceId: String) throws -> Void
|
|
27
29
|
func discoverServices(deviceId: String) throws -> Promise<[GATTService]>
|
|
28
30
|
func readCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Promise<CharacteristicValue>
|
|
31
|
+
func readDescriptor(deviceId: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String) throws -> Promise<DescriptorValue>
|
|
29
32
|
func writeCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String, value: String, writeType: WriteType?) throws -> Promise<Void>
|
|
33
|
+
func writeDescriptor(deviceId: String, serviceUUID: String, characteristicUUID: String, descriptorUUID: String, value: String) throws -> Promise<Void>
|
|
30
34
|
func subscribeToCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
|
|
31
35
|
func unsubscribeFromCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
|
|
32
36
|
func getConnectedDevices() throws -> Promise<[String]>
|
|
33
37
|
func readRSSI(deviceId: String) throws -> Promise<Double>
|
|
38
|
+
func requestMTU(deviceId: String, mtu: Double) throws -> Promise<Double>
|
|
39
|
+
func setPreferredPhy(deviceId: String, txPhy: BluetoothPhy, rxPhy: BluetoothPhy, phyOption: BluetoothPhyOption?) throws -> Promise<Void>
|
|
40
|
+
func readPhy(deviceId: String) throws -> Promise<PhyStatus>
|
|
41
|
+
func getBondState(deviceId: String) throws -> Promise<BondState>
|
|
42
|
+
func createBond(deviceId: String) throws -> Promise<BondState>
|
|
43
|
+
func removeBond(deviceId: String) throws -> Promise<BondState>
|
|
44
|
+
func startExtendedAdvertising(options: ExtendedAdvertisingOptions) throws -> Promise<String>
|
|
45
|
+
func stopExtendedAdvertising(advertisingId: String) throws -> Void
|
|
46
|
+
func publishL2CAPChannel(encryptionRequired: Bool?) throws -> Promise<L2CAPChannel>
|
|
47
|
+
func unpublishL2CAPChannel(psm: Double) throws -> Void
|
|
48
|
+
func openL2CAPChannel(deviceId: String, psm: Double) throws -> Promise<L2CAPChannel>
|
|
49
|
+
func closeL2CAPChannel(channelId: String) throws -> Void
|
|
50
|
+
func sendL2CAPData(channelId: String, value: String) throws -> Promise<Void>
|
|
51
|
+
func startClassicScan() throws -> Void
|
|
52
|
+
func stopClassicScan() throws -> Void
|
|
53
|
+
func connectClassic(deviceId: String, serviceUUID: String?) throws -> Promise<Void>
|
|
54
|
+
func startClassicServer(serviceUUID: String?, serviceName: String?) throws -> Promise<Void>
|
|
55
|
+
func stopClassicServer(serviceUUID: String?) throws -> Void
|
|
56
|
+
func disconnectClassic(deviceId: String) throws -> Void
|
|
57
|
+
func writeClassic(deviceId: String, value: String) throws -> Promise<Void>
|
|
34
58
|
func startBackgroundSession(options: BackgroundSessionOptions) throws -> Void
|
|
35
59
|
func stopBackgroundSession() throws -> Void
|
|
60
|
+
func startMultipeerSession(options: MultipeerSessionOptions) throws -> Void
|
|
61
|
+
func stopMultipeerSession() throws -> Void
|
|
62
|
+
func inviteMultipeerPeer(peerId: String) throws -> Void
|
|
63
|
+
func getMultipeerPeers() throws -> Promise<[MultipeerPeer]>
|
|
64
|
+
func sendMultipeerMessage(value: String, peerIds: [String]?, reliable: Bool?) throws -> Promise<Void>
|
|
36
65
|
func addListener(eventName: String) throws -> Void
|
|
37
66
|
func removeListeners(count: Double) throws -> Void
|
|
38
67
|
}
|