@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,179 +1,179 @@
|
|
|
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 ble from '@ohos.bluetooth.ble';
|
|
26
|
-
import Logger from './common/Logger';
|
|
27
|
-
import { Service } from './Service';
|
|
28
|
-
import { arrayBufferToBase64 } from './common/BleUtils'
|
|
29
|
-
import { Descriptor } from './Descriptor'
|
|
30
|
-
import { IdGenerator } from './common/IdGenerator';
|
|
31
|
-
import { IdGeneratorKey } from './common/IdGeneratorKey';
|
|
32
|
-
import { ValuesBucket } from '@kit.ArkData';
|
|
33
|
-
import { InstanceIdGenerator } from './common/InstanceIdGenerator';
|
|
34
|
-
|
|
35
|
-
export class Characteristic {
|
|
36
|
-
private id: number;
|
|
37
|
-
private serviceID: number;
|
|
38
|
-
private serviceUUID: string;
|
|
39
|
-
private deviceID: string;
|
|
40
|
-
private value: ArrayBuffer;
|
|
41
|
-
public gattCharacteristic: ble.BLECharacteristic;
|
|
42
|
-
|
|
43
|
-
public writeType: ble.GattWriteType;
|
|
44
|
-
|
|
45
|
-
public setValue(value: ArrayBuffer) {
|
|
46
|
-
this.value = value;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
constructor(id: number, deviceID: string, serviceID: number, serviceUUID: string,
|
|
50
|
-
gattCharacteristic: ble.BLECharacteristic) {
|
|
51
|
-
this.id = id;
|
|
52
|
-
this.deviceID = deviceID;
|
|
53
|
-
this.serviceUUID = serviceUUID;
|
|
54
|
-
this.serviceID = serviceID;
|
|
55
|
-
this.gattCharacteristic = gattCharacteristic;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static constructorWithId(id: number, service: Service, gattCharacteristic: ble.BLECharacteristic): Characteristic {
|
|
59
|
-
return new Characteristic(id, service.getDeviceID(), service.getId(), service.getUuid(), gattCharacteristic);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
static constructorWithNative(service: Service, gattCharacteristic: ble.BLECharacteristic): Characteristic {
|
|
63
|
-
let id: number =
|
|
64
|
-
IdGenerator.getIdForKey(new IdGeneratorKey(service.getDeviceID(), gattCharacteristic.characteristicUuid,
|
|
65
|
-
InstanceIdGenerator.generateInstanceId(gattCharacteristic.characteristicUuid)))
|
|
66
|
-
return new Characteristic(id, service.getDeviceID(), service.getId(), service.getUuid(), gattCharacteristic);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
static constructorWithOther(other: Characteristic): Characteristic {
|
|
70
|
-
return new Characteristic(other.id, other.deviceID, other.serviceID, other.serviceUUID, other.gattCharacteristic);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public getId(): number {
|
|
74
|
-
return this.id;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
public getUuid(): string {
|
|
78
|
-
return this.gattCharacteristic.characteristicUuid;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public getServiceID(): number {
|
|
82
|
-
return this.serviceID;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public getServiceUUID(): string {
|
|
86
|
-
return this.serviceUUID;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public getDeviceId(): string {
|
|
90
|
-
return this.deviceID;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public getInstanceId(): number {
|
|
94
|
-
return InstanceIdGenerator.generateInstanceId(this.gattCharacteristic.characteristicUuid);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
public getGattDescriptor(uuid: string): ble.BLEDescriptor | null {
|
|
98
|
-
let descriptor: ble.BLEDescriptor = null;
|
|
99
|
-
this.gattCharacteristic.descriptors.forEach(value => {
|
|
100
|
-
if (value.descriptorUuid == uuid) {
|
|
101
|
-
descriptor = value;
|
|
102
|
-
}
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
return descriptor;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
public setWriteType(writeType: number) {
|
|
109
|
-
this.writeType = writeType;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public isReadable(): boolean {
|
|
113
|
-
return this.gattCharacteristic.properties.read ?? false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
public isWritableWithResponse(): boolean {
|
|
117
|
-
return this.gattCharacteristic.properties.write ?? false;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
public isWritableWithoutResponse(): boolean {
|
|
121
|
-
return this.gattCharacteristic.properties.writeNoResponse ?? false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
public isNotifiable(): boolean {
|
|
125
|
-
return this.gattCharacteristic.properties.notify ?? false;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
public getDescriptors(): Descriptor[] {
|
|
129
|
-
var descriptors: Descriptor[] = []
|
|
130
|
-
this.gattCharacteristic.descriptors.forEach(value => {
|
|
131
|
-
let obj = Descriptor.constructorWithNative(this, value);
|
|
132
|
-
descriptors.push(obj);
|
|
133
|
-
});
|
|
134
|
-
return descriptors;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
public isNotifying(): boolean {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
public isIndicatable(): boolean {
|
|
142
|
-
return this.gattCharacteristic.properties.indicate;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
public getValue(): ArrayBuffer {
|
|
146
|
-
return this.value;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
public getDescriptorByUUID(uuid: string): Descriptor {
|
|
150
|
-
let descriptor: Descriptor = null;
|
|
151
|
-
this.gattCharacteristic.descriptors.forEach(value => {
|
|
152
|
-
if (value.descriptorUuid == uuid) {
|
|
153
|
-
descriptor = Descriptor.constructorWithNative(this, value);
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
return descriptor;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
public logValue(message: string, value: ArrayBuffer) {
|
|
160
|
-
Logger.debug(message);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
public asJSObject(): ValuesBucket {
|
|
164
|
-
return {
|
|
165
|
-
"id": this.getId(),
|
|
166
|
-
"uuid": this.getUuid(),
|
|
167
|
-
"deviceID": this.getDeviceId(),
|
|
168
|
-
"serviceID": this.getServiceID(),
|
|
169
|
-
"serviceUUID": this.getServiceUUID(),
|
|
170
|
-
"isReadable": this.isReadable(),
|
|
171
|
-
"isWritableWithResponse": this.isWritableWithResponse(),
|
|
172
|
-
"isWritableWithoutResponse": this.isWritableWithoutResponse(),
|
|
173
|
-
"isNotifiable": this.isNotifiable(),
|
|
174
|
-
"isNotifying": this.isNotifying(),
|
|
175
|
-
"isIndicatable": this.isIndicatable(),
|
|
176
|
-
"value": arrayBufferToBase64(this.value),
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
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 ble from '@ohos.bluetooth.ble';
|
|
26
|
+
import Logger from './common/Logger';
|
|
27
|
+
import { Service } from './Service';
|
|
28
|
+
import { arrayBufferToBase64 } from './common/BleUtils'
|
|
29
|
+
import { Descriptor } from './Descriptor'
|
|
30
|
+
import { IdGenerator } from './common/IdGenerator';
|
|
31
|
+
import { IdGeneratorKey } from './common/IdGeneratorKey';
|
|
32
|
+
import { ValuesBucket } from '@kit.ArkData';
|
|
33
|
+
import { InstanceIdGenerator } from './common/InstanceIdGenerator';
|
|
34
|
+
|
|
35
|
+
export class Characteristic {
|
|
36
|
+
private id: number;
|
|
37
|
+
private serviceID: number;
|
|
38
|
+
private serviceUUID: string;
|
|
39
|
+
private deviceID: string;
|
|
40
|
+
private value: ArrayBuffer;
|
|
41
|
+
public gattCharacteristic: ble.BLECharacteristic;
|
|
42
|
+
|
|
43
|
+
public writeType: ble.GattWriteType;
|
|
44
|
+
|
|
45
|
+
public setValue(value: ArrayBuffer) {
|
|
46
|
+
this.value = value;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
constructor(id: number, deviceID: string, serviceID: number, serviceUUID: string,
|
|
50
|
+
gattCharacteristic: ble.BLECharacteristic) {
|
|
51
|
+
this.id = id;
|
|
52
|
+
this.deviceID = deviceID;
|
|
53
|
+
this.serviceUUID = serviceUUID;
|
|
54
|
+
this.serviceID = serviceID;
|
|
55
|
+
this.gattCharacteristic = gattCharacteristic;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static constructorWithId(id: number, service: Service, gattCharacteristic: ble.BLECharacteristic): Characteristic {
|
|
59
|
+
return new Characteristic(id, service.getDeviceID(), service.getId(), service.getUuid(), gattCharacteristic);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static constructorWithNative(service: Service, gattCharacteristic: ble.BLECharacteristic): Characteristic {
|
|
63
|
+
let id: number =
|
|
64
|
+
IdGenerator.getIdForKey(new IdGeneratorKey(service.getDeviceID(), gattCharacteristic.characteristicUuid,
|
|
65
|
+
InstanceIdGenerator.generateInstanceId(gattCharacteristic.characteristicUuid)))
|
|
66
|
+
return new Characteristic(id, service.getDeviceID(), service.getId(), service.getUuid(), gattCharacteristic);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
static constructorWithOther(other: Characteristic): Characteristic {
|
|
70
|
+
return new Characteristic(other.id, other.deviceID, other.serviceID, other.serviceUUID, other.gattCharacteristic);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
public getId(): number {
|
|
74
|
+
return this.id;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
public getUuid(): string {
|
|
78
|
+
return this.gattCharacteristic.characteristicUuid;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public getServiceID(): number {
|
|
82
|
+
return this.serviceID;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
public getServiceUUID(): string {
|
|
86
|
+
return this.serviceUUID;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
public getDeviceId(): string {
|
|
90
|
+
return this.deviceID;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public getInstanceId(): number {
|
|
94
|
+
return InstanceIdGenerator.generateInstanceId(this.gattCharacteristic.characteristicUuid);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public getGattDescriptor(uuid: string): ble.BLEDescriptor | null {
|
|
98
|
+
let descriptor: ble.BLEDescriptor = null;
|
|
99
|
+
this.gattCharacteristic.descriptors.forEach(value => {
|
|
100
|
+
if (value.descriptorUuid == uuid) {
|
|
101
|
+
descriptor = value;
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
return descriptor;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
public setWriteType(writeType: number) {
|
|
109
|
+
this.writeType = writeType;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
public isReadable(): boolean {
|
|
113
|
+
return this.gattCharacteristic.properties.read ?? false;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
public isWritableWithResponse(): boolean {
|
|
117
|
+
return this.gattCharacteristic.properties.write ?? false;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
public isWritableWithoutResponse(): boolean {
|
|
121
|
+
return this.gattCharacteristic.properties.writeNoResponse ?? false;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public isNotifiable(): boolean {
|
|
125
|
+
return this.gattCharacteristic.properties.notify ?? false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public getDescriptors(): Descriptor[] {
|
|
129
|
+
var descriptors: Descriptor[] = []
|
|
130
|
+
this.gattCharacteristic.descriptors.forEach(value => {
|
|
131
|
+
let obj = Descriptor.constructorWithNative(this, value);
|
|
132
|
+
descriptors.push(obj);
|
|
133
|
+
});
|
|
134
|
+
return descriptors;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
public isNotifying(): boolean {
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
public isIndicatable(): boolean {
|
|
142
|
+
return this.gattCharacteristic.properties.indicate;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
public getValue(): ArrayBuffer {
|
|
146
|
+
return this.value;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
public getDescriptorByUUID(uuid: string): Descriptor {
|
|
150
|
+
let descriptor: Descriptor = null;
|
|
151
|
+
this.gattCharacteristic.descriptors.forEach(value => {
|
|
152
|
+
if (value.descriptorUuid == uuid) {
|
|
153
|
+
descriptor = Descriptor.constructorWithNative(this, value);
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
return descriptor;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
public logValue(message: string, value: ArrayBuffer) {
|
|
160
|
+
Logger.debug(message);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
public asJSObject(): ValuesBucket {
|
|
164
|
+
return {
|
|
165
|
+
"id": this.getId(),
|
|
166
|
+
"uuid": this.getUuid(),
|
|
167
|
+
"deviceID": this.getDeviceId(),
|
|
168
|
+
"serviceID": this.getServiceID(),
|
|
169
|
+
"serviceUUID": this.getServiceUUID(),
|
|
170
|
+
"isReadable": this.isReadable(),
|
|
171
|
+
"isWritableWithResponse": this.isWritableWithResponse(),
|
|
172
|
+
"isWritableWithoutResponse": this.isWritableWithoutResponse(),
|
|
173
|
+
"isNotifiable": this.isNotifiable(),
|
|
174
|
+
"isNotifying": this.isNotifying(),
|
|
175
|
+
"isIndicatable": this.isIndicatable(),
|
|
176
|
+
"value": arrayBufferToBase64(this.value),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
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
|
-
export default class CommonConstants {
|
|
26
|
-
/**
|
|
27
|
-
* Log tag.
|
|
28
|
-
*/
|
|
29
|
-
static readonly TAG = '[RNOH] BlePlx';
|
|
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
|
+
export default class CommonConstants {
|
|
26
|
+
/**
|
|
27
|
+
* Log tag.
|
|
28
|
+
*/
|
|
29
|
+
static readonly TAG = '[RNOH] BlePlx';
|
|
30
30
|
}
|