@ray-js/lock-sdk 1.2.1-beta.0 → 1.2.1-beta.10
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/lib/api/gesture.d.ts +4 -2
- package/lib/api/video.d.ts +16 -0
- package/lib/api/video.js +20 -0
- package/lib/entries/main/exports/capability.d.ts +0 -2
- package/lib/entries/main/exports/capability.js +1 -7
- package/lib/entries/main/exports/fit-sdk/device.d.ts +0 -1
- package/lib/entries/main/exports/fit-sdk/device.js +0 -4
- package/lib/entries/main/exports/fit-sdk/temp.d.ts +4 -19
- package/lib/entries/main/exports/gesture.d.ts +3 -5
- package/lib/entries/main/exports/media.d.ts +1 -1
- package/lib/entries/main/exports/misc.d.ts +10 -4
- package/lib/entries/main/exports/misc.js +7 -1
- package/lib/entries/main/exports/notify.d.ts +2 -5
- package/lib/entries/main/exports/offline-dps.d.ts +0 -1
- package/lib/entries/main/exports/offline-dps.js +1 -4
- package/lib/entries/main/exports/temporary.d.ts +2 -11
- package/lib/entries/main/index.d.ts +2 -1
- package/lib/feature/fit/password-list.d.ts +3 -13
- package/lib/feature/fit/temp-password.d.ts +3 -2
- package/lib/feature/media/camera.d.ts +2 -4
- package/lib/feature/misc/capability.d.ts +1 -1
- package/lib/feature/misc/capability.js +37 -2
- package/lib/feature/misc/connect-device.d.ts +6 -0
- package/lib/feature/misc/connect-device.js +103 -66
- package/lib/feature/misc/types.d.ts +3 -0
- package/lib/feature/misc/update-config.js +7 -0
- package/lib/feature/password/temporary/lists.d.ts +3 -2
- package/lib/feature/password/temporary/offline-create.d.ts +3 -2
- package/lib/feature/password/temporary/wifi-online.d.ts +3 -2
- package/lib/feature/state/init-state.js +48 -37
- package/lib/feature/state/internal/share-thread-local.js +2 -2
- package/lib/feature/unlock/method/add-flow.js +2 -2
- package/lib/feature/unlock/method/add-password.js +2 -2
- package/lib/feature/unlock/method/update-remove.js +1 -1
- package/lib/interface.d.ts +8 -0
- package/lib/platform/device.d.ts +1 -0
- package/lib/platform/device.js +11 -2
- package/lib/platform/ipc.d.ts +1 -0
- package/lib/platform/ipc.js +6 -0
- package/lib/utils/errors.js +2 -0
- package/package.json +1 -1
package/lib/api/gesture.d.ts
CHANGED
|
@@ -4,8 +4,10 @@ export interface GestureStatus {
|
|
|
4
4
|
[k: string]: any;
|
|
5
5
|
}
|
|
6
6
|
export declare const getGestureStatusApi: (devId: string) => Promise<GestureStatus>;
|
|
7
|
-
export
|
|
8
|
-
devId: string;
|
|
7
|
+
export interface UpdateGestureStatusParams {
|
|
9
8
|
password: string;
|
|
10
9
|
open: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const setGestureStatusApi: (params: UpdateGestureStatusParams & {
|
|
12
|
+
devId: string;
|
|
11
13
|
}) => Promise<boolean>;
|
package/lib/api/video.d.ts
CHANGED
|
@@ -37,4 +37,20 @@ export interface getAlbumDateListResult {
|
|
|
37
37
|
dateList: string[];
|
|
38
38
|
}
|
|
39
39
|
export declare const getAlbumDateList: (devId: string) => Promise<getAlbumDateListResult>;
|
|
40
|
+
interface GetDeviceCurrentMeidaConfigResult {
|
|
41
|
+
audioAttributes: {
|
|
42
|
+
callMode: Array<1 | 2>;
|
|
43
|
+
hardwareCapability: Array<1 | 2>;
|
|
44
|
+
};
|
|
45
|
+
maxZoomInTimes: number;
|
|
46
|
+
skill: string;
|
|
47
|
+
vedioClarity: number;
|
|
48
|
+
vedioClaritys: number[];
|
|
49
|
+
}
|
|
50
|
+
export declare const getDeviceCurrentMeidaConfig: (devId: string) => Promise<GetDeviceCurrentMeidaConfigResult>;
|
|
51
|
+
interface GetVideoResolutionMarkResult {
|
|
52
|
+
capability: number[];
|
|
53
|
+
cloudCapability: string[];
|
|
54
|
+
}
|
|
55
|
+
export declare const getVideoResolutionMark: (devId: string) => Promise<GetVideoResolutionMarkResult>;
|
|
40
56
|
export {};
|
package/lib/api/video.js
CHANGED
|
@@ -60,3 +60,23 @@ export const getAlbumDateList = (devId) => {
|
|
|
60
60
|
},
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
|
+
export const getDeviceCurrentMeidaConfig = (devId) => {
|
|
64
|
+
return requestApi({
|
|
65
|
+
logName: "getDeviceCurrentMeidaConfig",
|
|
66
|
+
api: "m.ipc.device.ability.get",
|
|
67
|
+
version: "1.0",
|
|
68
|
+
data: {
|
|
69
|
+
devId,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
export const getVideoResolutionMark = (devId) => {
|
|
74
|
+
return requestApi({
|
|
75
|
+
logName: "getVideoResolutionMark",
|
|
76
|
+
api: `${THING}.m.device.lock.capability.cloud.get`,
|
|
77
|
+
version: "1.0",
|
|
78
|
+
data: {
|
|
79
|
+
devId,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { ProductCommunicationType } from "../../../constant";
|
|
2
2
|
export declare function hasCapability(capability: ProductCommunicationType): boolean;
|
|
3
3
|
export declare function isBlePureDevice(): boolean;
|
|
4
|
-
export declare function isShareThead(): boolean;
|
|
5
|
-
export declare function isActiveThread(): Promise<boolean>;
|
|
6
4
|
export declare function getDeviceAdvancedAbilities(): Promise<import("../../..").DeviceAdvancedAbility>;
|
|
7
5
|
export declare function getDeviceAdvancedAbilitiesSync(): import("../../..").DeviceAdvancedAbility | undefined;
|
|
8
6
|
export declare function getDeviceCapabilities(): import("../../..").CapabilityInfo | null;
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime,
|
|
2
|
+
import { hasCapabilityForRuntime, isBlePureDeviceForRuntime, getDeviceAdvancedAbilitiesForRuntime, getDeviceAdvancedAbilitiesSyncForRuntime, getDeviceCapabilitiesForRuntime, } from "../../../feature/misc/capability";
|
|
3
3
|
export function hasCapability(capability) {
|
|
4
4
|
return hasCapabilityForRuntime(resolveRuntimeFromExportThis(this), capability);
|
|
5
5
|
}
|
|
6
6
|
export function isBlePureDevice() {
|
|
7
7
|
return isBlePureDeviceForRuntime(resolveRuntimeFromExportThis(this));
|
|
8
8
|
}
|
|
9
|
-
export function isShareThead() {
|
|
10
|
-
return isShareTheadForRuntime(resolveRuntimeFromExportThis(this));
|
|
11
|
-
}
|
|
12
|
-
export async function isActiveThread() {
|
|
13
|
-
return isActiveThreadForRuntime(resolveRuntimeFromExportThis(this));
|
|
14
|
-
}
|
|
15
9
|
export async function getDeviceAdvancedAbilities() {
|
|
16
10
|
return getDeviceAdvancedAbilitiesForRuntime(resolveRuntimeFromExportThis(this));
|
|
17
11
|
}
|
|
@@ -24,4 +24,3 @@ interface RemoveFitBleKeyParams {
|
|
|
24
24
|
export declare function removeFitBleKey(params: RemoveFitBleKeyParams): Promise<unknown>;
|
|
25
25
|
export declare function renameFitBleKey(params: RenameFitBleKeyParams): Promise<unknown>;
|
|
26
26
|
export declare function getFitUsers(): Promise<FitUserItem[]>;
|
|
27
|
-
export declare function setFitSetting(dpCode: string, value: string | number | boolean): Promise<void>;
|
|
@@ -6,7 +6,6 @@ import { offFitAddUnlockMethodForRuntime, onFitAddUnlockMethodForRuntime, } from
|
|
|
6
6
|
import { getFitUnlockMethodListForRuntime } from "../../../../feature/fit/method/list";
|
|
7
7
|
import { syncOpenModeRiseForRuntime } from "../../../../feature/fit/sync";
|
|
8
8
|
import { getFitBleKeyListForRuntime, addFitBleKeyForRuntime, createFitPermanentBleKeyForRuntime, createFitTemporaryBleKeyForRuntime, updateFitTemporaryBleKeyForRuntime, removeFitBleKeyForRuntime, renameFitBleKeyForRuntime, } from "../../../../feature/fit/ble-key";
|
|
9
|
-
import { setFitSettingForRuntime } from "../../../../feature/fit/setting";
|
|
10
9
|
import { getFitUsersForRuntime, } from "../../../../feature/fit/users";
|
|
11
10
|
export function fitAddPassword(params) {
|
|
12
11
|
return fitAddPasswordForRuntime(resolveRuntimeFromExportThis(this), params);
|
|
@@ -59,6 +58,3 @@ export function renameFitBleKey(params) {
|
|
|
59
58
|
export function getFitUsers() {
|
|
60
59
|
return getFitUsersForRuntime(resolveRuntimeFromExportThis(this));
|
|
61
60
|
}
|
|
62
|
-
export function setFitSetting(dpCode, value) {
|
|
63
|
-
return setFitSettingForRuntime(resolveRuntimeFromExportThis(this), dpCode, value);
|
|
64
|
-
}
|
|
@@ -1,25 +1,13 @@
|
|
|
1
1
|
import { type FitOnlinePasswordItem, type FitOfflinePasswordItem } from "../../../../feature/fit/password-list";
|
|
2
2
|
import { type AddFitTempPwdParams, type RemoveFitTempPwdParams, type RenameFitTempPwdParams, type RenameFitOfflineTempPwdParams, type RevokeFitOfflineTempPwdParams, type FitOfflineClearCodeResult, type ResendFitTempPwdParams, type UpdateFitTempPwdParams } from "../../../../feature/fit/temp-password";
|
|
3
3
|
import { type ClearFitInvalidPwdParams, type GetFitInvalidPwdListParams } from "../../../../feature/fit/invalid-password";
|
|
4
|
-
import { type FitOfflineOnceResult } from "../../../../feature/password/temporary/offline-create";
|
|
4
|
+
import { type FitOfflineOnceResult, type FitOfflineLimitParams } from "../../../../feature/password/temporary/offline-create";
|
|
5
5
|
import type { LimitOfflinePwdItem, OfflinePwdAvailableResult } from "../../../../api/temp";
|
|
6
6
|
import type { TempPasswordResult } from "../../../../interface";
|
|
7
|
-
export declare function getFitPasswordList(): Promise<
|
|
8
|
-
id: number;
|
|
9
|
-
unlockId: string;
|
|
10
|
-
unlockName: string;
|
|
11
|
-
photoUnlock: boolean;
|
|
12
|
-
userName: string;
|
|
13
|
-
lockUserId: number;
|
|
14
|
-
userType: number;
|
|
15
|
-
devLockId: string;
|
|
16
|
-
effective: import("../../../../interface").EffectiveConfig;
|
|
17
|
-
}[]>;
|
|
7
|
+
export declare function getFitPasswordList(): Promise<import("../../../../feature/fit/password-list").FitPasswordItem[]>;
|
|
18
8
|
export declare function getFitOnlinePasswordList(): Promise<FitOnlinePasswordItem[]>;
|
|
19
9
|
export declare function getFitOfflinePasswordList(): Promise<FitOfflinePasswordItem[]>;
|
|
20
|
-
export declare function addFitTempPwd(params: AddFitTempPwdParams): Promise<
|
|
21
|
-
pwdId: number;
|
|
22
|
-
}>;
|
|
10
|
+
export declare function addFitTempPwd(params: AddFitTempPwdParams): Promise<import("../../../../feature/fit/temp-password").AddFitTempPwdResult>;
|
|
23
11
|
export declare function removeFitTempPwd(params: RemoveFitTempPwdParams): Promise<void>;
|
|
24
12
|
export declare function updateFitTempPwd(params: UpdateFitTempPwdParams): Promise<void>;
|
|
25
13
|
export declare function renameFitTempPwd(params: RenameFitTempPwdParams): Promise<void>;
|
|
@@ -30,10 +18,7 @@ export declare function getFitInvalidPwdList(params?: GetFitInvalidPwdListParams
|
|
|
30
18
|
export declare function clearFitInvalidPwd(params?: ClearFitInvalidPwdParams): Promise<boolean>;
|
|
31
19
|
export declare function getFitDynamicPassword(): Promise<TempPasswordResult>;
|
|
32
20
|
export declare function getFitOfflineOncePassword(): Promise<FitOfflineOnceResult>;
|
|
33
|
-
export declare function getFitOfflineLimitPassword(params:
|
|
34
|
-
effectiveTime: number;
|
|
35
|
-
invalidTime: number;
|
|
36
|
-
}): Promise<FitOfflineOnceResult>;
|
|
21
|
+
export declare function getFitOfflineLimitPassword(params: FitOfflineLimitParams): Promise<FitOfflineOnceResult>;
|
|
37
22
|
export declare function getFitOfflineClearAllCode(): Promise<FitOfflineOnceResult>;
|
|
38
23
|
export declare function getFitOfflineRevocableList(): Promise<LimitOfflinePwdItem[]>;
|
|
39
24
|
export declare function getFitOfflinePwdAvailable(pwdType: string): Promise<OfflinePwdAvailableResult>;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { UpdateGestureStatusParams } from "../../../api/gesture";
|
|
2
|
+
export type { GestureStatus, UpdateGestureStatusParams, } from "../../../api/gesture";
|
|
2
3
|
export declare function getGestureStatus(): Promise<import("../../../api/gesture").GestureStatus>;
|
|
3
|
-
export declare function updateGestureStatus(params:
|
|
4
|
-
password: string;
|
|
5
|
-
open: boolean;
|
|
6
|
-
}): Promise<boolean>;
|
|
4
|
+
export declare function updateGestureStatus(params: UpdateGestureStatusParams): Promise<boolean>;
|
|
@@ -7,7 +7,7 @@ export declare function openLocalAlbum(params?: OpenLocalAlbumParams): Promise<v
|
|
|
7
7
|
export declare function gotoPlayback(params?: GotoPlaybackParams): Promise<void>;
|
|
8
8
|
export declare function isSupportMultiCamera(): boolean;
|
|
9
9
|
export declare function getCameraInfo(): import("../../../feature/media/camera").CameraDpInfo | undefined;
|
|
10
|
-
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").
|
|
10
|
+
export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraDpInfo | undefined>;
|
|
11
11
|
export declare function switchCamera(index: number): Promise<true>;
|
|
12
12
|
export declare function getMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
13
13
|
export declare function addMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GotoServiceParams } from "../../../feature/service/goto-service";
|
|
2
|
-
import type { OpenSceneOptions } from "../../../feature/misc/types";
|
|
2
|
+
import type { OpenSceneOptions, ConnectDeviceOptions } from "../../../feature/misc/types";
|
|
3
3
|
export { parseDpPeriodTime } from "../../../feature/misc/dp-period";
|
|
4
4
|
export { formatDpPeriodTime } from "../../../feature/misc/dp-period";
|
|
5
5
|
export declare function openScene(options?: OpenSceneOptions): Promise<void>;
|
|
@@ -13,8 +13,14 @@ export interface UpdateDpPeriodTimeOption {
|
|
|
13
13
|
offlineDp?: boolean;
|
|
14
14
|
}
|
|
15
15
|
export declare function updateDpPeriodTime(dpCode: string, data: UpdateDpPeriodTimeParams, option?: UpdateDpPeriodTimeOption): Promise<void>;
|
|
16
|
-
export declare function connectDevice(options?:
|
|
17
|
-
timeout?: number;
|
|
18
|
-
}): Promise<true>;
|
|
16
|
+
export declare function connectDevice(options?: ConnectDeviceOptions): Promise<true>;
|
|
19
17
|
export declare function gotoService(params?: GotoServiceParams): Promise<void>;
|
|
20
18
|
export declare function validatePwdComplexity(password: string): Promise<boolean>;
|
|
19
|
+
export interface AwakeDeviceOptions {
|
|
20
|
+
timeout?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function awakeDevice(options?: AwakeDeviceOptions): Promise<true>;
|
|
23
|
+
interface DisconnectDeviceOptions {
|
|
24
|
+
disconnetBle?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function disconnectDevice(options?: DisconnectDeviceOptions): Promise<void>;
|
|
@@ -2,7 +2,7 @@ import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-
|
|
|
2
2
|
import { openSceneForRuntime } from "../../../feature/misc/open-scene";
|
|
3
3
|
import { isSupportBleControlForRuntime } from "../../../feature/misc/ble-control";
|
|
4
4
|
import { getDpPeriodTimeForRuntime, updateDpPeriodTimeForRuntime, } from "../../../feature/misc/dp-period";
|
|
5
|
-
import { connectDeviceForRuntime } from "../../../feature/misc/connect-device";
|
|
5
|
+
import { awakeDeviceForRuntime, connectDeviceForRuntime, disconnectDeviceForRuntime, } from "../../../feature/misc/connect-device";
|
|
6
6
|
import { validatePwdComplexityForRuntime } from "../../../feature/misc/validate-pwd";
|
|
7
7
|
import { gotoServiceForRuntime, } from "../../../feature/service/goto-service";
|
|
8
8
|
export { parseDpPeriodTime } from "../../../feature/misc/dp-period";
|
|
@@ -28,3 +28,9 @@ export async function gotoService(params) {
|
|
|
28
28
|
export async function validatePwdComplexity(password) {
|
|
29
29
|
return validatePwdComplexityForRuntime(resolveRuntimeFromExportThis(this), password);
|
|
30
30
|
}
|
|
31
|
+
export async function awakeDevice(options) {
|
|
32
|
+
return awakeDeviceForRuntime(resolveRuntimeFromExportThis(this), options);
|
|
33
|
+
}
|
|
34
|
+
export async function disconnectDevice(options) {
|
|
35
|
+
return disconnectDeviceForRuntime(resolveRuntimeFromExportThis(this), options);
|
|
36
|
+
}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
+
import type { UpdateVasNotifyConfigParams } from "../../../api/notify";
|
|
1
2
|
export type { VasNotifyConfig, VasNotifyScene, VasNotifyPushConfig, UpdateVasNotifyConfigParams, } from "../../../api/notify";
|
|
2
3
|
export declare function getVasNotifyConfig(): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
3
|
-
export declare function updateVasNotifyConfig(params:
|
|
4
|
-
key: string;
|
|
5
|
-
enable: boolean;
|
|
6
|
-
userId?: string;
|
|
7
|
-
}): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
4
|
+
export declare function updateVasNotifyConfig(params: UpdateVasNotifyConfigParams): Promise<import("../../../api/notify").VasNotifyConfig>;
|
|
@@ -4,5 +4,4 @@ export declare function offOfflineDpsUpdate(callback: (dps: OfflineDps) => void)
|
|
|
4
4
|
export declare function publishOfflineDps(dps: Record<string, DpValue>): Promise<void>;
|
|
5
5
|
export declare function getOfflineDps(isForce?: boolean): Promise<OfflineDps>;
|
|
6
6
|
export declare function getOfflineDpCache(code: string): import("../../../interface").OfflineDpInfo | undefined;
|
|
7
|
-
export declare function checkOfflineDpUpdate(dps: Record<string, DpValue>, isForce?: boolean): Promise<void>;
|
|
8
7
|
export declare function isOfflineDpSyncing(code: string): boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
|
|
2
|
-
import {
|
|
2
|
+
import { publishOfflineDpsForRuntime, getOfflineDpsForRuntime, getOfflineDpCacheForRuntime, onOfflineDpsUpdateForRuntime, offOfflineDpsUpdateForRuntime, } from "../../../feature/offline-dps";
|
|
3
3
|
export function onOfflineDpsUpdate(callback) {
|
|
4
4
|
onOfflineDpsUpdateForRuntime(resolveRuntimeFromExportThis(this), callback);
|
|
5
5
|
}
|
|
@@ -15,9 +15,6 @@ export async function getOfflineDps(isForce) {
|
|
|
15
15
|
export function getOfflineDpCache(code) {
|
|
16
16
|
return getOfflineDpCacheForRuntime(resolveRuntimeFromExportThis(this), code);
|
|
17
17
|
}
|
|
18
|
-
export async function checkOfflineDpUpdate(dps, isForce) {
|
|
19
|
-
return checkOfflineDpUpdateForRuntime(resolveRuntimeFromExportThis(this), dps, isForce);
|
|
20
|
-
}
|
|
21
18
|
export function isOfflineDpSyncing(code) {
|
|
22
19
|
const rt = resolveRuntimeFromExportThis(this);
|
|
23
20
|
if (!rt.config.supportOfflineDps) {
|
|
@@ -5,21 +5,12 @@ export declare function createTempCustom(params: CreateCustomParams): Promise<Te
|
|
|
5
5
|
export declare function removeTempCustom(params: RemoveCustomProps): Promise<boolean>;
|
|
6
6
|
export declare function updateTempCustom(params: UpdateTempPasswordParams): Promise<boolean>;
|
|
7
7
|
export declare function getTempEffectiveList(): Promise<import("../../../feature/password/temporary/types").EffectivePasswrodItem[]>;
|
|
8
|
-
export declare function getTempInvalidList(params?: GetInvalidListParams): Promise<
|
|
9
|
-
list: import("../../../feature/password/temporary/types").InvalidPasswordItem[];
|
|
10
|
-
hasMore: boolean;
|
|
11
|
-
total: number;
|
|
12
|
-
}>;
|
|
8
|
+
export declare function getTempInvalidList(params?: GetInvalidListParams): Promise<import("../../../feature/password/temporary/lists").GetTempInvalidListResult>;
|
|
13
9
|
export declare function clearTempInvalidList(): Promise<boolean>;
|
|
14
10
|
export declare function freezeTemp(params: FreezeParams): Promise<boolean>;
|
|
15
11
|
export declare function unfreezeTemp(params: FreezeParams): Promise<boolean>;
|
|
16
12
|
export declare function renameTemp(params: RenameParams): Promise<void>;
|
|
17
|
-
export declare function saveTempOnlineUnlimited(params: CreateOnlineUnlimitedParams): Promise<
|
|
18
|
-
type: "custom";
|
|
19
|
-
name: string;
|
|
20
|
-
pwdId: string;
|
|
21
|
-
effectiveConfig: import("../../../interface").EffectiveConfig;
|
|
22
|
-
}>;
|
|
13
|
+
export declare function saveTempOnlineUnlimited(params: CreateOnlineUnlimitedParams): Promise<import("../../../feature/password/temporary/wifi-online").SaveTempOnlineUnlimitedResult>;
|
|
23
14
|
export declare function removeTempOnlineUnlimited(id: string): Promise<void>;
|
|
24
15
|
export declare function getTempOnlineUnlimitedList(): Promise<import("../../../feature/password/temporary/wifi-online").OnlinePasswordItem[]>;
|
|
25
16
|
export declare function createTempOffline(params: CreateOfflineParams): Promise<import("../../../feature/password/temporary/types").OfflineTempResult>;
|
|
@@ -3,6 +3,7 @@ import type { LockSDKInstance, FitSDKInstance } from "./build-instance";
|
|
|
3
3
|
export * from "./exports";
|
|
4
4
|
export type { LockSDKInstance, FitSDKInstance };
|
|
5
5
|
export type { LockSdkBoundExportThis } from "./bootstrap/resolve-runtime-from-export-this";
|
|
6
|
-
export
|
|
6
|
+
export type SDKOptions = Omit<LockSDKOption, "preFetch">;
|
|
7
|
+
export declare const createSDK: (options?: SDKOptions) => Promise<LockSDKInstance>;
|
|
7
8
|
export declare const init: (options?: LockSDKOption) => Promise<void>;
|
|
8
9
|
export declare const destroy: () => void;
|
|
@@ -1,18 +1,7 @@
|
|
|
1
1
|
import { type RawFitOpenModeScheduleItem } from "../../api/fit";
|
|
2
|
-
import { EffectiveConfig
|
|
2
|
+
import { EffectiveConfig } from "../../interface";
|
|
3
3
|
import { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
4
4
|
export interface FitPasswordItem {
|
|
5
|
-
id: number;
|
|
6
|
-
unlockId: number;
|
|
7
|
-
unlockName: string;
|
|
8
|
-
type: UnlockMethodType;
|
|
9
|
-
userName: string;
|
|
10
|
-
lockUserId: number;
|
|
11
|
-
userType: number;
|
|
12
|
-
devLockId: string;
|
|
13
|
-
effective: EffectiveConfig;
|
|
14
|
-
}
|
|
15
|
-
export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<{
|
|
16
5
|
id: number;
|
|
17
6
|
unlockId: string;
|
|
18
7
|
unlockName: string;
|
|
@@ -22,7 +11,8 @@ export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime)
|
|
|
22
11
|
userType: number;
|
|
23
12
|
devLockId: string;
|
|
24
13
|
effective: EffectiveConfig;
|
|
25
|
-
}
|
|
14
|
+
}
|
|
15
|
+
export declare const getFitPasswordListForRuntime: (runtime: LockDeviceRuntime) => Promise<FitPasswordItem[]>;
|
|
26
16
|
export interface FitOnlinePasswordItem {
|
|
27
17
|
id: number;
|
|
28
18
|
pwdId: number;
|
|
@@ -15,9 +15,10 @@ export interface UpdateFitTempPwdParams {
|
|
|
15
15
|
name: string;
|
|
16
16
|
effective: EffectiveConfig;
|
|
17
17
|
}
|
|
18
|
-
export
|
|
18
|
+
export interface AddFitTempPwdResult {
|
|
19
19
|
pwdId: number;
|
|
20
|
-
}
|
|
20
|
+
}
|
|
21
|
+
export declare function fitAddTempPwdForRuntime(runtime: LockDeviceRuntime, params: AddFitTempPwdParams): Promise<AddFitTempPwdResult>;
|
|
21
22
|
export declare function fitRemoveTempPwdForRuntime(runtime: LockDeviceRuntime, params: RemoveFitTempPwdParams): Promise<void>;
|
|
22
23
|
export declare function fitUpdateTempPwdForRuntime(runtime: LockDeviceRuntime, params: UpdateFitTempPwdParams): Promise<void>;
|
|
23
24
|
export interface RenameFitTempPwdParams {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
-
import type { CameraConfig
|
|
3
|
-
import { locationSelectReportMap } from "../../config/dp-map/media";
|
|
4
|
-
export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
|
|
2
|
+
import type { CameraConfig } from "../../interface";
|
|
5
3
|
export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
|
|
6
4
|
interface CameraItem {
|
|
7
5
|
index: number;
|
|
@@ -12,7 +10,7 @@ export interface CameraDpInfo {
|
|
|
12
10
|
list: CameraItem[];
|
|
13
11
|
}
|
|
14
12
|
export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraDpInfo | undefined;
|
|
15
|
-
export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<
|
|
13
|
+
export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraDpInfo | undefined>;
|
|
16
14
|
export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
|
|
17
15
|
export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
|
|
18
16
|
export {};
|
|
@@ -3,7 +3,7 @@ import { DeviceAdvancedAbility } from "../../interface";
|
|
|
3
3
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
4
4
|
export declare const hasCapabilityForRuntime: (runtime: LockDeviceRuntime, capability: ProductCommunicationType) => boolean;
|
|
5
5
|
export declare const isBlePureDeviceForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const isShareThreadForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
7
7
|
export declare const isActiveThreadForRuntime: (rt: LockDeviceRuntime) => Promise<boolean>;
|
|
8
8
|
export declare const getDeviceAdvancedAbilitiesSyncForRuntime: (rt: LockDeviceRuntime) => DeviceAdvancedAbility | undefined;
|
|
9
9
|
export declare const getDeviceAdvancedAbilitiesForRuntime: (rt: LockDeviceRuntime) => Promise<DeviceAdvancedAbility>;
|
|
@@ -3,10 +3,13 @@ import { CommunicationType, ProductCommunicationType } from "../../constant";
|
|
|
3
3
|
import { checkShowMatterMutilpleShare } from "../../platform/device";
|
|
4
4
|
import { ipc } from "../../platform";
|
|
5
5
|
import { getWithLocalCache } from "../storage/swr-cache";
|
|
6
|
+
import { getVideoResolutionMark } from "../../api/video";
|
|
7
|
+
import dpCodes from "../../config/dp-code";
|
|
8
|
+
import { hasDpForRuntime } from "../dp/has-dp";
|
|
6
9
|
export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
|
|
7
10
|
export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
|
|
8
11
|
rt.config.communication.length === 1;
|
|
9
|
-
export const
|
|
12
|
+
export const isShareThreadForRuntime = (rt) => {
|
|
10
13
|
const hasThread = hasCapabilityForRuntime(rt, ProductCommunicationType.THREAD);
|
|
11
14
|
return (hasThread &&
|
|
12
15
|
!rt.config.devInfo.meta?.["threadWithBLE"] &&
|
|
@@ -68,7 +71,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
68
71
|
return rt.cache.deviceAdvanceAbilityCache;
|
|
69
72
|
}
|
|
70
73
|
const devId = rt.config.devInfo.devId;
|
|
71
|
-
const [productAbilitiesRes, deviceAdvancedAbilityRes, tttList] = await Promise.allSettled([
|
|
74
|
+
const [productAbilitiesRes, deviceAdvancedAbilityRes, tttList, videoMarkRes] = await Promise.allSettled([
|
|
72
75
|
getWithLocalCache(rt, "productAbilities", () => getProductAbilities(devId, [
|
|
73
76
|
"tyabi4ucx5",
|
|
74
77
|
"tyabis9tpe",
|
|
@@ -79,10 +82,23 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
79
82
|
])),
|
|
80
83
|
getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
|
|
81
84
|
ipc.getTTTAbilityKeyList("isSupportedVRMode"),
|
|
85
|
+
hasDpForRuntime(rt, dpCodes.initiativeMessage)
|
|
86
|
+
? getWithLocalCache(rt, "videoResolutionMark", () => getVideoResolutionMark(devId))
|
|
87
|
+
: Promise.resolve({
|
|
88
|
+
capability: [],
|
|
89
|
+
cloudCapability: [],
|
|
90
|
+
}),
|
|
82
91
|
]);
|
|
83
92
|
const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
|
|
84
93
|
const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
|
|
94
|
+
const videoMark = videoMarkRes.status === "fulfilled"
|
|
95
|
+
? videoMarkRes.value
|
|
96
|
+
: { capability: [], cloudCapability: [] };
|
|
85
97
|
const deviceAdvanceAbilityCache = {
|
|
98
|
+
videoConfig: {
|
|
99
|
+
isLowResolution: videoMark?.cloudCapability?.includes("tyabig3wt9"),
|
|
100
|
+
isHighResolution: videoMark?.cloudCapability?.includes("tyabixkep7"),
|
|
101
|
+
},
|
|
86
102
|
cloudStorage: {
|
|
87
103
|
support: false,
|
|
88
104
|
},
|
|
@@ -91,6 +107,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
91
107
|
defaultMode: "VR",
|
|
92
108
|
modes: [],
|
|
93
109
|
coverMode: "VR",
|
|
110
|
+
options: {},
|
|
94
111
|
},
|
|
95
112
|
ai: {
|
|
96
113
|
support: false,
|
|
@@ -151,6 +168,24 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
|
|
|
151
168
|
deviceAdvanceAbilityCache.vr.modes?.[0]?.mode;
|
|
152
169
|
}
|
|
153
170
|
deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
|
|
171
|
+
if (data.configs) {
|
|
172
|
+
let options;
|
|
173
|
+
try {
|
|
174
|
+
options = JSON.parse(data.configs);
|
|
175
|
+
}
|
|
176
|
+
catch (e) {
|
|
177
|
+
}
|
|
178
|
+
if (options.zoomIn) {
|
|
179
|
+
deviceAdvanceAbilityCache.vr.options.zoomIn =
|
|
180
|
+
Number(options.zoomIn?.value) > 0
|
|
181
|
+
? Number(options.zoomIn?.value)
|
|
182
|
+
: undefined;
|
|
183
|
+
deviceAdvanceAbilityCache.vr.options.radialEmphasis =
|
|
184
|
+
Number(options.radialEmphasis?.value) > 0
|
|
185
|
+
? Number(options.radialEmphasis?.value)
|
|
186
|
+
: undefined;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
154
189
|
}
|
|
155
190
|
break;
|
|
156
191
|
}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
2
|
export declare function connectDeviceForRuntime(rt: LockDeviceRuntime, timeout?: number): Promise<true>;
|
|
3
|
+
export declare const awakeDeviceForRuntime: (runtime: LockDeviceRuntime, options?: {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}) => Promise<true>;
|
|
6
|
+
export declare const disconnectDeviceForRuntime: (rt: LockDeviceRuntime, options?: {
|
|
7
|
+
disconnetBle?: boolean;
|
|
8
|
+
}) => Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import dpCodes from "../../config/dp-code";
|
|
2
|
-
import { connectBLEDevice, getBLEOnlineState, onBleChange, onOnlineChange, offBleChange, offOnlineChange, yuChannelSyncSingleSync, } from "../../platform/device";
|
|
2
|
+
import { connectBLEDevice, getBLEOnlineState, onBleChange, onOnlineChange, offBleChange, offOnlineChange, yuChannelSyncSingleSync, disconnectBLEDevice, } from "../../platform/device";
|
|
3
3
|
import { DPCHANGE } from "../../utils/constant";
|
|
4
4
|
import emitter from "../../utils/event";
|
|
5
5
|
import { getError } from "../../utils/errors";
|
|
@@ -8,70 +8,8 @@ import { getDpValueForRuntime } from "../dp/get-dp-value";
|
|
|
8
8
|
import { getDeviceStatusForRuntime } from "../state/device-status";
|
|
9
9
|
import { isSupportBleControlForRuntime } from "./ble-control";
|
|
10
10
|
import { sdkLog } from "../../utils/sdk-log";
|
|
11
|
+
import { hasDpForRuntime } from "../dp/has-dp";
|
|
11
12
|
const { wirelessAwake } = dpCodes;
|
|
12
|
-
const awakeDevice = async (devId, timeout) => {
|
|
13
|
-
const startedAt = Date.now();
|
|
14
|
-
sdkLog("info", "connectDevice", "awakeStart", {
|
|
15
|
-
devId,
|
|
16
|
-
data: { timeout: timeout || 15000 },
|
|
17
|
-
});
|
|
18
|
-
return new Promise((resolve, reject) => {
|
|
19
|
-
const handleChangeDp = (dpCodesArg) => {
|
|
20
|
-
if (dpCodesArg[wirelessAwake] === true) {
|
|
21
|
-
sdkLog("info", "connectDevice", "awakeReportSuccess", {
|
|
22
|
-
devId,
|
|
23
|
-
duration: Date.now() - startedAt,
|
|
24
|
-
});
|
|
25
|
-
resolve(true);
|
|
26
|
-
emitter.off(DPCHANGE, handleChangeDp);
|
|
27
|
-
clearTimeout(timer);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
emitter.on(DPCHANGE, handleChangeDp);
|
|
31
|
-
const timer = setTimeout(() => {
|
|
32
|
-
emitter.off(DPCHANGE, handleChangeDp);
|
|
33
|
-
const error = getError(1002);
|
|
34
|
-
sdkLog("warn", "connectDevice", "awakeTimeout", {
|
|
35
|
-
devId,
|
|
36
|
-
duration: Date.now() - startedAt,
|
|
37
|
-
error,
|
|
38
|
-
});
|
|
39
|
-
reject(error);
|
|
40
|
-
}, timeout || 15000);
|
|
41
|
-
const run = async () => {
|
|
42
|
-
try {
|
|
43
|
-
ipc.wakeUpDoorBell(devId);
|
|
44
|
-
ipc.wakeUpDoorBell(devId);
|
|
45
|
-
ipc.wakeUpDoorBell(devId);
|
|
46
|
-
const connected = await ipc.isConnected(devId);
|
|
47
|
-
if (connected.isConnected) {
|
|
48
|
-
sdkLog("info", "connectDevice", "awakeAlreadyConnected", {
|
|
49
|
-
devId,
|
|
50
|
-
duration: Date.now() - startedAt,
|
|
51
|
-
});
|
|
52
|
-
return resolve(true);
|
|
53
|
-
}
|
|
54
|
-
const connecting = await ipc.isConnecting(devId);
|
|
55
|
-
if (!connecting.isConnecting) {
|
|
56
|
-
sdkLog("info", "connectDevice", "awakeIpcConnectStart", { devId });
|
|
57
|
-
await ipc.connect(devId);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
sdkLog("debug", "connectDevice", "awakeIpcConnecting", { devId });
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
sdkLog("error", "connectDevice", "awakeFail", {
|
|
65
|
-
devId,
|
|
66
|
-
duration: Date.now() - startedAt,
|
|
67
|
-
error,
|
|
68
|
-
});
|
|
69
|
-
reject(error);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
run();
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
13
|
const connectBle = async (devId, timeout) => {
|
|
76
14
|
const startedAt = Date.now();
|
|
77
15
|
sdkLog("info", "connectDevice", "bleConnectStart", { devId });
|
|
@@ -147,7 +85,7 @@ export async function connectDeviceForRuntime(rt, timeout) {
|
|
|
147
85
|
const cfg = rt.config;
|
|
148
86
|
const devId = cfg.devInfo.devId;
|
|
149
87
|
const deviceStatus = getDeviceStatusForRuntime(rt);
|
|
150
|
-
const hasWirelessAwakeDp =
|
|
88
|
+
const hasWirelessAwakeDp = hasDpForRuntime(rt, wirelessAwake) && !cfg.notSupportWake;
|
|
151
89
|
const startedAt = Date.now();
|
|
152
90
|
sdkLog("info", "connectDevice", "start", {
|
|
153
91
|
devId,
|
|
@@ -160,7 +98,7 @@ export async function connectDeviceForRuntime(rt, timeout) {
|
|
|
160
98
|
});
|
|
161
99
|
if (deviceStatus.connectEnable && hasWirelessAwakeDp) {
|
|
162
100
|
if (cfg.devInfo.isCloudOnline && !getDpValueForRuntime(rt, wirelessAwake)) {
|
|
163
|
-
const result = await
|
|
101
|
+
const result = await awakeDeviceForRuntime(rt, { timeout });
|
|
164
102
|
sdkLog("info", "connectDevice", "success", {
|
|
165
103
|
devId,
|
|
166
104
|
duration: Date.now() - startedAt,
|
|
@@ -205,3 +143,102 @@ export async function connectDeviceForRuntime(rt, timeout) {
|
|
|
205
143
|
});
|
|
206
144
|
throw error;
|
|
207
145
|
}
|
|
146
|
+
export const awakeDeviceForRuntime = (runtime, options) => {
|
|
147
|
+
const cfg = runtime.config;
|
|
148
|
+
const devId = cfg.devInfo.devId;
|
|
149
|
+
const timeout = options?.timeout || 15000;
|
|
150
|
+
const startedAt = Date.now();
|
|
151
|
+
const hasWirelessAwake = hasDpForRuntime(runtime, wirelessAwake) && !cfg.notSupportWake;
|
|
152
|
+
sdkLog("info", "connectDevice", "awakeStart", {
|
|
153
|
+
devId,
|
|
154
|
+
data: { timeout, hasWirelessAwake },
|
|
155
|
+
});
|
|
156
|
+
return new Promise((resolve, reject) => {
|
|
157
|
+
const handleChangeDp = (dpCodesArg) => {
|
|
158
|
+
if (dpCodesArg[wirelessAwake] === true) {
|
|
159
|
+
sdkLog("info", "connectDevice", "awakeReportSuccess", {
|
|
160
|
+
devId,
|
|
161
|
+
duration: Date.now() - startedAt,
|
|
162
|
+
});
|
|
163
|
+
resolve(true);
|
|
164
|
+
emitter.off(DPCHANGE, handleChangeDp);
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
hasWirelessAwake && emitter.on(DPCHANGE, handleChangeDp);
|
|
169
|
+
const timer = setTimeout(() => {
|
|
170
|
+
emitter.off(DPCHANGE, handleChangeDp);
|
|
171
|
+
const error = getError(1002);
|
|
172
|
+
sdkLog("warn", "connectDevice", "awakeTimeout", {
|
|
173
|
+
devId,
|
|
174
|
+
duration: Date.now() - startedAt,
|
|
175
|
+
error,
|
|
176
|
+
});
|
|
177
|
+
reject(error);
|
|
178
|
+
}, timeout);
|
|
179
|
+
const run = async () => {
|
|
180
|
+
try {
|
|
181
|
+
ipc.wakeUpDoorBell(devId);
|
|
182
|
+
ipc.wakeUpDoorBell(devId);
|
|
183
|
+
ipc.wakeUpDoorBell(devId);
|
|
184
|
+
const connected = await ipc.isConnected(devId);
|
|
185
|
+
if (connected.isConnected) {
|
|
186
|
+
sdkLog("info", "connectDevice", "awakeAlreadyConnected", {
|
|
187
|
+
devId,
|
|
188
|
+
duration: Date.now() - startedAt,
|
|
189
|
+
});
|
|
190
|
+
clearTimeout(timer);
|
|
191
|
+
return resolve(true);
|
|
192
|
+
}
|
|
193
|
+
const connecting = await ipc.isConnecting(devId);
|
|
194
|
+
if (!connecting.isConnecting) {
|
|
195
|
+
sdkLog("info", "connectDevice", "awakeIpcConnectStart", { devId });
|
|
196
|
+
await ipc.connect(devId);
|
|
197
|
+
if (!hasWirelessAwake) {
|
|
198
|
+
clearTimeout(timer);
|
|
199
|
+
return resolve(true);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
sdkLog("debug", "connectDevice", "awakeIpcConnecting", { devId });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
sdkLog("error", "connectDevice", "awakeFail", {
|
|
208
|
+
devId,
|
|
209
|
+
duration: Date.now() - startedAt,
|
|
210
|
+
error,
|
|
211
|
+
});
|
|
212
|
+
reject(error);
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
run();
|
|
216
|
+
});
|
|
217
|
+
};
|
|
218
|
+
export const disconnectDeviceForRuntime = async (rt, options) => {
|
|
219
|
+
const cfg = rt.config;
|
|
220
|
+
const devId = cfg.devInfo.devId;
|
|
221
|
+
const startedAt = Date.now();
|
|
222
|
+
sdkLog("info", "disconnectDevice", "start", {
|
|
223
|
+
devId,
|
|
224
|
+
});
|
|
225
|
+
try {
|
|
226
|
+
const deviceStatus = getDeviceStatusForRuntime(rt);
|
|
227
|
+
await ipc.disConnect(devId);
|
|
228
|
+
if (deviceStatus.onlineTypes.includes("ble") && !!options?.disconnetBle) {
|
|
229
|
+
await disconnectBLEDevice(devId);
|
|
230
|
+
}
|
|
231
|
+
sdkLog("info", "disconnectDevice", "success", {
|
|
232
|
+
devId,
|
|
233
|
+
duration: Date.now() - startedAt,
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
catch (e) {
|
|
237
|
+
sdkLog("error", "disconnectDevice", "Fail", {
|
|
238
|
+
devId,
|
|
239
|
+
duration: Date.now() - startedAt,
|
|
240
|
+
error: e,
|
|
241
|
+
});
|
|
242
|
+
throw e;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export type ExecutorRange = "unlock" | "lock";
|
|
2
2
|
export type Ability = "backHome" | "alarm" | "geographyArrive" | "geographyLeave" | "bleGeofence" | "siriUnlock" | "siriLock";
|
|
3
|
+
export interface ConnectDeviceOptions {
|
|
4
|
+
timeout?: number;
|
|
5
|
+
}
|
|
3
6
|
export interface OpenSceneOptions {
|
|
4
7
|
themeColor?: string;
|
|
5
8
|
executorRange?: Array<ExecutorRange>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
|
+
import { updateDeviceStatus } from "../state/device-status";
|
|
1
2
|
export function updateConfigForRuntime(runtime, options) {
|
|
2
3
|
const cfg = runtime.config;
|
|
4
|
+
let needUpdateDeviceStatus = false;
|
|
5
|
+
if (typeof options?.notSupportWake === "boolean" &&
|
|
6
|
+
cfg.notSupportWake !== options.notSupportWake) {
|
|
7
|
+
needUpdateDeviceStatus = true;
|
|
8
|
+
}
|
|
3
9
|
Object.keys(options).forEach((key) => {
|
|
4
10
|
const value = options[key];
|
|
5
11
|
if (value !== undefined) {
|
|
6
12
|
cfg[key] = value;
|
|
7
13
|
}
|
|
8
14
|
});
|
|
15
|
+
needUpdateDeviceStatus && updateDeviceStatus(runtime);
|
|
9
16
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
2
|
import type { EffectivePasswrodItem, GetInvalidListParams, InvalidPasswordItem } from "./types";
|
|
3
3
|
export declare function getTempEffectiveListForRuntime(rt: LockDeviceRuntime): Promise<EffectivePasswrodItem[]>;
|
|
4
|
-
export
|
|
4
|
+
export interface GetTempInvalidListResult {
|
|
5
5
|
list: InvalidPasswordItem[];
|
|
6
6
|
hasMore: boolean;
|
|
7
7
|
total: number;
|
|
8
|
-
}
|
|
8
|
+
}
|
|
9
|
+
export declare function getTempInvalidListForRuntime(rt: LockDeviceRuntime, params?: GetInvalidListParams): Promise<GetTempInvalidListResult>;
|
|
9
10
|
export declare function clearTempInvalidListForRuntime(rt: LockDeviceRuntime): Promise<boolean>;
|
|
10
11
|
export interface LimitTempItem {
|
|
11
12
|
id: string;
|
|
@@ -10,10 +10,11 @@ export interface FitOfflineOnceResult {
|
|
|
10
10
|
gmtExpired: number;
|
|
11
11
|
}
|
|
12
12
|
export declare function createFitOfflineOnceForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
|
|
13
|
-
export
|
|
13
|
+
export interface FitOfflineLimitParams {
|
|
14
14
|
effectiveTime: number;
|
|
15
15
|
invalidTime: number;
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
|
+
export declare function createFitOfflineLimitForRuntime(rt: LockDeviceRuntime, params: FitOfflineLimitParams): Promise<FitOfflineOnceResult>;
|
|
17
18
|
export declare function createFitOfflineClearAllForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
|
|
18
19
|
export declare function getFitOfflineRevocableListForRuntime(rt: LockDeviceRuntime): Promise<LimitOfflinePwdItem[]>;
|
|
19
20
|
export declare function getFitOfflinePwdAvailableForRuntime(rt: LockDeviceRuntime, pwdType: string): Promise<OfflinePwdAvailableResult>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
|
|
2
2
|
import type { CreateOnlineUnlimitedParams } from "./types";
|
|
3
3
|
import type { EffectiveConfig } from "../../../interface";
|
|
4
|
-
export
|
|
4
|
+
export interface SaveTempOnlineUnlimitedResult {
|
|
5
5
|
type: "custom";
|
|
6
6
|
name: string;
|
|
7
7
|
pwdId: string;
|
|
8
8
|
effectiveConfig: EffectiveConfig;
|
|
9
|
-
}
|
|
9
|
+
}
|
|
10
|
+
export declare function saveTempOnlineUnlimitedForRuntime(rt: LockDeviceRuntime, params: CreateOnlineUnlimitedParams): Promise<SaveTempOnlineUnlimitedResult>;
|
|
10
11
|
export declare function removeTempOnlineUnlimitedForRuntime(rt: LockDeviceRuntime, id: string): Promise<void>;
|
|
11
12
|
export interface OnlinePasswordItem {
|
|
12
13
|
status: "effective" | "synchronizing" | "expired" | "disabled" | "invalid";
|
|
@@ -14,10 +14,11 @@ import syncT0 from "./sync/t0";
|
|
|
14
14
|
import { getDeviceStatusForRuntime, updateOnlineType } from "./device-status";
|
|
15
15
|
import { handleDpChange } from "./dp-change";
|
|
16
16
|
import { fetchDeviceProperties } from "./remote-permissions";
|
|
17
|
-
import { ipc, yuChannelSyncSingleSync
|
|
17
|
+
import { ipc, yuChannelSyncSingleSync } from "../../platform";
|
|
18
18
|
import { sdkLog } from "../../utils/sdk-log";
|
|
19
19
|
import { ProductCommunicationType, RotateType } from "../../constant";
|
|
20
20
|
import { isHarmony } from "../../utils";
|
|
21
|
+
import { getError } from "../../utils/errors";
|
|
21
22
|
export const initState = async (runtime) => {
|
|
22
23
|
const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
|
|
23
24
|
const startedAt = Date.now();
|
|
@@ -41,7 +42,7 @@ export const initState = async (runtime) => {
|
|
|
41
42
|
isSupportVideo,
|
|
42
43
|
},
|
|
43
44
|
});
|
|
44
|
-
const [, , , advanceAbilities, isActiveThread, rotateInfo, deviceSkill, ipcConfig,] = await Promise.allSettled([
|
|
45
|
+
const [, userInfoResult, , advanceAbilities, isActiveThread, rotateInfo, deviceSkill, ipcConfig,] = await Promise.allSettled([
|
|
45
46
|
updateOnlineType(runtime),
|
|
46
47
|
getCurrentUserForRuntime(runtime),
|
|
47
48
|
fetchDeviceProperties(runtime),
|
|
@@ -71,6 +72,43 @@ export const initState = async (runtime) => {
|
|
|
71
72
|
},
|
|
72
73
|
}),
|
|
73
74
|
]);
|
|
75
|
+
if (userInfoResult.status === "rejected") {
|
|
76
|
+
throw userInfoResult.reason;
|
|
77
|
+
}
|
|
78
|
+
if (advanceAbilities.status === "fulfilled") {
|
|
79
|
+
const abilities = advanceAbilities.value;
|
|
80
|
+
sdkLog("debug", "initState", "advancedAbilitiesFetched", {
|
|
81
|
+
devId,
|
|
82
|
+
data: {
|
|
83
|
+
yuChannelSupport: abilities.yuChannel.support,
|
|
84
|
+
yuChannelValue: abilities.yuChannel.value,
|
|
85
|
+
},
|
|
86
|
+
});
|
|
87
|
+
if (isSupportVideo &&
|
|
88
|
+
!abilities.videoConfig.isHighResolution &&
|
|
89
|
+
!abilities.videoConfig.isLowResolution) {
|
|
90
|
+
throw getError(1107);
|
|
91
|
+
}
|
|
92
|
+
if (abilities.yuChannel.support) {
|
|
93
|
+
if (abilities.yuChannel.value === 1) {
|
|
94
|
+
sdkLog("debug", "initState", "yuChannelSync", {
|
|
95
|
+
devId,
|
|
96
|
+
data: { reason: "abilityEnabled" },
|
|
97
|
+
});
|
|
98
|
+
yuChannelSyncSingleSync(devId);
|
|
99
|
+
}
|
|
100
|
+
else if (yuNetState === 1) {
|
|
101
|
+
sdkLog("debug", "initState", "yuChannelSync", {
|
|
102
|
+
devId,
|
|
103
|
+
data: { reason: "yuNetState" },
|
|
104
|
+
});
|
|
105
|
+
yuChannelSyncSingleSync(devId);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
throw getError(1108);
|
|
111
|
+
}
|
|
74
112
|
if (isSupportVideo) {
|
|
75
113
|
const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
|
|
76
114
|
if (rotateInfo.status === "fulfilled") {
|
|
@@ -85,14 +123,11 @@ export const initState = async (runtime) => {
|
|
|
85
123
|
}
|
|
86
124
|
if (ipcConfig.status === "fulfilled" &&
|
|
87
125
|
ipcConfig.value?.audioAttributes?.hardwareCapability?.includes(2)) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
126
|
+
runtime.config.supportTalk = true;
|
|
127
|
+
runtime.config.isTwoWayTalk =
|
|
128
|
+
ipcConfig.value?.audioAttributes?.callMode?.[0] === 2;
|
|
129
|
+
if (!isHarmony()) {
|
|
94
130
|
try {
|
|
95
|
-
runtime.config.supportTalk = true;
|
|
96
131
|
const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
|
|
97
132
|
runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
|
|
98
133
|
sdkLog("info", "initState", "supportTalk", {
|
|
@@ -128,32 +163,6 @@ export const initState = async (runtime) => {
|
|
|
128
163
|
videoAngle: runtime.config.videoAngle,
|
|
129
164
|
},
|
|
130
165
|
});
|
|
131
|
-
if (advanceAbilities.status === "fulfilled") {
|
|
132
|
-
const abilities = advanceAbilities.value;
|
|
133
|
-
sdkLog("debug", "initState", "advancedAbilitiesFetched", {
|
|
134
|
-
devId,
|
|
135
|
-
data: {
|
|
136
|
-
yuChannelSupport: abilities.yuChannel.support,
|
|
137
|
-
yuChannelValue: abilities.yuChannel.value,
|
|
138
|
-
},
|
|
139
|
-
});
|
|
140
|
-
if (abilities.yuChannel.support) {
|
|
141
|
-
if (abilities.yuChannel.value === 1) {
|
|
142
|
-
sdkLog("debug", "initState", "yuChannelSync", {
|
|
143
|
-
devId,
|
|
144
|
-
data: { reason: "abilityEnabled" },
|
|
145
|
-
});
|
|
146
|
-
yuChannelSyncSingleSync(devId);
|
|
147
|
-
}
|
|
148
|
-
else if (yuNetState === 1) {
|
|
149
|
-
sdkLog("debug", "initState", "yuChannelSync", {
|
|
150
|
-
devId,
|
|
151
|
-
data: { reason: "yuNetState" },
|
|
152
|
-
});
|
|
153
|
-
yuChannelSyncSingleSync(devId);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
166
|
syncRemoteSerectKey(runtime);
|
|
158
167
|
checkOfflineDpUpdateForRuntime(runtime, {}, true).then(() => {
|
|
159
168
|
sdkLog("debug", "initState", "offlineDpCheckDone", { devId });
|
|
@@ -163,8 +172,10 @@ export const initState = async (runtime) => {
|
|
|
163
172
|
});
|
|
164
173
|
setTimeout(() => {
|
|
165
174
|
sdkLog("debug", "initState", "scheduledSyncUnlock", { devId });
|
|
166
|
-
|
|
167
|
-
|
|
175
|
+
if (getDeviceStatusForRuntime(runtime).type === "online") {
|
|
176
|
+
syncT0(runtime);
|
|
177
|
+
autoSyncUnlockMethod(runtime);
|
|
178
|
+
}
|
|
168
179
|
}, 2000);
|
|
169
180
|
setTimeout(() => {
|
|
170
181
|
sdkLog("debug", "initState", "scheduledSyncTempAndUsers", { devId });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
2
|
import { createUnlockMethod } from "../../../api/lock";
|
|
3
3
|
import { parallelOnlyForRuntime } from "../../utils";
|
|
4
|
-
import {
|
|
4
|
+
import { sleep } from "../../../utils";
|
|
5
5
|
import { getError } from "../../../utils/errors";
|
|
6
6
|
import { publishDpsForRuntime } from "../../dp/publish-dps";
|
|
7
7
|
import emitter from "../../../utils/event";
|
|
@@ -207,7 +207,7 @@ const handleAddReport = async (dps) => {
|
|
|
207
207
|
const res = await createUnlockMethod({
|
|
208
208
|
devId: cfg.devInfo.devId,
|
|
209
209
|
userId: addUnlockMethodData.userId,
|
|
210
|
-
unlockId:
|
|
210
|
+
unlockId: `${addUnlockMethodData.unlockDpId}-${result.unlockId}`,
|
|
211
211
|
unlockName: "",
|
|
212
212
|
unlockAttr: 0,
|
|
213
213
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dpUtils from "@ray-js/tuya-dp-transform";
|
|
2
2
|
import { createUnlockMethod } from "../../../api/lock";
|
|
3
3
|
import { encrypt } from "../../../platform/device";
|
|
4
|
-
import {
|
|
4
|
+
import { sleep } from "../../../utils";
|
|
5
5
|
import { getError, handleCloudError } from "../../../utils/errors";
|
|
6
6
|
import { publishDpsForRuntime } from "../../dp/publish-dps";
|
|
7
7
|
import { getUnlockMethodBase } from "./internal/base";
|
|
@@ -76,7 +76,7 @@ export async function addPasswordForRuntime(rt, params) {
|
|
|
76
76
|
const result = await createUnlockMethod({
|
|
77
77
|
devId: devId,
|
|
78
78
|
userId: params.userId,
|
|
79
|
-
unlockId:
|
|
79
|
+
unlockId: `${dpId}-${res.unlockId}`,
|
|
80
80
|
unlockName: params.name,
|
|
81
81
|
unlockDetail: aesPwd,
|
|
82
82
|
...specialInfo,
|
|
@@ -26,7 +26,7 @@ export async function updateUnlockMethodForRuntime(rt, params) {
|
|
|
26
26
|
await editUnlockMethod({
|
|
27
27
|
devId: cfg.devInfo.devId,
|
|
28
28
|
opModeId: params.id,
|
|
29
|
-
unlockName: params.name,
|
|
29
|
+
unlockName: params.name || detail.unlockName,
|
|
30
30
|
...specialInfo,
|
|
31
31
|
});
|
|
32
32
|
sdkLog("info", "unlockMethod", "updateSuccess", {
|
package/lib/interface.d.ts
CHANGED
|
@@ -359,6 +359,10 @@ export interface AlbumMessage extends MediaInfo {
|
|
|
359
359
|
}
|
|
360
360
|
export type VRModeType = "original" | "VR" | "horizontal" | "vertical";
|
|
361
361
|
export interface DeviceAdvancedAbility {
|
|
362
|
+
videoConfig: {
|
|
363
|
+
isLowResolution: boolean;
|
|
364
|
+
isHighResolution: boolean;
|
|
365
|
+
};
|
|
362
366
|
cloudStorage: {
|
|
363
367
|
support: boolean;
|
|
364
368
|
};
|
|
@@ -370,6 +374,10 @@ export interface DeviceAdvancedAbility {
|
|
|
370
374
|
value: number;
|
|
371
375
|
}>;
|
|
372
376
|
defaultMode: VRModeType;
|
|
377
|
+
options: {
|
|
378
|
+
zoomIn?: number;
|
|
379
|
+
radialEmphasis?: number;
|
|
380
|
+
};
|
|
373
381
|
};
|
|
374
382
|
ai: {
|
|
375
383
|
support: boolean;
|
package/lib/platform/device.d.ts
CHANGED
|
@@ -173,6 +173,7 @@ export declare const navigateTo: (params: ParamType<typeof ty.navigateTo>) => vo
|
|
|
173
173
|
export declare const checkShowMatterMutilpleShare: (deviceId: string) => Promise<unknown>;
|
|
174
174
|
export declare const getBLEOnlineState: (deviceId: string) => Promise<boolean>;
|
|
175
175
|
export declare const connectBLEDevice: (deviceId: string) => Promise<void>;
|
|
176
|
+
export declare const disconnectBLEDevice: (deviceId: string) => Promise<void>;
|
|
176
177
|
export interface BLEFileTransferParams {
|
|
177
178
|
deviceId: string;
|
|
178
179
|
fileId: number;
|
package/lib/platform/device.js
CHANGED
|
@@ -365,6 +365,15 @@ export const connectBLEDevice = (deviceId) => {
|
|
|
365
365
|
});
|
|
366
366
|
});
|
|
367
367
|
};
|
|
368
|
+
export const disconnectBLEDevice = (deviceId) => {
|
|
369
|
+
return new Promise((resolve, reject) => {
|
|
370
|
+
ty.device.disconnectBLEDevice({
|
|
371
|
+
deviceId,
|
|
372
|
+
success: () => resolve(),
|
|
373
|
+
fail: reject,
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
};
|
|
368
377
|
export const postBLEFileTransfer = (params) => {
|
|
369
378
|
return new Promise((resolve, reject) => {
|
|
370
379
|
const device = ty.device;
|
|
@@ -450,10 +459,10 @@ export const offAppShow = (cb) => {
|
|
|
450
459
|
ty.offAppShow(cb);
|
|
451
460
|
};
|
|
452
461
|
export const onAppHide = (cb) => {
|
|
453
|
-
ty.
|
|
462
|
+
ty.onAppHide(cb);
|
|
454
463
|
};
|
|
455
464
|
export const offAppHide = (cb) => {
|
|
456
|
-
ty.
|
|
465
|
+
ty.offAppHide(cb);
|
|
457
466
|
};
|
|
458
467
|
export const trackEvent = (event, data) => {
|
|
459
468
|
ty.event({
|
package/lib/platform/ipc.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ declare const _default: {
|
|
|
6
6
|
isConnecting: (deviceId: string) => Promise<{
|
|
7
7
|
isConnecting: boolean;
|
|
8
8
|
}>;
|
|
9
|
+
disConnect: (deviceId: string) => Promise<unknown>;
|
|
9
10
|
connect: (deviceId: string) => Promise<unknown>;
|
|
10
11
|
getCurrentSupportedTalkMode: (deviceId: string) => Promise<{
|
|
11
12
|
talkbackMode: number;
|
package/lib/platform/ipc.js
CHANGED
|
@@ -18,6 +18,11 @@ const connect = (deviceId) => {
|
|
|
18
18
|
ty.ipc.connect({ deviceId, success: resolve, fail: reject });
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
|
+
const disConnect = (deviceId) => {
|
|
22
|
+
return new Promise((resolve, reject) => {
|
|
23
|
+
ty.ipc.disConnect({ deviceId, success: resolve, fail: reject });
|
|
24
|
+
});
|
|
25
|
+
};
|
|
21
26
|
const getCurrentSupportedTalkMode = (deviceId) => {
|
|
22
27
|
if (ty.ipc.getCurrentSupportedTalkMode) {
|
|
23
28
|
return new Promise((resolve, reject) => {
|
|
@@ -47,6 +52,7 @@ export default {
|
|
|
47
52
|
wakeUpDoorBell,
|
|
48
53
|
isConnected,
|
|
49
54
|
isConnecting,
|
|
55
|
+
disConnect,
|
|
50
56
|
connect,
|
|
51
57
|
getCurrentSupportedTalkMode,
|
|
52
58
|
getTTTAbilityKeyList,
|
package/lib/utils/errors.js
CHANGED
|
@@ -106,6 +106,8 @@ const errors = {
|
|
|
106
106
|
1104: "Failed to switch cameras",
|
|
107
107
|
1105: "Camera switching is not supported",
|
|
108
108
|
1106: "No validity configuration data",
|
|
109
|
+
1107: "Invalid device, please re-authorize",
|
|
110
|
+
1108: "Failed to get configuration",
|
|
109
111
|
};
|
|
110
112
|
export const getError = (code, ...places) => {
|
|
111
113
|
if (errors[code]) {
|