@react-native-ohos/react-native-sensors 7.2.2-rc.2 → 7.2.3-rc.2
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 +21 -21
- package/README.OpenSource +11 -0
- package/README.md +13 -13
- package/harmony/sensors/Index.ets +18 -16
- package/harmony/sensors/build-profile.json5 +12 -12
- package/harmony/sensors/hvigorfile.ts +6 -6
- package/harmony/sensors/oh-package.json5 +11 -11
- package/harmony/sensors/src/main/cpp/CMakeLists.txt +8 -8
- package/harmony/sensors/src/main/cpp/SensorsPackage.h +25 -25
- package/harmony/sensors/src/main/cpp/generated/RNOH/generated/BaseReactNativeSensorsPackage.h +30 -30
- package/harmony/sensors/src/main/cpp/generated/RNOH/generated/turbo_modules/RTNSensors.cpp +25 -25
- package/harmony/sensors/src/main/cpp/generated/RNOH/generated/turbo_modules/RTNSensors.h +19 -19
- package/harmony/sensors/src/main/ets/RTNSensorsTurboModule.ts +275 -275
- package/harmony/sensors/src/main/ets/{SensorsPackage.ts → SensorsPackage.ets} +38 -37
- package/harmony/sensors/src/main/ets/generated/components/ts.ts +5 -5
- package/harmony/sensors/src/main/ets/generated/index.ets +5 -5
- package/harmony/sensors/src/main/ets/generated/ts.ts +6 -6
- package/harmony/sensors/src/main/ets/generated/turboModules/RTNSensors.ts +30 -30
- package/harmony/sensors/src/main/ets/generated/turboModules/ts.ts +5 -5
- package/harmony/sensors/src/main/module.json5 +9 -9
- package/harmony/sensors/src/main/resources/base/element/string.json +8 -8
- package/harmony/sensors/src/main/resources/en_US/element/string.json +8 -8
- package/harmony/sensors/src/main/resources/zh_CN/element/string.json +8 -8
- package/harmony/sensors/{ts.ts → ts.ets} +17 -17
- package/harmony/sensors.har +0 -0
- package/index.d.ts +69 -69
- package/index.js +13 -13
- package/package.json +90 -88
- package/src/NativeSensors.ts +30 -30
- package/src/rnsensors.js +49 -49
- package/src/sensors.js +75 -75
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export namespace RTNSensors {
|
|
6
|
-
export const NAME = 'RTNSensors' as const
|
|
7
|
-
|
|
8
|
-
export interface Spec {
|
|
9
|
-
accelerometer(interval: number): void;
|
|
10
|
-
|
|
11
|
-
gyroscope(interval: number): void;
|
|
12
|
-
|
|
13
|
-
magnetometer(interval: number): void;
|
|
14
|
-
|
|
15
|
-
barometer(interval: number): void;
|
|
16
|
-
|
|
17
|
-
orientation(interval: number): void;
|
|
18
|
-
|
|
19
|
-
gravity(interval: number): void;
|
|
20
|
-
|
|
21
|
-
off(sensorType: string): void;
|
|
22
|
-
|
|
23
|
-
setUpdateInterval(sensorType: string, updateInterval: number): void;
|
|
24
|
-
|
|
25
|
-
isAvailable(sensorType: string): Promise<boolean>;
|
|
26
|
-
|
|
27
|
-
setLogLevel(sensorType: string, logLevel: number): void;
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export namespace RTNSensors {
|
|
6
|
+
export const NAME = 'RTNSensors' as const
|
|
7
|
+
|
|
8
|
+
export interface Spec {
|
|
9
|
+
accelerometer(interval: number): void;
|
|
10
|
+
|
|
11
|
+
gyroscope(interval: number): void;
|
|
12
|
+
|
|
13
|
+
magnetometer(interval: number): void;
|
|
14
|
+
|
|
15
|
+
barometer(interval: number): void;
|
|
16
|
+
|
|
17
|
+
orientation(interval: number): void;
|
|
18
|
+
|
|
19
|
+
gravity(interval: number): void;
|
|
20
|
+
|
|
21
|
+
off(sensorType: string): void;
|
|
22
|
+
|
|
23
|
+
setUpdateInterval(sensorType: string, updateInterval: number): void;
|
|
24
|
+
|
|
25
|
+
isAvailable(sensorType: string): Promise<boolean>;
|
|
26
|
+
|
|
27
|
+
setLogLevel(sensorType: string, logLevel: number): void;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
export * from "./RTNSensors"
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
export * from "./RTNSensors"
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"module": {
|
|
3
|
-
"name": "sensors",
|
|
4
|
-
"type": "har",
|
|
5
|
-
"deviceTypes": [
|
|
6
|
-
"default",
|
|
7
|
-
]
|
|
8
|
-
}
|
|
9
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"module": {
|
|
3
|
+
"name": "sensors",
|
|
4
|
+
"type": "har",
|
|
5
|
+
"deviceTypes": [
|
|
6
|
+
"default",
|
|
7
|
+
]
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
{
|
|
2
|
-
"string": [
|
|
3
|
-
{
|
|
4
|
-
"name": "page_show",
|
|
5
|
-
"value": "page from package"
|
|
6
|
-
}
|
|
7
|
-
]
|
|
8
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"string": [
|
|
3
|
+
{
|
|
4
|
+
"name": "page_show",
|
|
5
|
+
"value": "page from package"
|
|
6
|
+
}
|
|
7
|
+
]
|
|
8
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the MIT License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://github.com/react-native-sensors/react-native-sensors/blob/master/LICENSE
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
export * from './src/main/ets/RTNSensorsTurboModule'
|
|
17
|
-
export * from './src/main/ets/SensorsPackage'
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the MIT License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://github.com/react-native-sensors/react-native-sensors/blob/master/LICENSE
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export * from './src/main/ets/RTNSensorsTurboModule'
|
|
17
|
+
export * from './src/main/ets/SensorsPackage.ets'
|
package/harmony/sensors.har
CHANGED
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
declare module "react-native-sensors" {
|
|
2
|
-
import { Observable } from "rxjs";
|
|
3
|
-
|
|
4
|
-
type Sensors = {
|
|
5
|
-
accelerometer: "accelerometer";
|
|
6
|
-
gyroscope: "gyroscope";
|
|
7
|
-
magnetometer: "magnetometer";
|
|
8
|
-
barometer: "barometer";
|
|
9
|
-
orientation: "orientation";
|
|
10
|
-
gravity: "gravity";
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const SensorTypes: Sensors;
|
|
14
|
-
|
|
15
|
-
export const setUpdateIntervalForType: (
|
|
16
|
-
type: keyof Sensors,
|
|
17
|
-
updateInterval: number
|
|
18
|
-
) => void;
|
|
19
|
-
|
|
20
|
-
export const setLogLevelForType: (
|
|
21
|
-
type: keyof Sensors,
|
|
22
|
-
logLevel: 0 | 1 | 2
|
|
23
|
-
) => void;
|
|
24
|
-
|
|
25
|
-
export interface SensorData {
|
|
26
|
-
x: number;
|
|
27
|
-
y: number;
|
|
28
|
-
z: number;
|
|
29
|
-
timestamp: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface BarometerData {
|
|
33
|
-
pressure: number;
|
|
34
|
-
timestamp: number;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface OrientationData {
|
|
38
|
-
qx: number;
|
|
39
|
-
qy: number;
|
|
40
|
-
qz: number;
|
|
41
|
-
qw: number;
|
|
42
|
-
pitch: number;
|
|
43
|
-
roll: number;
|
|
44
|
-
yaw: number;
|
|
45
|
-
timestamp: number;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
type SensorsBase = {
|
|
49
|
-
accelerometer: Observable<SensorData>;
|
|
50
|
-
gyroscope: Observable<SensorData>;
|
|
51
|
-
magnetometer: Observable<SensorData>;
|
|
52
|
-
barometer: Observable<BarometerData>;
|
|
53
|
-
orientation: Observable<OrientationData>;
|
|
54
|
-
gravity: Observable<SensorData>;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
export const {
|
|
58
|
-
accelerometer,
|
|
59
|
-
gyroscope,
|
|
60
|
-
magnetometer,
|
|
61
|
-
barometer,
|
|
62
|
-
orientation,
|
|
63
|
-
gravity,
|
|
64
|
-
}: SensorsBase;
|
|
65
|
-
|
|
66
|
-
const sensors: SensorsBase;
|
|
67
|
-
|
|
68
|
-
export default sensors;
|
|
69
|
-
}
|
|
1
|
+
declare module "react-native-sensors" {
|
|
2
|
+
import { Observable } from "rxjs";
|
|
3
|
+
|
|
4
|
+
type Sensors = {
|
|
5
|
+
accelerometer: "accelerometer";
|
|
6
|
+
gyroscope: "gyroscope";
|
|
7
|
+
magnetometer: "magnetometer";
|
|
8
|
+
barometer: "barometer";
|
|
9
|
+
orientation: "orientation";
|
|
10
|
+
gravity: "gravity";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const SensorTypes: Sensors;
|
|
14
|
+
|
|
15
|
+
export const setUpdateIntervalForType: (
|
|
16
|
+
type: keyof Sensors,
|
|
17
|
+
updateInterval: number
|
|
18
|
+
) => void;
|
|
19
|
+
|
|
20
|
+
export const setLogLevelForType: (
|
|
21
|
+
type: keyof Sensors,
|
|
22
|
+
logLevel: 0 | 1 | 2
|
|
23
|
+
) => void;
|
|
24
|
+
|
|
25
|
+
export interface SensorData {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
z: number;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface BarometerData {
|
|
33
|
+
pressure: number;
|
|
34
|
+
timestamp: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface OrientationData {
|
|
38
|
+
qx: number;
|
|
39
|
+
qy: number;
|
|
40
|
+
qz: number;
|
|
41
|
+
qw: number;
|
|
42
|
+
pitch: number;
|
|
43
|
+
roll: number;
|
|
44
|
+
yaw: number;
|
|
45
|
+
timestamp: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type SensorsBase = {
|
|
49
|
+
accelerometer: Observable<SensorData>;
|
|
50
|
+
gyroscope: Observable<SensorData>;
|
|
51
|
+
magnetometer: Observable<SensorData>;
|
|
52
|
+
barometer: Observable<BarometerData>;
|
|
53
|
+
orientation: Observable<OrientationData>;
|
|
54
|
+
gravity: Observable<SensorData>;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const {
|
|
58
|
+
accelerometer,
|
|
59
|
+
gyroscope,
|
|
60
|
+
magnetometer,
|
|
61
|
+
barometer,
|
|
62
|
+
orientation,
|
|
63
|
+
gravity,
|
|
64
|
+
}: SensorsBase;
|
|
65
|
+
|
|
66
|
+
const sensors: SensorsBase;
|
|
67
|
+
|
|
68
|
+
export default sensors;
|
|
69
|
+
}
|
package/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import sensors from "./src/sensors";
|
|
2
|
-
export { setUpdateInterval as setUpdateIntervalForType, setLogLevelForType } from "./src/rnsensors";
|
|
3
|
-
|
|
4
|
-
export const SensorTypes = {
|
|
5
|
-
accelerometer: "accelerometer",
|
|
6
|
-
gyroscope: "gyroscope",
|
|
7
|
-
magnetometer: "magnetometer",
|
|
8
|
-
barometer: "barometer",
|
|
9
|
-
orientation: "orientation",
|
|
10
|
-
gravity: "gravity"
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const { accelerometer, gyroscope, magnetometer, barometer, orientation, gravity } = sensors;
|
|
1
|
+
import sensors from "./src/sensors";
|
|
2
|
+
export { setUpdateInterval as setUpdateIntervalForType, setLogLevelForType } from "./src/rnsensors";
|
|
3
|
+
|
|
4
|
+
export const SensorTypes = {
|
|
5
|
+
accelerometer: "accelerometer",
|
|
6
|
+
gyroscope: "gyroscope",
|
|
7
|
+
magnetometer: "magnetometer",
|
|
8
|
+
barometer: "barometer",
|
|
9
|
+
orientation: "orientation",
|
|
10
|
+
gravity: "gravity"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const { accelerometer, gyroscope, magnetometer, barometer, orientation, gravity } = sensors;
|
|
14
14
|
export default sensors;
|
package/package.json
CHANGED
|
@@ -1,88 +1,90 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@react-native-ohos/react-native-sensors",
|
|
3
|
-
"version": "7.2.
|
|
4
|
-
"description": "A developer friendly approach for sensors in react-native",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"contributor:add": "all-contributors add",
|
|
7
|
-
"postcontributor:add": "npm run contributor:generate",
|
|
8
|
-
"contributor:generate": "all-contributors generate",
|
|
9
|
-
"postcontributor:generate": "npm run format",
|
|
10
|
-
"format": "prettier --write ./src/*",
|
|
11
|
-
"test": "prettier --check ./src/*",
|
|
12
|
-
"semantic-release": "semantic-release",
|
|
13
|
-
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-sensors --cpp-output-path ./harmony/sensors/src/main/cpp/generated --ets-output-path ./harmony/sensors/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeSensors.ts",
|
|
14
|
-
"travis-deploy-once": "travis-deploy-once"
|
|
15
|
-
},
|
|
16
|
-
"main": "index.js",
|
|
17
|
-
"types": "index.d.ts",
|
|
18
|
-
"repository": "
|
|
19
|
-
"homepage": "https://
|
|
20
|
-
"keywords": [
|
|
21
|
-
"react-native",
|
|
22
|
-
"harmony"
|
|
23
|
-
],
|
|
24
|
-
"author": {
|
|
25
|
-
"name": "Daniel Schmidt",
|
|
26
|
-
"email": "danielmschmidt92@gmail.com",
|
|
27
|
-
"url": "http://danielmschmidt.de"
|
|
28
|
-
},
|
|
29
|
-
"husky": {
|
|
30
|
-
"hooks": {
|
|
31
|
-
"pre-commit": "pretty-quick --staged"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"jest": {
|
|
35
|
-
"timers": "fake",
|
|
36
|
-
"projects": [
|
|
37
|
-
{
|
|
38
|
-
"displayName": "Unit",
|
|
39
|
-
"testEnvironment": "node",
|
|
40
|
-
"testPathIgnorePatterns": [
|
|
41
|
-
"tests/*"
|
|
42
|
-
],
|
|
43
|
-
"timers": "fake"
|
|
44
|
-
}
|
|
45
|
-
]
|
|
46
|
-
},
|
|
47
|
-
"babel": {
|
|
48
|
-
"presets": [
|
|
49
|
-
"react-native"
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
"license": "MIT",
|
|
53
|
-
"dependencies": {
|
|
54
|
-
"rxjs": ">= 6"
|
|
55
|
-
},
|
|
56
|
-
"devDependencies": {
|
|
57
|
-
"
|
|
58
|
-
"babel-
|
|
59
|
-
"babel-
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@react-native-ohos/react-native-sensors",
|
|
3
|
+
"version": "7.2.3-rc.2",
|
|
4
|
+
"description": "A developer friendly approach for sensors in react-native",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"contributor:add": "all-contributors add",
|
|
7
|
+
"postcontributor:add": "npm run contributor:generate",
|
|
8
|
+
"contributor:generate": "all-contributors generate",
|
|
9
|
+
"postcontributor:generate": "npm run format",
|
|
10
|
+
"format": "prettier --write ./src/*",
|
|
11
|
+
"test": "prettier --check ./src/*",
|
|
12
|
+
"semantic-release": "semantic-release",
|
|
13
|
+
"codegen-lib": "react-native codegen-lib-harmony --no-safety-check --npm-package-name react-native-sensors --cpp-output-path ./harmony/sensors/src/main/cpp/generated --ets-output-path ./harmony/sensors/src/main/ets/generated --turbo-modules-spec-paths ./src/NativeSensors.ts",
|
|
14
|
+
"travis-deploy-once": "travis-deploy-once"
|
|
15
|
+
},
|
|
16
|
+
"main": "index.js",
|
|
17
|
+
"types": "index.d.ts",
|
|
18
|
+
"repository": "https://gitcode.com/openharmony-sig/rntpc_react-native-sensors.git",
|
|
19
|
+
"homepage": "https://gitcode.com/openharmony-sig/rntpc_react-native-sensors.git",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"react-native",
|
|
22
|
+
"harmony"
|
|
23
|
+
],
|
|
24
|
+
"author": {
|
|
25
|
+
"name": "Daniel Schmidt",
|
|
26
|
+
"email": "danielmschmidt92@gmail.com",
|
|
27
|
+
"url": "http://danielmschmidt.de"
|
|
28
|
+
},
|
|
29
|
+
"husky": {
|
|
30
|
+
"hooks": {
|
|
31
|
+
"pre-commit": "pretty-quick --staged"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"jest": {
|
|
35
|
+
"timers": "fake",
|
|
36
|
+
"projects": [
|
|
37
|
+
{
|
|
38
|
+
"displayName": "Unit",
|
|
39
|
+
"testEnvironment": "node",
|
|
40
|
+
"testPathIgnorePatterns": [
|
|
41
|
+
"tests/*"
|
|
42
|
+
],
|
|
43
|
+
"timers": "fake"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"babel": {
|
|
48
|
+
"presets": [
|
|
49
|
+
"react-native"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"rxjs": ">= 6"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"babel-core": "6.26.3",
|
|
58
|
+
"babel-jest": "24.1.0",
|
|
59
|
+
"babel-preset-react-native": "4.0.0",
|
|
60
|
+
"husky": "4.2.3",
|
|
61
|
+
"metro-config": "^0.67.0",
|
|
62
|
+
"prettier": "2.2.1",
|
|
63
|
+
"pretty-quick": "3.1.0",
|
|
64
|
+
"react": "^17.0.2",
|
|
65
|
+
"react-native": "^0.68.0",
|
|
66
|
+
"regenerator-runtime": "0.13.1",
|
|
67
|
+
"rxjs-marbles": "5.0.0",
|
|
68
|
+
"react-native-harmony-cli": "npm:@react-native-oh/react-native-harmony-cli@^0.0.27"
|
|
69
|
+
},
|
|
70
|
+
"harmony": {
|
|
71
|
+
"alias": "react-native-sensors",
|
|
72
|
+
"autolinking": {
|
|
73
|
+
"etsPackageClassName": "SensorsPackage",
|
|
74
|
+
"cppPackageClassName": "SensorsPackage",
|
|
75
|
+
"cmakeLibraryTargetName": "rnoh_sensors",
|
|
76
|
+
"ohPackageName": "@react-native-ohos/react-native-sensors"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"files": [
|
|
80
|
+
"src",
|
|
81
|
+
"harmony",
|
|
82
|
+
"LICENSE",
|
|
83
|
+
"README.md",
|
|
84
|
+
"index.*"
|
|
85
|
+
],
|
|
86
|
+
"publishConfig": {
|
|
87
|
+
"registry": "https://registry.npmjs.org/",
|
|
88
|
+
"access": "public"
|
|
89
|
+
}
|
|
90
|
+
}
|
package/src/NativeSensors.ts
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
-
* Licensed under the MIT License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at
|
|
6
|
-
*
|
|
7
|
-
* https://github.com/react-native-sensors/react-native-sensors/blob/master/LICENSE
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
-
* See the License for the specific language governing permissions and
|
|
13
|
-
* limitations under the License.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
17
|
-
import { TurboModuleRegistry } from "react-native";
|
|
18
|
-
|
|
19
|
-
export interface Spec extends TurboModule {
|
|
20
|
-
accelerometer(interval?: number): void;
|
|
21
|
-
gyroscope(interval?: number): void;
|
|
22
|
-
magnetometer(interval?: number): void;
|
|
23
|
-
barometer(interval?: number): void;
|
|
24
|
-
orientation(interval?: number): void;
|
|
25
|
-
gravity(interval?: number): void;
|
|
26
|
-
off(sensorType: string): void;
|
|
27
|
-
setUpdateInterval(sensorType: string, updateInterval: number): void;
|
|
28
|
-
isAvailable(sensorType: string): Promise<boolean>;
|
|
29
|
-
setLogLevel(sensorType: string, logLevel: number): void;
|
|
30
|
-
}
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Huawei Device Co., Ltd.
|
|
3
|
+
* Licensed under the MIT License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License.
|
|
5
|
+
* You may obtain a copy of the License at
|
|
6
|
+
*
|
|
7
|
+
* https://github.com/react-native-sensors/react-native-sensors/blob/master/LICENSE
|
|
8
|
+
*
|
|
9
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
* See the License for the specific language governing permissions and
|
|
13
|
+
* limitations under the License.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
17
|
+
import { TurboModuleRegistry } from "react-native";
|
|
18
|
+
|
|
19
|
+
export interface Spec extends TurboModule {
|
|
20
|
+
accelerometer(interval?: number): void;
|
|
21
|
+
gyroscope(interval?: number): void;
|
|
22
|
+
magnetometer(interval?: number): void;
|
|
23
|
+
barometer(interval?: number): void;
|
|
24
|
+
orientation(interval?: number): void;
|
|
25
|
+
gravity(interval?: number): void;
|
|
26
|
+
off(sensorType: string): void;
|
|
27
|
+
setUpdateInterval(sensorType: string, updateInterval: number): void;
|
|
28
|
+
isAvailable(sensorType: string): Promise<boolean>;
|
|
29
|
+
setLogLevel(sensorType: string, logLevel: number): void;
|
|
30
|
+
}
|
|
31
31
|
export default TurboModuleRegistry.get<Spec>("RTNSensors") as Spec | null;
|