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.
- package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts +24 -25
- package/lib/typescript/src/specs/munim-bluetooth.nitro.d.ts.map +1 -1
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/MunimBluetooth+autolinking.cmake +81 -0
- package/nitrogen/generated/android/MunimBluetooth+autolinking.gradle +27 -0
- package/nitrogen/generated/android/MunimBluetoothOnLoad.cpp +44 -0
- package/nitrogen/generated/android/MunimBluetoothOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JAdvertisingDataTypes.hpp +345 -0
- package/nitrogen/generated/android/c++/JAdvertisingOptions.hpp +93 -0
- package/nitrogen/generated/android/c++/JCharacteristicValue.hpp +65 -0
- package/nitrogen/generated/android/c++/JGATTCharacteristic.hpp +85 -0
- package/nitrogen/generated/android/c++/JGATTService.hpp +83 -0
- package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.cpp +307 -0
- package/nitrogen/generated/android/c++/JHybridMunimBluetoothSpec.hpp +85 -0
- package/nitrogen/generated/android/c++/JScanMode.hpp +61 -0
- package/nitrogen/generated/android/c++/JScanOptions.hpp +87 -0
- package/nitrogen/generated/android/c++/JServiceDataEntry.hpp +61 -0
- package/nitrogen/generated/android/c++/JWriteType.hpp +58 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingDataTypes.kt +89 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/AdvertisingOptions.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/CharacteristicValue.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTCharacteristic.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/GATTService.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/HybridMunimBluetoothSpec.kt +134 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MunimBluetoothOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanMode.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ScanOptions.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/WriteType.kt +23 -0
- package/nitrogen/generated/ios/MunimBluetooth+autolinking.rb +60 -0
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.cpp +97 -0
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp +583 -0
- package/nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Umbrella.hpp +74 -0
- package/nitrogen/generated/ios/MunimBluetoothAutolinking.mm +33 -0
- package/nitrogen/generated/ios/MunimBluetoothAutolinking.swift +44 -0
- package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridMunimBluetoothSpecSwift.hpp +241 -0
- package/nitrogen/generated/ios/swift/AdvertisingDataTypes.swift +400 -0
- package/nitrogen/generated/ios/swift/AdvertisingOptions.swift +83 -0
- package/nitrogen/generated/ios/swift/CharacteristicValue.swift +40 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_AdvertisingDataTypes.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_CharacteristicValue.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_double.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_GATTService_.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
- package/nitrogen/generated/ios/swift/GATTCharacteristic.swift +59 -0
- package/nitrogen/generated/ios/swift/GATTService.swift +41 -0
- package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec.swift +75 -0
- package/nitrogen/generated/ios/swift/HybridMunimBluetoothSpec_cxx.swift +431 -0
- package/nitrogen/generated/ios/swift/ScanMode.swift +44 -0
- package/nitrogen/generated/ios/swift/ScanOptions.swift +78 -0
- package/nitrogen/generated/ios/swift/ServiceDataEntry.swift +35 -0
- package/nitrogen/generated/ios/swift/WriteType.swift +40 -0
- package/nitrogen/generated/shared/c++/AdvertisingDataTypes.hpp +155 -0
- package/nitrogen/generated/shared/c++/AdvertisingOptions.hpp +99 -0
- package/nitrogen/generated/shared/c++/CharacteristicValue.hpp +91 -0
- package/nitrogen/generated/shared/c++/GATTCharacteristic.hpp +93 -0
- package/nitrogen/generated/shared/c++/GATTService.hpp +90 -0
- package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.cpp +40 -0
- package/nitrogen/generated/shared/c++/HybridMunimBluetoothSpec.hpp +101 -0
- package/nitrogen/generated/shared/c++/ScanMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +95 -0
- package/nitrogen/generated/shared/c++/ServiceDataEntry.hpp +87 -0
- package/nitrogen/generated/shared/c++/WriteType.hpp +76 -0
- package/package.json +9 -9
- package/src/specs/munim-bluetooth.nitro.ts +34 -25
- package/lib/module/package.json +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMunimBluetoothSpec.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.HybridObject
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A Kotlin class representing the MunimBluetooth HybridObject.
|
|
18
|
+
* Implement this abstract class to create Kotlin-based instances of MunimBluetooth.
|
|
19
|
+
*/
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
@Suppress(
|
|
23
|
+
"KotlinJniMissingFunction", "unused",
|
|
24
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
25
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
26
|
+
)
|
|
27
|
+
abstract class HybridMunimBluetoothSpec: HybridObject() {
|
|
28
|
+
@DoNotStrip
|
|
29
|
+
private var mHybridData: HybridData = initHybrid()
|
|
30
|
+
|
|
31
|
+
init {
|
|
32
|
+
super.updateNative(mHybridData)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override fun updateNative(hybridData: HybridData) {
|
|
36
|
+
mHybridData = hybridData
|
|
37
|
+
super.updateNative(hybridData)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Default implementation of `HybridObject.toString()`
|
|
41
|
+
override fun toString(): String {
|
|
42
|
+
return "[HybridObject MunimBluetooth]"
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Properties
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Methods
|
|
49
|
+
@DoNotStrip
|
|
50
|
+
@Keep
|
|
51
|
+
abstract fun startAdvertising(options: AdvertisingOptions): Unit
|
|
52
|
+
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
abstract fun updateAdvertisingData(advertisingData: AdvertisingDataTypes): Unit
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
abstract fun getAdvertisingData(): Promise<AdvertisingDataTypes>
|
|
60
|
+
|
|
61
|
+
@DoNotStrip
|
|
62
|
+
@Keep
|
|
63
|
+
abstract fun stopAdvertising(): Unit
|
|
64
|
+
|
|
65
|
+
@DoNotStrip
|
|
66
|
+
@Keep
|
|
67
|
+
abstract fun setServices(services: Array<GATTService>): Unit
|
|
68
|
+
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
abstract fun isBluetoothEnabled(): Promise<Boolean>
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun requestBluetoothPermission(): Promise<Boolean>
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
abstract fun startScan(options: ScanOptions?): Unit
|
|
80
|
+
|
|
81
|
+
@DoNotStrip
|
|
82
|
+
@Keep
|
|
83
|
+
abstract fun stopScan(): Unit
|
|
84
|
+
|
|
85
|
+
@DoNotStrip
|
|
86
|
+
@Keep
|
|
87
|
+
abstract fun connect(deviceId: String): Promise<Unit>
|
|
88
|
+
|
|
89
|
+
@DoNotStrip
|
|
90
|
+
@Keep
|
|
91
|
+
abstract fun disconnect(deviceId: String): Unit
|
|
92
|
+
|
|
93
|
+
@DoNotStrip
|
|
94
|
+
@Keep
|
|
95
|
+
abstract fun discoverServices(deviceId: String): Promise<Array<GATTService>>
|
|
96
|
+
|
|
97
|
+
@DoNotStrip
|
|
98
|
+
@Keep
|
|
99
|
+
abstract fun readCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String): Promise<CharacteristicValue>
|
|
100
|
+
|
|
101
|
+
@DoNotStrip
|
|
102
|
+
@Keep
|
|
103
|
+
abstract fun writeCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String, value: String, writeType: WriteType?): Promise<Unit>
|
|
104
|
+
|
|
105
|
+
@DoNotStrip
|
|
106
|
+
@Keep
|
|
107
|
+
abstract fun subscribeToCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String): Unit
|
|
108
|
+
|
|
109
|
+
@DoNotStrip
|
|
110
|
+
@Keep
|
|
111
|
+
abstract fun unsubscribeFromCharacteristic(deviceId: String, serviceUUID: String, characteristicUUID: String): Unit
|
|
112
|
+
|
|
113
|
+
@DoNotStrip
|
|
114
|
+
@Keep
|
|
115
|
+
abstract fun getConnectedDevices(): Promise<Array<String>>
|
|
116
|
+
|
|
117
|
+
@DoNotStrip
|
|
118
|
+
@Keep
|
|
119
|
+
abstract fun readRSSI(deviceId: String): Promise<Double>
|
|
120
|
+
|
|
121
|
+
@DoNotStrip
|
|
122
|
+
@Keep
|
|
123
|
+
abstract fun addListener(eventName: String): Unit
|
|
124
|
+
|
|
125
|
+
@DoNotStrip
|
|
126
|
+
@Keep
|
|
127
|
+
abstract fun removeListeners(count: Double): Unit
|
|
128
|
+
|
|
129
|
+
private external fun initHybrid(): HybridData
|
|
130
|
+
|
|
131
|
+
companion object {
|
|
132
|
+
protected const val TAG = "HybridMunimBluetoothSpec"
|
|
133
|
+
}
|
|
134
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/MunimBluetoothOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MunimBluetoothOnLoad.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class MunimBluetoothOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "MunimBluetoothOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "MunimBluetooth".
|
|
18
|
+
* This method is idempotent and can be called more than once.
|
|
19
|
+
*/
|
|
20
|
+
@JvmStatic
|
|
21
|
+
fun initializeNative() {
|
|
22
|
+
if (didLoad) return
|
|
23
|
+
try {
|
|
24
|
+
Log.i(TAG, "Loading MunimBluetooth C++ library...")
|
|
25
|
+
System.loadLibrary("MunimBluetooth")
|
|
26
|
+
Log.i(TAG, "Successfully loaded MunimBluetooth C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load MunimBluetooth C++ library! Is it properly installed and linked? " +
|
|
30
|
+
"Is the name correct? (see `CMakeLists.txt`, at `add_library(...)`)", e)
|
|
31
|
+
throw e
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanMode.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "ScanMode".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class ScanMode(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
LOWPOWER(0),
|
|
20
|
+
BALANCED(1),
|
|
21
|
+
LOWLATENCY(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanOptions.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "ScanOptions".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ScanOptions(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val serviceUUIDs: Array<String>?,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val allowDuplicates: Boolean?,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val scanMode: ScanMode?
|
|
29
|
+
) {
|
|
30
|
+
/* primary constructor */
|
|
31
|
+
|
|
32
|
+
companion object {
|
|
33
|
+
/**
|
|
34
|
+
* Constructor called from C++
|
|
35
|
+
*/
|
|
36
|
+
@DoNotStrip
|
|
37
|
+
@Keep
|
|
38
|
+
@Suppress("unused")
|
|
39
|
+
@JvmStatic
|
|
40
|
+
private fun fromCpp(serviceUUIDs: Array<String>?, allowDuplicates: Boolean?, scanMode: ScanMode?): ScanOptions {
|
|
41
|
+
return ScanOptions(serviceUUIDs, allowDuplicates, scanMode)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimbluetooth/ServiceDataEntry.kt
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ServiceDataEntry.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "ServiceDataEntry".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ServiceDataEntry(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val uuid: String,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val data: String
|
|
26
|
+
) {
|
|
27
|
+
/* primary constructor */
|
|
28
|
+
|
|
29
|
+
companion object {
|
|
30
|
+
/**
|
|
31
|
+
* Constructor called from C++
|
|
32
|
+
*/
|
|
33
|
+
@DoNotStrip
|
|
34
|
+
@Keep
|
|
35
|
+
@Suppress("unused")
|
|
36
|
+
@JvmStatic
|
|
37
|
+
private fun fromCpp(uuid: String, data: String): ServiceDataEntry {
|
|
38
|
+
return ServiceDataEntry(uuid, data)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WriteType.kt
|
|
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
|
+
package com.margelo.nitro.munimbluetooth
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "WriteType".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class WriteType(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
WRITE(0),
|
|
20
|
+
WRITEWITHOUTRESPONSE(1);
|
|
21
|
+
|
|
22
|
+
companion object
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# MunimBluetooth+autolinking.rb
|
|
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
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/MunimBluetooth+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 MunimBluetooth is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/MunimBluetooth-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MunimBluetooth-Swift-Cxx-Bridge.cpp
|
|
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
|
+
#include "MunimBluetooth-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
#include "HybridMunimBluetoothSpecSwift.hpp"
|
|
12
|
+
#include "MunimBluetooth-Swift-Cxx-Umbrella.hpp"
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::munimbluetooth::bridge::swift {
|
|
16
|
+
|
|
17
|
+
// pragma MARK: std::function<void(const AdvertisingDataTypes& /* result */)>
|
|
18
|
+
Func_void_AdvertisingDataTypes create_Func_void_AdvertisingDataTypes(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
19
|
+
auto swiftClosure = MunimBluetooth::Func_void_AdvertisingDataTypes::fromUnsafe(swiftClosureWrapper);
|
|
20
|
+
return [swiftClosure = std::move(swiftClosure)](const AdvertisingDataTypes& result) mutable -> void {
|
|
21
|
+
swiftClosure.call(result);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// pragma MARK: std::function<void(const std::exception_ptr& /* error */)>
|
|
26
|
+
Func_void_std__exception_ptr create_Func_void_std__exception_ptr(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
27
|
+
auto swiftClosure = MunimBluetooth::Func_void_std__exception_ptr::fromUnsafe(swiftClosureWrapper);
|
|
28
|
+
return [swiftClosure = std::move(swiftClosure)](const std::exception_ptr& error) mutable -> void {
|
|
29
|
+
swiftClosure.call(error);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// pragma MARK: std::function<void(bool /* result */)>
|
|
34
|
+
Func_void_bool create_Func_void_bool(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
35
|
+
auto swiftClosure = MunimBluetooth::Func_void_bool::fromUnsafe(swiftClosureWrapper);
|
|
36
|
+
return [swiftClosure = std::move(swiftClosure)](bool result) mutable -> void {
|
|
37
|
+
swiftClosure.call(result);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// pragma MARK: std::function<void()>
|
|
42
|
+
Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
43
|
+
auto swiftClosure = MunimBluetooth::Func_void::fromUnsafe(swiftClosureWrapper);
|
|
44
|
+
return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
|
|
45
|
+
swiftClosure.call();
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// pragma MARK: std::function<void(const std::vector<GATTService>& /* result */)>
|
|
50
|
+
Func_void_std__vector_GATTService_ create_Func_void_std__vector_GATTService_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
51
|
+
auto swiftClosure = MunimBluetooth::Func_void_std__vector_GATTService_::fromUnsafe(swiftClosureWrapper);
|
|
52
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<GATTService>& result) mutable -> void {
|
|
53
|
+
swiftClosure.call(result);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// pragma MARK: std::function<void(const CharacteristicValue& /* result */)>
|
|
58
|
+
Func_void_CharacteristicValue create_Func_void_CharacteristicValue(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
59
|
+
auto swiftClosure = MunimBluetooth::Func_void_CharacteristicValue::fromUnsafe(swiftClosureWrapper);
|
|
60
|
+
return [swiftClosure = std::move(swiftClosure)](const CharacteristicValue& result) mutable -> void {
|
|
61
|
+
swiftClosure.call(result);
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// pragma MARK: std::function<void(const std::vector<std::string>& /* result */)>
|
|
66
|
+
Func_void_std__vector_std__string_ create_Func_void_std__vector_std__string_(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
67
|
+
auto swiftClosure = MunimBluetooth::Func_void_std__vector_std__string_::fromUnsafe(swiftClosureWrapper);
|
|
68
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<std::string>& result) mutable -> void {
|
|
69
|
+
swiftClosure.call(result);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// pragma MARK: std::function<void(double /* result */)>
|
|
74
|
+
Func_void_double create_Func_void_double(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
75
|
+
auto swiftClosure = MunimBluetooth::Func_void_double::fromUnsafe(swiftClosureWrapper);
|
|
76
|
+
return [swiftClosure = std::move(swiftClosure)](double result) mutable -> void {
|
|
77
|
+
swiftClosure.call(result);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// pragma MARK: std::shared_ptr<HybridMunimBluetoothSpec>
|
|
82
|
+
std::shared_ptr<HybridMunimBluetoothSpec> create_std__shared_ptr_HybridMunimBluetoothSpec_(void* NON_NULL swiftUnsafePointer) noexcept {
|
|
83
|
+
MunimBluetooth::HybridMunimBluetoothSpec_cxx swiftPart = MunimBluetooth::HybridMunimBluetoothSpec_cxx::fromUnsafe(swiftUnsafePointer);
|
|
84
|
+
return std::make_shared<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift>(swiftPart);
|
|
85
|
+
}
|
|
86
|
+
void* NON_NULL get_std__shared_ptr_HybridMunimBluetoothSpec_(std__shared_ptr_HybridMunimBluetoothSpec_ cppType) {
|
|
87
|
+
std::shared_ptr<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift> swiftWrapper = std::dynamic_pointer_cast<margelo::nitro::munimbluetooth::HybridMunimBluetoothSpecSwift>(cppType);
|
|
88
|
+
#ifdef NITRO_DEBUG
|
|
89
|
+
if (swiftWrapper == nullptr) [[unlikely]] {
|
|
90
|
+
throw std::runtime_error("Class \"HybridMunimBluetoothSpec\" is not implemented in Swift!");
|
|
91
|
+
}
|
|
92
|
+
#endif
|
|
93
|
+
MunimBluetooth::HybridMunimBluetoothSpec_cxx& swiftPart = swiftWrapper->getSwiftPart();
|
|
94
|
+
return swiftPart.toUnsafe();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro::munimbluetooth::bridge::swift
|