@ray-js/lock-sdk 1.2.0-beta.3 → 1.2.0-beta.30

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.
Files changed (269) hide show
  1. package/lib/api/fit.d.ts +55 -2
  2. package/lib/api/fit.js +43 -1
  3. package/lib/api/gesture.d.ts +11 -0
  4. package/lib/api/gesture.js +18 -0
  5. package/lib/api/log.d.ts +52 -4
  6. package/lib/api/log.js +22 -0
  7. package/lib/api/notify.d.ts +28 -0
  8. package/lib/api/notify.js +17 -0
  9. package/lib/api/service.d.ts +26 -0
  10. package/lib/api/service.js +25 -0
  11. package/lib/api/temp.d.ts +21 -0
  12. package/lib/api/temp.js +24 -0
  13. package/lib/api/video.d.ts +9 -0
  14. package/lib/api/video.js +30 -0
  15. package/lib/api/voip.d.ts +10 -0
  16. package/lib/api/voip.js +17 -0
  17. package/lib/config/dp-code/index.d.ts +2 -1
  18. package/lib/config/dp-code/index.js +2 -0
  19. package/lib/config/dp-map/media.d.ts +13 -0
  20. package/lib/config/dp-map/media.js +19 -0
  21. package/lib/entries/main/bootstrap/bootstrap-lock-instance.d.ts +2 -1
  22. package/lib/entries/main/bootstrap/bootstrap-lock-instance.js +23 -8
  23. package/lib/entries/main/bootstrap/bootstrap.d.ts +3 -2
  24. package/lib/entries/main/bootstrap/bootstrap.js +10 -6
  25. package/lib/entries/main/bootstrap/primary-instance.d.ts +1 -2
  26. package/lib/entries/main/bootstrap/primary-instance.js +1 -1
  27. package/lib/entries/main/bootstrap/resolve-runtime-from-export-this.js +1 -1
  28. package/lib/entries/main/build-instance.d.ts +6 -3
  29. package/lib/entries/main/build-instance.js +13 -1
  30. package/lib/entries/main/exports/capability.d.ts +2 -0
  31. package/lib/entries/main/exports/capability.js +7 -1
  32. package/lib/entries/main/exports/fit-sdk/binding.d.ts +10 -0
  33. package/lib/entries/{fit/exports → main/exports/fit-sdk}/binding.js +6 -3
  34. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.d.ts +11 -10
  35. package/lib/entries/{fit/exports → main/exports/fit-sdk}/device.js +20 -20
  36. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.d.ts +1 -0
  37. package/lib/entries/{fit/exports → main/exports/fit-sdk}/index.js +1 -0
  38. package/lib/entries/main/exports/fit-sdk/log.d.ts +3 -0
  39. package/lib/entries/main/exports/fit-sdk/log.js +5 -0
  40. package/lib/entries/main/exports/fit-sdk/temp.d.ts +40 -0
  41. package/lib/entries/main/exports/fit-sdk/temp.js +59 -0
  42. package/lib/entries/main/exports/gesture.d.ts +6 -0
  43. package/lib/entries/main/exports/gesture.js +8 -0
  44. package/lib/entries/main/exports/index.d.ts +8 -0
  45. package/lib/entries/main/exports/index.js +8 -0
  46. package/lib/entries/main/exports/log.d.ts +2 -0
  47. package/lib/entries/main/exports/log.js +7 -1
  48. package/lib/entries/main/exports/media.d.ts +10 -1
  49. package/lib/entries/main/exports/media.js +29 -1
  50. package/lib/entries/main/exports/misc.d.ts +4 -2
  51. package/lib/entries/main/exports/misc.js +2 -2
  52. package/lib/entries/main/exports/notify.d.ts +7 -0
  53. package/lib/entries/main/exports/notify.js +8 -0
  54. package/lib/entries/main/exports/service.d.ts +4 -0
  55. package/lib/entries/main/exports/service.js +11 -0
  56. package/lib/entries/main/exports/voip.d.ts +3 -0
  57. package/lib/entries/main/exports/voip.js +8 -0
  58. package/lib/entries/main/index.d.ts +3 -3
  59. package/lib/entries/main/index.js +11 -5
  60. package/lib/feature/fit/bind-lock-to-fit.d.ts +1 -0
  61. package/lib/feature/fit/bind-lock-to-fit.js +53 -0
  62. package/lib/feature/fit/ble-key.d.ts +10 -4
  63. package/lib/feature/fit/ble-key.js +145 -4
  64. package/lib/feature/fit/device-bv.d.ts +2 -0
  65. package/lib/feature/fit/device-bv.js +15 -0
  66. package/lib/feature/fit/invalid-password.d.ts +10 -0
  67. package/lib/feature/fit/invalid-password.js +43 -0
  68. package/lib/feature/fit/list.d.ts +12 -2
  69. package/lib/feature/fit/list.js +54 -5
  70. package/lib/feature/fit/log.d.ts +7 -0
  71. package/lib/feature/fit/log.js +123 -0
  72. package/lib/feature/fit/method/add-flow.js +2 -2
  73. package/lib/feature/fit/method/add-password.js +2 -2
  74. package/lib/feature/fit/method/update-remove.js +40 -14
  75. package/lib/feature/fit/password-list.d.ts +37 -0
  76. package/lib/feature/fit/password-list.js +44 -1
  77. package/lib/feature/fit/security-channel.d.ts +3 -0
  78. package/lib/feature/fit/security-channel.js +43 -0
  79. package/lib/feature/fit/shared.d.ts +8 -0
  80. package/lib/feature/fit/shared.js +40 -1
  81. package/lib/feature/fit/sync.d.ts +4 -2
  82. package/lib/feature/fit/sync.js +63 -22
  83. package/lib/feature/fit/temp-password.d.ts +23 -0
  84. package/lib/feature/fit/temp-password.js +95 -3
  85. package/lib/feature/fit/users.d.ts +1 -0
  86. package/lib/feature/fit/users.js +1 -0
  87. package/lib/feature/gesture/gesture.d.ts +6 -0
  88. package/lib/feature/gesture/gesture.js +3 -0
  89. package/lib/feature/log/log.d.ts +5 -1
  90. package/lib/feature/log/log.js +53 -6
  91. package/lib/feature/media/camera.d.ts +18 -0
  92. package/lib/feature/media/camera.js +36 -0
  93. package/lib/feature/media/media.d.ts +10 -0
  94. package/lib/feature/media/media.js +31 -0
  95. package/lib/feature/misc/ble-control.js +2 -2
  96. package/lib/feature/misc/capability.d.ts +2 -0
  97. package/lib/feature/misc/capability.js +84 -11
  98. package/lib/feature/misc/connect-device.d.ts +1 -1
  99. package/lib/feature/misc/connect-device.js +7 -6
  100. package/lib/feature/misc/is-use-near-channel-for-runtime.js +8 -1
  101. package/lib/feature/notify/notify.d.ts +4 -0
  102. package/lib/feature/notify/notify.js +3 -0
  103. package/lib/feature/password/temporary/custom-dp.js +59 -54
  104. package/lib/feature/password/temporary/offline-create.d.ts +14 -0
  105. package/lib/feature/password/temporary/offline-create.js +77 -1
  106. package/lib/feature/service/goto-service.d.ts +3 -2
  107. package/lib/feature/service/goto-service.js +7 -1
  108. package/lib/feature/service/value-added.d.ts +4 -0
  109. package/lib/feature/service/value-added.js +4 -0
  110. package/lib/feature/state/clear.js +1 -0
  111. package/lib/feature/state/device-status.js +17 -6
  112. package/lib/feature/state/init-state.js +20 -12
  113. package/lib/feature/state/platform-routing.js +12 -3
  114. package/lib/feature/state/remote-permissions.js +17 -0
  115. package/lib/feature/state/sync/remote-serect-key.js +7 -0
  116. package/lib/feature/storage/index.d.ts +5 -0
  117. package/lib/feature/storage/index.js +32 -0
  118. package/lib/feature/storage/swr-cache.d.ts +7 -0
  119. package/lib/feature/storage/swr-cache.js +54 -0
  120. package/lib/feature/unlock/method/add-flow.js +2 -2
  121. package/lib/feature/unlock/method/add-password.js +2 -2
  122. package/lib/feature/unlock/sync/unlock-method.js +3 -0
  123. package/lib/feature/user/sync-user.js +4 -2
  124. package/lib/feature/utils/index.d.ts +1 -0
  125. package/lib/feature/utils/index.js +1 -0
  126. package/lib/feature/voip/voip.d.ts +3 -0
  127. package/lib/feature/voip/voip.js +3 -0
  128. package/lib/interface.d.ts +42 -1
  129. package/lib/platform/device.d.ts +4 -3
  130. package/lib/platform/index.d.ts +1 -0
  131. package/lib/platform/index.js +1 -0
  132. package/lib/platform/ipc.d.ts +3 -0
  133. package/lib/platform/ipc.js +13 -0
  134. package/lib/platform/storage.d.ts +3 -0
  135. package/lib/platform/storage.js +9 -0
  136. package/lib/runtime/LockDeviceRuntime.js +3 -0
  137. package/lib/runtime/lock-config.d.ts +5 -1
  138. package/lib/runtime/lock-config.js +6 -0
  139. package/lib/runtime/runtime-state-types.d.ts +6 -0
  140. package/lib/utils/constant.d.ts +1 -0
  141. package/lib/utils/constant.js +6 -0
  142. package/lib/utils/errors.js +3 -1
  143. package/lib/utils/index.d.ts +2 -1
  144. package/lib/utils/index.js +1 -0
  145. package/lib/utils/parse.js +1 -1
  146. package/package.json +1 -11
  147. package/lib/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  148. package/lib/bootstrap/bootstrap-lock-instance.js +0 -16
  149. package/lib/bootstrap/bootstrap.d.ts +0 -4
  150. package/lib/bootstrap/bootstrap.js +0 -53
  151. package/lib/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  152. package/lib/bootstrap/lock-instance-runtime-ref.js +0 -7
  153. package/lib/bootstrap/primary-instance.d.ts +0 -6
  154. package/lib/bootstrap/primary-instance.js +0 -24
  155. package/lib/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  156. package/lib/bootstrap/resolve-runtime-from-export-this.js +0 -29
  157. package/lib/bootstrap/top-level-runtime.d.ts +0 -2
  158. package/lib/bootstrap/top-level-runtime.js +0 -9
  159. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  160. package/lib/entries/ble/bootstrap/bootstrap-lock-instance.js +0 -12
  161. package/lib/entries/ble/bootstrap/bootstrap.d.ts +0 -4
  162. package/lib/entries/ble/bootstrap/bootstrap.js +0 -53
  163. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  164. package/lib/entries/ble/bootstrap/lock-instance-runtime-ref.js +0 -7
  165. package/lib/entries/ble/bootstrap/primary-instance.d.ts +0 -6
  166. package/lib/entries/ble/bootstrap/primary-instance.js +0 -24
  167. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  168. package/lib/entries/ble/bootstrap/resolve-runtime-from-export-this.js +0 -29
  169. package/lib/entries/ble/bootstrap/top-level-runtime.d.ts +0 -2
  170. package/lib/entries/ble/bootstrap/top-level-runtime.js +0 -9
  171. package/lib/entries/ble/build-instance.d.ts +0 -9
  172. package/lib/entries/ble/build-instance.js +0 -50
  173. package/lib/entries/ble/exports/capability.d.ts +0 -6
  174. package/lib/entries/ble/exports/capability.js +0 -17
  175. package/lib/entries/ble/exports/config.d.ts +0 -3
  176. package/lib/entries/ble/exports/config.js +0 -5
  177. package/lib/entries/ble/exports/dp.d.ts +0 -9
  178. package/lib/entries/ble/exports/dp.js +0 -13
  179. package/lib/entries/ble/exports/index.d.ts +0 -16
  180. package/lib/entries/ble/exports/index.js +0 -16
  181. package/lib/entries/ble/exports/linkage.d.ts +0 -5
  182. package/lib/entries/ble/exports/linkage.js +0 -15
  183. package/lib/entries/ble/exports/log.d.ts +0 -9
  184. package/lib/entries/ble/exports/log.js +0 -21
  185. package/lib/entries/ble/exports/media.d.ts +0 -4
  186. package/lib/entries/ble/exports/media.js +0 -12
  187. package/lib/entries/ble/exports/misc.d.ts +0 -19
  188. package/lib/entries/ble/exports/misc.js +0 -30
  189. package/lib/entries/ble/exports/offline-dps.d.ts +0 -8
  190. package/lib/entries/ble/exports/offline-dps.js +0 -24
  191. package/lib/entries/ble/exports/open/do-open-close-action.d.ts +0 -2
  192. package/lib/entries/ble/exports/open/do-open-close-action.js +0 -36
  193. package/lib/entries/ble/exports/open/index.d.ts +0 -18
  194. package/lib/entries/ble/exports/open/index.js +0 -45
  195. package/lib/entries/ble/exports/signal.d.ts +0 -6
  196. package/lib/entries/ble/exports/signal.js +0 -14
  197. package/lib/entries/ble/exports/sleep.d.ts +0 -13
  198. package/lib/entries/ble/exports/sleep.js +0 -31
  199. package/lib/entries/ble/exports/state.d.ts +0 -6
  200. package/lib/entries/ble/exports/state.js +0 -19
  201. package/lib/entries/ble/exports/temporary.d.ts +0 -31
  202. package/lib/entries/ble/exports/temporary.js +0 -91
  203. package/lib/entries/ble/exports/unlock/sync.d.ts +0 -1
  204. package/lib/entries/ble/exports/unlock/sync.js +0 -5
  205. package/lib/entries/ble/exports/unlock-method.d.ts +0 -19
  206. package/lib/entries/ble/exports/unlock-method.js +0 -58
  207. package/lib/entries/ble/exports/user/index.d.ts +0 -23
  208. package/lib/entries/ble/exports/user/index.js +0 -22
  209. package/lib/entries/ble/exports/user/sync.d.ts +0 -1
  210. package/lib/entries/ble/exports/user/sync.js +0 -5
  211. package/lib/entries/ble/index.d.ts +0 -8
  212. package/lib/entries/ble/index.js +0 -39
  213. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  214. package/lib/entries/fit/bootstrap/bootstrap-lock-instance.js +0 -12
  215. package/lib/entries/fit/bootstrap/bootstrap.d.ts +0 -4
  216. package/lib/entries/fit/bootstrap/bootstrap.js +0 -69
  217. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  218. package/lib/entries/fit/bootstrap/lock-instance-runtime-ref.js +0 -7
  219. package/lib/entries/fit/bootstrap/primary-instance.d.ts +0 -6
  220. package/lib/entries/fit/bootstrap/primary-instance.js +0 -24
  221. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  222. package/lib/entries/fit/bootstrap/resolve-runtime-from-export-this.js +0 -29
  223. package/lib/entries/fit/bootstrap/top-level-runtime.d.ts +0 -2
  224. package/lib/entries/fit/bootstrap/top-level-runtime.js +0 -9
  225. package/lib/entries/fit/build-instance.d.ts +0 -9
  226. package/lib/entries/fit/build-instance.js +0 -57
  227. package/lib/entries/fit/exports/binding.d.ts +0 -8
  228. package/lib/entries/fit/exports/temp.d.ts +0 -19
  229. package/lib/entries/fit/exports/temp.js +0 -18
  230. package/lib/entries/fit/index.d.ts +0 -8
  231. package/lib/entries/fit/index.js +0 -36
  232. package/lib/entries/main/exports/open.d.ts +0 -16
  233. package/lib/entries/main/exports/open.js +0 -44
  234. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.d.ts +0 -7
  235. package/lib/entries/screen/bootstrap/bootstrap-lock-instance.js +0 -12
  236. package/lib/entries/screen/bootstrap/bootstrap.d.ts +0 -4
  237. package/lib/entries/screen/bootstrap/bootstrap.js +0 -69
  238. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.d.ts +0 -3
  239. package/lib/entries/screen/bootstrap/lock-instance-runtime-ref.js +0 -7
  240. package/lib/entries/screen/bootstrap/primary-instance.d.ts +0 -6
  241. package/lib/entries/screen/bootstrap/primary-instance.js +0 -24
  242. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.d.ts +0 -5
  243. package/lib/entries/screen/bootstrap/resolve-runtime-from-export-this.js +0 -29
  244. package/lib/entries/screen/bootstrap/top-level-runtime.d.ts +0 -2
  245. package/lib/entries/screen/bootstrap/top-level-runtime.js +0 -9
  246. package/lib/entries/screen/build-instance.d.ts +0 -9
  247. package/lib/entries/screen/build-instance.js +0 -57
  248. package/lib/entries/screen/exports/bind-events.d.ts +0 -4
  249. package/lib/entries/screen/exports/bind-events.js +0 -8
  250. package/lib/entries/screen/exports/binding.d.ts +0 -6
  251. package/lib/entries/screen/exports/binding.js +0 -15
  252. package/lib/entries/screen/exports/device.d.ts +0 -16
  253. package/lib/entries/screen/exports/device.js +0 -41
  254. package/lib/entries/screen/exports/event.d.ts +0 -3
  255. package/lib/entries/screen/exports/event.js +0 -5
  256. package/lib/entries/screen/exports/index.d.ts +0 -5
  257. package/lib/entries/screen/exports/index.js +0 -5
  258. package/lib/entries/screen/exports/user.d.ts +0 -2
  259. package/lib/entries/screen/exports/user.js +0 -8
  260. package/lib/entries/screen/index.d.ts +0 -8
  261. package/lib/entries/screen/index.js +0 -36
  262. package/lib/feature/unlock/door/door-action.d.ts +0 -2
  263. package/lib/feature/unlock/door/door-action.js +0 -32
  264. package/lib/fit.d.ts +0 -4
  265. package/lib/fit.js +0 -3
  266. package/lib/runtime/device-status/compute-device-status.d.ts +0 -25
  267. package/lib/runtime/device-status/compute-device-status.js +0 -94
  268. package/lib/screen.d.ts +0 -4
  269. package/lib/screen.js +0 -3
