munim-bluetooth 0.2.8 → 0.3.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.
Files changed (70) hide show
  1. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +24 -25
  2. package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
  3. package/nitrogen/generated/.gitattributes +1 -0
  4. package/nitrogen/generated/android/MunimBluetooth+autolinking.cmake +81 -0
  5. package/nitrogen/generated/android/MunimBluetooth+autolinking.gradle +27 -0
  6. package/nitrogen/generated/android/MunimBluetoothOnLoad.cpp +44 -0
  7. package/nitrogen/generated/android/MunimBluetoothOnLoad.hpp +25 -0
  8. package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +345 -0
  9. package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +93 -0
  10. package/nitrogen/generated/android/c++/JCharacteristicValue.hpp +65 -0
  11. package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +85 -0
  12. package/nitrogen/generated/android/c++/JGATTService.hpp +83 -0
  13. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +307 -0
  14. package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +85 -0
  15. package/nitrogen/generated/android/c++/JScanMode.hpp +61 -0
  16. package/nitrogen/generated/android/c++/JScanOptions.hpp +87 -0
  17. package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +61 -0
  18. package/nitrogen/generated/android/c++/JWriteType.hpp +58 -0
  19. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +89 -0
  20. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +47 -0
  21. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +44 -0
  22. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +44 -0
  23. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +41 -0
  24. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +134 -0
  25. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MunimBluetoothOnLoad.kt +35 -0
  26. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanMode.kt +24 -0
  27. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +44 -0
  28. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +41 -0
  29. package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/WriteType.kt +23 -0
  30. package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +60 -0
  31. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +97 -0
  32. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +583 -0
  33. package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +74 -0
  34. package/nitrogen/generated/ios/MunimBluetoothAutolinking.mm +33 -0
  35. package/nitrogen/generated/ios/MunimBluetoothAutolinking.swift +44 -0
  36. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.cpp +11 -0
  37. package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +241 -0
  38. package/nitrogen/generated/ios/swift/AdvertisingDataTypes.swift +400 -0
  39. package/nitrogen/generated/ios/swift/AdvertisingOptions.swift +83 -0
  40. package/nitrogen/generated/ios/swift/CharacteristicValue.swift +40 -0
  41. package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
  42. package/nitrogen/generated/ios/swift/Func_void_AdvertisingDataTypes.swift +47 -0
  43. package/nitrogen/generated/ios/swift/Func_void_CharacteristicValue.swift +47 -0
  44. package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
  45. package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
  46. package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
  47. package/nitrogen/generated/ios/swift/Func_void_std__vector_GATTService_.swift +47 -0
  48. package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
  49. package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +59 -0
  50. package/nitrogen/generated/ios/swift/GATTService.swift +41 -0
  51. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +75 -0
  52. package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +431 -0
  53. package/nitrogen/generated/ios/swift/ScanMode.swift +44 -0
  54. package/nitrogen/generated/ios/swift/ScanOptions.swift +78 -0
  55. package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +35 -0
  56. package/nitrogen/generated/ios/swift/WriteType.swift +40 -0
  57. package/nitrogen/generated/shared/c++/AdvertisingDataTypes.hpp +155 -0
  58. package/nitrogen/generated/shared/c++/AdvertisingOptions.hpp +99 -0
  59. package/nitrogen/generated/shared/c++/CharacteristicValue.hpp +91 -0
  60. package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +93 -0
  61. package/nitrogen/generated/shared/c++/GATTService.hpp +90 -0
  62. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +40 -0
  63. package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +101 -0
  64. package/nitrogen/generated/shared/c++/ScanMode.hpp +80 -0
  65. package/nitrogen/generated/shared/c++/ScanOptions.hpp +95 -0
  66. package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +87 -0
  67. package/nitrogen/generated/shared/c++/WriteType.hpp +76 -0
  68. package/package.json +9 -9
  69. package/src/specs/munim-bluetooth.nitro.ts +34 -25
  70. package/lib/module/package.json +0 -1
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_bool.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: Bool) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_bool {
16
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ private let closure: (_ value: Bool) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: Bool) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: Bool) -> Void {
26
+ self.closure(value)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_bool`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_bool>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_bool {
45
+ return Unmanaged<Func_void_bool>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_double.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: Double) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_double {
16
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ private let closure: (_ value: Double) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: Double) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: Double) -> Void {
26
+ self.closure(value)
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_double`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_double>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_double {
45
+ return Unmanaged<Func_void_double>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__exception_ptr.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ error: Error) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__exception_ptr {
16
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ private let closure: (_ error: Error) -> Void
19
+
20
+ public init(_ closure: @escaping (_ error: Error) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(error: std.exception_ptr) -> Void {
26
+ self.closure(RuntimeError.from(cppError: error))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__exception_ptr`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__exception_ptr>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__exception_ptr {
45
+ return Unmanaged<Func_void_std__exception_ptr>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__vector_GATTService_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: [GATTService]) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__vector_GATTService_ {
16
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ private let closure: (_ value: [GATTService]) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: [GATTService]) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: bridge.std__vector_GATTService_) -> Void {
26
+ self.closure(value.map({ __item in __item }))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__vector_GATTService_`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_GATTService_>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_GATTService_ {
45
+ return Unmanaged<Func_void_std__vector_GATTService_>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,47 @@
1
+ ///
2
+ /// Func_void_std__vector_std__string_.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Wraps a Swift `(_ value: [String]) -> Void` as a class.
13
+ * This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
14
+ */
15
+ public final class Func_void_std__vector_std__string_ {
16
+ public typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
17
+
18
+ private let closure: (_ value: [String]) -> Void
19
+
20
+ public init(_ closure: @escaping (_ value: [String]) -> Void) {
21
+ self.closure = closure
22
+ }
23
+
24
+ @inline(__always)
25
+ public func call(value: bridge.std__vector_std__string_) -> Void {
26
+ self.closure(value.map({ __item in String(__item) }))
27
+ }
28
+
29
+ /**
30
+ * Casts this instance to a retained unsafe raw pointer.
31
+ * This acquires one additional strong reference on the object!
32
+ */
33
+ @inline(__always)
34
+ public func toUnsafe() -> UnsafeMutableRawPointer {
35
+ return Unmanaged.passRetained(self).toOpaque()
36
+ }
37
+
38
+ /**
39
+ * Casts an unsafe pointer to a `Func_void_std__vector_std__string_`.
40
+ * The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_std__string_>`.
41
+ * This removes one strong reference from the object!
42
+ */
43
+ @inline(__always)
44
+ public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_std__string_ {
45
+ return Unmanaged<Func_void_std__vector_std__string_>.fromOpaque(pointer).takeRetainedValue()
46
+ }
47
+ }
@@ -0,0 +1,59 @@
1
+ ///
2
+ /// GATTCharacteristic.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Represents an instance of `GATTCharacteristic`, backed by a C++ struct.
13
+ */
14
+ public typealias GATTCharacteristic = margelo.nitro.munimbluetooth.GATTCharacteristic
15
+
16
+ public extension GATTCharacteristic {
17
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `GATTCharacteristic`.
21
+ */
22
+ init(uuid: String, properties: [String], value: String?) {
23
+ self.init(std.string(uuid), { () -> bridge.std__vector_std__string_ in
24
+ var __vector = bridge.create_std__vector_std__string_(properties.count)
25
+ for __item in properties {
26
+ __vector.push_back(std.string(__item))
27
+ }
28
+ return __vector
29
+ }(), { () -> bridge.std__optional_std__string_ in
30
+ if let __unwrappedValue = value {
31
+ return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
32
+ } else {
33
+ return .init()
34
+ }
35
+ }())
36
+ }
37
+
38
+ @inline(__always)
39
+ var uuid: String {
40
+ return String(self.__uuid)
41
+ }
42
+
43
+ @inline(__always)
44
+ var properties: [String] {
45
+ return self.__properties.map({ __item in String(__item) })
46
+ }
47
+
48
+ @inline(__always)
49
+ var value: String? {
50
+ return { () -> String? in
51
+ if bridge.has_value_std__optional_std__string_(self.__value) {
52
+ let __unwrapped = bridge.get_std__optional_std__string_(self.__value)
53
+ return String(__unwrapped)
54
+ } else {
55
+ return nil
56
+ }
57
+ }()
58
+ }
59
+ }
@@ -0,0 +1,41 @@
1
+ ///
2
+ /// GATTService.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /**
12
+ * Represents an instance of `GATTService`, backed by a C++ struct.
13
+ */
14
+ public typealias GATTService = margelo.nitro.munimbluetooth.GATTService
15
+
16
+ public extension GATTService {
17
+ private typealias bridge = margelo.nitro.munimbluetooth.bridge.swift
18
+
19
+ /**
20
+ * Create a new instance of `GATTService`.
21
+ */
22
+ init(uuid: String, characteristics: [GATTCharacteristic]) {
23
+ self.init(std.string(uuid), { () -> bridge.std__vector_GATTCharacteristic_ in
24
+ var __vector = bridge.create_std__vector_GATTCharacteristic_(characteristics.count)
25
+ for __item in characteristics {
26
+ __vector.push_back(__item)
27
+ }
28
+ return __vector
29
+ }())
30
+ }
31
+
32
+ @inline(__always)
33
+ var uuid: String {
34
+ return String(self.__uuid)
35
+ }
36
+
37
+ @inline(__always)
38
+ var characteristics: [GATTCharacteristic] {
39
+ return self.__characteristics.map({ __item in __item })
40
+ }
41
+ }
@@ -0,0 +1,75 @@
1
+ ///
2
+ /// HybridMunimBluetoothSpec.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import Foundation
9
+ import NitroModules
10
+
11
+ /// See ``HybridMunimBluetoothSpec``
12
+ public protocol HybridMunimBluetoothSpec_protocol: HybridObject {
13
+ // Properties
14
+
15
+
16
+ // Methods
17
+ func startAdvertising(options: AdvertisingOptions) throws -> Void
18
+ func updateAdvertisingData(advertisingData: AdvertisingDataTypes) throws -> Void
19
+ func getAdvertisingData() throws -> Promise<AdvertisingDataTypes>
20
+ func stopAdvertising() throws -> Void
21
+ func setServices(services: [GATTService]) throws -> Void
22
+ func isBluetoothEnabled() throws -> Promise<Bool>
23
+ func requestBluetoothPermission() throws -> Promise<Bool>
24
+ func startScan(options: ScanOptions?) throws -> Void
25
+ func stopScan() throws -> Void
26
+ func connect(deviceId: String) throws -> Promise<Void>
27
+ func disconnect(deviceId: String) throws -> Void
28
+ func discoverServices(deviceId: String) throws -> Promise<[GATTService]>
29
+ func readCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Promise<CharacteristicValue>
30
+ func writeCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String, value: String, writeType: WriteType?) throws -> Promise<Void>
31
+ func subscribeToCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
32
+ func unsubscribeFromCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String) throws -> Void
33
+ func getConnectedDevices() throws -> Promise<[String]>
34
+ func readRSSI(deviceId: String) throws -> Promise<Double>
35
+ func addListener(eventName: String) throws -> Void
36
+ func removeListeners(count: Double) throws -> Void
37
+ }
38
+
39
+ public extension HybridMunimBluetoothSpec_protocol {
40
+ /// Default implementation of ``HybridObject.toString``
41
+ func toString() -> String {
42
+ return "[HybridObject MunimBluetooth]"
43
+ }
44
+ }
45
+
46
+ /// See ``HybridMunimBluetoothSpec``
47
+ open class HybridMunimBluetoothSpec_base {
48
+ private weak var cxxWrapper: HybridMunimBluetoothSpec_cxx? = nil
49
+ public init() { }
50
+ public func getCxxWrapper() -> HybridMunimBluetoothSpec_cxx {
51
+ #if DEBUG
52
+ guard self is any HybridMunimBluetoothSpec else {
53
+ fatalError("`self` is not a `HybridMunimBluetoothSpec`! Did you accidentally inherit from `HybridMunimBluetoothSpec_base` instead of `HybridMunimBluetoothSpec`?")
54
+ }
55
+ #endif
56
+ if let cxxWrapper = self.cxxWrapper {
57
+ return cxxWrapper
58
+ } else {
59
+ let cxxWrapper = HybridMunimBluetoothSpec_cxx(self as! any HybridMunimBluetoothSpec)
60
+ self.cxxWrapper = cxxWrapper
61
+ return cxxWrapper
62
+ }
63
+ }
64
+ }
65
+
66
+ /**
67
+ * A Swift base-protocol representing the MunimBluetooth HybridObject.
68
+ * Implement this protocol to create Swift-based instances of MunimBluetooth.
69
+ * ```swift
70
+ * class HybridMunimBluetooth : HybridMunimBluetoothSpec {
71
+ * // ...
72
+ * }
73
+ * ```
74
+ */
75
+ public typealias HybridMunimBluetoothSpec = HybridMunimBluetoothSpec_protocol & HybridMunimBluetoothSpec_base