@react-native-ohos/react-native-ble-plx 3.2.1-rc.2 → 3.2.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 +202 -202
- package/README.OpenSource +10 -10
- package/README.md +9 -9
- package/app.plugin.js +1 -1
- package/harmony/rn_bleplx/build-profile.json5 +7 -7
- package/harmony/rn_bleplx/hvigorfile.ts +1 -1
- package/harmony/rn_bleplx/index.ets +26 -26
- package/harmony/rn_bleplx/obfuscation-rules.txt +17 -17
- package/harmony/rn_bleplx/oh-package.json5 +13 -13
- package/harmony/rn_bleplx/src/main/cpp/BlePlxPackage.h +36 -36
- package/harmony/rn_bleplx/src/main/cpp/CMakeLists.txt +9 -9
- package/harmony/rn_bleplx/src/main/cpp/generated/RNOH/generated/BaseReactNativeBlePlxPackage.h +65 -65
- package/harmony/rn_bleplx/src/main/cpp/generated/RNOH/generated/turbo_modules/BlePlx.cpp +59 -59
- package/harmony/rn_bleplx/src/main/cpp/generated/RNOH/generated/turbo_modules/BlePlx.h +16 -16
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/ComponentDescriptors.h +22 -22
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/EventEmitters.cpp +18 -18
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/EventEmitters.h +19 -19
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/Props.cpp +21 -21
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/Props.h +20 -20
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/ShadowNodes.cpp +19 -19
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/ShadowNodes.h +25 -25
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/States.cpp +18 -18
- package/harmony/rn_bleplx/src/main/cpp/generated/react/renderer/components/react_native_ble_plx/States.h +22 -22
- package/harmony/rn_bleplx/src/main/ets/BleDevice.ts +98 -98
- package/harmony/rn_bleplx/src/main/ets/BleModule.ts +1219 -1219
- package/harmony/rn_bleplx/src/main/ets/BlePlxInterface.ts +26 -26
- package/harmony/rn_bleplx/src/main/ets/BlePlxModule.ts +246 -246
- package/harmony/rn_bleplx/src/main/ets/BlePlxPackage.ets +46 -46
- package/harmony/rn_bleplx/src/main/ets/Characteristic.ts +179 -179
- package/harmony/rn_bleplx/src/main/ets/CommonConstants.ts +29 -29
- package/harmony/rn_bleplx/src/main/ets/Descriptor.ts +143 -143
- package/harmony/rn_bleplx/src/main/ets/Service.ts +85 -85
- package/harmony/rn_bleplx/src/main/ets/common/BleError.ts +90 -90
- package/harmony/rn_bleplx/src/main/ets/common/BleErrorToJsObjectConverter.ts +62 -62
- package/harmony/rn_bleplx/src/main/ets/common/BleEvent.ts +32 -32
- package/harmony/rn_bleplx/src/main/ets/common/BleUtils.ts +86 -86
- package/harmony/rn_bleplx/src/main/ets/common/IdGenerator.ts +49 -49
- package/harmony/rn_bleplx/src/main/ets/common/IdGeneratorKey.ts +70 -70
- package/harmony/rn_bleplx/src/main/ets/common/InstanceIdGenerator.ts +36 -36
- package/harmony/rn_bleplx/src/main/ets/common/Logger.ts +64 -64
- package/harmony/rn_bleplx/src/main/ets/common/PermissionHandler.ts +98 -98
- package/harmony/rn_bleplx/src/main/ets/common/ServiceFactory.ts +37 -37
- package/harmony/rn_bleplx/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/rn_bleplx/src/main/ets/generated/index.ets +5 -5
- package/harmony/rn_bleplx/src/main/ets/generated/ts.ts +6 -6
- package/harmony/rn_bleplx/src/main/ets/generated/turboModules/BlePlx.ts +100 -100
- package/harmony/rn_bleplx/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/rn_bleplx/src/main/module.json5 +6 -6
- package/harmony/rn_bleplx/ts.ets +25 -25
- package/harmony/rn_bleplx.har +0 -0
- package/package.json +185 -185
- package/src/BleError.js +555 -555
- package/src/BleManager.js +1287 -1287
- package/src/BleModule.js +847 -847
- package/src/Characteristic.js +166 -166
- package/src/Descriptor.js +82 -82
- package/src/Device.js +370 -370
- package/src/NativeBlePlx.ts +121 -121
- package/src/Service.js +188 -188
- package/src/TypeDefinition.js +360 -360
- package/src/Utils.js +26 -26
- package/src/index.d.ts +2113 -2113
- package/src/index.js +20 -20
|
@@ -1,25 +1,25 @@
|
|
|
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: GenerateShadowNodeH.js
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
#pragma once
|
|
12
|
-
|
|
13
|
-
#include <react/renderer/components/react_native_ble_plx/EventEmitters.h>
|
|
14
|
-
#include <react/renderer/components/react_native_ble_plx/Props.h>
|
|
15
|
-
#include <react/renderer/components/react_native_ble_plx/States.h>
|
|
16
|
-
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
-
#include <jsi/jsi.h>
|
|
18
|
-
|
|
19
|
-
namespace facebook {
|
|
20
|
-
namespace react {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} // namespace react
|
|
25
|
-
} // namespace facebook
|
|
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: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/react_native_ble_plx/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/react_native_ble_plx/Props.h>
|
|
15
|
+
#include <react/renderer/components/react_native_ble_plx/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook {
|
|
20
|
+
namespace react {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
} // namespace react
|
|
25
|
+
} // namespace facebook
|
|
@@ -1,18 +1,18 @@
|
|
|
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: GenerateStateCpp.js
|
|
9
|
-
*/
|
|
10
|
-
#include <react/renderer/components/react_native_ble_plx/States.h>
|
|
11
|
-
|
|
12
|
-
namespace facebook {
|
|
13
|
-
namespace react {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} // namespace react
|
|
18
|
-
} // namespace facebook
|
|
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: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include <react/renderer/components/react_native_ble_plx/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook {
|
|
13
|
+
namespace react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace react
|
|
18
|
+
} // namespace facebook
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
-
*
|
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
-
* once the code is regenerated.
|
|
6
|
-
*
|
|
7
|
-
* @generated by codegen project: GenerateStateH.js
|
|
8
|
-
*/
|
|
9
|
-
#pragma once
|
|
10
|
-
|
|
11
|
-
#ifdef ANDROID
|
|
12
|
-
#include <folly/dynamic.h>
|
|
13
|
-
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
14
|
-
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
15
|
-
#endif
|
|
16
|
-
|
|
17
|
-
namespace facebook {
|
|
18
|
-
namespace react {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} // namespace react
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
14
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
namespace facebook {
|
|
18
|
+
namespace react {
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
} // namespace react
|
|
23
23
|
} // namespace facebook
|
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* MIT License
|
|
3
|
-
*
|
|
4
|
-
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
-
*
|
|
6
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
* in the Software without restriction, including without limitation the rights
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
import { Service } from './Service'
|
|
26
|
-
import { ble } from '@kit.ConnectivityKit';
|
|
27
|
-
import { ValuesBucket } from '@kit.ArkData';
|
|
28
|
-
|
|
29
|
-
export class BleDevice {
|
|
30
|
-
private id: string;
|
|
31
|
-
|
|
32
|
-
private name: string;
|
|
33
|
-
|
|
34
|
-
private services: Service[];
|
|
35
|
-
|
|
36
|
-
public clientDevice: ble.GattClientDevice;
|
|
37
|
-
|
|
38
|
-
public mtu: number = 23;
|
|
39
|
-
|
|
40
|
-
constructor(id: string, name: string) {
|
|
41
|
-
this.id = id;
|
|
42
|
-
this.name = name;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
public getId(): string {
|
|
46
|
-
return this.id;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
public setId(id: string) {
|
|
50
|
-
this.id = id;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
public getName(): string {
|
|
54
|
-
return this.name;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
public setName(name: string) {
|
|
58
|
-
this.name = name;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
public getServices(): Service[] {
|
|
62
|
-
return this.services;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
public setServices(services: Service[]) {
|
|
66
|
-
this.services = services;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
public getServiceByUUID(uuid: string): Service | null {
|
|
70
|
-
if (this.services == null) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var result: Service = null;
|
|
75
|
-
this.services.forEach(value => {
|
|
76
|
-
if (value.getUuid() == uuid) {
|
|
77
|
-
result = value;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
return result;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
public asJSObject(rssi?: number): ValuesBucket {
|
|
84
|
-
return {
|
|
85
|
-
'id': this.getId(),
|
|
86
|
-
'name': this.getName(),
|
|
87
|
-
'rssi': rssi,
|
|
88
|
-
'mtu': this.mtu,
|
|
89
|
-
'manufacturerData': null,
|
|
90
|
-
'serviceData': null,
|
|
91
|
-
'serviceUUIDs': null,
|
|
92
|
-
'localName': null,
|
|
93
|
-
'txPowerLevel': null,
|
|
94
|
-
'solicitedServiceUUIDs': null,
|
|
95
|
-
'isConnectable': null,
|
|
96
|
-
'overflowServiceUUIDs': null
|
|
97
|
-
}
|
|
98
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { Service } from './Service'
|
|
26
|
+
import { ble } from '@kit.ConnectivityKit';
|
|
27
|
+
import { ValuesBucket } from '@kit.ArkData';
|
|
28
|
+
|
|
29
|
+
export class BleDevice {
|
|
30
|
+
private id: string;
|
|
31
|
+
|
|
32
|
+
private name: string;
|
|
33
|
+
|
|
34
|
+
private services: Service[];
|
|
35
|
+
|
|
36
|
+
public clientDevice: ble.GattClientDevice;
|
|
37
|
+
|
|
38
|
+
public mtu: number = 23;
|
|
39
|
+
|
|
40
|
+
constructor(id: string, name: string) {
|
|
41
|
+
this.id = id;
|
|
42
|
+
this.name = name;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public getId(): string {
|
|
46
|
+
return this.id;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public setId(id: string) {
|
|
50
|
+
this.id = id;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public getName(): string {
|
|
54
|
+
return this.name;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public setName(name: string) {
|
|
58
|
+
this.name = name;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public getServices(): Service[] {
|
|
62
|
+
return this.services;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public setServices(services: Service[]) {
|
|
66
|
+
this.services = services;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public getServiceByUUID(uuid: string): Service | null {
|
|
70
|
+
if (this.services == null) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
var result: Service = null;
|
|
75
|
+
this.services.forEach(value => {
|
|
76
|
+
if (value.getUuid() == uuid) {
|
|
77
|
+
result = value;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return result;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public asJSObject(rssi?: number): ValuesBucket {
|
|
84
|
+
return {
|
|
85
|
+
'id': this.getId(),
|
|
86
|
+
'name': this.getName(),
|
|
87
|
+
'rssi': rssi,
|
|
88
|
+
'mtu': this.mtu,
|
|
89
|
+
'manufacturerData': null,
|
|
90
|
+
'serviceData': null,
|
|
91
|
+
'serviceUUIDs': null,
|
|
92
|
+
'localName': null,
|
|
93
|
+
'txPowerLevel': null,
|
|
94
|
+
'solicitedServiceUUIDs': null,
|
|
95
|
+
'isConnectable': null,
|
|
96
|
+
'overflowServiceUUIDs': null
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
99
|
}
|