@@ -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.pwdId);
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
+ };
@@ -7,6 +7,7 @@ export interface FitUserItem {
7
7
  nickName: string;
8
8
  userType: UserType;
9
9
  userContact: string;
10
+ userTimeSet: string;
10
11
  phase: number;
11
12
  }
12
13
  export declare function getFitUsersForRuntime(runtime: LockDeviceRuntime): Promise<FitUserItem[]>;
@@ -7,6 +7,7 @@ const pickFitUserItem = (raw) => ({
7
7
  nickName: raw.nickName,
8
8
  userType: raw.userType,
9
9
  userContact: raw.userContact,
10
+ userTimeSet: raw.userTimeSet,
10
11
  phase: raw.phase,
11
12
  });
12
13
  export async function getFitUsersForRuntime(runtime) {
@@ -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 });
@@ -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>;
@@ -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);
@@ -0,0 +1,18 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import type { CameraConfig, DpMapDataType } from "../../interface";
3
+ import { locationSelectReportMap } from "../../config/dp-map/media";
4
+ export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
5
+ export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
6
+ interface CameraItem {
7
+ index: number;
8
+ type: number;
9
+ }
10
+ export interface CameraDpInfo {
11
+ status: number;
12
+ list: CameraItem[];
13
+ }
14
+ export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraDpInfo | undefined;
15
+ export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraInfo | undefined>;
16
+ export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
17
+ export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
18
+ export {};
@@ -0,0 +1,36 @@
1
+ import dpUtils from "@ray-js/tuya-dp-transform";
2
+ import dpCodes from "../../config/dp-code";
3
+ import { locationSelectReportMap } from "../../config/dp-map/media";
4
+ import { getDpValueForRuntime } from "../dp/get-dp-value";
5
+ import { hasDpForRuntime } from "../dp/has-dp";
6
+ import { publishDpsForRuntime } from "../dp/publish-dps";
7
+ import { getError } from "../../utils/errors";
8
+ export const isSupportMultiCameraForRuntime = (runtime) => hasDpForRuntime(runtime, dpCodes.locationSelect);
9
+ export const getCameraInfoForRuntime = (runtime) => {
10
+ const raw = getDpValueForRuntime(runtime, dpCodes.locationSelect);
11
+ if (!raw) {
12
+ return undefined;
13
+ }
14
+ return dpUtils.parse(raw, locationSelectReportMap);
15
+ };
16
+ export const queryCameraInfoForRuntime = async (runtime) => {
17
+ await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: "ff" });
18
+ return getCameraInfoForRuntime(runtime);
19
+ };
20
+ export const switchCameraForRuntime = async (runtime, index) => {
21
+ const value = index.toString(16).padStart(2, "0");
22
+ await publishDpsForRuntime(runtime, { [dpCodes.locationSelect]: value });
23
+ const info = getCameraInfoForRuntime(runtime);
24
+ switch (info?.status) {
25
+ case 0:
26
+ return true;
27
+ case 2:
28
+ throw getError(1105);
29
+ case 1:
30
+ default:
31
+ throw getError(1104);
32
+ }
33
+ };
34
+ export const getCameraConfigForRuntime = (runtime) => {
35
+ return runtime.config.cameraConfig;
36
+ };
@@ -1,4 +1,5 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ import { MediaViewTimesResult, getAlbumDateListResult } from "../../api/video";
2
3
  export interface GetMediaUrlParams {
3
4
  mediaPath: string;
4
5
  mediaBucket: string;
@@ -19,6 +20,12 @@ export interface OpenLocalAlbumParams {
19
20
  serviceCode?: string;
20
21
  }
21
22
  export declare const openLocalAlbumForRuntime: (runtime: LockDeviceRuntime, params?: OpenLocalAlbumParams) => Promise<void>;
23
+ export interface GotoPlaybackParams {
24
+ tabs?: ("local" | "cloud")[];
25
+ isLowPower?: boolean;
26
+ rotate?: number;
27
+ }
28
+ export declare const gotoPlaybackForRuntime: (runtime: LockDeviceRuntime, params?: GotoPlaybackParams) => Promise<void>;
22
29
  export interface MediaInfo {
23
30
  imageAngle: number;
24
31
  videoAngle: number;
@@ -29,3 +36,6 @@ export interface MediaInfo {
29
36
  isTwoWayTalk: boolean;
30
37
  }
31
38
  export declare const getMediaInfoForRuntime: (runtime: LockDeviceRuntime) => MediaInfo;
39
+ export declare const getMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
40
+ export declare const setMediaViewTimesForRuntime: (runtime: LockDeviceRuntime) => Promise<MediaViewTimesResult>;
41
+ export declare const getAlbumDateListForRuntime: (runtime: LockDeviceRuntime) => Promise<getAlbumDateListResult>;
@@ -4,6 +4,7 @@ import dpCodes from "../../config/dp-code";
4
4
  import { RotateType, VedioType } from "../../constant";
5
5
  import { isSupportShortLink } from "../../platform";
6
6
  import { getError } from "../../utils/errors";
7
+ import { getMediaViewTimes, setMediaViewTimes, getAlbumDateList, } from "../../api/video";
7
8
  export const getMediaUrlForRuntime = async (runtime, params) => {
8
9
  const devId = runtime.config.devInfo.devId;
9
10
  if ("mediaPath" in params && "mediaBucket" in params) {
@@ -52,6 +53,27 @@ export const openLocalAlbumForRuntime = async (runtime, params) => {
52
53
  }
53
54
  return Promise.reject(getError(1013));
54
55
  };
56
+ export const gotoPlaybackForRuntime = async (runtime, params) => {
57
+ const link = await isSupportShortLink("camera_playbacks_panel");
58
+ if (!link) {
59
+ return Promise.reject(getError(1013));
60
+ }
61
+ const tabs = params?.tabs && params.tabs.length ? params.tabs : ["local"];
62
+ let url = `tuyaSmart://${link}?extra_camera_uuid=${runtime.devId}&devId=${runtime.devId}&bizType=doorLock&defaultShowTabs=true&theme=1&tabs=${JSON.stringify(tabs)}`;
63
+ if (params?.isLowPower) {
64
+ url += `&isLowPowerDevice=true`;
65
+ }
66
+ if (params?.rotate !== undefined) {
67
+ url += `&rotate=${params.rotate}`;
68
+ }
69
+ return new Promise((resolve, reject) => {
70
+ ty.router({
71
+ url,
72
+ success: () => resolve(),
73
+ fail: (e) => reject(e),
74
+ });
75
+ });
76
+ };
55
77
  export const getMediaInfoForRuntime = (runtime) => {
56
78
  const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
57
79
  return {
@@ -64,3 +86,12 @@ export const getMediaInfoForRuntime = (runtime) => {
64
86
  isTwoWayTalk: runtime.config.isTwoWayTalk,
65
87
  };
66
88
  };
89
+ export const getMediaViewTimesForRuntime = (runtime) => {
90
+ return getMediaViewTimes(runtime.config.devInfo.devId);
91
+ };
92
+ export const setMediaViewTimesForRuntime = (runtime) => {
93
+ return setMediaViewTimes(runtime.config.devInfo.devId);
94
+ };
95
+ export const getAlbumDateListForRuntime = (runtime) => {
96
+ return getAlbumDateList(runtime.config.devInfo.devId);
97
+ };
@@ -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 hasReportTime = !reportTIme ||
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 || !hasReportTime) {
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;
@@ -1,6 +1,8 @@
1
1
  import { getDeviceAdvancedAbility, getProductAbilities } from "../../api";
2
- import { ProductCommunicationType } from "../../constant";
2
+ import { CommunicationType, ProductCommunicationType } from "../../constant";
3
3
  import { checkShowMatterMutilpleShare } from "../../platform/device";
4
+ import { ipc } from "../../platform";
5
+ import { getWithLocalCache } from "../storage/swr-cache";
4
6
  export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
5
7
  export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
6
8
  rt.config.communication.length === 1;
@@ -15,11 +17,17 @@ export const isActiveThreadForRuntime = async (rt) => {
15
17
  if (hasThread) {
16
18
  if (rt.deviceStatus.onlineTypes.includes("cloud") ||
17
19
  rt.config.communication.length === 1) {
20
+ rt.cache.isActiveThreadCache = true;
18
21
  return true;
19
22
  }
20
23
  const hasBle = hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH);
24
+ if (rt.config.capabilities?.communicationType === CommunicationType.THREAD) {
25
+ rt.cache.isActiveThreadCache = true;
26
+ return true;
27
+ }
21
28
  if (hasBle) {
22
29
  if (rt.cache.isActiveThreadCache) {
30
+ rt.cache.isActiveThreadCache = true;
23
31
  return true;
24
32
  }
25
33
  try {
@@ -34,23 +42,55 @@ export const isActiveThreadForRuntime = async (rt) => {
34
42
  }
35
43
  return false;
36
44
  };
45
+ const allModes = [
46
+ {
47
+ mode: "VR",
48
+ value: 1,
49
+ },
50
+ {
51
+ mode: "original",
52
+ value: 0,
53
+ },
54
+ {
55
+ mode: "vertical",
56
+ value: 3,
57
+ },
58
+ {
59
+ mode: "horizontal",
60
+ value: 2,
61
+ },
62
+ ];
63
+ export const getDeviceAdvancedAbilitiesSyncForRuntime = (rt) => {
64
+ return rt.cache.deviceAdvanceAbilityCache;
65
+ };
37
66
  export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
38
67
  if (rt.cache.deviceAdvanceAbilityCache) {
39
68
  return rt.cache.deviceAdvanceAbilityCache;
40
69
  }
41
- const [productAbilities, deviceAdvancedAbility] = await Promise.all([
42
- getProductAbilities(rt.config.devInfo.devId, [
70
+ const devId = rt.config.devInfo.devId;
71
+ const [productAbilitiesRes, deviceAdvancedAbilityRes, tttList] = await Promise.allSettled([
72
+ getWithLocalCache(rt, "productAbilities", () => getProductAbilities(devId, [
43
73
  "tyabi4ucx5",
44
74
  "tyabis9tpe",
45
75
  "tyabiwxrn9",
46
76
  "tyabipd4hh",
47
77
  "tyabin4u5v",
48
- ]),
49
- getDeviceAdvancedAbility(rt.config.devInfo.devId),
78
+ "visual_door_lock_cloud_store",
79
+ ])),
80
+ getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
81
+ ipc.getTTTAbilityKeyList("isSupportedVRMode"),
50
82
  ]);
83
+ const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
84
+ const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
51
85
  const deviceAdvanceAbilityCache = {
52
86
  cloudStorage: {
53
- support: deviceAdvancedAbility.types.includes(0),
87
+ support: false,
88
+ },
89
+ vr: {
90
+ support: false,
91
+ defaultMode: "VR",
92
+ modes: [],
93
+ coverMode: "VR",
54
94
  },
55
95
  ai: {
56
96
  support: false,
@@ -61,12 +101,12 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
61
101
  config: {},
62
102
  },
63
103
  voip: {
64
- support: deviceAdvancedAbility.types.includes(1),
104
+ support: false,
65
105
  config: {},
66
106
  },
67
107
  wechatVoip: {
68
108
  support: false,
69
- config: {},
109
+ isPublice: true,
70
110
  },
71
111
  unlockGuide: {
72
112
  support: false,
@@ -80,8 +120,11 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
80
120
  productAbilities.forEach((item) => {
81
121
  try {
82
122
  if (item.isOpen) {
83
- const data = JSON.parse(item.extConfig);
123
+ const data = item.extConfig ? JSON.parse(item.extConfig) : {};
84
124
  switch (item.abilityCode) {
125
+ case "visual_door_lock_cloud_store":
126
+ deviceAdvanceAbilityCache.cloudStorage.support = true;
127
+ break;
85
128
  case "tyabi4ucx5": {
86
129
  deviceAdvanceAbilityCache.ai.config = data;
87
130
  const dataReport = data?.ai_data_report ?? false;
@@ -95,6 +138,20 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
95
138
  petRecognition ||
96
139
  voice ||
97
140
  message;
141
+ deviceAdvanceAbilityCache.vr.support =
142
+ !!data?.lock_VR && tttAbList.length > 0;
143
+ if (deviceAdvanceAbilityCache.vr.support) {
144
+ deviceAdvanceAbilityCache.vr.modes = allModes.filter((item) => {
145
+ return data?.modes?.includes(item.mode);
146
+ });
147
+ deviceAdvanceAbilityCache.vr.defaultMode = data.default_mode;
148
+ const exist = deviceAdvanceAbilityCache.vr.modes.find((x) => x.mode === deviceAdvanceAbilityCache.vr.defaultMode);
149
+ if (!exist) {
150
+ deviceAdvanceAbilityCache.vr.defaultMode =
151
+ deviceAdvanceAbilityCache.vr.modes?.[0]?.mode;
152
+ }
153
+ deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
154
+ }
98
155
  break;
99
156
  }
100
157
  case "tyabis9tpe": {
@@ -103,9 +160,15 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
103
160
  break;
104
161
  }
105
162
  case "tyabiwxrn9": {
106
- deviceAdvanceAbilityCache.wechatVoip.support =
163
+ deviceAdvanceAbilityCache.wechatVoip.isPublice =
164
+ data?.WechatType === "0";
165
+ if (!deviceAdvanceAbilityCache.wechatVoip.isPublice) {
166
+ deviceAdvanceAbilityCache.wechatVoip.appId =
167
+ data["WechatMPAppid"];
168
+ deviceAdvanceAbilityCache.wechatVoip.modeId = data["WechatMPMid"];
169
+ }
170
+ deviceAdvanceAbilityCache.voip.support =
107
171
  !!data?.voipType?.includes("0");
108
- deviceAdvanceAbilityCache.wechatVoip.config = data;
109
172
  break;
110
173
  }
111
174
  case "tyabipd4hh": {
@@ -126,6 +189,16 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
126
189
  console.warn(`setting [${item.abilityCode}] config error`, error);
127
190
  }
128
191
  });
192
+ if (deviceAdvancedAbilityRes.status === "fulfilled") {
193
+ const res = deviceAdvancedAbilityRes.value;
194
+ deviceAdvanceAbilityCache.cloudStorage.support =
195
+ res.types?.includes(0) ?? false;
196
+ deviceAdvanceAbilityCache.wechatVoip.support =
197
+ res.types?.includes(1) ?? false;
198
+ }
129
199
  rt.cache.deviceAdvanceAbilityCache = deviceAdvanceAbilityCache;
130
200
  return deviceAdvanceAbilityCache;
131
201
  };
202
+ export const getDeviceCapabilitiesForRuntime = (rt) => {
203
+ return rt.config.capabilities;
204
+ };
@@ -1,2 +1,2 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
- export declare function connectDeviceForRuntime(rt: LockDeviceRuntime): Promise<true>;
2
+ export declare function connectDeviceForRuntime(rt: LockDeviceRuntime, timeout?: number): Promise<true>;