react-native-bluebreeze 0.0.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/LICENSE +20 -0
- package/README.md +33 -0
- package/android/build.gradle +122 -0
- package/android/generated/java/com/bluebreeze/NativeBlueBreezeSpec.java +153 -0
- package/android/generated/jni/CMakeLists.txt +36 -0
- package/android/generated/jni/RNBlueBreezeSpec-generated.cpp +156 -0
- package/android/generated/jni/RNBlueBreezeSpec.h +31 -0
- package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI-generated.cpp +171 -0
- package/android/generated/jni/react/renderer/components/RNBlueBreezeSpec/RNBlueBreezeSpecJSI.h +632 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/AndroidManifestNew.xml +2 -0
- package/android/src/main/java/com/bluebreeze/BlueBreezeModule.kt +23 -0
- package/android/src/main/java/com/bluebreeze/BlueBreezePackage.kt +34 -0
- package/ios/BlueBreezeImpl.swift +477 -0
- package/ios/Bluebreeze.h +6 -0
- package/ios/Bluebreeze.mm +280 -0
- package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec-generated.mm +219 -0
- package/ios/generated/RNBlueBreezeSpec/RNBlueBreezeSpec.h +117 -0
- package/ios/generated/RNBlueBreezeSpecJSI-generated.cpp +171 -0
- package/ios/generated/RNBlueBreezeSpecJSI.h +632 -0
- package/package.json +203 -0
- package/react-native-bluebreeze.podspec +44 -0
- package/react-native.config.js +12 -0
- package/src/NativeBlueBreeze.ts +142 -0
- package/src/index.tsx +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Like Magic
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# react-native-bluebreeze
|
|
2
|
+
|
|
3
|
+
BlueBreeze bindings for React Native. A modern Bluetooth LE library.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install react-native-bluebreeze
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
```js
|
|
15
|
+
import { multiply } from 'react-native-bluebreeze';
|
|
16
|
+
|
|
17
|
+
// ...
|
|
18
|
+
|
|
19
|
+
const result = multiply(3, 7);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
## Contributing
|
|
24
|
+
|
|
25
|
+
See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
|
26
|
+
|
|
27
|
+
## License
|
|
28
|
+
|
|
29
|
+
MIT
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
buildscript {
|
|
2
|
+
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
|
|
3
|
+
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["BlueBreeze_kotlinVersion"]
|
|
4
|
+
|
|
5
|
+
repositories {
|
|
6
|
+
google()
|
|
7
|
+
mavenCentral()
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dependencies {
|
|
11
|
+
classpath "com.android.tools.build:gradle:7.2.1"
|
|
12
|
+
// noinspection DifferentKotlinGradleVersion
|
|
13
|
+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
def reactNativeArchitectures() {
|
|
18
|
+
def value = rootProject.getProperties().get("reactNativeArchitectures")
|
|
19
|
+
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
def isNewArchitectureEnabled() {
|
|
23
|
+
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
apply plugin: "com.android.library"
|
|
27
|
+
apply plugin: "kotlin-android"
|
|
28
|
+
|
|
29
|
+
if (isNewArchitectureEnabled()) {
|
|
30
|
+
apply plugin: "com.facebook.react"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
def getExtOrDefault(name) {
|
|
34
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["BlueBreeze_" + name]
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
def getExtOrIntegerDefault(name) {
|
|
38
|
+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["BlueBreeze_" + name]).toInteger()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
def supportsNamespace() {
|
|
42
|
+
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
|
|
43
|
+
def major = parsed[0].toInteger()
|
|
44
|
+
def minor = parsed[1].toInteger()
|
|
45
|
+
|
|
46
|
+
// Namespace support was added in 7.3.0
|
|
47
|
+
return (major == 7 && minor >= 3) || major >= 8
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
android {
|
|
51
|
+
if (supportsNamespace()) {
|
|
52
|
+
namespace "com.bluebreeze"
|
|
53
|
+
|
|
54
|
+
sourceSets {
|
|
55
|
+
main {
|
|
56
|
+
manifest.srcFile "src/main/AndroidManifestNew.xml"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
|
|
62
|
+
|
|
63
|
+
defaultConfig {
|
|
64
|
+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
|
|
65
|
+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
|
|
66
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
67
|
+
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
buildFeatures {
|
|
71
|
+
buildConfig true
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
buildTypes {
|
|
75
|
+
release {
|
|
76
|
+
minifyEnabled false
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
lintOptions {
|
|
81
|
+
disable "GradleCompatible"
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
compileOptions {
|
|
85
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
86
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
sourceSets {
|
|
90
|
+
main {
|
|
91
|
+
if (isNewArchitectureEnabled()) {
|
|
92
|
+
java.srcDirs += [
|
|
93
|
+
"generated/java",
|
|
94
|
+
"generated/jni"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
repositories {
|
|
102
|
+
mavenCentral()
|
|
103
|
+
google()
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
107
|
+
|
|
108
|
+
dependencies {
|
|
109
|
+
// For < 0.71, this will be from the local maven repo
|
|
110
|
+
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
111
|
+
//noinspection GradleDynamicVersion
|
|
112
|
+
implementation "com.facebook.react:react-native:+"
|
|
113
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (isNewArchitectureEnabled()) {
|
|
117
|
+
react {
|
|
118
|
+
jsRootDir = file("../src/")
|
|
119
|
+
libraryName = "BlueBreeze"
|
|
120
|
+
codegenJavaPackageName = "com.bluebreeze"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJavaSpec.js
|
|
9
|
+
*
|
|
10
|
+
* @nolint
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
package com.bluebreeze;
|
|
14
|
+
|
|
15
|
+
import com.facebook.proguard.annotations.DoNotStrip;
|
|
16
|
+
import com.facebook.react.bridge.Promise;
|
|
17
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
18
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
19
|
+
import com.facebook.react.bridge.ReactMethod;
|
|
20
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
21
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
22
|
+
import com.facebook.react.bridge.WritableArray;
|
|
23
|
+
import com.facebook.react.turbomodule.core.interfaces.TurboModule;
|
|
24
|
+
import javax.annotation.Nonnull;
|
|
25
|
+
|
|
26
|
+
public abstract class NativeBlueBreezeSpec extends ReactContextBaseJavaModule implements TurboModule {
|
|
27
|
+
public static final String NAME = "BlueBreeze";
|
|
28
|
+
|
|
29
|
+
public NativeBlueBreezeSpec(ReactApplicationContext reactContext) {
|
|
30
|
+
super(reactContext);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@Override
|
|
34
|
+
public @Nonnull String getName() {
|
|
35
|
+
return NAME;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
protected final void emitAuthorizationStatusEmitter(String value) {
|
|
39
|
+
mEventEmitterCallback.invoke("authorizationStatusEmitter", value);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
protected final void emitStateEmitter(String value) {
|
|
43
|
+
mEventEmitterCallback.invoke("stateEmitter", value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
protected final void emitScanningEnabledEmitter(boolean value) {
|
|
47
|
+
mEventEmitterCallback.invoke("scanningEnabledEmitter", value);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
protected final void emitDevicesEmitter(ReadableArray value) {
|
|
51
|
+
mEventEmitterCallback.invoke("devicesEmitter", value);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
protected final void emitDeviceServicesEmitter(ReadableMap value) {
|
|
55
|
+
mEventEmitterCallback.invoke("deviceServicesEmitter", value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected final void emitDeviceConnectionStatusEmitter(ReadableMap value) {
|
|
59
|
+
mEventEmitterCallback.invoke("deviceConnectionStatusEmitter", value);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected final void emitDeviceMTUEmitter(ReadableMap value) {
|
|
63
|
+
mEventEmitterCallback.invoke("deviceMTUEmitter", value);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
protected final void emitDeviceCharacteristicDataEmitter(ReadableMap value) {
|
|
67
|
+
mEventEmitterCallback.invoke("deviceCharacteristicDataEmitter", value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected final void emitDeviceCharacteristicNotifyEnabledEmitter(ReadableMap value) {
|
|
71
|
+
mEventEmitterCallback.invoke("deviceCharacteristicNotifyEnabledEmitter", value);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
public abstract String authorizationStatus();
|
|
77
|
+
|
|
78
|
+
@ReactMethod
|
|
79
|
+
@DoNotStrip
|
|
80
|
+
public abstract void authorizationRequest();
|
|
81
|
+
|
|
82
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
83
|
+
@DoNotStrip
|
|
84
|
+
public abstract String state();
|
|
85
|
+
|
|
86
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
87
|
+
@DoNotStrip
|
|
88
|
+
public abstract boolean scanningEnabled();
|
|
89
|
+
|
|
90
|
+
@ReactMethod
|
|
91
|
+
@DoNotStrip
|
|
92
|
+
public abstract void scanningStart();
|
|
93
|
+
|
|
94
|
+
@ReactMethod
|
|
95
|
+
@DoNotStrip
|
|
96
|
+
public abstract void scanningStop();
|
|
97
|
+
|
|
98
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
99
|
+
@DoNotStrip
|
|
100
|
+
public abstract WritableArray devices();
|
|
101
|
+
|
|
102
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
103
|
+
@DoNotStrip
|
|
104
|
+
public abstract WritableArray deviceServices(String id);
|
|
105
|
+
|
|
106
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
107
|
+
@DoNotStrip
|
|
108
|
+
public abstract String deviceConnectionStatus(String id);
|
|
109
|
+
|
|
110
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
111
|
+
@DoNotStrip
|
|
112
|
+
public abstract double deviceMTU(String id);
|
|
113
|
+
|
|
114
|
+
@ReactMethod
|
|
115
|
+
@DoNotStrip
|
|
116
|
+
public abstract void deviceConnect(String id, Promise promise);
|
|
117
|
+
|
|
118
|
+
@ReactMethod
|
|
119
|
+
@DoNotStrip
|
|
120
|
+
public abstract void deviceDisconnect(String id, Promise promise);
|
|
121
|
+
|
|
122
|
+
@ReactMethod
|
|
123
|
+
@DoNotStrip
|
|
124
|
+
public abstract void deviceDiscoverServices(String id, Promise promise);
|
|
125
|
+
|
|
126
|
+
@ReactMethod
|
|
127
|
+
@DoNotStrip
|
|
128
|
+
public abstract void deviceRequestMTU(String id, double mtu, Promise promise);
|
|
129
|
+
|
|
130
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
131
|
+
@DoNotStrip
|
|
132
|
+
public abstract WritableArray deviceCharacteristicData(String id, String serviceId, String characteristicId);
|
|
133
|
+
|
|
134
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
135
|
+
@DoNotStrip
|
|
136
|
+
public abstract boolean deviceCharacteristicNotifyEnabled(String id, String serviceId, String characteristicId);
|
|
137
|
+
|
|
138
|
+
@ReactMethod
|
|
139
|
+
@DoNotStrip
|
|
140
|
+
public abstract void deviceCharacteristicRead(String id, String serviceId, String characteristicId, Promise promise);
|
|
141
|
+
|
|
142
|
+
@ReactMethod
|
|
143
|
+
@DoNotStrip
|
|
144
|
+
public abstract void deviceCharacteristicWrite(String id, String serviceId, String characteristicId, ReadableArray data, boolean withResponse, Promise promise);
|
|
145
|
+
|
|
146
|
+
@ReactMethod
|
|
147
|
+
@DoNotStrip
|
|
148
|
+
public abstract void deviceCharacteristicSubscribe(String id, String serviceId, String characteristicId, Promise promise);
|
|
149
|
+
|
|
150
|
+
@ReactMethod
|
|
151
|
+
@DoNotStrip
|
|
152
|
+
public abstract void deviceCharacteristicUnsubscribe(String id, String serviceId, String characteristicId, Promise promise);
|
|
153
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
#
|
|
3
|
+
# This source code is licensed under the MIT license found in the
|
|
4
|
+
# LICENSE file in the root directory of this source tree.
|
|
5
|
+
|
|
6
|
+
cmake_minimum_required(VERSION 3.13)
|
|
7
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
8
|
+
|
|
9
|
+
file(GLOB react_codegen_SRCS CONFIGURE_DEPENDS *.cpp react/renderer/components/RNBlueBreezeSpec/*.cpp)
|
|
10
|
+
|
|
11
|
+
add_library(
|
|
12
|
+
react_codegen_RNBlueBreezeSpec
|
|
13
|
+
OBJECT
|
|
14
|
+
${react_codegen_SRCS}
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
target_include_directories(react_codegen_RNBlueBreezeSpec PUBLIC . react/renderer/components/RNBlueBreezeSpec)
|
|
18
|
+
|
|
19
|
+
target_link_libraries(
|
|
20
|
+
react_codegen_RNBlueBreezeSpec
|
|
21
|
+
fbjni
|
|
22
|
+
jsi
|
|
23
|
+
# We need to link different libraries based on whether we are building rncore or not, that's necessary
|
|
24
|
+
# because we want to break a circular dependency between react_codegen_rncore and reactnative
|
|
25
|
+
reactnative
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
target_compile_options(
|
|
29
|
+
react_codegen_RNBlueBreezeSpec
|
|
30
|
+
PRIVATE
|
|
31
|
+
-DLOG_TAG=\"ReactNative\"
|
|
32
|
+
-fexceptions
|
|
33
|
+
-frtti
|
|
34
|
+
-std=c++20
|
|
35
|
+
-Wall
|
|
36
|
+
)
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include "RNBlueBreezeSpec.h"
|
|
12
|
+
|
|
13
|
+
namespace facebook::react {
|
|
14
|
+
|
|
15
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_authorizationStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
16
|
+
static jmethodID cachedMethodId = nullptr;
|
|
17
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, StringKind, "authorizationStatus", "()Ljava/lang/String;", args, count, cachedMethodId);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_authorizationRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
21
|
+
static jmethodID cachedMethodId = nullptr;
|
|
22
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "authorizationRequest", "()V", args, count, cachedMethodId);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_state(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
26
|
+
static jmethodID cachedMethodId = nullptr;
|
|
27
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, StringKind, "state", "()Ljava/lang/String;", args, count, cachedMethodId);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_scanningEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
31
|
+
static jmethodID cachedMethodId = nullptr;
|
|
32
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "scanningEnabled", "()Z", args, count, cachedMethodId);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_scanningStart(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
36
|
+
static jmethodID cachedMethodId = nullptr;
|
|
37
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "scanningStart", "()V", args, count, cachedMethodId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_scanningStop(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
41
|
+
static jmethodID cachedMethodId = nullptr;
|
|
42
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, VoidKind, "scanningStop", "()V", args, count, cachedMethodId);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_devices(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
46
|
+
static jmethodID cachedMethodId = nullptr;
|
|
47
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ArrayKind, "devices", "()Lcom/facebook/react/bridge/WritableArray;", args, count, cachedMethodId);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceServices(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
51
|
+
static jmethodID cachedMethodId = nullptr;
|
|
52
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ArrayKind, "deviceServices", "(Ljava/lang/String;)Lcom/facebook/react/bridge/WritableArray;", args, count, cachedMethodId);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceConnectionStatus(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
56
|
+
static jmethodID cachedMethodId = nullptr;
|
|
57
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, StringKind, "deviceConnectionStatus", "(Ljava/lang/String;)Ljava/lang/String;", args, count, cachedMethodId);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceMTU(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
61
|
+
static jmethodID cachedMethodId = nullptr;
|
|
62
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, NumberKind, "deviceMTU", "(Ljava/lang/String;)D", args, count, cachedMethodId);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceConnect(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
66
|
+
static jmethodID cachedMethodId = nullptr;
|
|
67
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceConnect", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceDisconnect(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
71
|
+
static jmethodID cachedMethodId = nullptr;
|
|
72
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceDisconnect", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceDiscoverServices(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
76
|
+
static jmethodID cachedMethodId = nullptr;
|
|
77
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceDiscoverServices", "(Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceRequestMTU(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
81
|
+
static jmethodID cachedMethodId = nullptr;
|
|
82
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceRequestMTU", "(Ljava/lang/String;DLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicData(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
86
|
+
static jmethodID cachedMethodId = nullptr;
|
|
87
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, ArrayKind, "deviceCharacteristicData", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Lcom/facebook/react/bridge/WritableArray;", args, count, cachedMethodId);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicNotifyEnabled(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
91
|
+
static jmethodID cachedMethodId = nullptr;
|
|
92
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, BooleanKind, "deviceCharacteristicNotifyEnabled", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Z", args, count, cachedMethodId);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicRead(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
96
|
+
static jmethodID cachedMethodId = nullptr;
|
|
97
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceCharacteristicRead", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicWrite(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
101
|
+
static jmethodID cachedMethodId = nullptr;
|
|
102
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceCharacteristicWrite", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/ReadableArray;ZLcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicSubscribe(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
106
|
+
static jmethodID cachedMethodId = nullptr;
|
|
107
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceCharacteristicSubscribe", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static facebook::jsi::Value __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicUnsubscribe(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
|
|
111
|
+
static jmethodID cachedMethodId = nullptr;
|
|
112
|
+
return static_cast<JavaTurboModule &>(turboModule).invokeJavaMethod(rt, PromiseKind, "deviceCharacteristicUnsubscribe", "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/facebook/react/bridge/Promise;)V", args, count, cachedMethodId);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
NativeBlueBreezeSpecJSI::NativeBlueBreezeSpecJSI(const JavaTurboModule::InitParams ¶ms)
|
|
116
|
+
: JavaTurboModule(params) {
|
|
117
|
+
methodMap_["authorizationStatus"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_authorizationStatus};
|
|
118
|
+
methodMap_["authorizationRequest"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_authorizationRequest};
|
|
119
|
+
methodMap_["state"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_state};
|
|
120
|
+
methodMap_["scanningEnabled"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_scanningEnabled};
|
|
121
|
+
methodMap_["scanningStart"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_scanningStart};
|
|
122
|
+
methodMap_["scanningStop"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_scanningStop};
|
|
123
|
+
methodMap_["devices"] = MethodMetadata {0, __hostFunction_NativeBlueBreezeSpecJSI_devices};
|
|
124
|
+
methodMap_["deviceServices"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceServices};
|
|
125
|
+
methodMap_["deviceConnectionStatus"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceConnectionStatus};
|
|
126
|
+
methodMap_["deviceMTU"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceMTU};
|
|
127
|
+
methodMap_["deviceConnect"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceConnect};
|
|
128
|
+
methodMap_["deviceDisconnect"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceDisconnect};
|
|
129
|
+
methodMap_["deviceDiscoverServices"] = MethodMetadata {1, __hostFunction_NativeBlueBreezeSpecJSI_deviceDiscoverServices};
|
|
130
|
+
methodMap_["deviceRequestMTU"] = MethodMetadata {2, __hostFunction_NativeBlueBreezeSpecJSI_deviceRequestMTU};
|
|
131
|
+
methodMap_["deviceCharacteristicData"] = MethodMetadata {3, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicData};
|
|
132
|
+
methodMap_["deviceCharacteristicNotifyEnabled"] = MethodMetadata {3, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicNotifyEnabled};
|
|
133
|
+
methodMap_["deviceCharacteristicRead"] = MethodMetadata {3, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicRead};
|
|
134
|
+
methodMap_["deviceCharacteristicWrite"] = MethodMetadata {5, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicWrite};
|
|
135
|
+
methodMap_["deviceCharacteristicSubscribe"] = MethodMetadata {3, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicSubscribe};
|
|
136
|
+
methodMap_["deviceCharacteristicUnsubscribe"] = MethodMetadata {3, __hostFunction_NativeBlueBreezeSpecJSI_deviceCharacteristicUnsubscribe};
|
|
137
|
+
eventEmitterMap_["authorizationStatusEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
138
|
+
eventEmitterMap_["stateEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
139
|
+
eventEmitterMap_["scanningEnabledEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
140
|
+
eventEmitterMap_["devicesEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
141
|
+
eventEmitterMap_["deviceServicesEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
142
|
+
eventEmitterMap_["deviceConnectionStatusEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
143
|
+
eventEmitterMap_["deviceMTUEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
144
|
+
eventEmitterMap_["deviceCharacteristicDataEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
145
|
+
eventEmitterMap_["deviceCharacteristicNotifyEnabledEmitter"] = std::make_shared<AsyncEventEmitter<folly::dynamic>>();
|
|
146
|
+
setEventEmitterCallback(params.instance);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
std::shared_ptr<TurboModule> RNBlueBreezeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms) {
|
|
150
|
+
if (moduleName == "BlueBreeze") {
|
|
151
|
+
return std::make_shared<NativeBlueBreezeSpecJSI>(params);
|
|
152
|
+
}
|
|
153
|
+
return nullptr;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
} // namespace facebook::react
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateModuleJniH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <ReactCommon/JavaTurboModule.h>
|
|
14
|
+
#include <ReactCommon/TurboModule.h>
|
|
15
|
+
#include <jsi/jsi.h>
|
|
16
|
+
|
|
17
|
+
namespace facebook::react {
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* JNI C++ class for module 'NativeBlueBreeze'
|
|
21
|
+
*/
|
|
22
|
+
class JSI_EXPORT NativeBlueBreezeSpecJSI : public JavaTurboModule {
|
|
23
|
+
public:
|
|
24
|
+
NativeBlueBreezeSpecJSI(const JavaTurboModule::InitParams ¶ms);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
JSI_EXPORT
|
|
29
|
+
std::shared_ptr<TurboModule> RNBlueBreezeSpec_ModuleProvider(const std::string &moduleName, const JavaTurboModule::InitParams ¶ms);
|
|
30
|
+
|
|
31
|
+
} // namespace facebook::react
|