munim-wifi 0.1.0 → 0.1.1
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/README.md +132 -8
- package/ios/HybridMunimWifi.swift +178 -145
- package/lib/typescript/src/specs/munim-wifi.nitro.d.ts +47 -5
- package/lib/typescript/src/specs/munim-wifi.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/MunimWifi+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JConnectionOptions.hpp +66 -0
- package/nitrogen/generated/android/c++/JCurrentNetworkInfo.hpp +97 -0
- package/nitrogen/generated/android/c++/JHybridMunimWifiSpec.cpp +72 -0
- package/nitrogen/generated/android/c++/JHybridMunimWifiSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_CurrentNetworkInfo.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_CurrentNetworkInfo.hpp +74 -0
- package/nitrogen/generated/android/c++/JWifiNetwork.hpp +9 -9
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/ConnectionOptions.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/CurrentNetworkInfo.kt +53 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/HybridMunimWifiSpec.kt +16 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/Variant_NullType_CurrentNetworkInfo.kt +59 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/WifiNetwork.kt +3 -3
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Bridge.cpp +16 -0
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Bridge.hpp +133 -0
- package/nitrogen/generated/ios/MunimWifi-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridMunimWifiSpecSwift.hpp +38 -0
- package/nitrogen/generated/ios/swift/ConnectionOptions.swift +66 -0
- package/nitrogen/generated/ios/swift/CurrentNetworkInfo.swift +113 -0
- package/nitrogen/generated/ios/swift/Func_void.swift +47 -0
- package/nitrogen/generated/ios/swift/Func_void_std__variant_nitro__NullType__CurrentNetworkInfo_.swift +59 -0
- package/nitrogen/generated/ios/swift/HybridMunimWifiSpec.swift +4 -0
- package/nitrogen/generated/ios/swift/HybridMunimWifiSpec_cxx.swift +90 -0
- package/nitrogen/generated/ios/swift/Variant_NullType_CurrentNetworkInfo.swift +18 -0
- package/nitrogen/generated/ios/swift/WifiNetwork.swift +18 -6
- package/nitrogen/generated/shared/c++/ConnectionOptions.hpp +92 -0
- package/nitrogen/generated/shared/c++/CurrentNetworkInfo.hpp +105 -0
- package/nitrogen/generated/shared/c++/HybridMunimWifiSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridMunimWifiSpec.hpp +10 -0
- package/nitrogen/generated/shared/c++/WifiNetwork.hpp +9 -9
- package/package.json +2 -2
- package/src/index.ts +45 -0
- package/src/specs/munim-wifi.nitro.ts +56 -6
|
@@ -7,16 +7,29 @@ export interface ChannelInfo {
|
|
|
7
7
|
channel: number;
|
|
8
8
|
frequency: number;
|
|
9
9
|
}
|
|
10
|
+
export interface CurrentNetworkInfo {
|
|
11
|
+
ssid: string;
|
|
12
|
+
bssid: string;
|
|
13
|
+
ipAddress?: string;
|
|
14
|
+
subnetMask?: string;
|
|
15
|
+
gateway?: string;
|
|
16
|
+
dnsServers?: string[];
|
|
17
|
+
}
|
|
10
18
|
export interface WifiNetwork {
|
|
11
19
|
ssid: string;
|
|
12
20
|
bssid: string;
|
|
13
|
-
rssi
|
|
14
|
-
frequency
|
|
21
|
+
rssi?: number;
|
|
22
|
+
frequency?: number;
|
|
15
23
|
channel?: number;
|
|
16
24
|
capabilities?: string;
|
|
17
25
|
isSecure?: boolean;
|
|
18
26
|
timestamp?: number;
|
|
19
27
|
}
|
|
28
|
+
export interface ConnectionOptions {
|
|
29
|
+
ssid: string;
|
|
30
|
+
password?: string;
|
|
31
|
+
isWEP?: boolean;
|
|
32
|
+
}
|
|
20
33
|
export interface WifiFingerprint {
|
|
21
34
|
networks: WifiNetwork[];
|
|
22
35
|
timestamp: number;
|
|
@@ -69,16 +82,17 @@ export interface MunimWifi extends HybridObject<{
|
|
|
69
82
|
getSSIDs(): Promise<string[]>;
|
|
70
83
|
/**
|
|
71
84
|
* Get Wi-Fi fingerprint containing all network information.
|
|
72
|
-
*
|
|
85
|
+
* Note: On iOS, RSSI, channel, and frequency are not available.
|
|
73
86
|
*
|
|
74
87
|
* @returns Promise resolving to Wi-Fi fingerprint data.
|
|
75
88
|
*/
|
|
76
89
|
getWifiFingerprint(): Promise<WifiFingerprint>;
|
|
77
90
|
/**
|
|
78
91
|
* Get RSSI (signal strength) for a specific network by SSID.
|
|
92
|
+
* Note: Not available on iOS - returns null.
|
|
79
93
|
*
|
|
80
94
|
* @param ssid - The SSID of the network.
|
|
81
|
-
* @returns Promise resolving to RSSI value in dBm, or null if network not found.
|
|
95
|
+
* @returns Promise resolving to RSSI value in dBm, or null if network not found or not available.
|
|
82
96
|
*/
|
|
83
97
|
getRSSI(ssid: string): Promise<number | null>;
|
|
84
98
|
/**
|
|
@@ -90,18 +104,46 @@ export interface MunimWifi extends HybridObject<{
|
|
|
90
104
|
getBSSID(ssid: string): Promise<string | null>;
|
|
91
105
|
/**
|
|
92
106
|
* Get channel and frequency information for a specific network by SSID.
|
|
107
|
+
* Note: Not available on iOS - returns null.
|
|
93
108
|
*
|
|
94
109
|
* @param ssid - The SSID of the network.
|
|
95
|
-
* @returns Promise resolving to object with channel and frequency, or null if network not found.
|
|
110
|
+
* @returns Promise resolving to object with channel and frequency, or null if network not found or not available.
|
|
96
111
|
*/
|
|
97
112
|
getChannelInfo(ssid: string): Promise<ChannelInfo | null>;
|
|
98
113
|
/**
|
|
99
114
|
* Get all available information for a specific network by SSID.
|
|
115
|
+
* Note: On iOS, RSSI, channel, and frequency will be undefined.
|
|
100
116
|
*
|
|
101
117
|
* @param ssid - The SSID of the network.
|
|
102
118
|
* @returns Promise resolving to WifiNetwork object, or null if network not found.
|
|
103
119
|
*/
|
|
104
120
|
getNetworkInfo(ssid: string): Promise<WifiNetwork | null>;
|
|
121
|
+
/**
|
|
122
|
+
* Get information about the currently connected Wi-Fi network.
|
|
123
|
+
*
|
|
124
|
+
* @returns Promise resolving to current network info, or null if not connected.
|
|
125
|
+
*/
|
|
126
|
+
getCurrentNetwork(): Promise<CurrentNetworkInfo | null>;
|
|
127
|
+
/**
|
|
128
|
+
* Connect to a Wi-Fi network.
|
|
129
|
+
* Note: Requires appropriate permissions and capabilities on both platforms.
|
|
130
|
+
*
|
|
131
|
+
* @param options - Connection options including SSID and password.
|
|
132
|
+
* @returns Promise resolving when connection is attempted.
|
|
133
|
+
*/
|
|
134
|
+
connectToNetwork(options: ConnectionOptions): Promise<void>;
|
|
135
|
+
/**
|
|
136
|
+
* Disconnect from the current Wi-Fi network.
|
|
137
|
+
*
|
|
138
|
+
* @returns Promise resolving when disconnection is complete.
|
|
139
|
+
*/
|
|
140
|
+
disconnect(): Promise<void>;
|
|
141
|
+
/**
|
|
142
|
+
* Get IP address information for the current Wi-Fi connection.
|
|
143
|
+
*
|
|
144
|
+
* @returns Promise resolving to IP address string, or null if not connected.
|
|
145
|
+
*/
|
|
146
|
+
getIPAddress(): Promise<string | null>;
|
|
105
147
|
/**
|
|
106
148
|
* Add an event listener for network found events (when using startScan).
|
|
107
149
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"munim-wifi.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/munim-wifi.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAG9D,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAGD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;CAClB;AAGD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"munim-wifi.nitro.d.ts","sourceRoot":"","sources":["../../../../src/specs/munim-wifi.nitro.ts"],"names":[],"mappings":"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"}
|
|
@@ -40,6 +40,7 @@ target_sources(
|
|
|
40
40
|
../nitrogen/generated/android/c++/JVariant_NullType_String.cpp
|
|
41
41
|
../nitrogen/generated/android/c++/JVariant_NullType_ChannelInfo.cpp
|
|
42
42
|
../nitrogen/generated/android/c++/JVariant_NullType_WifiNetwork.cpp
|
|
43
|
+
../nitrogen/generated/android/c++/JVariant_NullType_CurrentNetworkInfo.cpp
|
|
43
44
|
)
|
|
44
45
|
|
|
45
46
|
# From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JConnectionOptions.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "ConnectionOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::munimwifi {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "ConnectionOptions" and the the Kotlin data class "ConnectionOptions".
|
|
22
|
+
*/
|
|
23
|
+
struct JConnectionOptions final: public jni::JavaClass<JConnectionOptions> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/ConnectionOptions;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ConnectionOptions by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
ConnectionOptions toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldSsid = clazz->getField<jni::JString>("ssid");
|
|
36
|
+
jni::local_ref<jni::JString> ssid = this->getFieldValue(fieldSsid);
|
|
37
|
+
static const auto fieldPassword = clazz->getField<jni::JString>("password");
|
|
38
|
+
jni::local_ref<jni::JString> password = this->getFieldValue(fieldPassword);
|
|
39
|
+
static const auto fieldIsWEP = clazz->getField<jni::JBoolean>("isWEP");
|
|
40
|
+
jni::local_ref<jni::JBoolean> isWEP = this->getFieldValue(fieldIsWEP);
|
|
41
|
+
return ConnectionOptions(
|
|
42
|
+
ssid->toStdString(),
|
|
43
|
+
password != nullptr ? std::make_optional(password->toStdString()) : std::nullopt,
|
|
44
|
+
isWEP != nullptr ? std::make_optional(static_cast<bool>(isWEP->value())) : std::nullopt
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
51
|
+
*/
|
|
52
|
+
[[maybe_unused]]
|
|
53
|
+
static jni::local_ref<JConnectionOptions::javaobject> fromCpp(const ConnectionOptions& value) {
|
|
54
|
+
using JSignature = JConnectionOptions(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>);
|
|
55
|
+
static const auto clazz = javaClassStatic();
|
|
56
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
57
|
+
return create(
|
|
58
|
+
clazz,
|
|
59
|
+
jni::make_jstring(value.ssid),
|
|
60
|
+
value.password.has_value() ? jni::make_jstring(value.password.value()) : nullptr,
|
|
61
|
+
value.isWEP.has_value() ? jni::JBoolean::valueOf(value.isWEP.value()) : nullptr
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JCurrentNetworkInfo.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "CurrentNetworkInfo.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
#include <vector>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::munimwifi {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The C++ JNI bridge between the C++ struct "CurrentNetworkInfo" and the the Kotlin data class "CurrentNetworkInfo".
|
|
23
|
+
*/
|
|
24
|
+
struct JCurrentNetworkInfo final: public jni::JavaClass<JCurrentNetworkInfo> {
|
|
25
|
+
public:
|
|
26
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/CurrentNetworkInfo;";
|
|
27
|
+
|
|
28
|
+
public:
|
|
29
|
+
/**
|
|
30
|
+
* Convert this Java/Kotlin-based struct to the C++ struct CurrentNetworkInfo by copying all values to C++.
|
|
31
|
+
*/
|
|
32
|
+
[[maybe_unused]]
|
|
33
|
+
[[nodiscard]]
|
|
34
|
+
CurrentNetworkInfo toCpp() const {
|
|
35
|
+
static const auto clazz = javaClassStatic();
|
|
36
|
+
static const auto fieldSsid = clazz->getField<jni::JString>("ssid");
|
|
37
|
+
jni::local_ref<jni::JString> ssid = this->getFieldValue(fieldSsid);
|
|
38
|
+
static const auto fieldBssid = clazz->getField<jni::JString>("bssid");
|
|
39
|
+
jni::local_ref<jni::JString> bssid = this->getFieldValue(fieldBssid);
|
|
40
|
+
static const auto fieldIpAddress = clazz->getField<jni::JString>("ipAddress");
|
|
41
|
+
jni::local_ref<jni::JString> ipAddress = this->getFieldValue(fieldIpAddress);
|
|
42
|
+
static const auto fieldSubnetMask = clazz->getField<jni::JString>("subnetMask");
|
|
43
|
+
jni::local_ref<jni::JString> subnetMask = this->getFieldValue(fieldSubnetMask);
|
|
44
|
+
static const auto fieldGateway = clazz->getField<jni::JString>("gateway");
|
|
45
|
+
jni::local_ref<jni::JString> gateway = this->getFieldValue(fieldGateway);
|
|
46
|
+
static const auto fieldDnsServers = clazz->getField<jni::JArrayClass<jni::JString>>("dnsServers");
|
|
47
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> dnsServers = this->getFieldValue(fieldDnsServers);
|
|
48
|
+
return CurrentNetworkInfo(
|
|
49
|
+
ssid->toStdString(),
|
|
50
|
+
bssid->toStdString(),
|
|
51
|
+
ipAddress != nullptr ? std::make_optional(ipAddress->toStdString()) : std::nullopt,
|
|
52
|
+
subnetMask != nullptr ? std::make_optional(subnetMask->toStdString()) : std::nullopt,
|
|
53
|
+
gateway != nullptr ? std::make_optional(gateway->toStdString()) : std::nullopt,
|
|
54
|
+
dnsServers != nullptr ? std::make_optional([&]() {
|
|
55
|
+
size_t __size = dnsServers->size();
|
|
56
|
+
std::vector<std::string> __vector;
|
|
57
|
+
__vector.reserve(__size);
|
|
58
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
59
|
+
auto __element = dnsServers->getElement(__i);
|
|
60
|
+
__vector.push_back(__element->toStdString());
|
|
61
|
+
}
|
|
62
|
+
return __vector;
|
|
63
|
+
}()) : std::nullopt
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
public:
|
|
68
|
+
/**
|
|
69
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
70
|
+
*/
|
|
71
|
+
[[maybe_unused]]
|
|
72
|
+
static jni::local_ref<JCurrentNetworkInfo::javaobject> fromCpp(const CurrentNetworkInfo& value) {
|
|
73
|
+
using JSignature = JCurrentNetworkInfo(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JArrayClass<jni::JString>>);
|
|
74
|
+
static const auto clazz = javaClassStatic();
|
|
75
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
76
|
+
return create(
|
|
77
|
+
clazz,
|
|
78
|
+
jni::make_jstring(value.ssid),
|
|
79
|
+
jni::make_jstring(value.bssid),
|
|
80
|
+
value.ipAddress.has_value() ? jni::make_jstring(value.ipAddress.value()) : nullptr,
|
|
81
|
+
value.subnetMask.has_value() ? jni::make_jstring(value.subnetMask.value()) : nullptr,
|
|
82
|
+
value.gateway.has_value() ? jni::make_jstring(value.gateway.value()) : nullptr,
|
|
83
|
+
value.dnsServers.has_value() ? [&]() {
|
|
84
|
+
size_t __size = value.dnsServers.value().size();
|
|
85
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
86
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
87
|
+
const auto& __element = value.dnsServers.value()[__i];
|
|
88
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
89
|
+
__array->setElement(__i, *__elementJni);
|
|
90
|
+
}
|
|
91
|
+
return __array;
|
|
92
|
+
}() : nullptr
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -15,8 +15,12 @@ namespace margelo::nitro::munimwifi { struct WifiFingerprint; }
|
|
|
15
15
|
namespace margelo::nitro::munimwifi { struct Location; }
|
|
16
16
|
// Forward declaration of `ChannelInfo` to properly resolve imports.
|
|
17
17
|
namespace margelo::nitro::munimwifi { struct ChannelInfo; }
|
|
18
|
+
// Forward declaration of `CurrentNetworkInfo` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::munimwifi { struct CurrentNetworkInfo; }
|
|
18
20
|
// Forward declaration of `ScanOptions` to properly resolve imports.
|
|
19
21
|
namespace margelo::nitro::munimwifi { struct ScanOptions; }
|
|
22
|
+
// Forward declaration of `ConnectionOptions` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::munimwifi { struct ConnectionOptions; }
|
|
20
24
|
|
|
21
25
|
#include <NitroModules/Promise.hpp>
|
|
22
26
|
#include <NitroModules/JPromise.hpp>
|
|
@@ -38,8 +42,14 @@ namespace margelo::nitro::munimwifi { struct ScanOptions; }
|
|
|
38
42
|
#include "JVariant_NullType_ChannelInfo.hpp"
|
|
39
43
|
#include "JChannelInfo.hpp"
|
|
40
44
|
#include "JVariant_NullType_WifiNetwork.hpp"
|
|
45
|
+
#include "CurrentNetworkInfo.hpp"
|
|
46
|
+
#include "JVariant_NullType_CurrentNetworkInfo.hpp"
|
|
47
|
+
#include "JCurrentNetworkInfo.hpp"
|
|
48
|
+
#include <NitroModules/JUnit.hpp>
|
|
41
49
|
#include "ScanOptions.hpp"
|
|
42
50
|
#include "JScanOptions.hpp"
|
|
51
|
+
#include "ConnectionOptions.hpp"
|
|
52
|
+
#include "JConnectionOptions.hpp"
|
|
43
53
|
|
|
44
54
|
namespace margelo::nitro::munimwifi {
|
|
45
55
|
|
|
@@ -250,6 +260,68 @@ namespace margelo::nitro::munimwifi {
|
|
|
250
260
|
return __promise;
|
|
251
261
|
}();
|
|
252
262
|
}
|
|
263
|
+
std::shared_ptr<Promise<std::variant<nitro::NullType, CurrentNetworkInfo>>> JHybridMunimWifiSpec::getCurrentNetwork() {
|
|
264
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getCurrentNetwork");
|
|
265
|
+
auto __result = method(_javaPart);
|
|
266
|
+
return [&]() {
|
|
267
|
+
auto __promise = Promise<std::variant<nitro::NullType, CurrentNetworkInfo>>::create();
|
|
268
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
269
|
+
auto __result = jni::static_ref_cast<JVariant_NullType_CurrentNetworkInfo>(__boxedResult);
|
|
270
|
+
__promise->resolve(__result->toCpp());
|
|
271
|
+
});
|
|
272
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
273
|
+
jni::JniException __jniError(__throwable);
|
|
274
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
275
|
+
});
|
|
276
|
+
return __promise;
|
|
277
|
+
}();
|
|
278
|
+
}
|
|
279
|
+
std::shared_ptr<Promise<void>> JHybridMunimWifiSpec::connectToNetwork(const ConnectionOptions& options) {
|
|
280
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JConnectionOptions> /* options */)>("connectToNetwork");
|
|
281
|
+
auto __result = method(_javaPart, JConnectionOptions::fromCpp(options));
|
|
282
|
+
return [&]() {
|
|
283
|
+
auto __promise = Promise<void>::create();
|
|
284
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
285
|
+
__promise->resolve();
|
|
286
|
+
});
|
|
287
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
288
|
+
jni::JniException __jniError(__throwable);
|
|
289
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
290
|
+
});
|
|
291
|
+
return __promise;
|
|
292
|
+
}();
|
|
293
|
+
}
|
|
294
|
+
std::shared_ptr<Promise<void>> JHybridMunimWifiSpec::disconnect() {
|
|
295
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("disconnect");
|
|
296
|
+
auto __result = method(_javaPart);
|
|
297
|
+
return [&]() {
|
|
298
|
+
auto __promise = Promise<void>::create();
|
|
299
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
300
|
+
__promise->resolve();
|
|
301
|
+
});
|
|
302
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
303
|
+
jni::JniException __jniError(__throwable);
|
|
304
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
305
|
+
});
|
|
306
|
+
return __promise;
|
|
307
|
+
}();
|
|
308
|
+
}
|
|
309
|
+
std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> JHybridMunimWifiSpec::getIPAddress() {
|
|
310
|
+
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getIPAddress");
|
|
311
|
+
auto __result = method(_javaPart);
|
|
312
|
+
return [&]() {
|
|
313
|
+
auto __promise = Promise<std::variant<nitro::NullType, std::string>>::create();
|
|
314
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
315
|
+
auto __result = jni::static_ref_cast<JVariant_NullType_String>(__boxedResult);
|
|
316
|
+
__promise->resolve(__result->toCpp());
|
|
317
|
+
});
|
|
318
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
319
|
+
jni::JniException __jniError(__throwable);
|
|
320
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
321
|
+
});
|
|
322
|
+
return __promise;
|
|
323
|
+
}();
|
|
324
|
+
}
|
|
253
325
|
void JHybridMunimWifiSpec::addListener(const std::string& eventName) {
|
|
254
326
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* eventName */)>("addListener");
|
|
255
327
|
method(_javaPart, jni::make_jstring(eventName));
|
|
@@ -66,6 +66,10 @@ namespace margelo::nitro::munimwifi {
|
|
|
66
66
|
std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> getBSSID(const std::string& ssid) override;
|
|
67
67
|
std::shared_ptr<Promise<std::variant<nitro::NullType, ChannelInfo>>> getChannelInfo(const std::string& ssid) override;
|
|
68
68
|
std::shared_ptr<Promise<std::variant<nitro::NullType, WifiNetwork>>> getNetworkInfo(const std::string& ssid) override;
|
|
69
|
+
std::shared_ptr<Promise<std::variant<nitro::NullType, CurrentNetworkInfo>>> getCurrentNetwork() override;
|
|
70
|
+
std::shared_ptr<Promise<void>> connectToNetwork(const ConnectionOptions& options) override;
|
|
71
|
+
std::shared_ptr<Promise<void>> disconnect() override;
|
|
72
|
+
std::shared_ptr<Promise<std::variant<nitro::NullType, std::string>>> getIPAddress() override;
|
|
69
73
|
void addListener(const std::string& eventName) override;
|
|
70
74
|
void removeListeners(double count) override;
|
|
71
75
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_CurrentNetworkInfo.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 "JVariant_NullType_CurrentNetworkInfo.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::munimwifi {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JVariant_NullType_CurrentNetworkInfo to std::variant<nitro::NullType, CurrentNetworkInfo>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<nitro::NullType, CurrentNetworkInfo> JVariant_NullType_CurrentNetworkInfo::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JVariant_NullType_CurrentNetworkInfo_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `nitro::NullType`
|
|
17
|
+
auto jniValue = static_cast<const JVariant_NullType_CurrentNetworkInfo_impl::First*>(this)->getValue();
|
|
18
|
+
return nitro::null;
|
|
19
|
+
} else if (isInstanceOf(JVariant_NullType_CurrentNetworkInfo_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `CurrentNetworkInfo`
|
|
21
|
+
auto jniValue = static_cast<const JVariant_NullType_CurrentNetworkInfo_impl::Second*>(this)->getValue();
|
|
22
|
+
return jniValue->toCpp();
|
|
23
|
+
}
|
|
24
|
+
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
+
}
|
|
26
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_CurrentNetworkInfo.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
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <variant>
|
|
12
|
+
|
|
13
|
+
#include <NitroModules/Null.hpp>
|
|
14
|
+
#include "CurrentNetworkInfo.hpp"
|
|
15
|
+
#include <variant>
|
|
16
|
+
#include <NitroModules/JNull.hpp>
|
|
17
|
+
#include "JCurrentNetworkInfo.hpp"
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
#include <vector>
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::munimwifi {
|
|
23
|
+
|
|
24
|
+
using namespace facebook;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_CurrentNetworkInfo".
|
|
28
|
+
*/
|
|
29
|
+
class JVariant_NullType_CurrentNetworkInfo: public jni::JavaClass<JVariant_NullType_CurrentNetworkInfo> {
|
|
30
|
+
public:
|
|
31
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_CurrentNetworkInfo;";
|
|
32
|
+
|
|
33
|
+
static jni::local_ref<JVariant_NullType_CurrentNetworkInfo> create_0(jni::alias_ref<JNull> value) {
|
|
34
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_CurrentNetworkInfo(jni::alias_ref<JNull>)>("create");
|
|
35
|
+
return method(javaClassStatic(), value);
|
|
36
|
+
}
|
|
37
|
+
static jni::local_ref<JVariant_NullType_CurrentNetworkInfo> create_1(jni::alias_ref<JCurrentNetworkInfo> value) {
|
|
38
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_CurrentNetworkInfo(jni::alias_ref<JCurrentNetworkInfo>)>("create");
|
|
39
|
+
return method(javaClassStatic(), value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static jni::local_ref<JVariant_NullType_CurrentNetworkInfo> fromCpp(const std::variant<nitro::NullType, CurrentNetworkInfo>& variant) {
|
|
43
|
+
switch (variant.index()) {
|
|
44
|
+
case 0: return create_0(JNull::null());
|
|
45
|
+
case 1: return create_1(JCurrentNetworkInfo::fromCpp(std::get<1>(variant)));
|
|
46
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
[[nodiscard]] std::variant<nitro::NullType, CurrentNetworkInfo> toCpp() const;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
namespace JVariant_NullType_CurrentNetworkInfo_impl {
|
|
54
|
+
class First final: public jni::JavaClass<First, JVariant_NullType_CurrentNetworkInfo> {
|
|
55
|
+
public:
|
|
56
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_CurrentNetworkInfo$First;";
|
|
57
|
+
|
|
58
|
+
[[nodiscard]] jni::local_ref<JNull> getValue() const {
|
|
59
|
+
static const auto field = javaClassStatic()->getField<JNull>("value");
|
|
60
|
+
return getFieldValue(field);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
class Second final: public jni::JavaClass<Second, JVariant_NullType_CurrentNetworkInfo> {
|
|
65
|
+
public:
|
|
66
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_CurrentNetworkInfo$Second;";
|
|
67
|
+
|
|
68
|
+
[[nodiscard]] jni::local_ref<JCurrentNetworkInfo> getValue() const {
|
|
69
|
+
static const auto field = javaClassStatic()->getField<JCurrentNetworkInfo>("value");
|
|
70
|
+
return getFieldValue(field);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
} // namespace JVariant_NullType_CurrentNetworkInfo_impl
|
|
74
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -36,10 +36,10 @@ namespace margelo::nitro::munimwifi {
|
|
|
36
36
|
jni::local_ref<jni::JString> ssid = this->getFieldValue(fieldSsid);
|
|
37
37
|
static const auto fieldBssid = clazz->getField<jni::JString>("bssid");
|
|
38
38
|
jni::local_ref<jni::JString> bssid = this->getFieldValue(fieldBssid);
|
|
39
|
-
static const auto fieldRssi = clazz->getField<
|
|
40
|
-
|
|
41
|
-
static const auto fieldFrequency = clazz->getField<
|
|
42
|
-
|
|
39
|
+
static const auto fieldRssi = clazz->getField<jni::JDouble>("rssi");
|
|
40
|
+
jni::local_ref<jni::JDouble> rssi = this->getFieldValue(fieldRssi);
|
|
41
|
+
static const auto fieldFrequency = clazz->getField<jni::JDouble>("frequency");
|
|
42
|
+
jni::local_ref<jni::JDouble> frequency = this->getFieldValue(fieldFrequency);
|
|
43
43
|
static const auto fieldChannel = clazz->getField<jni::JDouble>("channel");
|
|
44
44
|
jni::local_ref<jni::JDouble> channel = this->getFieldValue(fieldChannel);
|
|
45
45
|
static const auto fieldCapabilities = clazz->getField<jni::JString>("capabilities");
|
|
@@ -51,8 +51,8 @@ namespace margelo::nitro::munimwifi {
|
|
|
51
51
|
return WifiNetwork(
|
|
52
52
|
ssid->toStdString(),
|
|
53
53
|
bssid->toStdString(),
|
|
54
|
-
rssi,
|
|
55
|
-
frequency,
|
|
54
|
+
rssi != nullptr ? std::make_optional(rssi->value()) : std::nullopt,
|
|
55
|
+
frequency != nullptr ? std::make_optional(frequency->value()) : std::nullopt,
|
|
56
56
|
channel != nullptr ? std::make_optional(channel->value()) : std::nullopt,
|
|
57
57
|
capabilities != nullptr ? std::make_optional(capabilities->toStdString()) : std::nullopt,
|
|
58
58
|
isSecure != nullptr ? std::make_optional(static_cast<bool>(isSecure->value())) : std::nullopt,
|
|
@@ -66,15 +66,15 @@ namespace margelo::nitro::munimwifi {
|
|
|
66
66
|
*/
|
|
67
67
|
[[maybe_unused]]
|
|
68
68
|
static jni::local_ref<JWifiNetwork::javaobject> fromCpp(const WifiNetwork& value) {
|
|
69
|
-
using JSignature = JWifiNetwork(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>,
|
|
69
|
+
using JSignature = JWifiNetwork(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>);
|
|
70
70
|
static const auto clazz = javaClassStatic();
|
|
71
71
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
72
72
|
return create(
|
|
73
73
|
clazz,
|
|
74
74
|
jni::make_jstring(value.ssid),
|
|
75
75
|
jni::make_jstring(value.bssid),
|
|
76
|
-
value.rssi,
|
|
77
|
-
value.frequency,
|
|
76
|
+
value.rssi.has_value() ? jni::JDouble::valueOf(value.rssi.value()) : nullptr,
|
|
77
|
+
value.frequency.has_value() ? jni::JDouble::valueOf(value.frequency.value()) : nullptr,
|
|
78
78
|
value.channel.has_value() ? jni::JDouble::valueOf(value.channel.value()) : nullptr,
|
|
79
79
|
value.capabilities.has_value() ? jni::make_jstring(value.capabilities.value()) : nullptr,
|
|
80
80
|
value.isSecure.has_value() ? jni::JBoolean::valueOf(value.isSecure.value()) : nullptr,
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ConnectionOptions.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.munimwifi
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "ConnectionOptions".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ConnectionOptions(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val ssid: String,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val password: String?,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val isWEP: Boolean?
|
|
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(ssid: String, password: String?, isWEP: Boolean?): ConnectionOptions {
|
|
41
|
+
return ConnectionOptions(ssid, password, isWEP)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CurrentNetworkInfo.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.munimwifi
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Represents the JavaScript object/struct "CurrentNetworkInfo".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class CurrentNetworkInfo(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val ssid: String,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val bssid: String,
|
|
26
|
+
@DoNotStrip
|
|
27
|
+
@Keep
|
|
28
|
+
val ipAddress: String?,
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
val subnetMask: String?,
|
|
32
|
+
@DoNotStrip
|
|
33
|
+
@Keep
|
|
34
|
+
val gateway: String?,
|
|
35
|
+
@DoNotStrip
|
|
36
|
+
@Keep
|
|
37
|
+
val dnsServers: Array<String>?
|
|
38
|
+
) {
|
|
39
|
+
/* primary constructor */
|
|
40
|
+
|
|
41
|
+
companion object {
|
|
42
|
+
/**
|
|
43
|
+
* Constructor called from C++
|
|
44
|
+
*/
|
|
45
|
+
@DoNotStrip
|
|
46
|
+
@Keep
|
|
47
|
+
@Suppress("unused")
|
|
48
|
+
@JvmStatic
|
|
49
|
+
private fun fromCpp(ssid: String, bssid: String, ipAddress: String?, subnetMask: String?, gateway: String?, dnsServers: Array<String>?): CurrentNetworkInfo {
|
|
50
|
+
return CurrentNetworkInfo(ssid, bssid, ipAddress, subnetMask, gateway, dnsServers)
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/munimwifi/HybridMunimWifiSpec.kt
CHANGED
|
@@ -91,6 +91,22 @@ abstract class HybridMunimWifiSpec: HybridObject() {
|
|
|
91
91
|
@Keep
|
|
92
92
|
abstract fun getNetworkInfo(ssid: String): Promise<Variant_NullType_WifiNetwork>
|
|
93
93
|
|
|
94
|
+
@DoNotStrip
|
|
95
|
+
@Keep
|
|
96
|
+
abstract fun getCurrentNetwork(): Promise<Variant_NullType_CurrentNetworkInfo>
|
|
97
|
+
|
|
98
|
+
@DoNotStrip
|
|
99
|
+
@Keep
|
|
100
|
+
abstract fun connectToNetwork(options: ConnectionOptions): Promise<Unit>
|
|
101
|
+
|
|
102
|
+
@DoNotStrip
|
|
103
|
+
@Keep
|
|
104
|
+
abstract fun disconnect(): Promise<Unit>
|
|
105
|
+
|
|
106
|
+
@DoNotStrip
|
|
107
|
+
@Keep
|
|
108
|
+
abstract fun getIPAddress(): Promise<Variant_NullType_String>
|
|
109
|
+
|
|
94
110
|
@DoNotStrip
|
|
95
111
|
@Keep
|
|
96
112
|
abstract fun addListener(eventName: String): Unit
|