simplejsble 0.0.1 → 0.0.3
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/NitroSimplejsble.podspec +58 -0
- package/android/CMakeLists.txt +35 -0
- package/android/build.gradle +142 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/simplejsble/NitroSimplejsblePackage.kt +18 -0
- package/cpp/HybridAdapter.cpp +20 -0
- package/cpp/HybridAdapter.hpp +22 -0
- package/ios/Bridge.h +8 -0
- package/ios/CMakeLists.txt +21 -0
- package/ios/SimpleBLE.xcframework/Info.plist +47 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Adapter.h +102 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/AdapterSafe.h +58 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Advanced.h +50 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Characteristic.h +39 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Config.h +64 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Descriptor.h +30 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Exceptions.h +72 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Logging.h +73 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Peripheral.h +82 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/PeripheralSafe.h +64 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Service.h +34 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/SimpleBLE.h +8 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Types.h +49 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/Utils.h +13 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/export.h +43 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/Headers/simpleble/kvn/kvn_bytearray.h +297 -0
- package/ios/SimpleBLE.xcframework/ios-arm64/libsimpleble.a +0 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Adapter.h +102 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/AdapterSafe.h +58 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Advanced.h +50 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Characteristic.h +39 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Config.h +64 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Descriptor.h +30 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Exceptions.h +72 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Logging.h +73 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Peripheral.h +82 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/PeripheralSafe.h +64 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Service.h +34 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/SimpleBLE.h +8 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Types.h +49 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/Utils.h +13 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/export.h +43 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/Headers/simpleble/kvn/kvn_bytearray.h +297 -0
- package/ios/SimpleBLE.xcframework/ios-arm64-simulator/libsimpleble.a +0 -0
- package/ios/build_simpleble.sh +51 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Adapter.h +102 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/AdapterSafe.h +58 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Advanced.h +50 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Characteristic.h +39 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Config.h +64 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Descriptor.h +30 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Exceptions.h +72 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Logging.h +73 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Peripheral.h +82 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/PeripheralSafe.h +64 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Service.h +34 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/SimpleBLE.h +8 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Types.h +49 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/Utils.h +13 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/export.h +43 -0
- package/ios/simpleble_iphoneos_arm64/include/simpleble/kvn/kvn_bytearray.h +297 -0
- package/ios/simpleble_iphoneos_arm64/lib/cmake/simpleble/simpleble-config-release.cmake +19 -0
- package/ios/simpleble_iphoneos_arm64/lib/cmake/simpleble/simpleble-config.cmake +107 -0
- package/ios/simpleble_iphoneos_arm64/lib/libsimpleble.a +0 -0
- package/ios/simpleble_iphoneos_arm64/lib/pkgconfig/simpleble.pc +11 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Adapter.h +102 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/AdapterSafe.h +58 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Advanced.h +50 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Characteristic.h +39 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Config.h +64 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Descriptor.h +30 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Exceptions.h +72 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Logging.h +73 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Peripheral.h +82 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/PeripheralSafe.h +64 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Service.h +34 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/SimpleBLE.h +8 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Types.h +49 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/Utils.h +13 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/export.h +43 -0
- package/ios/simpleble_iphonesimulator_arm64/include/simpleble/kvn/kvn_bytearray.h +297 -0
- package/ios/simpleble_iphonesimulator_arm64/lib/cmake/simpleble/simpleble-config-release.cmake +19 -0
- package/ios/simpleble_iphonesimulator_arm64/lib/cmake/simpleble/simpleble-config.cmake +107 -0
- package/ios/simpleble_iphonesimulator_arm64/lib/libsimpleble.a +0 -0
- package/ios/simpleble_iphonesimulator_arm64/lib/pkgconfig/simpleble.pc +11 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/specs/Adapter.nitro.d.ts +9 -0
- package/lib/specs/Adapter.nitro.js +1 -0
- package/nitro.json +23 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroSimplejsble+autolinking.cmake +81 -0
- package/nitrogen/generated/android/NitroSimplejsble+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroSimplejsbleOnLoad.cpp +44 -0
- package/nitrogen/generated/android/NitroSimplejsbleOnLoad.hpp +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/simplejsble/NitroSimplejsbleOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroSimplejsble+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroSimplejsble-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroSimplejsble-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroSimplejsble-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroSimplejsbleAutolinking.mm +35 -0
- package/nitrogen/generated/ios/NitroSimplejsbleAutolinking.swift +12 -0
- package/nitrogen/generated/shared/c++/HybridAdapterSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridAdapterSpec.hpp +68 -0
- package/package.json +108 -6
- package/react-native.config.js +16 -0
- package/src/index.ts +5 -0
- package/src/specs/Adapter.nitro.ts +9 -0
- package/README.md +0 -0
- package/index.js +0 -6
package/nitrogen/generated/android/kotlin/com/margelo/nitro/simplejsble/NitroSimplejsbleOnLoad.kt
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsbleOnLoad.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.simplejsble
|
|
9
|
+
|
|
10
|
+
import android.util.Log
|
|
11
|
+
|
|
12
|
+
internal class NitroSimplejsbleOnLoad {
|
|
13
|
+
companion object {
|
|
14
|
+
private const val TAG = "NitroSimplejsbleOnLoad"
|
|
15
|
+
private var didLoad = false
|
|
16
|
+
/**
|
|
17
|
+
* Initializes the native part of "NitroSimplejsble".
|
|
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 NitroSimplejsble C++ library...")
|
|
25
|
+
System.loadLibrary("NitroSimplejsble")
|
|
26
|
+
Log.i(TAG, "Successfully loaded NitroSimplejsble C++ library!")
|
|
27
|
+
didLoad = true
|
|
28
|
+
} catch (e: Error) {
|
|
29
|
+
Log.e(TAG, "Failed to load NitroSimplejsble 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,60 @@
|
|
|
1
|
+
#
|
|
2
|
+
# NitroSimplejsble+autolinking.rb
|
|
3
|
+
# This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
# https://github.com/mrousavy/nitro
|
|
5
|
+
# Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
#
|
|
7
|
+
|
|
8
|
+
# This is a Ruby script that adds all files generated by Nitrogen
|
|
9
|
+
# to the given podspec.
|
|
10
|
+
#
|
|
11
|
+
# To use it, add this to your .podspec:
|
|
12
|
+
# ```ruby
|
|
13
|
+
# Pod::Spec.new do |spec|
|
|
14
|
+
# # ...
|
|
15
|
+
#
|
|
16
|
+
# # Add all files generated by Nitrogen
|
|
17
|
+
# load 'nitrogen/generated/ios/NitroSimplejsble+autolinking.rb'
|
|
18
|
+
# add_nitrogen_files(spec)
|
|
19
|
+
# end
|
|
20
|
+
# ```
|
|
21
|
+
|
|
22
|
+
def add_nitrogen_files(spec)
|
|
23
|
+
Pod::UI.puts "[NitroModules] 🔥 NitroSimplejsble is boosted by nitro!"
|
|
24
|
+
|
|
25
|
+
spec.dependency "NitroModules"
|
|
26
|
+
|
|
27
|
+
current_source_files = Array(spec.attributes_hash['source_files'])
|
|
28
|
+
spec.source_files = current_source_files + [
|
|
29
|
+
# Generated cross-platform specs
|
|
30
|
+
"nitrogen/generated/shared/**/*.{h,hpp,c,cpp,swift}",
|
|
31
|
+
# Generated bridges for the cross-platform specs
|
|
32
|
+
"nitrogen/generated/ios/**/*.{h,hpp,c,cpp,mm,swift}",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
current_public_header_files = Array(spec.attributes_hash['public_header_files'])
|
|
36
|
+
spec.public_header_files = current_public_header_files + [
|
|
37
|
+
# Generated specs
|
|
38
|
+
"nitrogen/generated/shared/**/*.{h,hpp}",
|
|
39
|
+
# Swift to C++ bridging helpers
|
|
40
|
+
"nitrogen/generated/ios/NitroSimplejsble-Swift-Cxx-Bridge.hpp"
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
current_private_header_files = Array(spec.attributes_hash['private_header_files'])
|
|
44
|
+
spec.private_header_files = current_private_header_files + [
|
|
45
|
+
# iOS specific specs
|
|
46
|
+
"nitrogen/generated/ios/c++/**/*.{h,hpp}",
|
|
47
|
+
# Views are framework-specific and should be private
|
|
48
|
+
"nitrogen/generated/shared/**/views/**/*"
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
current_pod_target_xcconfig = spec.attributes_hash['pod_target_xcconfig'] || {}
|
|
52
|
+
spec.pod_target_xcconfig = current_pod_target_xcconfig.merge({
|
|
53
|
+
# Use C++ 20
|
|
54
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
|
|
55
|
+
# Enables C++ <-> Swift interop (by default it's only ObjC)
|
|
56
|
+
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
|
+
# Enables stricter modular headers
|
|
58
|
+
"DEFINES_MODULE" => "YES",
|
|
59
|
+
})
|
|
60
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsble-Swift-Cxx-Bridge.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "NitroSimplejsble-Swift-Cxx-Bridge.hpp"
|
|
9
|
+
|
|
10
|
+
// Include C++ implementation defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::simplejsble::bridge::swift {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace margelo::nitro::simplejsble::bridge::swift
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsble-Swift-Cxx-Bridge.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Forward declarations of Swift defined types
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// Include C++ defined types
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Contains specialized versions of C++ templated types so they can be accessed from Swift,
|
|
21
|
+
* as well as helper functions to interact with those C++ types from Swift.
|
|
22
|
+
*/
|
|
23
|
+
namespace margelo::nitro::simplejsble::bridge::swift {
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
} // namespace margelo::nitro::simplejsble::bridge::swift
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsble-Swift-Cxx-Umbrella.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
// Forward declarations of C++ defined types
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// Include C++ defined types
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
// C++ helpers for Swift
|
|
17
|
+
#include "NitroSimplejsble-Swift-Cxx-Bridge.hpp"
|
|
18
|
+
|
|
19
|
+
// Common C++ types used in Swift
|
|
20
|
+
#include <NitroModules/ArrayBufferHolder.hpp>
|
|
21
|
+
#include <NitroModules/AnyMapUtils.hpp>
|
|
22
|
+
#include <NitroModules/RuntimeError.hpp>
|
|
23
|
+
#include <NitroModules/DateToChronoDate.hpp>
|
|
24
|
+
|
|
25
|
+
// Forward declarations of Swift defined types
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
// Include Swift defined types
|
|
29
|
+
#if __has_include("NitroSimplejsble-Swift.h")
|
|
30
|
+
// This header is generated by Xcode/Swift on every app build.
|
|
31
|
+
// If it cannot be found, make sure the Swift module's name (= podspec name) is actually "NitroSimplejsble".
|
|
32
|
+
#include "NitroSimplejsble-Swift.h"
|
|
33
|
+
// Same as above, but used when building with frameworks (`use_frameworks`)
|
|
34
|
+
#elif __has_include(<NitroSimplejsble/NitroSimplejsble-Swift.h>)
|
|
35
|
+
#include <NitroSimplejsble/NitroSimplejsble-Swift.h>
|
|
36
|
+
#else
|
|
37
|
+
#error NitroSimplejsble's autogenerated Swift header cannot be found! Make sure the Swift module's name (= podspec name) is actually "NitroSimplejsble", and try building the app first.
|
|
38
|
+
#endif
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsbleAutolinking.mm
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#import <Foundation/Foundation.h>
|
|
9
|
+
#import <NitroModules/HybridObjectRegistry.hpp>
|
|
10
|
+
|
|
11
|
+
#import <type_traits>
|
|
12
|
+
|
|
13
|
+
#include "HybridAdapter.hpp"
|
|
14
|
+
|
|
15
|
+
@interface NitroSimplejsbleAutolinking : NSObject
|
|
16
|
+
@end
|
|
17
|
+
|
|
18
|
+
@implementation NitroSimplejsbleAutolinking
|
|
19
|
+
|
|
20
|
+
+ (void) load {
|
|
21
|
+
using namespace margelo::nitro;
|
|
22
|
+
using namespace margelo::nitro::simplejsble;
|
|
23
|
+
|
|
24
|
+
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
25
|
+
"Adapter",
|
|
26
|
+
[]() -> std::shared_ptr<HybridObject> {
|
|
27
|
+
static_assert(std::is_default_constructible_v<HybridAdapter>,
|
|
28
|
+
"The HybridObject \"HybridAdapter\" is not default-constructible! "
|
|
29
|
+
"Create a public constructor that takes zero arguments to be able to autolink this HybridObject.");
|
|
30
|
+
return std::make_shared<HybridAdapter>();
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroSimplejsbleAutolinking.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
public final class NitroSimplejsbleAutolinking {
|
|
9
|
+
public typealias bridge = margelo.nitro.simplejsble.bridge.swift
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAdapterSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridAdapterSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::simplejsble {
|
|
11
|
+
|
|
12
|
+
void HybridAdapterSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("greet", &HybridAdapterSpec::greet);
|
|
18
|
+
prototype.registerHybridMethod("get_adapters", &HybridAdapterSpec::get_adapters);
|
|
19
|
+
prototype.registerHybridMethod("bluetooth_enabled", &HybridAdapterSpec::bluetooth_enabled);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::simplejsble
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAdapterSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2025 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 `HybridAdapterSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::simplejsble { class HybridAdapterSpec; }
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <memory>
|
|
21
|
+
#include "HybridAdapterSpec.hpp"
|
|
22
|
+
#include <vector>
|
|
23
|
+
|
|
24
|
+
namespace margelo::nitro::simplejsble {
|
|
25
|
+
|
|
26
|
+
using namespace margelo::nitro;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An abstract base class for `Adapter`
|
|
30
|
+
* Inherit this class to create instances of `HybridAdapterSpec` in C++.
|
|
31
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
32
|
+
* @example
|
|
33
|
+
* ```cpp
|
|
34
|
+
* class HybridAdapter: public HybridAdapterSpec {
|
|
35
|
+
* public:
|
|
36
|
+
* HybridAdapter(...): HybridObject(TAG) { ... }
|
|
37
|
+
* // ...
|
|
38
|
+
* };
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
class HybridAdapterSpec: public virtual HybridObject {
|
|
42
|
+
public:
|
|
43
|
+
// Constructor
|
|
44
|
+
explicit HybridAdapterSpec(): HybridObject(TAG) { }
|
|
45
|
+
|
|
46
|
+
// Destructor
|
|
47
|
+
~HybridAdapterSpec() override = default;
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
// Properties
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
// Methods
|
|
55
|
+
virtual std::string greet(const std::string& name) = 0;
|
|
56
|
+
virtual std::vector<std::shared_ptr<HybridAdapterSpec>> get_adapters() = 0;
|
|
57
|
+
virtual bool bluetooth_enabled() = 0;
|
|
58
|
+
|
|
59
|
+
protected:
|
|
60
|
+
// Hybrid Setup
|
|
61
|
+
void loadHybridMethods() override;
|
|
62
|
+
|
|
63
|
+
protected:
|
|
64
|
+
// Tag for logging
|
|
65
|
+
static constexpr auto TAG = "Adapter";
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::simplejsble
|
package/package.json
CHANGED
|
@@ -1,11 +1,113 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simplejsble",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "SimpleBLE
|
|
5
|
-
"main": "index
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"description": "React Native Bluetooth Low Energy library using SimpleBLE with Nitro Modules",
|
|
5
|
+
"main": "lib/index",
|
|
6
|
+
"module": "lib/index",
|
|
7
|
+
"types": "lib/index.d.ts",
|
|
8
|
+
"react-native": "src/index",
|
|
9
|
+
"source": "src/index",
|
|
10
|
+
"files": [
|
|
11
|
+
"src",
|
|
12
|
+
"lib",
|
|
13
|
+
"nitrogen",
|
|
14
|
+
"android/",
|
|
15
|
+
"ios/",
|
|
16
|
+
"cpp/",
|
|
17
|
+
"react-native.config.js",
|
|
18
|
+
"nitro.json",
|
|
19
|
+
"*.podspec",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
6
22
|
"scripts": {
|
|
7
|
-
"
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"build": "tsc --noEmit false",
|
|
25
|
+
"clean": "rm -rf android/build android/.cxx android/.gradle lib",
|
|
26
|
+
"lint": "eslint \"**/*.{js,ts,tsx}\" --fix",
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"specs": "tsc --noEmit false && nitrogen --logLevel=\"debug\""
|
|
8
29
|
},
|
|
9
|
-
"
|
|
10
|
-
|
|
30
|
+
"keywords": [
|
|
31
|
+
"react-native",
|
|
32
|
+
"bluetooth",
|
|
33
|
+
"ble",
|
|
34
|
+
"bluetooth-low-energy",
|
|
35
|
+
"simpleble",
|
|
36
|
+
"nitro",
|
|
37
|
+
"nitro-modules",
|
|
38
|
+
"ios",
|
|
39
|
+
"android"
|
|
40
|
+
],
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/OpenBluetoothToolbox/SimpleBLE.git",
|
|
44
|
+
"directory": "simplejsble/packages/simplejsble"
|
|
45
|
+
},
|
|
46
|
+
"author": "SimpleBLE Contributors",
|
|
47
|
+
"license": "MIT",
|
|
48
|
+
"bugs": {
|
|
49
|
+
"url": "https://github.com/OpenBluetoothToolbox/SimpleBLE/issues"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/OpenBluetoothToolbox/SimpleBLE#readme",
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"registry": "https://registry.npmjs.org/",
|
|
54
|
+
"access": "public"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@react-native/eslint-config": "0.82.0",
|
|
58
|
+
"@types/react": "^19.1.03",
|
|
59
|
+
"eslint": "^8.57.0",
|
|
60
|
+
"eslint-config-prettier": "^9.1.0",
|
|
61
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
62
|
+
"nitrogen": "*",
|
|
63
|
+
"prettier": "^3.3.3",
|
|
64
|
+
"react": "19.1.0",
|
|
65
|
+
"react-native": "0.81.5",
|
|
66
|
+
"react-native-nitro-modules": "*",
|
|
67
|
+
"typescript": "^5.8.3"
|
|
68
|
+
},
|
|
69
|
+
"peerDependencies": {
|
|
70
|
+
"react": "*",
|
|
71
|
+
"react-native": "*",
|
|
72
|
+
"react-native-nitro-modules": ">=0.20.0"
|
|
73
|
+
},
|
|
74
|
+
"peerDependenciesMeta": {
|
|
75
|
+
"react-native-nitro-modules": {
|
|
76
|
+
"optional": false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"eslintConfig": {
|
|
80
|
+
"root": true,
|
|
81
|
+
"extends": [
|
|
82
|
+
"@react-native",
|
|
83
|
+
"prettier"
|
|
84
|
+
],
|
|
85
|
+
"plugins": [
|
|
86
|
+
"prettier"
|
|
87
|
+
],
|
|
88
|
+
"rules": {
|
|
89
|
+
"prettier/prettier": [
|
|
90
|
+
"warn",
|
|
91
|
+
{
|
|
92
|
+
"quoteProps": "consistent",
|
|
93
|
+
"singleQuote": true,
|
|
94
|
+
"tabWidth": 2,
|
|
95
|
+
"trailingComma": "es5",
|
|
96
|
+
"useTabs": false
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"eslintIgnore": [
|
|
102
|
+
"node_modules/",
|
|
103
|
+
"lib/"
|
|
104
|
+
],
|
|
105
|
+
"prettier": {
|
|
106
|
+
"quoteProps": "consistent",
|
|
107
|
+
"singleQuote": true,
|
|
108
|
+
"tabWidth": 2,
|
|
109
|
+
"trailingComma": "es5",
|
|
110
|
+
"useTabs": false,
|
|
111
|
+
"semi": false
|
|
112
|
+
}
|
|
11
113
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// https://github.com/react-native-community/cli/blob/main/docs/dependencies.md
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
dependency: {
|
|
5
|
+
platforms: {
|
|
6
|
+
/**
|
|
7
|
+
* @type {import('@react-native-community/cli-types').IOSDependencyParams}
|
|
8
|
+
*/
|
|
9
|
+
ios: {},
|
|
10
|
+
/**
|
|
11
|
+
* @type {import('@react-native-community/cli-types').AndroidDependencyParams}
|
|
12
|
+
*/
|
|
13
|
+
android: {},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
package/src/index.ts
ADDED
package/README.md
DELETED
|
File without changes
|