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,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_String.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_String.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::munimwifi {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JVariant_NullType_String to std::variant<nitro::NullType, std::string>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<nitro::NullType, std::string> JVariant_NullType_String::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JVariant_NullType_String_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `nitro::NullType`
|
|
17
|
+
auto jniValue = static_cast<const JVariant_NullType_String_impl::First*>(this)->getValue();
|
|
18
|
+
return nitro::null;
|
|
19
|
+
} else if (isInstanceOf(JVariant_NullType_String_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `std::string`
|
|
21
|
+
auto jniValue = static_cast<const JVariant_NullType_String_impl::Second*>(this)->getValue();
|
|
22
|
+
return jniValue->toStdString();
|
|
23
|
+
}
|
|
24
|
+
throw std::invalid_argument("Variant is unknown Kotlin instance!");
|
|
25
|
+
}
|
|
26
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_String.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 <string>
|
|
15
|
+
#include <variant>
|
|
16
|
+
#include <NitroModules/JNull.hpp>
|
|
17
|
+
|
|
18
|
+
namespace margelo::nitro::munimwifi {
|
|
19
|
+
|
|
20
|
+
using namespace facebook;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_String".
|
|
24
|
+
*/
|
|
25
|
+
class JVariant_NullType_String: public jni::JavaClass<JVariant_NullType_String> {
|
|
26
|
+
public:
|
|
27
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_String;";
|
|
28
|
+
|
|
29
|
+
static jni::local_ref<JVariant_NullType_String> create_0(jni::alias_ref<JNull> value) {
|
|
30
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_String(jni::alias_ref<JNull>)>("create");
|
|
31
|
+
return method(javaClassStatic(), value);
|
|
32
|
+
}
|
|
33
|
+
static jni::local_ref<JVariant_NullType_String> create_1(jni::alias_ref<jni::JString> value) {
|
|
34
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_String(jni::alias_ref<jni::JString>)>("create");
|
|
35
|
+
return method(javaClassStatic(), value);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static jni::local_ref<JVariant_NullType_String> fromCpp(const std::variant<nitro::NullType, std::string>& variant) {
|
|
39
|
+
switch (variant.index()) {
|
|
40
|
+
case 0: return create_0(JNull::null());
|
|
41
|
+
case 1: return create_1(jni::make_jstring(std::get<1>(variant)));
|
|
42
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
[[nodiscard]] std::variant<nitro::NullType, std::string> toCpp() const;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
namespace JVariant_NullType_String_impl {
|
|
50
|
+
class First final: public jni::JavaClass<First, JVariant_NullType_String> {
|
|
51
|
+
public:
|
|
52
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_String$First;";
|
|
53
|
+
|
|
54
|
+
[[nodiscard]] jni::local_ref<JNull> getValue() const {
|
|
55
|
+
static const auto field = javaClassStatic()->getField<JNull>("value");
|
|
56
|
+
return getFieldValue(field);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
class Second final: public jni::JavaClass<Second, JVariant_NullType_String> {
|
|
61
|
+
public:
|
|
62
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_String$Second;";
|
|
63
|
+
|
|
64
|
+
[[nodiscard]] jni::local_ref<jni::JString> getValue() const {
|
|
65
|
+
static const auto field = javaClassStatic()->getField<jni::JString>("value");
|
|
66
|
+
return getFieldValue(field);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
} // namespace JVariant_NullType_String_impl
|
|
70
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_WifiNetwork.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_WifiNetwork.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::munimwifi {
|
|
11
|
+
/**
|
|
12
|
+
* Converts JVariant_NullType_WifiNetwork to std::variant<nitro::NullType, WifiNetwork>
|
|
13
|
+
*/
|
|
14
|
+
std::variant<nitro::NullType, WifiNetwork> JVariant_NullType_WifiNetwork::toCpp() const {
|
|
15
|
+
if (isInstanceOf(JVariant_NullType_WifiNetwork_impl::First::javaClassStatic())) {
|
|
16
|
+
// It's a `nitro::NullType`
|
|
17
|
+
auto jniValue = static_cast<const JVariant_NullType_WifiNetwork_impl::First*>(this)->getValue();
|
|
18
|
+
return nitro::null;
|
|
19
|
+
} else if (isInstanceOf(JVariant_NullType_WifiNetwork_impl::Second::javaClassStatic())) {
|
|
20
|
+
// It's a `WifiNetwork`
|
|
21
|
+
auto jniValue = static_cast<const JVariant_NullType_WifiNetwork_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,73 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JVariant_NullType_WifiNetwork.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 "WifiNetwork.hpp"
|
|
15
|
+
#include <variant>
|
|
16
|
+
#include <NitroModules/JNull.hpp>
|
|
17
|
+
#include "JWifiNetwork.hpp"
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <optional>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::munimwifi {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_WifiNetwork".
|
|
27
|
+
*/
|
|
28
|
+
class JVariant_NullType_WifiNetwork: public jni::JavaClass<JVariant_NullType_WifiNetwork> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_WifiNetwork;";
|
|
31
|
+
|
|
32
|
+
static jni::local_ref<JVariant_NullType_WifiNetwork> create_0(jni::alias_ref<JNull> value) {
|
|
33
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_WifiNetwork(jni::alias_ref<JNull>)>("create");
|
|
34
|
+
return method(javaClassStatic(), value);
|
|
35
|
+
}
|
|
36
|
+
static jni::local_ref<JVariant_NullType_WifiNetwork> create_1(jni::alias_ref<JWifiNetwork> value) {
|
|
37
|
+
static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_WifiNetwork(jni::alias_ref<JWifiNetwork>)>("create");
|
|
38
|
+
return method(javaClassStatic(), value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static jni::local_ref<JVariant_NullType_WifiNetwork> fromCpp(const std::variant<nitro::NullType, WifiNetwork>& variant) {
|
|
42
|
+
switch (variant.index()) {
|
|
43
|
+
case 0: return create_0(JNull::null());
|
|
44
|
+
case 1: return create_1(JWifiNetwork::fromCpp(std::get<1>(variant)));
|
|
45
|
+
default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[[nodiscard]] std::variant<nitro::NullType, WifiNetwork> toCpp() const;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
namespace JVariant_NullType_WifiNetwork_impl {
|
|
53
|
+
class First final: public jni::JavaClass<First, JVariant_NullType_WifiNetwork> {
|
|
54
|
+
public:
|
|
55
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_WifiNetwork$First;";
|
|
56
|
+
|
|
57
|
+
[[nodiscard]] jni::local_ref<JNull> getValue() const {
|
|
58
|
+
static const auto field = javaClassStatic()->getField<JNull>("value");
|
|
59
|
+
return getFieldValue(field);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
class Second final: public jni::JavaClass<Second, JVariant_NullType_WifiNetwork> {
|
|
64
|
+
public:
|
|
65
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/Variant_NullType_WifiNetwork$Second;";
|
|
66
|
+
|
|
67
|
+
[[nodiscard]] jni::local_ref<JWifiNetwork> getValue() const {
|
|
68
|
+
static const auto field = javaClassStatic()->getField<JWifiNetwork>("value");
|
|
69
|
+
return getFieldValue(field);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
} // namespace JVariant_NullType_WifiNetwork_impl
|
|
73
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JWifiFingerprint.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 "WifiFingerprint.hpp"
|
|
12
|
+
|
|
13
|
+
#include "JLocation.hpp"
|
|
14
|
+
#include "JWifiNetwork.hpp"
|
|
15
|
+
#include "Location.hpp"
|
|
16
|
+
#include "WifiNetwork.hpp"
|
|
17
|
+
#include <optional>
|
|
18
|
+
#include <string>
|
|
19
|
+
#include <vector>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::munimwifi {
|
|
22
|
+
|
|
23
|
+
using namespace facebook;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The C++ JNI bridge between the C++ struct "WifiFingerprint" and the the Kotlin data class "WifiFingerprint".
|
|
27
|
+
*/
|
|
28
|
+
struct JWifiFingerprint final: public jni::JavaClass<JWifiFingerprint> {
|
|
29
|
+
public:
|
|
30
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/WifiFingerprint;";
|
|
31
|
+
|
|
32
|
+
public:
|
|
33
|
+
/**
|
|
34
|
+
* Convert this Java/Kotlin-based struct to the C++ struct WifiFingerprint by copying all values to C++.
|
|
35
|
+
*/
|
|
36
|
+
[[maybe_unused]]
|
|
37
|
+
[[nodiscard]]
|
|
38
|
+
WifiFingerprint toCpp() const {
|
|
39
|
+
static const auto clazz = javaClassStatic();
|
|
40
|
+
static const auto fieldNetworks = clazz->getField<jni::JArrayClass<JWifiNetwork>>("networks");
|
|
41
|
+
jni::local_ref<jni::JArrayClass<JWifiNetwork>> networks = this->getFieldValue(fieldNetworks);
|
|
42
|
+
static const auto fieldTimestamp = clazz->getField<double>("timestamp");
|
|
43
|
+
double timestamp = this->getFieldValue(fieldTimestamp);
|
|
44
|
+
static const auto fieldLocation = clazz->getField<JLocation>("location");
|
|
45
|
+
jni::local_ref<JLocation> location = this->getFieldValue(fieldLocation);
|
|
46
|
+
return WifiFingerprint(
|
|
47
|
+
[&]() {
|
|
48
|
+
size_t __size = networks->size();
|
|
49
|
+
std::vector<WifiNetwork> __vector;
|
|
50
|
+
__vector.reserve(__size);
|
|
51
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
52
|
+
auto __element = networks->getElement(__i);
|
|
53
|
+
__vector.push_back(__element->toCpp());
|
|
54
|
+
}
|
|
55
|
+
return __vector;
|
|
56
|
+
}(),
|
|
57
|
+
timestamp,
|
|
58
|
+
location != nullptr ? std::make_optional(location->toCpp()) : std::nullopt
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
/**
|
|
64
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
65
|
+
*/
|
|
66
|
+
[[maybe_unused]]
|
|
67
|
+
static jni::local_ref<JWifiFingerprint::javaobject> fromCpp(const WifiFingerprint& value) {
|
|
68
|
+
using JSignature = JWifiFingerprint(jni::alias_ref<jni::JArrayClass<JWifiNetwork>>, double, jni::alias_ref<JLocation>);
|
|
69
|
+
static const auto clazz = javaClassStatic();
|
|
70
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
71
|
+
return create(
|
|
72
|
+
clazz,
|
|
73
|
+
[&]() {
|
|
74
|
+
size_t __size = value.networks.size();
|
|
75
|
+
jni::local_ref<jni::JArrayClass<JWifiNetwork>> __array = jni::JArrayClass<JWifiNetwork>::newArray(__size);
|
|
76
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
77
|
+
const auto& __element = value.networks[__i];
|
|
78
|
+
auto __elementJni = JWifiNetwork::fromCpp(__element);
|
|
79
|
+
__array->setElement(__i, *__elementJni);
|
|
80
|
+
}
|
|
81
|
+
return __array;
|
|
82
|
+
}(),
|
|
83
|
+
value.timestamp,
|
|
84
|
+
value.location.has_value() ? JLocation::fromCpp(value.location.value()) : nullptr
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JWifiNetwork.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 "WifiNetwork.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 "WifiNetwork" and the the Kotlin data class "WifiNetwork".
|
|
22
|
+
*/
|
|
23
|
+
struct JWifiNetwork final: public jni::JavaClass<JWifiNetwork> {
|
|
24
|
+
public:
|
|
25
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/munimwifi/WifiNetwork;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct WifiNetwork by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
WifiNetwork 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 fieldBssid = clazz->getField<jni::JString>("bssid");
|
|
38
|
+
jni::local_ref<jni::JString> bssid = this->getFieldValue(fieldBssid);
|
|
39
|
+
static const auto fieldRssi = clazz->getField<double>("rssi");
|
|
40
|
+
double rssi = this->getFieldValue(fieldRssi);
|
|
41
|
+
static const auto fieldFrequency = clazz->getField<double>("frequency");
|
|
42
|
+
double frequency = this->getFieldValue(fieldFrequency);
|
|
43
|
+
static const auto fieldChannel = clazz->getField<jni::JDouble>("channel");
|
|
44
|
+
jni::local_ref<jni::JDouble> channel = this->getFieldValue(fieldChannel);
|
|
45
|
+
static const auto fieldCapabilities = clazz->getField<jni::JString>("capabilities");
|
|
46
|
+
jni::local_ref<jni::JString> capabilities = this->getFieldValue(fieldCapabilities);
|
|
47
|
+
static const auto fieldIsSecure = clazz->getField<jni::JBoolean>("isSecure");
|
|
48
|
+
jni::local_ref<jni::JBoolean> isSecure = this->getFieldValue(fieldIsSecure);
|
|
49
|
+
static const auto fieldTimestamp = clazz->getField<jni::JDouble>("timestamp");
|
|
50
|
+
jni::local_ref<jni::JDouble> timestamp = this->getFieldValue(fieldTimestamp);
|
|
51
|
+
return WifiNetwork(
|
|
52
|
+
ssid->toStdString(),
|
|
53
|
+
bssid->toStdString(),
|
|
54
|
+
rssi,
|
|
55
|
+
frequency,
|
|
56
|
+
channel != nullptr ? std::make_optional(channel->value()) : std::nullopt,
|
|
57
|
+
capabilities != nullptr ? std::make_optional(capabilities->toStdString()) : std::nullopt,
|
|
58
|
+
isSecure != nullptr ? std::make_optional(static_cast<bool>(isSecure->value())) : std::nullopt,
|
|
59
|
+
timestamp != nullptr ? std::make_optional(timestamp->value()) : std::nullopt
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
/**
|
|
65
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
66
|
+
*/
|
|
67
|
+
[[maybe_unused]]
|
|
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>, double, double, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>);
|
|
70
|
+
static const auto clazz = javaClassStatic();
|
|
71
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
72
|
+
return create(
|
|
73
|
+
clazz,
|
|
74
|
+
jni::make_jstring(value.ssid),
|
|
75
|
+
jni::make_jstring(value.bssid),
|
|
76
|
+
value.rssi,
|
|
77
|
+
value.frequency,
|
|
78
|
+
value.channel.has_value() ? jni::JDouble::valueOf(value.channel.value()) : nullptr,
|
|
79
|
+
value.capabilities.has_value() ? jni::make_jstring(value.capabilities.value()) : nullptr,
|
|
80
|
+
value.isSecure.has_value() ? jni::JBoolean::valueOf(value.isSecure.value()) : nullptr,
|
|
81
|
+
value.timestamp.has_value() ? jni::JDouble::valueOf(value.timestamp.value()) : nullptr
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // namespace margelo::nitro::munimwifi
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// ChannelInfo.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 "ChannelInfo".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class ChannelInfo(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val channel: Double,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val frequency: Double
|
|
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(channel: Double, frequency: Double): ChannelInfo {
|
|
38
|
+
return ChannelInfo(channel, frequency)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridMunimWifiSpec.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.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.Promise
|
|
14
|
+
import com.margelo.nitro.core.NullType
|
|
15
|
+
import com.margelo.nitro.core.HybridObject
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A Kotlin class representing the MunimWifi HybridObject.
|
|
19
|
+
* Implement this abstract class to create Kotlin-based instances of MunimWifi.
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress(
|
|
24
|
+
"KotlinJniMissingFunction", "unused",
|
|
25
|
+
"RedundantSuppression", "RedundantUnitReturnType", "SimpleRedundantLet",
|
|
26
|
+
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
27
|
+
)
|
|
28
|
+
abstract class HybridMunimWifiSpec: HybridObject() {
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
private var mHybridData: HybridData = initHybrid()
|
|
31
|
+
|
|
32
|
+
init {
|
|
33
|
+
super.updateNative(mHybridData)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
override fun updateNative(hybridData: HybridData) {
|
|
37
|
+
mHybridData = hybridData
|
|
38
|
+
super.updateNative(hybridData)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Default implementation of `HybridObject.toString()`
|
|
42
|
+
override fun toString(): String {
|
|
43
|
+
return "[HybridObject MunimWifi]"
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Properties
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
// Methods
|
|
50
|
+
@DoNotStrip
|
|
51
|
+
@Keep
|
|
52
|
+
abstract fun isWifiEnabled(): Promise<Boolean>
|
|
53
|
+
|
|
54
|
+
@DoNotStrip
|
|
55
|
+
@Keep
|
|
56
|
+
abstract fun requestWifiPermission(): Promise<Boolean>
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
abstract fun scanNetworks(options: ScanOptions?): Promise<Array<WifiNetwork>>
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
abstract fun startScan(options: ScanOptions?): Unit
|
|
65
|
+
|
|
66
|
+
@DoNotStrip
|
|
67
|
+
@Keep
|
|
68
|
+
abstract fun stopScan(): Unit
|
|
69
|
+
|
|
70
|
+
@DoNotStrip
|
|
71
|
+
@Keep
|
|
72
|
+
abstract fun getSSIDs(): Promise<Array<String>>
|
|
73
|
+
|
|
74
|
+
@DoNotStrip
|
|
75
|
+
@Keep
|
|
76
|
+
abstract fun getWifiFingerprint(): Promise<WifiFingerprint>
|
|
77
|
+
|
|
78
|
+
@DoNotStrip
|
|
79
|
+
@Keep
|
|
80
|
+
abstract fun getRSSI(ssid: String): Promise<Variant_NullType_Double>
|
|
81
|
+
|
|
82
|
+
@DoNotStrip
|
|
83
|
+
@Keep
|
|
84
|
+
abstract fun getBSSID(ssid: String): Promise<Variant_NullType_String>
|
|
85
|
+
|
|
86
|
+
@DoNotStrip
|
|
87
|
+
@Keep
|
|
88
|
+
abstract fun getChannelInfo(ssid: String): Promise<Variant_NullType_ChannelInfo>
|
|
89
|
+
|
|
90
|
+
@DoNotStrip
|
|
91
|
+
@Keep
|
|
92
|
+
abstract fun getNetworkInfo(ssid: String): Promise<Variant_NullType_WifiNetwork>
|
|
93
|
+
|
|
94
|
+
@DoNotStrip
|
|
95
|
+
@Keep
|
|
96
|
+
abstract fun addListener(eventName: String): Unit
|
|
97
|
+
|
|
98
|
+
@DoNotStrip
|
|
99
|
+
@Keep
|
|
100
|
+
abstract fun removeListeners(count: Double): Unit
|
|
101
|
+
|
|
102
|
+
private external fun initHybrid(): HybridData
|
|
103
|
+
|
|
104
|
+
companion object {
|
|
105
|
+
protected const val TAG = "HybridMunimWifiSpec"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Location.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 "Location".
|
|
16
|
+
*/
|
|
17
|
+
@DoNotStrip
|
|
18
|
+
@Keep
|
|
19
|
+
data class Location(
|
|
20
|
+
@DoNotStrip
|
|
21
|
+
@Keep
|
|
22
|
+
val latitude: Double?,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val longitude: Double?
|
|
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(latitude: Double?, longitude: Double?): Location {
|
|
38
|
+
return Location(latitude, longitude)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MunimWifiOnLoad.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 android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class MunimWifiOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "MunimWifiOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "MunimWifi".
|
|
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 MunimWifi C++ library...")
|
|
25
|
+
System.loadLibrary("MunimWifi")
|
|
26
|
+
Log.i(TAG, "Successfully loaded MunimWifi C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load MunimWifi 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,41 @@
|
|
|
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.munimwifi
|
|
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 maxResults: Double?,
|
|
23
|
+
@DoNotStrip
|
|
24
|
+
@Keep
|
|
25
|
+
val timeout: Double?
|
|
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(maxResults: Double?, timeout: Double?): ScanOptions {
|
|
38
|
+
return ScanOptions(maxResults, timeout)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|