forked from react-native-sensors/react-native-sensors
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
56 lines (45 loc) · 1.29 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
declare module "react-native-sensors" {
import { Observable } from "rxjs";
type Sensors = {
accelerometer: "accelerometer";
gyroscope: "gyroscope";
magnetometer: "magnetometer";
barometer: "barometer";
orientation: "orientation";
gravity: "gravity";
};
export const SensorTypes: Sensors;
export const setUpdateIntervalForType: (type: keyof Sensors, updateInterval: number) => void;
export const setLogLevelForType: (type: keyof Sensors, logLevel: 0 | 1 | 2) => void;
export interface SensorData {
x: number;
y: number;
z: number;
timestamp: number;
}
export interface BarometerData {
pressure: number;
timestamp: number;
}
export interface OrientationData {
qx: number;
qy: number;
qz: number;
qw: number;
pitch: number;
roll: number;
yaw: number;
timestamp: number;
}
type SensorsBase = {
accelerometer: Observable<SensorData>;
gyroscope: Observable<SensorData>;
magnetometer: Observable<SensorData>;
barometer: Observable<BarometerData>;
orientation: Observable<OrientationData>;
gravity: Observable<SensorData>
};
export const { accelerometer, gyroscope, magnetometer, barometer, orientation, gravity }: SensorsBase;
const sensors: SensorsBase;
export default sensors;
}