simplejsble 0.0.55 → 0.0.56
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/apple/SimpleBLE.xcframework/Info.plist +4 -4
- package/apple/SimpleBLE.xcframework/ios-arm64/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/ios-arm64-simulator/libsimpleble.a +0 -0
- package/apple/SimpleBLE.xcframework/macos-arm64_x86_64/libsimpleble.a +0 -0
- package/cpp/HybridAdapter.cpp +12 -8
- package/cpp/HybridAdapter.hpp +3 -2
- package/lib/specs/Adapter.nitro.d.ts +4 -2
- package/lib/specs/Adapter.nitro.d.ts.map +1 -1
- package/nitrogen/generated/shared/c++/HybridAdapterSpec.hpp +3 -2
- package/package.json +1 -1
- package/src/specs/Adapter.nitro.ts +4 -2
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<key>HeadersPath</key>
|
|
28
28
|
<string>Headers</string>
|
|
29
29
|
<key>LibraryIdentifier</key>
|
|
30
|
-
<string>ios-arm64
|
|
30
|
+
<string>ios-arm64</string>
|
|
31
31
|
<key>LibraryPath</key>
|
|
32
32
|
<string>libsimpleble.a</string>
|
|
33
33
|
<key>SupportedArchitectures</key>
|
|
@@ -36,8 +36,6 @@
|
|
|
36
36
|
</array>
|
|
37
37
|
<key>SupportedPlatform</key>
|
|
38
38
|
<string>ios</string>
|
|
39
|
-
<key>SupportedPlatformVariant</key>
|
|
40
|
-
<string>simulator</string>
|
|
41
39
|
</dict>
|
|
42
40
|
<dict>
|
|
43
41
|
<key>BinaryPath</key>
|
|
@@ -45,7 +43,7 @@
|
|
|
45
43
|
<key>HeadersPath</key>
|
|
46
44
|
<string>Headers</string>
|
|
47
45
|
<key>LibraryIdentifier</key>
|
|
48
|
-
<string>ios-arm64</string>
|
|
46
|
+
<string>ios-arm64-simulator</string>
|
|
49
47
|
<key>LibraryPath</key>
|
|
50
48
|
<string>libsimpleble.a</string>
|
|
51
49
|
<key>SupportedArchitectures</key>
|
|
@@ -54,6 +52,8 @@
|
|
|
54
52
|
</array>
|
|
55
53
|
<key>SupportedPlatform</key>
|
|
56
54
|
<string>ios</string>
|
|
55
|
+
<key>SupportedPlatformVariant</key>
|
|
56
|
+
<string>simulator</string>
|
|
57
57
|
</dict>
|
|
58
58
|
</array>
|
|
59
59
|
<key>CFBundlePackageType</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/cpp/HybridAdapter.cpp
CHANGED
|
@@ -2,16 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
namespace margelo::nitro::simplejsble {
|
|
4
4
|
|
|
5
|
-
bool HybridAdapter::bluetooth_enabled() {
|
|
6
|
-
return
|
|
5
|
+
std::shared_ptr<Promise<bool>> HybridAdapter::bluetooth_enabled() {
|
|
6
|
+
return Promise<bool>::async([]() -> bool {
|
|
7
|
+
return SimpleBLE::Adapter::bluetooth_enabled();
|
|
8
|
+
});
|
|
7
9
|
}
|
|
8
10
|
|
|
9
|
-
std::vector<std::shared_ptr<HybridAdapterSpec
|
|
10
|
-
std::vector<std::shared_ptr<HybridAdapterSpec
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridAdapterSpec>>>> HybridAdapter::get_adapters() {
|
|
12
|
+
return Promise<std::vector<std::shared_ptr<HybridAdapterSpec>>>::async([]() {
|
|
13
|
+
std::vector<std::shared_ptr<HybridAdapterSpec>> result;
|
|
14
|
+
for (auto& adapter : SimpleBLE::Adapter::get_adapters()) {
|
|
15
|
+
result.push_back(std::make_shared<HybridAdapter>(std::move(adapter)));
|
|
16
|
+
}
|
|
17
|
+
return result;
|
|
18
|
+
});
|
|
15
19
|
}
|
|
16
20
|
|
|
17
21
|
bool HybridAdapter::initialized() {
|
package/cpp/HybridAdapter.hpp
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
#include "HybridAdapterSpec.hpp"
|
|
4
4
|
#include "HybridPeripheral.hpp"
|
|
5
|
+
#include <NitroModules/Promise.hpp>
|
|
5
6
|
#include <simpleble/SimpleBLE.h>
|
|
6
7
|
#include <functional>
|
|
7
8
|
#include <string>
|
|
@@ -16,8 +17,8 @@ class HybridAdapter : public HybridAdapterSpec {
|
|
|
16
17
|
explicit HybridAdapter(SimpleBLE::Adapter adapter)
|
|
17
18
|
: HybridObject(TAG), _adapter(std::move(adapter)) {}
|
|
18
19
|
|
|
19
|
-
bool bluetooth_enabled() override;
|
|
20
|
-
std::vector<std::shared_ptr<HybridAdapterSpec
|
|
20
|
+
std::shared_ptr<Promise<bool>> bluetooth_enabled() override;
|
|
21
|
+
std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridAdapterSpec>>>> get_adapters() override;
|
|
21
22
|
|
|
22
23
|
bool initialized() override;
|
|
23
24
|
std::string identifier() override;
|
|
@@ -9,12 +9,14 @@ export interface Adapter extends HybridObject<{
|
|
|
9
9
|
}> {
|
|
10
10
|
/**
|
|
11
11
|
* Check if Bluetooth is enabled on the system.
|
|
12
|
+
* Returns a Promise to avoid blocking the JS thread during initialization.
|
|
12
13
|
*/
|
|
13
|
-
bluetooth_enabled(): boolean
|
|
14
|
+
bluetooth_enabled(): Promise<boolean>;
|
|
14
15
|
/**
|
|
15
16
|
* Retrieve a list of all available Bluetooth adapters.
|
|
17
|
+
* Returns a Promise to avoid blocking the JS thread during initialization.
|
|
16
18
|
*/
|
|
17
|
-
get_adapters(): Adapter[]
|
|
19
|
+
get_adapters(): Promise<Adapter[]>;
|
|
18
20
|
/**
|
|
19
21
|
* Check if the adapter is initialized (has a valid internal handle).
|
|
20
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Adapter.nitro.d.ts","sourceRoot":"","sources":["../../src/specs/Adapter.nitro.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAE,KAAK,UA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AQ,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAA;IAE9E;;OAEG;IACH,0BAA0B,CAAC,QAAQ,EAAE,CAAC,UAAU,EAAE,UAAU,KAAK,IAAI,GAAG,IAAI,CAAA;IAE5E;;;;;;OAMG;IACH,sBAAsB,IAAI,UAAU,EAAE,CAAA;CACvC"}
|
|
@@ -18,6 +18,7 @@ namespace margelo::nitro::simplejsble { class HybridAdapterSpec; }
|
|
|
18
18
|
// Forward declaration of `HybridPeripheralSpec` to properly resolve imports.
|
|
19
19
|
namespace margelo::nitro::simplejsble { class HybridPeripheralSpec; }
|
|
20
20
|
|
|
21
|
+
#include <NitroModules/Promise.hpp>
|
|
21
22
|
#include <memory>
|
|
22
23
|
#include "HybridAdapterSpec.hpp"
|
|
23
24
|
#include <vector>
|
|
@@ -56,8 +57,8 @@ namespace margelo::nitro::simplejsble {
|
|
|
56
57
|
|
|
57
58
|
public:
|
|
58
59
|
// Methods
|
|
59
|
-
virtual bool bluetooth_enabled() = 0;
|
|
60
|
-
virtual std::vector<std::shared_ptr<HybridAdapterSpec
|
|
60
|
+
virtual std::shared_ptr<Promise<bool>> bluetooth_enabled() = 0;
|
|
61
|
+
virtual std::shared_ptr<Promise<std::vector<std::shared_ptr<HybridAdapterSpec>>>> get_adapters() = 0;
|
|
61
62
|
virtual bool initialized() = 0;
|
|
62
63
|
virtual std::string identifier() = 0;
|
|
63
64
|
virtual std::string address() = 0;
|
package/package.json
CHANGED
|
@@ -11,13 +11,15 @@ export interface Adapter
|
|
|
11
11
|
}> {
|
|
12
12
|
/**
|
|
13
13
|
* Check if Bluetooth is enabled on the system.
|
|
14
|
+
* Returns a Promise to avoid blocking the JS thread during initialization.
|
|
14
15
|
*/
|
|
15
|
-
bluetooth_enabled(): boolean
|
|
16
|
+
bluetooth_enabled(): Promise<boolean>
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Retrieve a list of all available Bluetooth adapters.
|
|
20
|
+
* Returns a Promise to avoid blocking the JS thread during initialization.
|
|
19
21
|
*/
|
|
20
|
-
get_adapters(): Adapter[]
|
|
22
|
+
get_adapters(): Promise<Adapter[]>
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Check if the adapter is initialized (has a valid internal handle).
|