munim-wifi 0.1.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/LICENSE +21 -0
- package/MunimWifi.podspec +31 -0
- package/README.md +591 -0
- package/android/CMakeLists.txt +32 -0
- package/android/build.gradle +148 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +6 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/munimwifi/HybridMunimWifi.kt +283 -0
- package/android/src/main/java/com/munimwifi/MunimWifiPackage.kt +20 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridMunimWifi.swift +222 -0
- package/lib/commonjs/index.js +216 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/specs/munim-wifi.nitro.js +6 -0
- package/lib/commonjs/specs/munim-wifi.nitro.js.map +1 -0
- package/lib/module/index.js +198 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/munim-wifi.nitro.js +4 -0
- package/lib/module/specs/munim-wifi.nitro.js.map +1 -0
- package/lib/typescript/src/index.d.ts +120 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/specs/munim-wifi.nitro.d.ts +118 -0
- package/lib/typescript/src/specs/munim-wifi.nitro.d.ts.map +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/MunimWifi+autolinking.cmake +85 -0
- package/nitrogen/generated/android/MunimWifi+autolinking.gradle +27 -0
- package/nitrogen/generated/android/MunimWifiOnLoad.cpp +44 -0
- package/nitrogen/generated/android/MunimWifiOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JChannelInfo.hpp +61 -0
- package/nitrogen/generated/android/c++/JHybridMunimWifiSpec.cpp +262 -0
- package/nitrogen/generated/android/c++/JHybridMunimWifiSpec.hpp +78 -0
- package/nitrogen/generated/android/c++/JLocation.hpp +61 -0
- package/nitrogen/generated/android/c++/JScanOptions.hpp +61 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_ChannelInfo.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_ChannelInfo.hpp +71 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Double.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_Double.hpp +69 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_String.hpp +70 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_WifiNetwork.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_WifiNetwork.hpp +73 -0
- package/nitrogen/generated/android/c++/JWifiFingerprint.hpp +89 -0
- package/nitrogen/generated/android/c++/JWifiNetwork.hpp +86 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/ChannelInfo.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/HybridMunimWifiSpec.kt +107 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Location.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/MunimWifiOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/ScanOptions.kt +41 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Variant_NullType_ChannelInfo.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Variant_NullType_Double.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Variant_NullType_String.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Variant_NullType_WifiNetwork.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/WifiFingerprint.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/WifiNetwork.kt +59 -0
- package/nitrogen/generated/ios/MunimWifi+autolinking.rb +60 -0
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Bridge.cpp +105 -0
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Bridge.hpp +653 -0
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Umbrella.hpp +64 -0
- package/nitrogen/generated/ios/MunimWifiAutolinking.mm +33 -0
- package/nitrogen/generated/ios/MunimWifiAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridMunimWifiSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridMunimWifiSpecSwift.hpp +189 -0
- package/nitrogen/generated/ios/swift/ChannelInfo.swift +35 -0
- package/nitrogen/generated/ios/swift/Func_void_WifiFingerprint.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_bool.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__exception_ptr.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__ChannelInfo_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__WifiNetwork_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__double_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__std__string_.swift +59 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_WifiNetwork_.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_std__string_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridMunimWifiSpec.swift +68 -0
- package/nitrogen/generated/ios/swift/HybridMunimWifiSpec_cxx.swift +382 -0
- package/nitrogen/generated/ios/swift/Location.swift +47 -0
- package/nitrogen/generated/ios/swift/ScanOptions.swift +47 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_ChannelInfo.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_Double.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_String.swift +18 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_WifiNetwork.swift +18 -0
- package/nitrogen/generated/ios/swift/WifiFingerprint.swift +52 -0
- package/nitrogen/generated/ios/swift/WifiNetwork.swift +103 -0
- package/nitrogen/generated/shared/c++/ChannelInfo.hpp +87 -0
- package/nitrogen/generated/shared/c++/HybridMunimWifiSpec.cpp +33 -0
- package/nitrogen/generated/shared/c++/HybridMunimWifiSpec.hpp +90 -0
- package/nitrogen/generated/shared/c++/Location.hpp +87 -0
- package/nitrogen/generated/shared/c++/ScanOptions.hpp +87 -0
- package/nitrogen/generated/shared/c++/WifiFingerprint.hpp +97 -0
- package/nitrogen/generated/shared/c++/WifiNetwork.hpp +112 -0
- package/package.json +122 -0
- package/src/index.ts +221 -0
- package/src/specs/munim-wifi.nitro.ts +140 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanOptions.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 `ScanOptions`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias ScanOptions = margelo.nitro.munimwifi.ScanOptions
|
|
15
|
+
|
|
16
|
+
public extension ScanOptions {
|
|
17
|
+
private typealias bridge = margelo.nitro.munimwifi.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `ScanOptions`.
|
|
21
|
+
*/
|
|
22
|
+
init(maxResults: Double?, timeout: Double?) {
|
|
23
|
+
self.init({ () -> bridge.std__optional_double_ in
|
|
24
|
+
if let __unwrappedValue = maxResults {
|
|
25
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
30
|
+
if let __unwrappedValue = timeout {
|
|
31
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@inline(__always)
|
|
39
|
+
var maxResults: Double? {
|
|
40
|
+
return self.__maxResults.value
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var timeout: Double? {
|
|
45
|
+
return self.__timeout.value
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_ChannelInfo.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 NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_NullType_ChannelInfo {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(ChannelInfo)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_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 NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | number`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public enum Variant_NullType_Double {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(Double)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_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 NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | string`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public enum Variant_NullType_String {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(String)
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Variant_NullType_WifiNetwork.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 NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* An Swift enum with associated values representing a Variant/Union type.
|
|
12
|
+
* JS type: `null | struct`
|
|
13
|
+
*/
|
|
14
|
+
@frozen
|
|
15
|
+
public indirect enum Variant_NullType_WifiNetwork {
|
|
16
|
+
case first(NullType)
|
|
17
|
+
case second(WifiNetwork)
|
|
18
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WifiFingerprint.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 `WifiFingerprint`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias WifiFingerprint = margelo.nitro.munimwifi.WifiFingerprint
|
|
15
|
+
|
|
16
|
+
public extension WifiFingerprint {
|
|
17
|
+
private typealias bridge = margelo.nitro.munimwifi.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `WifiFingerprint`.
|
|
21
|
+
*/
|
|
22
|
+
init(networks: [WifiNetwork], timestamp: Double, location: Location?) {
|
|
23
|
+
self.init({ () -> bridge.std__vector_WifiNetwork_ in
|
|
24
|
+
var __vector = bridge.create_std__vector_WifiNetwork_(networks.count)
|
|
25
|
+
for __item in networks {
|
|
26
|
+
__vector.push_back(__item)
|
|
27
|
+
}
|
|
28
|
+
return __vector
|
|
29
|
+
}(), timestamp, { () -> bridge.std__optional_Location_ in
|
|
30
|
+
if let __unwrappedValue = location {
|
|
31
|
+
return bridge.create_std__optional_Location_(__unwrappedValue)
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}())
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@inline(__always)
|
|
39
|
+
var networks: [WifiNetwork] {
|
|
40
|
+
return self.__networks.map({ __item in __item })
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var timestamp: Double {
|
|
45
|
+
return self.__timestamp
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@inline(__always)
|
|
49
|
+
var location: Location? {
|
|
50
|
+
return self.__location.value
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WifiNetwork.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 `WifiNetwork`, backed by a C++ struct.
|
|
13
|
+
*/
|
|
14
|
+
public typealias WifiNetwork = margelo.nitro.munimwifi.WifiNetwork
|
|
15
|
+
|
|
16
|
+
public extension WifiNetwork {
|
|
17
|
+
private typealias bridge = margelo.nitro.munimwifi.bridge.swift
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new instance of `WifiNetwork`.
|
|
21
|
+
*/
|
|
22
|
+
init(ssid: String, bssid: String, rssi: Double, frequency: Double, channel: Double?, capabilities: String?, isSecure: Bool?, timestamp: Double?) {
|
|
23
|
+
self.init(std.string(ssid), std.string(bssid), rssi, frequency, { () -> bridge.std__optional_double_ in
|
|
24
|
+
if let __unwrappedValue = channel {
|
|
25
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
26
|
+
} else {
|
|
27
|
+
return .init()
|
|
28
|
+
}
|
|
29
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
30
|
+
if let __unwrappedValue = capabilities {
|
|
31
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
32
|
+
} else {
|
|
33
|
+
return .init()
|
|
34
|
+
}
|
|
35
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
36
|
+
if let __unwrappedValue = isSecure {
|
|
37
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
38
|
+
} else {
|
|
39
|
+
return .init()
|
|
40
|
+
}
|
|
41
|
+
}(), { () -> bridge.std__optional_double_ in
|
|
42
|
+
if let __unwrappedValue = timestamp {
|
|
43
|
+
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
44
|
+
} else {
|
|
45
|
+
return .init()
|
|
46
|
+
}
|
|
47
|
+
}())
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@inline(__always)
|
|
51
|
+
var ssid: String {
|
|
52
|
+
return String(self.__ssid)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@inline(__always)
|
|
56
|
+
var bssid: String {
|
|
57
|
+
return String(self.__bssid)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@inline(__always)
|
|
61
|
+
var rssi: Double {
|
|
62
|
+
return self.__rssi
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@inline(__always)
|
|
66
|
+
var frequency: Double {
|
|
67
|
+
return self.__frequency
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@inline(__always)
|
|
71
|
+
var channel: Double? {
|
|
72
|
+
return self.__channel.value
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@inline(__always)
|
|
76
|
+
var capabilities: String? {
|
|
77
|
+
return { () -> String? in
|
|
78
|
+
if bridge.has_value_std__optional_std__string_(self.__capabilities) {
|
|
79
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__capabilities)
|
|
80
|
+
return String(__unwrapped)
|
|
81
|
+
} else {
|
|
82
|
+
return nil
|
|
83
|
+
}
|
|
84
|
+
}()
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@inline(__always)
|
|
88
|
+
var isSecure: Bool? {
|
|
89
|
+
return { () -> Bool? in
|
|
90
|
+
if bridge.has_value_std__optional_bool_(self.__isSecure) {
|
|
91
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__isSecure)
|
|
92
|
+
return __unwrapped
|
|
93
|
+
} else {
|
|
94
|
+
return nil
|
|
95
|
+
}
|
|
96
|
+
}()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@inline(__always)
|
|
100
|
+
var timestamp: Double? {
|
|
101
|
+
return self.__timestamp.value
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChannelInfo.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::munimwifi {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (ChannelInfo).
|
|
39
|
+
*/
|
|
40
|
+
struct ChannelInfo final {
|
|
41
|
+
public:
|
|
42
|
+
double channel SWIFT_PRIVATE;
|
|
43
|
+
double frequency SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
ChannelInfo() = default;
|
|
47
|
+
explicit ChannelInfo(double channel, double frequency): channel(channel), frequency(frequency) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const ChannelInfo& lhs, const ChannelInfo& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::munimwifi
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ ChannelInfo <> JS ChannelInfo (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::munimwifi::ChannelInfo> final {
|
|
60
|
+
static inline margelo::nitro::munimwifi::ChannelInfo fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::munimwifi::ChannelInfo(
|
|
63
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channel"))),
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequency")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::munimwifi::ChannelInfo& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "channel"), JSIConverter<double>::toJSI(runtime, arg.channel));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "frequency"), JSIConverter<double>::toJSI(runtime, arg.frequency));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "channel")))) return false;
|
|
82
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "frequency")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMunimWifiSpec.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 "HybridMunimWifiSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::munimwifi {
|
|
11
|
+
|
|
12
|
+
void HybridMunimWifiSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("isWifiEnabled", &HybridMunimWifiSpec::isWifiEnabled);
|
|
18
|
+
prototype.registerHybridMethod("requestWifiPermission", &HybridMunimWifiSpec::requestWifiPermission);
|
|
19
|
+
prototype.registerHybridMethod("scanNetworks", &HybridMunimWifiSpec::scanNetworks);
|
|
20
|
+
prototype.registerHybridMethod("startScan", &HybridMunimWifiSpec::startScan);
|
|
21
|
+
prototype.registerHybridMethod("stopScan", &HybridMunimWifiSpec::stopScan);
|
|
22
|
+
prototype.registerHybridMethod("getSSIDs", &HybridMunimWifiSpec::getSSIDs);
|
|
23
|
+
prototype.registerHybridMethod("getWifiFingerprint", &HybridMunimWifiSpec::getWifiFingerprint);
|
|
24
|
+
prototype.registerHybridMethod("getRSSI", &HybridMunimWifiSpec::getRSSI);
|
|
25
|
+
prototype.registerHybridMethod("getBSSID", &HybridMunimWifiSpec::getBSSID);
|
|
26
|
+
prototype.registerHybridMethod("getChannelInfo", &HybridMunimWifiSpec::getChannelInfo);
|
|
27
|
+
prototype.registerHybridMethod("getNetworkInfo", &HybridMunimWifiSpec::getNetworkInfo);
|
|
28
|
+
prototype.registerHybridMethod("addListener", &HybridMunimWifiSpec::addListener);
|
|
29
|
+
prototype.registerHybridMethod("removeListeners", &HybridMunimWifiSpec::removeListeners);
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMunimWifiSpec.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `WifiNetwork` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::munimwifi { struct WifiNetwork; }
|
|
18
|
+
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::munimwifi { struct ScanOptions; }
|
|
20
|
+
// Forward declaration of `WifiFingerprint` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::munimwifi { struct WifiFingerprint; }
|
|
22
|
+
// Forward declaration of `ChannelInfo` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::munimwifi { struct ChannelInfo; }
|
|
24
|
+
|
|
25
|
+
#include <NitroModules/Promise.hpp>
|
|
26
|
+
#include "WifiNetwork.hpp"
|
|
27
|
+
#include <vector>
|
|
28
|
+
#include "ScanOptions.hpp"
|
|
29
|
+
#include <optional>
|
|
30
|
+
#include <string>
|
|
31
|
+
#include "WifiFingerprint.hpp"
|
|
32
|
+
#include <NitroModules/Null.hpp>
|
|
33
|
+
#include <variant>
|
|
34
|
+
#include "ChannelInfo.hpp"
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::munimwifi {
|
|
37
|
+
|
|
38
|
+
using namespace margelo::nitro;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* An abstract base class for `MunimWifi`
|
|
42
|
+
* Inherit this class to create instances of `HybridMunimWifiSpec` in C++.
|
|
43
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
44
|
+
* @example
|
|
45
|
+
* ```cpp
|
|
46
|
+
* class HybridMunimWifi: public HybridMunimWifiSpec {
|
|
47
|
+
* public:
|
|
48
|
+
* HybridMunimWifi(...): HybridObject(TAG) { ... }
|
|
49
|
+
* // ...
|
|
50
|
+
* };
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
class HybridMunimWifiSpec: public virtual HybridObject {
|
|
54
|
+
public:
|
|
55
|
+
// Constructor
|
|
56
|
+
explicit HybridMunimWifiSpec(): HybridObject(TAG) { }
|
|
57
|
+
|
|
58
|
+
// Destructor
|
|
59
|
+
~HybridMunimWifiSpec() override = default;
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
// Properties
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
// Methods
|
|
67
|
+
virtual std::shared_ptr<Promise<bool>> isWifiEnabled() = 0;
|
|
68
|
+
virtual std::shared_ptr<Promise<bool>> requestWifiPermission() = 0;
|
|
69
|
+
virtual std::shared_ptr<Promise<std::vector<WifiNetwork>>> scanNetworks(const std::optional<ScanOptions>& options) = 0;
|
|
70
|
+
virtual void startScan(const std::optional<ScanOptions>& options) = 0;
|
|
71
|
+
virtual void stopScan() = 0;
|
|
72
|
+
virtual std::shared_ptr<Promise<std::vector<std::string>>> getSSIDs() = 0;
|
|
73
|
+
virtual std::shared_ptr<Promise<WifiFingerprint>> getWifiFingerprint() = 0;
|
|
74
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, double>>> getRSSI(const std::string& ssid) = 0;
|
|
75
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> getBSSID(const std::string& ssid) = 0;
|
|
76
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, ChannelInfo>>> getChannelInfo(const std::string& ssid) = 0;
|
|
77
|
+
virtual std::shared_ptr<Promise<std::variant<nitro::NullType, WifiNetwork>>> getNetworkInfo(const std::string& ssid) = 0;
|
|
78
|
+
virtual void addListener(const std::string& eventName) = 0;
|
|
79
|
+
virtual void removeListeners(double count) = 0;
|
|
80
|
+
|
|
81
|
+
protected:
|
|
82
|
+
// Hybrid Setup
|
|
83
|
+
void loadHybridMethods() override;
|
|
84
|
+
|
|
85
|
+
protected:
|
|
86
|
+
// Tag for logging
|
|
87
|
+
static constexpr auto TAG = "MunimWifi";
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Location.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::munimwifi {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (Location).
|
|
39
|
+
*/
|
|
40
|
+
struct Location final {
|
|
41
|
+
public:
|
|
42
|
+
std::optional<double> latitude SWIFT_PRIVATE;
|
|
43
|
+
std::optional<double> longitude SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
Location() = default;
|
|
47
|
+
explicit Location(std::optional<double> latitude, std::optional<double> longitude): latitude(latitude), longitude(longitude) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const Location& lhs, const Location& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::munimwifi
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ Location <> JS Location (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::munimwifi::Location> final {
|
|
60
|
+
static inline margelo::nitro::munimwifi::Location fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::munimwifi::Location(
|
|
63
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
|
|
64
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::munimwifi::Location& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.latitude));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.longitude));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
|
|
82
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ScanOptions.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::munimwifi {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (ScanOptions).
|
|
39
|
+
*/
|
|
40
|
+
struct ScanOptions final {
|
|
41
|
+
public:
|
|
42
|
+
std::optional<double> maxResults SWIFT_PRIVATE;
|
|
43
|
+
std::optional<double> timeout SWIFT_PRIVATE;
|
|
44
|
+
|
|
45
|
+
public:
|
|
46
|
+
ScanOptions() = default;
|
|
47
|
+
explicit ScanOptions(std::optional<double> maxResults, std::optional<double> timeout): maxResults(maxResults), timeout(timeout) {}
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
friend bool operator==(const ScanOptions& lhs, const ScanOptions& rhs) = default;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
} // namespace margelo::nitro::munimwifi
|
|
54
|
+
|
|
55
|
+
namespace margelo::nitro {
|
|
56
|
+
|
|
57
|
+
// C++ ScanOptions <> JS ScanOptions (object)
|
|
58
|
+
template <>
|
|
59
|
+
struct JSIConverter<margelo::nitro::munimwifi::ScanOptions> final {
|
|
60
|
+
static inline margelo::nitro::munimwifi::ScanOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
61
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
62
|
+
return margelo::nitro::munimwifi::ScanOptions(
|
|
63
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxResults"))),
|
|
64
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::munimwifi::ScanOptions& arg) {
|
|
68
|
+
jsi::Object obj(runtime);
|
|
69
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "maxResults"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.maxResults));
|
|
70
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeout"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeout));
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
74
|
+
if (!value.isObject()) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
jsi::Object obj = value.getObject(runtime);
|
|
78
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "maxResults")))) return false;
|
|
82
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeout")))) return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro
|