@ziztechnology/dial-library 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/README.md +1 -0
- package/dist/index.d.mts +59 -0
- package/dist/index.mjs +6 -0
- package/package.json +25 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Toooony 表盘用户 SDK
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//#region src/sensor/unified_info.d.ts
|
|
2
|
+
type UnifiedSensorUnavailableReason = 'SENSOR_MISSING' | 'NO_SAMPLE' | 'PLATFORM_UNAVAILABLE' | 'PERMISSION_DENIED' | 'NOT_CONNECTED';
|
|
3
|
+
interface Vector3Value {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
}
|
|
8
|
+
interface OrientationValue {
|
|
9
|
+
azimuth: number;
|
|
10
|
+
pitch: number;
|
|
11
|
+
roll: number;
|
|
12
|
+
}
|
|
13
|
+
interface BatteryCapacityValue {
|
|
14
|
+
levelPercent: number | null;
|
|
15
|
+
chargeCounterUah: number | null;
|
|
16
|
+
}
|
|
17
|
+
type BatteryStatus = 'CHARGING' | 'DISCHARGING' | 'FULL' | 'NOT_CHARGING' | 'UNKNOWN';
|
|
18
|
+
type BatteryPlugged = 'AC' | 'USB' | 'WIRELESS' | 'DOCK' | 'NONE';
|
|
19
|
+
type BatteryHealth = 'GOOD' | 'OVERHEAT' | 'DEAD' | 'OVER_VOLTAGE' | 'UNSPECIFIED_FAILURE' | 'COLD' | 'UNKNOWN';
|
|
20
|
+
interface BatteryStateValue {
|
|
21
|
+
present: boolean;
|
|
22
|
+
charging: boolean;
|
|
23
|
+
status: BatteryStatus;
|
|
24
|
+
plugged: BatteryPlugged;
|
|
25
|
+
health: BatteryHealth;
|
|
26
|
+
voltageMv: number | null;
|
|
27
|
+
}
|
|
28
|
+
interface AvailableSensorMetric<T, TSource extends string, TUnit extends string | null> {
|
|
29
|
+
available: true;
|
|
30
|
+
source: TSource;
|
|
31
|
+
value: T;
|
|
32
|
+
unit: TUnit;
|
|
33
|
+
sampledAtMs: number;
|
|
34
|
+
unavailableReason: null;
|
|
35
|
+
}
|
|
36
|
+
interface UnavailableSensorMetric<TSource extends string, TUnit extends string | null, TReason extends UnifiedSensorUnavailableReason | null = UnifiedSensorUnavailableReason, TSampledAt extends number | null = null> {
|
|
37
|
+
available: false;
|
|
38
|
+
source: TSource;
|
|
39
|
+
value: null;
|
|
40
|
+
unit: TUnit;
|
|
41
|
+
sampledAtMs: TSampledAt;
|
|
42
|
+
unavailableReason: TReason;
|
|
43
|
+
}
|
|
44
|
+
type UnifiedSensorMetric<T, TSource extends string, TUnit extends string | null, TReason extends UnifiedSensorUnavailableReason | null = UnifiedSensorUnavailableReason, TUnavailableSampledAt extends number | null = null> = AvailableSensorMetric<T, TSource, TUnit> | UnavailableSensorMetric<TSource, TUnit, TReason, TUnavailableSampledAt>;
|
|
45
|
+
interface UnifiedSensorInfoPayload {
|
|
46
|
+
capturedAtMs: number;
|
|
47
|
+
gyroscope: UnifiedSensorMetric<Vector3Value, 'TYPE_GYROSCOPE', 'rad/s', 'SENSOR_MISSING' | 'NO_SAMPLE', number | null>;
|
|
48
|
+
batteryCapacity: UnifiedSensorMetric<BatteryCapacityValue, 'BatteryManager', null, null, number>;
|
|
49
|
+
wifiSsid: UnifiedSensorMetric<string, 'NetworkCapabilities.WifiInfo', null, 'PERMISSION_DENIED' | 'NOT_CONNECTED' | 'PLATFORM_UNAVAILABLE'>;
|
|
50
|
+
battery: UnifiedSensorMetric<BatteryStateValue, 'ACTION_BATTERY_CHANGED', null, 'PLATFORM_UNAVAILABLE'>;
|
|
51
|
+
temperature: UnifiedSensorMetric<number, 'BATTERY_EXTRA_TEMPERATURE', '°C', 'PLATFORM_UNAVAILABLE'>;
|
|
52
|
+
gravity: UnifiedSensorMetric<Vector3Value, 'TYPE_GRAVITY', 'm/s²', 'SENSOR_MISSING' | 'NO_SAMPLE', number | null>;
|
|
53
|
+
orientation: UnifiedSensorMetric<OrientationValue, 'TYPE_ROTATION_VECTOR' | 'ACCELEROMETER_MAGNETIC_FIELD', 'degree', 'SENSOR_MISSING' | 'NO_SAMPLE', number | null>;
|
|
54
|
+
magneticField: UnifiedSensorMetric<Vector3Value, 'TYPE_MAGNETIC_FIELD', 'µT', 'SENSOR_MISSING' | 'NO_SAMPLE', number | null>;
|
|
55
|
+
linearAcceleration: UnifiedSensorMetric<Vector3Value, 'TYPE_LINEAR_ACCELERATION', 'm/s²', 'SENSOR_MISSING' | 'NO_SAMPLE', number | null>;
|
|
56
|
+
}
|
|
57
|
+
declare const unifiedSensorInfo: () => Promise<UnifiedSensorInfoPayload>;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { AvailableSensorMetric, BatteryCapacityValue, BatteryHealth, BatteryPlugged, BatteryStateValue, BatteryStatus, OrientationValue, UnavailableSensorMetric, UnifiedSensorInfoPayload, UnifiedSensorMetric, UnifiedSensorUnavailableReason, Vector3Value, unifiedSensorInfo };
|
package/dist/index.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ziztechnology/dial-library",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"private": false,
|
|
6
|
+
"description": "Tooony 表盘工具函数、方法",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.mjs",
|
|
9
|
+
"./package.json": "./package.json"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsdown",
|
|
16
|
+
"dev": "tsdown --watch",
|
|
17
|
+
"fmt": "oxfmt",
|
|
18
|
+
"fmt:check": "oxfmt --check"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"oxfmt": "^0.58.0",
|
|
22
|
+
"tsdown": "^0.22.0",
|
|
23
|
+
"typescript": "^6.0.3"
|
|
24
|
+
}
|
|
25
|
+
}
|