@ledvance/base 1.1.15 → 1.1.16
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/package.json
CHANGED
package/src/api/native.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import { NativeResult, Result } from '../models/modules/Result';
|
|
2
|
+
export interface DeviceInfo {
|
|
3
|
+
deviceId: string;
|
|
4
|
+
deviceName: string;
|
|
5
|
+
deviceIcon: string;
|
|
6
|
+
roomName: string;
|
|
7
|
+
status: number;
|
|
8
|
+
}
|
|
2
9
|
declare type GetFeatureResultType = (deviceId: string, featureId: string) => Promise<NativeResult<any>>;
|
|
3
10
|
declare type SetFeatureResultType = (deviceId: string, featureId: string, value: any) => Promise<NativeResult<any>>;
|
|
4
11
|
export declare const getFeature: GetFeatureResultType;
|
|
@@ -21,6 +28,7 @@ export declare class NativeApi {
|
|
|
21
28
|
static putJson(deviceId: string, featureType: string, json: string): Promise<Result<any>>;
|
|
22
29
|
static getJson(deviceId: string, featureType: string): Promise<Result<any>>;
|
|
23
30
|
static groupControl(tyGroupId: number, dps: string, config: string): Promise<Result<any>>;
|
|
31
|
+
static getGroupDevices(tyGroupId: number): Promise<Result<DeviceInfo[]>>;
|
|
24
32
|
}
|
|
25
33
|
export declare const openDownloadFile: (filePath: string) => Promise<unknown>;
|
|
26
34
|
export declare const queryDpIds: (dpIds: string, deviceId: string) => Promise<unknown>;
|
package/src/api/native.ts
CHANGED
|
@@ -18,6 +18,15 @@ interface LDVDevicePanelManager {
|
|
|
18
18
|
groupControl: (tyGroupId: number, dps: string, config: string) => Promise<NativeResult<any>>
|
|
19
19
|
getFeature: (deviceId: string, featureId: string, callback: (res: NativeResult<string>) => void) => void
|
|
20
20
|
putFeature: (deviceId: string, featureId: string, value: any, callback: (res: NativeResult<string>) => void) => void
|
|
21
|
+
getGroupDevices: (tyGroupId: number) => Promise<NativeResult<string>>
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface DeviceInfo {
|
|
25
|
+
deviceId: string
|
|
26
|
+
deviceName: string
|
|
27
|
+
deviceIcon: string
|
|
28
|
+
roomName: string
|
|
29
|
+
status: number
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
const devicePanel: LDVDevicePanelManager = NativeModules.LDVDevicePanelManager
|
|
@@ -255,6 +264,15 @@ export class NativeApi {
|
|
|
255
264
|
data: nativeResult.data,
|
|
256
265
|
}
|
|
257
266
|
}
|
|
267
|
+
|
|
268
|
+
static async getGroupDevices(tyGroupId: number): Promise<Result<DeviceInfo[]>> {
|
|
269
|
+
const nativeResult = await devicePanel.getGroupDevices(tyGroupId)
|
|
270
|
+
return {
|
|
271
|
+
success: nativeResult.result,
|
|
272
|
+
msg: nativeResult.msg,
|
|
273
|
+
data: nativeResult.data && JSON.parse(nativeResult.data),
|
|
274
|
+
}
|
|
275
|
+
}
|
|
258
276
|
}
|
|
259
277
|
|
|
260
278
|
// 打开下载文件
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
|
-
import { Result } from './Result';
|
|
2
|
+
import { DpsResult, Result } from './Result';
|
|
3
3
|
import { DevInfo, DpValue } from 'tuya-panel-kit';
|
|
4
4
|
export interface NativeProps {
|
|
5
5
|
familyName: string;
|
|
@@ -19,6 +19,9 @@ export interface UAGroupInfo {
|
|
|
19
19
|
dps: any;
|
|
20
20
|
config: any;
|
|
21
21
|
}
|
|
22
|
+
declare type AsyncBlockType<T> = () => Promise<DpsResult<T>>;
|
|
23
|
+
declare type SyncBlockType<T> = () => DpsResult<T>;
|
|
24
|
+
declare function asyncSetDps<T>(dispatch: Dispatch<any>, block: AsyncBlockType<T> | SyncBlockType<T>): Promise<Result<T>>;
|
|
22
25
|
declare function simpleSetDps<T>(dispatch: Dispatch<any>): (deviceId: string, dps: any) => Promise<Result<T>>;
|
|
23
26
|
declare function simpleSetDp<T>(dispatch: Dispatch<any>): (deviceId: string, dp: string, value: any) => Promise<Result<T>>;
|
|
24
27
|
declare const useDeviceId: () => string;
|
|
@@ -46,4 +49,4 @@ export declare function useGroupConfigFeature<GC, GCPT extends {
|
|
|
46
49
|
}[keyof GC]>(key: keyof GC, extraDps?: any): [GCPT, (value: GCPT, dpValue: any) => Promise<Result<any>>];
|
|
47
50
|
export declare const ldvModules: import("@reduxjs/toolkit").Reducer<NativeProps, import("@reduxjs/toolkit").AnyAction>;
|
|
48
51
|
export declare const setNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setGroupNativeProps: import("@reduxjs/toolkit").ActionCreatorWithPayload<NativeProps, string>, setDps: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setTimeSchedule: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>, setEnergieverbrauch: import("@reduxjs/toolkit").ActionCreatorWithPayload<any, string>;
|
|
49
|
-
export { simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useDps, useFamilyName, useTimeSchedule, useEnergieverbrauch, };
|
|
52
|
+
export { asyncSetDps, simpleSetDps, simpleSetDp, useDeviceId, useDeviceInfo, useDp, useDps, useFamilyName, useTimeSchedule, useEnergieverbrauch, };
|