@ray-js/lock-sdk 1.2.0-beta.9 → 1.2.0
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/fit.d.ts +55 -2
- package/lib/api/fit.js +43 -1
- package/lib/api/gesture.d.ts +11 -0
- package/lib/api/gesture.js +18 -0
- package/lib/api/log.d.ts +52 -4
- package/lib/api/log.js +22 -0
- package/lib/api/temp.d.ts +21 -0
- package/lib/api/temp.js +24 -0
- package/lib/config/dp-code/index.d.ts +1 -1
- package/lib/config/dp-code/index.js +1 -0
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
- package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
- package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
- package/lib/entries/main/bootstrap/bootstrap.js +10 -6
- package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
- package/lib/entries/main/bootstrap/primary-instance.js +1 -1
- package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
- package/lib/entries/main/build-instance.d.ts +6 -3
- package/lib/entries/main/build-instance.js +13 -1
- package/lib/entries/main/exports/capability.d.ts +2 -0
- package/lib/entries/main/exports/capability.js +7 -1
- package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
- package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
- package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
- package/lib/entries/main/exports/fit-sdk/log.js +5 -0
- package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
- package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
- package/lib/entries/main/exports/gesture.d.ts +6 -0
- package/lib/entries/main/exports/gesture.js +8 -0
- package/lib/entries/main/exports/index.d.ts +5 -0
- package/lib/entries/main/exports/index.js +5 -0
- package/lib/entries/main/exports/log.d.ts +2 -0
- package/lib/entries/main/exports/log.js +7 -1
- package/lib/entries/main/exports/misc.d.ts +4 -2
- package/lib/entries/main/exports/misc.js +2 -2
- package/lib/entries/main/index.d.ts +3 -3
- package/lib/entries/main/index.js +11 -5
- package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
- package/lib/feature/fit/bind-lock-to-fit.js +53 -0
- package/lib/feature/fit/ble-key.d.ts +10 -4
- package/lib/feature/fit/ble-key.js +145 -4
- package/lib/feature/fit/device-bv.d.ts +2 -0
- package/lib/feature/fit/device-bv.js +15 -0
- package/lib/feature/fit/invalid-password.d.ts +10 -0
- package/lib/feature/fit/invalid-password.js +43 -0
- package/lib/feature/fit/list.d.ts +12 -2
- package/lib/feature/fit/list.js +54 -5
- package/lib/feature/fit/log.d.ts +7 -0
- package/lib/feature/fit/log.js +123 -0
- package/lib/feature/fit/method/add-flow.js +2 -2
- package/lib/feature/fit/method/add-password.js +2 -2
- package/lib/feature/fit/method/update-remove.js +40 -14
- package/lib/feature/fit/password-list.d.ts +37 -0
- package/lib/feature/fit/password-list.js +44 -1
- package/lib/feature/fit/security-channel.d.ts +3 -0
- package/lib/feature/fit/security-channel.js +43 -0
- package/lib/feature/fit/shared.d.ts +8 -0
- package/lib/feature/fit/shared.js +40 -1
- package/lib/feature/fit/sync.d.ts +4 -2
- package/lib/feature/fit/sync.js +63 -22
- package/lib/feature/fit/temp-password.d.ts +23 -0
- package/lib/feature/fit/temp-password.js +95 -3
- package/lib/feature/fit/users.d.ts +1 -0
- package/lib/feature/fit/users.js +1 -0
- package/lib/feature/gesture/gesture.d.ts +6 -0
- package/lib/feature/gesture/gesture.js +3 -0
- package/lib/feature/log/log.d.ts +5 -1
- package/lib/feature/log/log.js +53 -6
- package/lib/feature/misc/ble-control.js +2 -2
- package/lib/feature/misc/capability.d.ts +2 -0
- package/lib/feature/misc/capability.js +33 -31
- package/lib/feature/misc/connect-device.d.ts +1 -1
- package/lib/feature/misc/connect-device.js +7 -6
- package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
- package/lib/feature/password/temporary/offline-create.d.ts +14 -0
- package/lib/feature/password/temporary/offline-create.js +77 -1
- package/lib/feature/service/goto-service.d.ts +1 -1
- package/lib/feature/state/clear.js +1 -0
- package/lib/feature/state/device-status.js +17 -6
- package/lib/feature/state/init-state.js +17 -9
- package/lib/feature/state/platform-routing.js +12 -3
- package/lib/feature/state/remote-permissions.js +2 -1
- package/lib/feature/state/sync/remote-serect-key.js +7 -0
- package/lib/feature/storage/swr-cache.d.ts +7 -0
- package/lib/feature/storage/swr-cache.js +54 -0
- package/lib/feature/unlock/method/add-flow.js +2 -2
- package/lib/feature/unlock/method/add-password.js +2 -2
- package/lib/feature/user/sync-user.js +4 -2
- package/lib/feature/utils/index.d.ts +1 -0
- package/lib/feature/utils/index.js +1 -0
- package/lib/interface.d.ts +23 -1
- package/lib/platform/device.d.ts +4 -3
- package/lib/platform/ipc.d.ts +3 -0
- package/lib/platform/ipc.js +13 -0
- package/lib/platform/storage.d.ts +1 -1
- package/lib/runtime/LockDeviceRuntime.js +3 -0
- package/lib/runtime/lock-config.d.ts +3 -0
- package/lib/runtime/lock-config.js +5 -0
- package/lib/runtime/runtime-state-types.d.ts +6 -0
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +6 -0
- package/lib/utils/index.d.ts +2 -1
- package/lib/utils/index.js +1 -0
- package/package.json +1 -11
- package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
- package/lib/bootstrap/bootstrap.d.ts +0 -4
- package/lib/bootstrap/bootstrap.js +0 -53
- package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/bootstrap/primary-instance.d.ts +0 -6
- package/lib/bootstrap/primary-instance.js +0 -24
- package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/ble/build-instance.d.ts +0 -9
- package/lib/entries/ble/build-instance.js +0 -50
- package/lib/entries/ble/exports/capability.d.ts +0 -6
- package/lib/entries/ble/exports/capability.js +0 -17
- package/lib/entries/ble/exports/config.d.ts +0 -3
- package/lib/entries/ble/exports/config.js +0 -5
- package/lib/entries/ble/exports/dp.d.ts +0 -9
- package/lib/entries/ble/exports/dp.js +0 -13
- package/lib/entries/ble/exports/index.d.ts +0 -16
- package/lib/entries/ble/exports/index.js +0 -16
- package/lib/entries/ble/exports/linkage.d.ts +0 -5
- package/lib/entries/ble/exports/linkage.js +0 -15
- package/lib/entries/ble/exports/log.d.ts +0 -9
- package/lib/entries/ble/exports/log.js +0 -21
- package/lib/entries/ble/exports/media.d.ts +0 -4
- package/lib/entries/ble/exports/media.js +0 -12
- package/lib/entries/ble/exports/misc.d.ts +0 -19
- package/lib/entries/ble/exports/misc.js +0 -30
- package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
- package/lib/entries/ble/exports/offline-dps.js +0 -24
- package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
- package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
- package/lib/entries/ble/exports/open/index.d.ts +0 -18
- package/lib/entries/ble/exports/open/index.js +0 -45
- package/lib/entries/ble/exports/signal.d.ts +0 -6
- package/lib/entries/ble/exports/signal.js +0 -14
- package/lib/entries/ble/exports/sleep.d.ts +0 -13
- package/lib/entries/ble/exports/sleep.js +0 -31
- package/lib/entries/ble/exports/state.d.ts +0 -6
- package/lib/entries/ble/exports/state.js +0 -19
- package/lib/entries/ble/exports/temporary.d.ts +0 -31
- package/lib/entries/ble/exports/temporary.js +0 -91
- package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
- package/lib/entries/ble/exports/unlock/sync.js +0 -5
- package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
- package/lib/entries/ble/exports/unlock-method.js +0 -58
- package/lib/entries/ble/exports/user/index.d.ts +0 -23
- package/lib/entries/ble/exports/user/index.js +0 -22
- package/lib/entries/ble/exports/user/sync.d.ts +0 -1
- package/lib/entries/ble/exports/user/sync.js +0 -5
- package/lib/entries/ble/index.d.ts +0 -8
- package/lib/entries/ble/index.js +0 -39
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/fit/build-instance.d.ts +0 -9
- package/lib/entries/fit/build-instance.js +0 -57
- package/lib/entries/fit/exports/binding.d.ts +0 -8
- package/lib/entries/fit/exports/temp.d.ts +0 -19
- package/lib/entries/fit/exports/temp.js +0 -18
- package/lib/entries/fit/index.d.ts +0 -8
- package/lib/entries/fit/index.js +0 -36
- package/lib/entries/main/exports/open.d.ts +0 -16
- package/lib/entries/main/exports/open.js +0 -44
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
- package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
- package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
- package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
- package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
- package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
- package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
- package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
- package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
- package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
- package/lib/entries/screen/build-instance.d.ts +0 -9
- package/lib/entries/screen/build-instance.js +0 -57
- package/lib/entries/screen/exports/bind-events.d.ts +0 -4
- package/lib/entries/screen/exports/bind-events.js +0 -8
- package/lib/entries/screen/exports/binding.d.ts +0 -6
- package/lib/entries/screen/exports/binding.js +0 -15
- package/lib/entries/screen/exports/device.d.ts +0 -16
- package/lib/entries/screen/exports/device.js +0 -41
- package/lib/entries/screen/exports/event.d.ts +0 -3
- package/lib/entries/screen/exports/event.js +0 -5
- package/lib/entries/screen/exports/index.d.ts +0 -5
- package/lib/entries/screen/exports/index.js +0 -5
- package/lib/entries/screen/exports/user.d.ts +0 -2
- package/lib/entries/screen/exports/user.js +0 -8
- package/lib/entries/screen/index.d.ts +0 -8
- package/lib/entries/screen/index.js +0 -36
- package/lib/feature/unlock/door/door-action.d.ts +0 -2
- package/lib/feature/unlock/door/door-action.js +0 -32
- package/lib/fit.d.ts +0 -4
- package/lib/fit.js +0 -3
- package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
- package/lib/runtime/device-status/compute-device-status.js +0 -94
- package/lib/screen.d.ts +0 -4
- package/lib/screen.js +0 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getFitPasswordList } from "../../api/fit";
|
|
1
|
+
import { getFitPasswordList, getFitOfflinePasswordList, } from "../../api/fit";
|
|
2
2
|
import { parseWeek } from "../../utils";
|
|
3
3
|
export const getFitPasswordListForRuntime = async (runtime) => {
|
|
4
4
|
const list = await getFitPasswordList(runtime.devId);
|
|
@@ -29,3 +29,46 @@ export const getFitPasswordListForRuntime = async (runtime) => {
|
|
|
29
29
|
};
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
+
export const getFitOnlinePasswordListForRuntime = async (runtime) => {
|
|
33
|
+
const list = await getFitPasswordList(runtime.devId);
|
|
34
|
+
return (list ?? []).map((item) => ({
|
|
35
|
+
id: item.unlockBindingId,
|
|
36
|
+
pwdId: item.pwdId,
|
|
37
|
+
sn: item.sn,
|
|
38
|
+
gmtCreate: item.gmtCreate,
|
|
39
|
+
opModeType: item.opModeType,
|
|
40
|
+
opModeSubType: item.opModeSubType,
|
|
41
|
+
name: item.name,
|
|
42
|
+
userName: item.userName,
|
|
43
|
+
mobile: item.mobile,
|
|
44
|
+
hijack: item.hijack,
|
|
45
|
+
operate: item.operate,
|
|
46
|
+
effectiveTime: item.effectiveTime,
|
|
47
|
+
invalidTime: item.invalidTime,
|
|
48
|
+
devNameList: item.devNameList ?? [],
|
|
49
|
+
scheduleDetails: item.scheduleDetails ?? [],
|
|
50
|
+
}));
|
|
51
|
+
};
|
|
52
|
+
export const getFitOfflinePasswordListForRuntime = async (runtime) => {
|
|
53
|
+
const res = await getFitOfflinePasswordList(runtime.devId);
|
|
54
|
+
const list = Array.isArray(res)
|
|
55
|
+
? res
|
|
56
|
+
: (res?.datas ?? []);
|
|
57
|
+
return list.map((item) => ({
|
|
58
|
+
id: item.unlockBindingId ?? item.pwdId,
|
|
59
|
+
pwdId: item.pwdId,
|
|
60
|
+
sn: item.sn,
|
|
61
|
+
gmtCreate: item.gmtCreate,
|
|
62
|
+
opModeType: item.opModeType ?? 3,
|
|
63
|
+
opModeSubType: item.opModeSubType,
|
|
64
|
+
pwdName: item.pwdName,
|
|
65
|
+
mayExpired: item.mayExpired,
|
|
66
|
+
gmtStart: item.gmtStart,
|
|
67
|
+
gmtExpired: item.gmtExpired,
|
|
68
|
+
devNameList: item.devNameList ?? [],
|
|
69
|
+
scheduleDetails: item.scheduleDetails ?? [],
|
|
70
|
+
revokedPwdName: item.revokedPwdName,
|
|
71
|
+
revokedPwdEffectiveTime: item.revokedPwdEffectiveTime,
|
|
72
|
+
revokedPwdInvalidTime: item.revokedPwdInvalidTime,
|
|
73
|
+
}));
|
|
74
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getDeviceProperties } from "../../api/setting";
|
|
2
|
+
import { sdkLog } from "../../utils/sdk-log";
|
|
3
|
+
export const isFitSecurityChannelEnabledForRuntime = (rt) => {
|
|
4
|
+
const raw = rt.config.devInfo?.meta?.["btScyChannel"];
|
|
5
|
+
if (!raw) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const parsed = typeof raw === "string"
|
|
10
|
+
? JSON.parse(raw)
|
|
11
|
+
: raw;
|
|
12
|
+
return parsed?.enable === 1;
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const getSecurityUpdatedLockIds = async (fittingId) => {
|
|
19
|
+
try {
|
|
20
|
+
const props = await getDeviceProperties(fittingId, ["SECURITY_UPDATED"]);
|
|
21
|
+
const raw = props?.["SECURITY_UPDATED"];
|
|
22
|
+
if (typeof raw === "string") {
|
|
23
|
+
try {
|
|
24
|
+
return JSON.parse(raw).value || [];
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
if (raw && typeof raw === "object") {
|
|
31
|
+
return (raw.value ||
|
|
32
|
+
(Array.isArray(raw) ? raw : []));
|
|
33
|
+
}
|
|
34
|
+
return [];
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
sdkLog("warn", "fit", "getSecurityUpdatedError", {
|
|
38
|
+
devId: fittingId,
|
|
39
|
+
error: e,
|
|
40
|
+
});
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
};
|
|
@@ -2,6 +2,14 @@ export type FitBindOperation = "bind" | "unbind";
|
|
|
2
2
|
export declare const FIT_BIND_TIMEOUT_MS = 12000;
|
|
3
3
|
export declare const FIT_OPERATION_CODE: Record<FitBindOperation, "00" | "01">;
|
|
4
4
|
export declare const normalizeHex: (value: string) => string;
|
|
5
|
+
export declare function markPrecautionaryUnbindPublished(fittingId: string, fit: {
|
|
6
|
+
fittingUnlockId: string;
|
|
7
|
+
randomStr: string;
|
|
8
|
+
devUnlockId: string;
|
|
9
|
+
}): void;
|
|
10
|
+
export declare function clearPrecautionaryUnbindSuppression(fittingId: string): void;
|
|
11
|
+
export declare function shouldSuppressFitSyncReportFrame(fittingId: string, data: string): boolean;
|
|
12
|
+
export declare function normalizeDevUuidHex(devUuid: string): string;
|
|
5
13
|
export declare function buildTransparentData(operation: FitBindOperation, fit: {
|
|
6
14
|
fittingUnlockId: string;
|
|
7
15
|
randomStr: string;
|
|
@@ -7,8 +7,43 @@ export const FIT_OPERATION_CODE = {
|
|
|
7
7
|
unbind: "01",
|
|
8
8
|
};
|
|
9
9
|
export const normalizeHex = (value) => value.replace(/\s/g, "");
|
|
10
|
+
const PRECAUTIONARY_UNBIND_SUPPRESS_MS = 60_000;
|
|
11
|
+
const pendingPrecautionaryUnbindAcks = new Map();
|
|
12
|
+
const buildUnbindAckPrefix = (fit) => `01${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}`.toLowerCase();
|
|
13
|
+
export function markPrecautionaryUnbindPublished(fittingId, fit) {
|
|
14
|
+
pendingPrecautionaryUnbindAcks.set(fittingId, {
|
|
15
|
+
prefix: buildUnbindAckPrefix(fit),
|
|
16
|
+
expiresAt: Date.now() + PRECAUTIONARY_UNBIND_SUPPRESS_MS,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export function clearPrecautionaryUnbindSuppression(fittingId) {
|
|
20
|
+
pendingPrecautionaryUnbindAcks.delete(fittingId);
|
|
21
|
+
}
|
|
22
|
+
export function shouldSuppressFitSyncReportFrame(fittingId, data) {
|
|
23
|
+
const entry = pendingPrecautionaryUnbindAcks.get(fittingId);
|
|
24
|
+
if (!entry) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
if (Date.now() > entry.expiresAt) {
|
|
28
|
+
pendingPrecautionaryUnbindAcks.delete(fittingId);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return normalizeHex(data).toLowerCase().startsWith(entry.prefix);
|
|
32
|
+
}
|
|
33
|
+
export function normalizeDevUuidHex(devUuid) {
|
|
34
|
+
if (devUuid.length >= 32 &&
|
|
35
|
+
devUuid.length % 2 === 0 &&
|
|
36
|
+
/^[0-9a-fA-F]+$/.test(devUuid)) {
|
|
37
|
+
return devUuid;
|
|
38
|
+
}
|
|
39
|
+
let hex = "";
|
|
40
|
+
for (let i = 0; i < devUuid.length; i += 1) {
|
|
41
|
+
hex += devUuid.charCodeAt(i).toString(16);
|
|
42
|
+
}
|
|
43
|
+
return hex;
|
|
44
|
+
}
|
|
10
45
|
export function buildTransparentData(operation, fit, loginKey) {
|
|
11
|
-
return `${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}${fit.devUuid}${loginKey}`;
|
|
46
|
+
return `${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}${fit.devUnlockId}${normalizeDevUuidHex(fit.devUuid)}${loginKey}`;
|
|
12
47
|
}
|
|
13
48
|
export function buildLockCheckCodeTemplate(operation, fit) {
|
|
14
49
|
return `ffff${fit.devUnlockId}${FIT_OPERATION_CODE[operation]}${fit.fittingUnlockId}${fit.randomStr}`;
|
|
@@ -106,8 +141,12 @@ export async function publishFitTransparentFlow(fittingId, keyDeviceId, operatio
|
|
|
106
141
|
expectedOperation: FIT_OPERATION_CODE[operation],
|
|
107
142
|
});
|
|
108
143
|
if (operation === "bind") {
|
|
144
|
+
markPrecautionaryUnbindPublished(fittingId, fit);
|
|
109
145
|
await publishBLETransparentData(fittingId, buildTransparentData("unbind", fit, loginKey));
|
|
110
146
|
}
|
|
147
|
+
else {
|
|
148
|
+
clearPrecautionaryUnbindSuppression(fittingId);
|
|
149
|
+
}
|
|
111
150
|
await publishBLETransparentData(fittingId, buildTransparentData(operation, fit, loginKey));
|
|
112
151
|
await waitResult;
|
|
113
152
|
sdkLog("info", "fit", "transparentFlowSuccess", {
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
import { type SyncOpenModeRiseResult } from "../../api/fit";
|
|
2
3
|
export declare function syncFitBindingsForRuntime(runtime: LockDeviceRuntime): Promise<void>;
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function startFitSyncReportForRuntime(runtime: LockDeviceRuntime): void;
|
|
5
|
+
export declare function stopFitSyncReportForRuntime(runtime: LockDeviceRuntime): void;
|
|
6
|
+
export declare function syncOpenModeRiseForRuntime(runtime: LockDeviceRuntime, dpCodes?: string[]): Promise<SyncOpenModeRiseResult>;
|
package/lib/feature/fit/sync.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
import { syncFitToLockRise, syncFitReport as syncFitReportApi, syncOpenModeRise as syncOpenModeRiseApi, } from "../../api/fit";
|
|
2
|
-
import {
|
|
2
|
+
import { unlockMethodDpCodes } from "../utils";
|
|
3
|
+
import { offBLETransparentDataReport, onBLETransparentDataReport, publishBLETransparentData, subscribeBLETransparentDataReport, } from "../../platform/device";
|
|
3
4
|
import { sdkLog } from "../../utils/sdk-log";
|
|
5
|
+
import { shouldSuppressFitSyncReportFrame } from "./shared";
|
|
4
6
|
export async function syncFitBindingsForRuntime(runtime) {
|
|
5
7
|
const startedAt = Date.now();
|
|
6
8
|
const fittingId = runtime.devId;
|
|
7
9
|
sdkLog("info", "fit", "syncBindingsStart", {
|
|
8
10
|
devId: runtime.devId,
|
|
9
11
|
});
|
|
12
|
+
if (runtime.sync.fitBindingsSyncStarted) {
|
|
13
|
+
sdkLog("info", "fit", "syncBindingsSkip", {
|
|
14
|
+
devId: runtime.devId,
|
|
15
|
+
data: { reason: "already_started" },
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
runtime.sync.fitBindingsSyncStarted = true;
|
|
10
20
|
try {
|
|
11
21
|
const result = await syncFitToLockRise(fittingId);
|
|
12
22
|
const instructions = Array.isArray(result.ins) ? result.ins : [];
|
|
@@ -29,6 +39,7 @@ export async function syncFitBindingsForRuntime(runtime) {
|
|
|
29
39
|
});
|
|
30
40
|
}
|
|
31
41
|
catch (error) {
|
|
42
|
+
runtime.sync.fitBindingsSyncStarted = false;
|
|
32
43
|
sdkLog("error", "fit", "syncBindingsFail", {
|
|
33
44
|
devId: runtime.devId,
|
|
34
45
|
duration: Date.now() - startedAt,
|
|
@@ -37,35 +48,65 @@ export async function syncFitBindingsForRuntime(runtime) {
|
|
|
37
48
|
throw error;
|
|
38
49
|
}
|
|
39
50
|
}
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
devId: runtime.devId,
|
|
44
|
-
data: { hasInstruction: !!ins },
|
|
45
|
-
});
|
|
46
|
-
try {
|
|
47
|
-
const result = await syncFitReportApi(runtime.devId, ins);
|
|
48
|
-
sdkLog("info", "fit", "syncReportSuccess", {
|
|
49
|
-
devId: runtime.devId,
|
|
50
|
-
duration: Date.now() - startedAt,
|
|
51
|
-
});
|
|
52
|
-
return result;
|
|
51
|
+
export function startFitSyncReportForRuntime(runtime) {
|
|
52
|
+
if (runtime.sync.fitSyncReportHandler) {
|
|
53
|
+
return;
|
|
53
54
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
const devId = runtime.devId;
|
|
56
|
+
subscribeBLETransparentDataReport(devId);
|
|
57
|
+
const handler = (params) => {
|
|
58
|
+
if (params?.deviceId !== devId || !params?.data) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (shouldSuppressFitSyncReportFrame(devId, params.data)) {
|
|
62
|
+
sdkLog("info", "fit", "syncReportSuppressPrecautionaryUnbindAck", {
|
|
63
|
+
devId,
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
syncFitReportApi(devId, params.data).catch((e) => {
|
|
68
|
+
sdkLog("warn", "fit", "syncReportAutoError", {
|
|
69
|
+
devId,
|
|
70
|
+
error: e,
|
|
71
|
+
});
|
|
59
72
|
});
|
|
60
|
-
|
|
73
|
+
};
|
|
74
|
+
runtime.sync.fitSyncReportHandler = handler;
|
|
75
|
+
onBLETransparentDataReport(handler);
|
|
76
|
+
sdkLog("info", "fit", "startSyncReport", { devId });
|
|
77
|
+
}
|
|
78
|
+
export function stopFitSyncReportForRuntime(runtime) {
|
|
79
|
+
const handler = runtime.sync.fitSyncReportHandler;
|
|
80
|
+
if (handler) {
|
|
81
|
+
offBLETransparentDataReport(handler);
|
|
82
|
+
runtime.sync.fitSyncReportHandler = null;
|
|
61
83
|
}
|
|
84
|
+
runtime.sync.fitBindingsSyncStarted = false;
|
|
85
|
+
sdkLog("info", "fit", "stopSyncReport", { devId: runtime.devId });
|
|
62
86
|
}
|
|
63
|
-
export async function syncOpenModeRiseForRuntime(runtime,
|
|
87
|
+
export async function syncOpenModeRiseForRuntime(runtime, dpCodes) {
|
|
64
88
|
const startedAt = Date.now();
|
|
89
|
+
const codes = dpCodes?.length ? dpCodes : unlockMethodDpCodes;
|
|
90
|
+
const dpIds = [
|
|
91
|
+
...new Set(codes.reduce((res, code) => {
|
|
92
|
+
const id = runtime.config.idsByCode[code];
|
|
93
|
+
if (id) {
|
|
94
|
+
res.push(String(id));
|
|
95
|
+
}
|
|
96
|
+
return res;
|
|
97
|
+
}, [])),
|
|
98
|
+
];
|
|
65
99
|
sdkLog("info", "fit", "syncOpenModeRiseStart", {
|
|
66
100
|
devId: runtime.devId,
|
|
67
|
-
data: {
|
|
101
|
+
data: { isAll: !dpCodes?.length, dpIdCount: dpIds.length },
|
|
68
102
|
});
|
|
103
|
+
if (!dpIds.length) {
|
|
104
|
+
sdkLog("info", "fit", "syncOpenModeRiseSkip", {
|
|
105
|
+
devId: runtime.devId,
|
|
106
|
+
data: { reason: "no_matched_dp" },
|
|
107
|
+
});
|
|
108
|
+
return { ins: "", distributed: false };
|
|
109
|
+
}
|
|
69
110
|
try {
|
|
70
111
|
const result = await syncOpenModeRiseApi(runtime.devId, dpIds);
|
|
71
112
|
sdkLog("info", "fit", "syncOpenModeRiseSuccess", {
|
|
@@ -25,3 +25,26 @@ export interface RenameFitTempPwdParams {
|
|
|
25
25
|
name: string;
|
|
26
26
|
}
|
|
27
27
|
export declare const fitRenameTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RenameFitTempPwdParams) => Promise<void>;
|
|
28
|
+
export interface RenameFitOfflineTempPwdParams {
|
|
29
|
+
pwdId: number;
|
|
30
|
+
name: string;
|
|
31
|
+
}
|
|
32
|
+
export declare const fitRenameOfflineTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RenameFitOfflineTempPwdParams) => Promise<void>;
|
|
33
|
+
export interface RevokeFitOfflineTempPwdParams {
|
|
34
|
+
pwdId: number;
|
|
35
|
+
name?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface FitOfflineClearCodeResult {
|
|
38
|
+
password: string;
|
|
39
|
+
pwdId: string;
|
|
40
|
+
name: string;
|
|
41
|
+
effectiveConfig: {
|
|
42
|
+
effectiveDate: number;
|
|
43
|
+
expiredDate: number;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export declare const fitRevokeOfflineTempPwdForRuntime: (runtime: LockDeviceRuntime, params: RevokeFitOfflineTempPwdParams) => Promise<FitOfflineClearCodeResult>;
|
|
47
|
+
export interface ResendFitTempPwdParams {
|
|
48
|
+
id: number;
|
|
49
|
+
}
|
|
50
|
+
export declare const fitResendTempPwdForRuntime: (runtime: LockDeviceRuntime, params: ResendFitTempPwdParams) => Promise<boolean>;
|
|
@@ -3,11 +3,13 @@ import dpCodes from "../../config/dp-code";
|
|
|
3
3
|
import { fitAddTempPwd, fitReportAddTempPwd, fitRemoveTempPwd, fitReportRemoveTempPwd, fitUpdateTempPwd, fitReportUpdateTempPwd, fitBlePswCreate, fitBlePswDelete, fitBlePswCreateReport, fitBlePswDeleteReport, fitBlePswUpdate, fitBlePswUpdateReport, } from "../../config/dp-map/temp-pwd-fit";
|
|
4
4
|
import { publishDpsForRuntime } from "../dp/publish-dps";
|
|
5
5
|
import { resolveSlaveId } from "./resolve-slave-id";
|
|
6
|
-
import { getError } from "../../utils/errors";
|
|
6
|
+
import { getError, handleCloudError } from "../../utils/errors";
|
|
7
7
|
import { sdkLog } from "../../utils/sdk-log";
|
|
8
|
-
import { addFitOnlineTempPwd, addFitOnlineTempPwdCloud, getFitPasswordList, removeFitOnlineTempPwd, renameFitOnlineTempPwd, updateFitOnlineTempPwd, } from "../../api/fit";
|
|
8
|
+
import { addFitOnlineTempPwd, addFitOnlineTempPwdCloud, getFitPasswordList, removeFitOnlineTempPwd, renameFitOnlineTempPwd, resendFitOnlineTempPwd, updateFitOnlineTempPwd, } from "../../api/fit";
|
|
9
|
+
import { reNameOfflineByPwdId, revokeOfflinePasswordByPwdId } from "../../api/temp";
|
|
9
10
|
import { decrypt, encrypt } from "../../platform";
|
|
10
11
|
import { formatPasswordToList, formatWeek, getAppUser, parseWeek, sleep, transformEffectiveConfigToValidConfig, validateEffectiveConfig, } from "../../utils";
|
|
12
|
+
import { parseOfflinePasswordForRuntime } from "../utils";
|
|
11
13
|
import { hasDpForRuntime } from "../dp/has-dp";
|
|
12
14
|
export async function fitAddTempPwdForRuntime(runtime, params) {
|
|
13
15
|
const startedAt = Date.now();
|
|
@@ -180,7 +182,7 @@ export async function fitRemoveTempPwdForRuntime(runtime, params) {
|
|
|
180
182
|
data: { id: params.id, status: res.status, strategy: "device_first" },
|
|
181
183
|
});
|
|
182
184
|
if (res.status === 0x00 || res.status === 0x02) {
|
|
183
|
-
await removeFitOnlineTempPwd(runtime.devId, exist.
|
|
185
|
+
await removeFitOnlineTempPwd(runtime.devId, exist.unlockBindingId);
|
|
184
186
|
}
|
|
185
187
|
else {
|
|
186
188
|
throw getError(1028);
|
|
@@ -426,3 +428,93 @@ export const fitRenameTempPwdForRuntime = async (runtime, params) => {
|
|
|
426
428
|
throw error;
|
|
427
429
|
}
|
|
428
430
|
};
|
|
431
|
+
export const fitRenameOfflineTempPwdForRuntime = async (runtime, params) => {
|
|
432
|
+
const startedAt = Date.now();
|
|
433
|
+
sdkLog("info", "fitTempPassword", "renameOfflineStart", {
|
|
434
|
+
devId: runtime.devId,
|
|
435
|
+
data: { pwdId: params.pwdId, hasName: typeof params.name === "string" },
|
|
436
|
+
});
|
|
437
|
+
try {
|
|
438
|
+
await reNameOfflineByPwdId({
|
|
439
|
+
devId: runtime.devId,
|
|
440
|
+
pwdName: params.name,
|
|
441
|
+
pwdId: params.pwdId,
|
|
442
|
+
});
|
|
443
|
+
sdkLog("info", "fitTempPassword", "renameOfflineSuccess", {
|
|
444
|
+
devId: runtime.devId,
|
|
445
|
+
duration: Date.now() - startedAt,
|
|
446
|
+
data: { pwdId: params.pwdId },
|
|
447
|
+
});
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
sdkLog("error", "fitTempPassword", "renameOfflineFail", {
|
|
451
|
+
devId: runtime.devId,
|
|
452
|
+
duration: Date.now() - startedAt,
|
|
453
|
+
data: { pwdId: params.pwdId },
|
|
454
|
+
error,
|
|
455
|
+
});
|
|
456
|
+
throw error;
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
export const fitRevokeOfflineTempPwdForRuntime = async (runtime, params) => {
|
|
460
|
+
const startedAt = Date.now();
|
|
461
|
+
sdkLog("info", "fitTempPassword", "revokeOfflineStart", {
|
|
462
|
+
devId: runtime.devId,
|
|
463
|
+
data: { pwdId: params.pwdId, hasName: typeof params.name === "string" },
|
|
464
|
+
});
|
|
465
|
+
try {
|
|
466
|
+
const res = await revokeOfflinePasswordByPwdId({
|
|
467
|
+
devId: runtime.devId,
|
|
468
|
+
pwdId: params.pwdId,
|
|
469
|
+
name: params.name,
|
|
470
|
+
});
|
|
471
|
+
sdkLog("info", "fitTempPassword", "revokeOfflineSuccess", {
|
|
472
|
+
devId: runtime.devId,
|
|
473
|
+
duration: Date.now() - startedAt,
|
|
474
|
+
data: { pwdId: params.pwdId },
|
|
475
|
+
});
|
|
476
|
+
return {
|
|
477
|
+
password: parseOfflinePasswordForRuntime(runtime, res.pwd),
|
|
478
|
+
pwdId: res.pwdId,
|
|
479
|
+
name: res.pwdName,
|
|
480
|
+
effectiveConfig: {
|
|
481
|
+
effectiveDate: res.gmtStart,
|
|
482
|
+
expiredDate: res.gmtExpired,
|
|
483
|
+
},
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
catch (error) {
|
|
487
|
+
sdkLog("error", "fitTempPassword", "revokeOfflineFail", {
|
|
488
|
+
devId: runtime.devId,
|
|
489
|
+
duration: Date.now() - startedAt,
|
|
490
|
+
data: { pwdId: params.pwdId },
|
|
491
|
+
error,
|
|
492
|
+
});
|
|
493
|
+
throw handleCloudError(error);
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
export const fitResendTempPwdForRuntime = async (runtime, params) => {
|
|
497
|
+
const startedAt = Date.now();
|
|
498
|
+
sdkLog("info", "fitTempPassword", "resendStart", {
|
|
499
|
+
devId: runtime.devId,
|
|
500
|
+
data: { id: params.id },
|
|
501
|
+
});
|
|
502
|
+
try {
|
|
503
|
+
const result = await resendFitOnlineTempPwd(runtime.devId, params.id);
|
|
504
|
+
sdkLog("info", "fitTempPassword", "resendSuccess", {
|
|
505
|
+
devId: runtime.devId,
|
|
506
|
+
duration: Date.now() - startedAt,
|
|
507
|
+
data: { id: params.id },
|
|
508
|
+
});
|
|
509
|
+
return result;
|
|
510
|
+
}
|
|
511
|
+
catch (error) {
|
|
512
|
+
sdkLog("error", "fitTempPassword", "resendFail", {
|
|
513
|
+
devId: runtime.devId,
|
|
514
|
+
duration: Date.now() - startedAt,
|
|
515
|
+
data: { id: params.id },
|
|
516
|
+
error,
|
|
517
|
+
});
|
|
518
|
+
throw error;
|
|
519
|
+
}
|
|
520
|
+
};
|
package/lib/feature/fit/users.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
2
|
+
export declare const getGestureStatusForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/gesture").GestureStatus>;
|
|
3
|
+
export declare const updateGestureStatusForRuntime: (rt: LockDeviceRuntime, params: {
|
|
4
|
+
password: string;
|
|
5
|
+
open: boolean;
|
|
6
|
+
}) => Promise<boolean>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { getGestureStatusApi, setGestureStatusApi } from "../../api/gesture";
|
|
2
|
+
export const getGestureStatusForRuntime = (rt) => getGestureStatusApi(rt.config.devInfo.devId);
|
|
3
|
+
export const updateGestureStatusForRuntime = (rt, params) => setGestureStatusApi({ devId: rt.config.devInfo.devId, ...params });
|
package/lib/feature/log/log.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LockLogCategory } from "../../api/log";
|
|
2
|
-
import { AlbumMessage, LogData, UnlockMethodType } from "../../interface";
|
|
2
|
+
import { AlbumMessage, CloseValue, LogData, UnlockMethodType } from "../../interface";
|
|
3
3
|
import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
|
|
4
4
|
export type LogsRefreshListener = () => void;
|
|
5
5
|
export declare function getLogsRefreshEvent(runtime: LockDeviceRuntime): string;
|
|
@@ -16,11 +16,13 @@ export interface GetLogsParams {
|
|
|
16
16
|
pageSize?: number;
|
|
17
17
|
}
|
|
18
18
|
export declare const openDps: ("unlock_matter_kw" | "unlock_password" | "unlock_fingerprint" | "unlock_finger_vein" | "unlock_hand" | "unlock_dynamic" | "unlock_key" | "unlock_card" | "unlock_face" | "unlock_temporary" | "unlock_offline_pd" | "unlock_phone_remote" | "unlock_voice_remote" | "lock_record" | "unlock_ble" | "unlock_eye" | "unlock_double_kit" | "unlock_double_kit_w" | "open_inside" | "lock_local_record" | "unlock_inside" | "door_opened" | "unlock_app")[];
|
|
19
|
+
export declare const closeTypes: CloseValue[];
|
|
19
20
|
export interface GetLogsResult {
|
|
20
21
|
list: LogData[];
|
|
21
22
|
hasMore: boolean;
|
|
22
23
|
total: number;
|
|
23
24
|
}
|
|
25
|
+
export declare const dpIdsForUsernameToUnlockName: number[];
|
|
24
26
|
export declare function getLogsForRuntime(rt: LockDeviceRuntime, params?: GetLogsParams): Promise<GetLogsResult>;
|
|
25
27
|
export interface GetAlarmsParams {
|
|
26
28
|
page?: number;
|
|
@@ -61,3 +63,5 @@ export interface GetLockLogListResult {
|
|
|
61
63
|
lastRowKey: string;
|
|
62
64
|
}
|
|
63
65
|
export declare const getLockLogListForRuntime: (rt: LockDeviceRuntime, params: GetLockLogListParams) => Promise<GetLockLogListResult>;
|
|
66
|
+
export declare const getAlarmUnreadCountForRuntime: (rt: LockDeviceRuntime) => Promise<number>;
|
|
67
|
+
export declare const getActivePeriodForRuntime: (rt: LockDeviceRuntime) => Promise<number>;
|
package/lib/feature/log/log.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAlarmList, getAlbumMessages, getLatest2Log, getLockLogList, getRecordList, } from "../../api/log";
|
|
1
|
+
import { getAlarmList, getAlbumMessages, getLatest2Log, getLockLogList, getRecordList, getAlarmUnreadCountApi, getActivePeriodApi, } from "../../api/log";
|
|
2
2
|
import dpCodes from "../../config/dp-code";
|
|
3
3
|
import { getCurrentUserForRuntime } from "../user/current-user";
|
|
4
4
|
import base64ToHex from "../../utils/base64-to-hex";
|
|
@@ -6,6 +6,7 @@ import { LOGCHANGE } from "../../utils/constant";
|
|
|
6
6
|
import emitter from "../../utils/event";
|
|
7
7
|
import { handleLocalOperation } from "../../utils/log";
|
|
8
8
|
import { parseWeek } from "../../utils";
|
|
9
|
+
import { cameraPositionMap } from "../../utils/constant";
|
|
9
10
|
export function getLogsRefreshEvent(runtime) {
|
|
10
11
|
return `${LOGCHANGE}_${runtime.devId}`;
|
|
11
12
|
}
|
|
@@ -152,7 +153,20 @@ function handleLockLogs(list, cfg) {
|
|
|
152
153
|
userId: item.userId,
|
|
153
154
|
userName: userName || "",
|
|
154
155
|
unlockName: unlockName || "",
|
|
155
|
-
mediaInfo: item.mediaInfoList
|
|
156
|
+
mediaInfo: item.mediaInfoList?.map?.((item) => {
|
|
157
|
+
return {
|
|
158
|
+
mediaPath: item.mediaPath,
|
|
159
|
+
fileKey: item.fileKey,
|
|
160
|
+
fileUrl: item.fileUrl,
|
|
161
|
+
mediaBucket: item.mediaBucket,
|
|
162
|
+
mediaKey: item.mediaKey,
|
|
163
|
+
width: item.positionWidth,
|
|
164
|
+
height: item.positionHeight,
|
|
165
|
+
angle: item.positionAngle,
|
|
166
|
+
isVR: !!item.positionVr,
|
|
167
|
+
position: item.position,
|
|
168
|
+
};
|
|
169
|
+
}),
|
|
156
170
|
localRecord: handleLocalOperation(item.localOperateRecordInfo, itemData),
|
|
157
171
|
unionUnlockInfo: item.unionUnlockInfo?.map((item1) => {
|
|
158
172
|
return {
|
|
@@ -227,7 +241,7 @@ export const openDps = [
|
|
|
227
241
|
dpCodes.unlockApp,
|
|
228
242
|
dpCodes.unlockMatterKw,
|
|
229
243
|
];
|
|
230
|
-
const closeTypes = [
|
|
244
|
+
export const closeTypes = [
|
|
231
245
|
"UNDEFINED",
|
|
232
246
|
"APP_REMOTE",
|
|
233
247
|
"VOICE_REMOTE",
|
|
@@ -237,7 +251,7 @@ const closeTypes = [
|
|
|
237
251
|
"AUTO",
|
|
238
252
|
"LOCAL_MANUAL",
|
|
239
253
|
];
|
|
240
|
-
const dpIdsForUsernameToUnlockName = [89, 69, 55, 67, 3, 32];
|
|
254
|
+
export const dpIdsForUsernameToUnlockName = [89, 69, 55, 67, 3, 32];
|
|
241
255
|
export async function getLogsForRuntime(rt, params) {
|
|
242
256
|
const cfg = rt.config;
|
|
243
257
|
const { page = 1, pageSize = 50 } = params || {};
|
|
@@ -285,7 +299,20 @@ export async function getLogsForRuntime(rt, params) {
|
|
|
285
299
|
dpCode,
|
|
286
300
|
userName,
|
|
287
301
|
unlockName,
|
|
288
|
-
mediaInfo: record.mediaInfoList
|
|
302
|
+
mediaInfo: record.mediaInfoList?.map?.(item => {
|
|
303
|
+
return {
|
|
304
|
+
mediaPath: item.mediaPath,
|
|
305
|
+
fileKey: item.fileKey,
|
|
306
|
+
fileUrl: item.fileUrl,
|
|
307
|
+
mediaBucket: item.mediaBucket,
|
|
308
|
+
mediaKey: item.mediaKey,
|
|
309
|
+
width: item.positionWidth,
|
|
310
|
+
height: item.positionHeight,
|
|
311
|
+
angle: item.positionAngle,
|
|
312
|
+
isVR: !!item.positionVr,
|
|
313
|
+
position: item.position,
|
|
314
|
+
};
|
|
315
|
+
}),
|
|
289
316
|
unionUnlockInfo: record.unionUnlockInfo?.map((item) => ({
|
|
290
317
|
userId: item.userId,
|
|
291
318
|
userName: item.userName,
|
|
@@ -364,7 +391,20 @@ export async function getAlarmsForRuntime(rt, params) {
|
|
|
364
391
|
dpCode,
|
|
365
392
|
userName: record.userName,
|
|
366
393
|
unlockName: record.unlockName,
|
|
367
|
-
mediaInfo: record.mediaInfoList
|
|
394
|
+
mediaInfo: record.mediaInfoList?.map?.(item => {
|
|
395
|
+
return {
|
|
396
|
+
mediaPath: item.mediaPath,
|
|
397
|
+
fileKey: item.fileKey,
|
|
398
|
+
fileUrl: item.fileUrl,
|
|
399
|
+
mediaBucket: item.mediaBucket,
|
|
400
|
+
mediaKey: item.mediaKey,
|
|
401
|
+
width: item.positionWidth,
|
|
402
|
+
height: item.positionHeight,
|
|
403
|
+
angle: item.positionAngle,
|
|
404
|
+
isVR: !!item.positionVr,
|
|
405
|
+
position: item.position,
|
|
406
|
+
};
|
|
407
|
+
}),
|
|
368
408
|
time: record.gmtCreate,
|
|
369
409
|
currentUser: +record.userId === +currentUser.userId,
|
|
370
410
|
bindable: false,
|
|
@@ -418,6 +458,11 @@ export async function getAlbumsForRuntime(rt, params) {
|
|
|
418
458
|
})),
|
|
419
459
|
type: item.eventType,
|
|
420
460
|
createTime: item.uploadMilTime,
|
|
461
|
+
width: item.width,
|
|
462
|
+
height: item.height,
|
|
463
|
+
angle: item.angle,
|
|
464
|
+
position: cameraPositionMap[item.position],
|
|
465
|
+
isVR: !!item.vr,
|
|
421
466
|
})),
|
|
422
467
|
allAitypes: data.allAitypes,
|
|
423
468
|
types: data.eventTypes,
|
|
@@ -436,3 +481,5 @@ export const getLockLogListForRuntime = async (rt, params) => {
|
|
|
436
481
|
lastRowKey: data?.lastRowKey ?? "",
|
|
437
482
|
};
|
|
438
483
|
};
|
|
484
|
+
export const getAlarmUnreadCountForRuntime = (rt) => getAlarmUnreadCountApi(rt.config.devInfo.devId);
|
|
485
|
+
export const getActivePeriodForRuntime = (rt) => getActivePeriodApi(rt.config.devInfo.devId);
|
|
@@ -26,10 +26,10 @@ export const isSupportBleControlForRuntime = (rt) => {
|
|
|
26
26
|
const bleControlDp = rt.config.idsByCode[dpCodes.bleControl];
|
|
27
27
|
if (bleControlDp) {
|
|
28
28
|
const reportTIme = devInfo?.dpsTime?.[bleControlDp];
|
|
29
|
-
const
|
|
29
|
+
const noReportTime = !reportTIme ||
|
|
30
30
|
Math.floor(Number(reportTIme) / 1000) <= devInfo.activeTime;
|
|
31
31
|
const bleVal = rt.cache.dpState[dpCodes.bleControl];
|
|
32
|
-
if (!bleVal
|
|
32
|
+
if (!bleVal && noReportTime) {
|
|
33
33
|
return true;
|
|
34
34
|
}
|
|
35
35
|
return bleVal;
|
|
@@ -5,4 +5,6 @@ export declare const hasCapabilityForRuntime: (runtime: LockDeviceRuntime, capab
|
|
|
5
5
|
export declare const isBlePureDeviceForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
6
6
|
export declare const isShareTheadForRuntime: (rt: LockDeviceRuntime) => boolean;
|
|
7
7
|
export declare const isActiveThreadForRuntime: (rt: LockDeviceRuntime) => Promise<boolean>;
|
|
8
|
+
export declare const getDeviceAdvancedAbilitiesSyncForRuntime: (rt: LockDeviceRuntime) => DeviceAdvancedAbility | undefined;
|
|
8
9
|
export declare const getDeviceAdvancedAbilitiesForRuntime: (rt: LockDeviceRuntime) => Promise<DeviceAdvancedAbility>;
|
|
10
|
+
export declare const getDeviceCapabilitiesForRuntime: (rt: LockDeviceRuntime) => import("../../interface").CapabilityInfo | null;
|