@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
@@ -72,7 +72,7 @@ const awakeDevice = async (devId, timeout) => {
72
72
  run();
73
73
  });
74
74
  };
75
- const connectBle = async (devId) => {
75
+ const connectBle = async (devId, timeout) => {
76
76
  const startedAt = Date.now();
77
77
  sdkLog("info", "connectDevice", "bleConnectStart", { devId });
78
78
  return new Promise((resolve, reject) => {
@@ -109,7 +109,7 @@ const connectBle = async (devId) => {
109
109
  error,
110
110
  });
111
111
  reject(error);
112
- }, 15000);
112
+ }, timeout ?? 15000);
113
113
  const clearTimer = () => {
114
114
  clearTimeout(timer);
115
115
  offBleChange(handleStatusChange);
@@ -143,7 +143,7 @@ const connectBle = async (devId) => {
143
143
  });
144
144
  });
145
145
  };
146
- export async function connectDeviceForRuntime(rt) {
146
+ export async function connectDeviceForRuntime(rt, timeout) {
147
147
  const cfg = rt.config;
148
148
  const devId = cfg.devInfo.devId;
149
149
  const deviceStatus = getDeviceStatusForRuntime(rt);
@@ -154,12 +154,13 @@ export async function connectDeviceForRuntime(rt) {
154
154
  data: {
155
155
  statusType: deviceStatus.type,
156
156
  onlineTypes: deviceStatus.onlineTypes,
157
+ connectEnable: deviceStatus.connectEnable,
157
158
  hasWirelessAwakeDp,
158
159
  },
159
160
  });
160
- if (hasWirelessAwakeDp) {
161
+ if (deviceStatus.connectEnable && hasWirelessAwakeDp) {
161
162
  if (cfg.devInfo.isCloudOnline && !getDpValueForRuntime(rt, wirelessAwake)) {
162
- const result = await awakeDevice(devId);
163
+ const result = await awakeDevice(devId, timeout);
163
164
  sdkLog("info", "connectDevice", "success", {
164
165
  devId,
165
166
  duration: Date.now() - startedAt,
@@ -178,7 +179,7 @@ export async function connectDeviceForRuntime(rt) {
178
179
  });
179
180
  return true;
180
181
  }
181
- await connectBle(devId);
182
+ await connectBle(devId, timeout);
182
183
  if (rt.cache.deviceAdvanceAbilityCache?.yuChannel.support) {
183
184
  if (rt.cache.deviceAdvanceAbilityCache?.yuChannel.value === 1) {
184
185
  yuChannelSyncSingleSync(devId);
@@ -1,17 +1,24 @@
1
+ import dpCodes from "../../config/dp-code";
1
2
  import { ProductCommunicationType } from "../../constant";
2
3
  import { isOnlineByType } from "../../utils";
4
+ import { hasDpForRuntime } from "../dp/has-dp";
3
5
  import { hasCapabilityForRuntime } from "./capability";
4
6
  export const isUseNearChannelForRuntime = (rt) => {
5
7
  const { onlineType, devInfo } = rt.config;
6
8
  const isBleOnline = isOnlineByType(onlineType, 2);
7
9
  const isSupportWifi = hasCapabilityForRuntime(rt, ProductCommunicationType.WIFI);
8
10
  const isSupportBle = hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH);
11
+ if (isSupportWifi &&
12
+ isSupportBle &&
13
+ !hasDpForRuntime(rt, dpCodes.unlockBle)) {
14
+ return false;
15
+ }
9
16
  const isSupportThread = hasCapabilityForRuntime(rt, ProductCommunicationType.THREAD);
10
17
  if (isSupportWifi && isSupportBle) {
11
18
  return isBleOnline;
12
19
  }
13
20
  if (isSupportThread && isSupportBle) {
14
- return isBleOnline && !devInfo.isCloudOnline && !devInfo.isLocalOnline;
21
+ return isBleOnline && !devInfo.isCloudOnline;
15
22
  }
16
23
  return isBleOnline;
17
24
  };
@@ -0,0 +1,4 @@
1
+ import { type UpdateVasNotifyConfigParams } from "../../api/notify";
2
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
3
+ export declare const getVasNotifyConfigForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/notify").VasNotifyConfig>;
4
+ export declare const updateVasNotifyConfigForRuntime: (rt: LockDeviceRuntime, params: UpdateVasNotifyConfigParams) => Promise<import("../../api/notify").VasNotifyConfig>;
@@ -0,0 +1,3 @@
1
+ import { getVasNotifyConfigApi, updateVasNotifyConfigApi, } from "../../api/notify";
2
+ export const getVasNotifyConfigForRuntime = (rt) => getVasNotifyConfigApi(rt.config.devInfo.devId);
3
+ export const updateVasNotifyConfigForRuntime = (rt, params) => updateVasNotifyConfigApi(rt.config.devInfo.devId, params);
@@ -52,67 +52,72 @@ export const createTempCustomForRuntime = parallelOnlyForRuntime(async function
52
52
  throw handleCloudError(error);
53
53
  }
54
54
  }
55
- await isValidPassword(baseData);
56
- const { tyNum, name: createdName } = await createTemporaryPassword({
57
- ...baseData,
58
- sn: 0,
59
- availTime: 0,
60
- symbolic: false,
61
- dpTunnel: 2,
62
- });
63
- if (!tyNum) {
64
- const error = getError(1043);
65
- sdkLog("warn", "tempPassword", "createCustomMissingCloudNo", {
55
+ try {
56
+ await isValidPassword(baseData);
57
+ const { tyNum, name: createdName } = await createTemporaryPassword({
58
+ ...baseData,
59
+ sn: 0,
60
+ availTime: 0,
61
+ symbolic: false,
62
+ dpTunnel: 2,
63
+ });
64
+ if (!tyNum) {
65
+ const error = getError(1043);
66
+ sdkLog("warn", "tempPassword", "createCustomMissingCloudNo", {
67
+ devId: rt.devId,
68
+ duration: Date.now() - startedAt,
69
+ error,
70
+ });
71
+ throw error;
72
+ }
73
+ const targetDpCode = cfg.supportBigData
74
+ ? dpCodes.tempPwdCreateW
75
+ : dpCodes.tempPwdCreate;
76
+ const dpPayload = dpUtils.format({
77
+ cloudNo: tyNum,
78
+ valid: true,
79
+ validConfig,
80
+ validNum: 0,
81
+ pwdLength: params.password.length,
82
+ pwd: params.password.split("").map(Number),
83
+ }, (cfg.supportBigData ? addTempPwdBigDpMap : addTempPwdDpMap));
84
+ const result = await publishDpsForRuntime(rt, {
85
+ [targetDpCode]: dpPayload,
86
+ }, {
87
+ checkReport: (dpsIn) => {
88
+ const dpDataRow = dpsIn;
89
+ const reportData = dpDataRow[targetDpCode];
90
+ if (reportData) {
91
+ const data = dpUtils.parse(dpDataRow[targetDpCode], (cfg.supportBigData
92
+ ? reportAddTempPwdDBigpMap
93
+ : reportAddTempPwdDpMap));
94
+ if (data.cloudNo === tyNum) {
95
+ return data;
96
+ }
97
+ }
98
+ return false;
99
+ },
100
+ });
101
+ if (result.status === 0) {
102
+ sdkLog("info", "tempPassword", "createCustomSuccess", {
103
+ devId: rt.devId,
104
+ duration: Date.now() - startedAt,
105
+ data: { route: "nearDp" },
106
+ });
107
+ return buildTempCustomCreateResult(createdName, params.password, result.unlockBindingId, effective);
108
+ }
109
+ const error = getError(result.status === 2 ? 1041 : 1042);
110
+ sdkLog("warn", "tempPassword", "createCustomDpFail", {
66
111
  devId: rt.devId,
67
112
  duration: Date.now() - startedAt,
113
+ data: { status: result.status },
68
114
  error,
69
115
  });
70
116
  throw error;
71
117
  }
72
- const targetDpCode = cfg.supportBigData
73
- ? dpCodes.tempPwdCreateW
74
- : dpCodes.tempPwdCreate;
75
- const dpPayload = dpUtils.format({
76
- cloudNo: tyNum,
77
- valid: true,
78
- validConfig,
79
- validNum: 0,
80
- pwdLength: params.password.length,
81
- pwd: params.password.split("").map(Number),
82
- }, (cfg.supportBigData ? addTempPwdBigDpMap : addTempPwdDpMap));
83
- const result = await publishDpsForRuntime(rt, {
84
- [targetDpCode]: dpPayload,
85
- }, {
86
- checkReport: (dpsIn) => {
87
- const dpDataRow = dpsIn;
88
- const reportData = dpDataRow[targetDpCode];
89
- if (reportData) {
90
- const data = dpUtils.parse(dpDataRow[targetDpCode], (cfg.supportBigData
91
- ? reportAddTempPwdDBigpMap
92
- : reportAddTempPwdDpMap));
93
- if (data.cloudNo === tyNum) {
94
- return data;
95
- }
96
- }
97
- return false;
98
- },
99
- });
100
- if (result.status === 0) {
101
- sdkLog("info", "tempPassword", "createCustomSuccess", {
102
- devId: rt.devId,
103
- duration: Date.now() - startedAt,
104
- data: { route: "nearDp" },
105
- });
106
- return buildTempCustomCreateResult(createdName, params.password, result.unlockBindingId, effective);
118
+ catch (er) {
119
+ throw handleCloudError(er);
107
120
  }
108
- const error = getError(result.status === 2 ? 1041 : 1042);
109
- sdkLog("warn", "tempPassword", "createCustomDpFail", {
110
- devId: rt.devId,
111
- duration: Date.now() - startedAt,
112
- data: { status: result.status },
113
- error,
114
- });
115
- throw error;
116
121
  });
117
122
  export async function removeTempCustomForRuntime(rt, params) {
118
123
  const cfg = rt.config;
@@ -1,7 +1,21 @@
1
+ import { type LimitOfflinePwdItem, type OfflinePwdAvailableResult } from "../../../api/temp";
1
2
  import type { TempPasswordResult } from "../../../interface";
2
3
  import type { LockDeviceRuntime } from "../../../runtime/LockDeviceRuntime";
3
4
  import type { CreateClearParams, CreateLimitParams, CreateOnceParams } from "./types";
4
5
  export declare function createTempLimitForRuntime(rt: LockDeviceRuntime, params: CreateLimitParams): Promise<TempPasswordResult>;
5
6
  export declare function createTempOnceForRuntime(rt: LockDeviceRuntime, params: CreateOnceParams): Promise<TempPasswordResult>;
7
+ export interface FitOfflineOnceResult {
8
+ password: string;
9
+ pwdId: string;
10
+ gmtExpired: number;
11
+ }
12
+ export declare function createFitOfflineOnceForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
13
+ export declare function createFitOfflineLimitForRuntime(rt: LockDeviceRuntime, params: {
14
+ effectiveTime: number;
15
+ invalidTime: number;
16
+ }): Promise<FitOfflineOnceResult>;
17
+ export declare function createFitOfflineClearAllForRuntime(rt: LockDeviceRuntime): Promise<FitOfflineOnceResult>;
18
+ export declare function getFitOfflineRevocableListForRuntime(rt: LockDeviceRuntime): Promise<LimitOfflinePwdItem[]>;
19
+ export declare function getFitOfflinePwdAvailableForRuntime(rt: LockDeviceRuntime, pwdType: string): Promise<OfflinePwdAvailableResult>;
6
20
  export declare function createTempDynamicForRuntime(rt: LockDeviceRuntime): Promise<TempPasswordResult>;
7
21
  export declare function createTempClearForRuntime(rt: LockDeviceRuntime, params: CreateClearParams): Promise<TempPasswordResult>;
@@ -1,4 +1,4 @@
1
- import { getDynamicPassword, revokeOfflinePassword, } from "../../../api/temp";
1
+ import { createOfflineOnceAPI, getDynamicPassword, getLimitOfflinePwdListForClear, getOfflinePwdAvailable, revokeOfflinePassword, } from "../../../api/temp";
2
2
  import { parseOfflinePasswordForRuntime } from "../../utils";
3
3
  import { getError, handleCloudError } from "../../../utils/errors";
4
4
  import { getOfflinePassword } from "./internal/password-helpers";
@@ -87,6 +87,82 @@ export async function createTempOnceForRuntime(rt, params) {
87
87
  },
88
88
  };
89
89
  }
90
+ async function createFitOfflinePwdForRuntime(rt, params) {
91
+ const startedAt = Date.now();
92
+ sdkLog("info", "tempPassword", "createFitOfflinePwdStart", {
93
+ devId: rt.devId,
94
+ data: { pwdType: params.pwdType },
95
+ });
96
+ try {
97
+ const res = await createOfflineOnceAPI({
98
+ devId: rt.devId,
99
+ ...params,
100
+ });
101
+ sdkLog("info", "tempPassword", "createFitOfflinePwdSuccess", {
102
+ devId: rt.devId,
103
+ duration: Date.now() - startedAt,
104
+ data: { pwdType: params.pwdType },
105
+ });
106
+ return {
107
+ password: parseOfflinePasswordForRuntime(rt, res.pwd),
108
+ pwdId: res.pwdId,
109
+ gmtExpired: res.gmtExpired,
110
+ };
111
+ }
112
+ catch (error) {
113
+ sdkLog("error", "tempPassword", "createFitOfflinePwdFail", {
114
+ devId: rt.devId,
115
+ duration: Date.now() - startedAt,
116
+ data: { pwdType: params.pwdType },
117
+ error,
118
+ });
119
+ throw handleCloudError(error);
120
+ }
121
+ }
122
+ export function createFitOfflineOnceForRuntime(rt) {
123
+ return createFitOfflinePwdForRuntime(rt, {
124
+ pwdType: "1",
125
+ gmtStart: "0",
126
+ gmtExpired: "0",
127
+ });
128
+ }
129
+ export function createFitOfflineLimitForRuntime(rt, params) {
130
+ const { effectiveTime, invalidTime } = params;
131
+ if (effectiveTime >= invalidTime) {
132
+ throw getError(1010);
133
+ }
134
+ return createFitOfflinePwdForRuntime(rt, {
135
+ pwdType: "0",
136
+ gmtStart: String(effectiveTime),
137
+ gmtExpired: String(invalidTime),
138
+ });
139
+ }
140
+ export function createFitOfflineClearAllForRuntime(rt) {
141
+ return createFitOfflinePwdForRuntime(rt, {
142
+ pwdType: "9",
143
+ gmtStart: "0",
144
+ gmtExpired: "0",
145
+ });
146
+ }
147
+ export async function getFitOfflineRevocableListForRuntime(rt) {
148
+ try {
149
+ return (await getLimitOfflinePwdListForClear({ devId: rt.devId })) || [];
150
+ }
151
+ catch (error) {
152
+ throw handleCloudError(error);
153
+ }
154
+ }
155
+ export async function getFitOfflinePwdAvailableForRuntime(rt, pwdType) {
156
+ try {
157
+ return await getOfflinePwdAvailable({
158
+ devId: rt.config.devInfo.devId,
159
+ pwdType,
160
+ });
161
+ }
162
+ catch (error) {
163
+ throw handleCloudError(error);
164
+ }
165
+ }
90
166
  export async function createTempDynamicForRuntime(rt) {
91
167
  const startedAt = Date.now();
92
168
  sdkLog("info", "tempPassword", "createDynamicStart", {
@@ -1,5 +1,6 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
2
  export interface GotoServiceParams {
3
- tab?: "cloudStorage" | "AI";
3
+ tab?: "cloudStorage" | "AI" | "voip";
4
+ showGift?: boolean;
4
5
  }
5
- export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<unknown>;
6
+ export declare function gotoServiceForRuntime(rt: LockDeviceRuntime, params?: GotoServiceParams): Promise<void>;
@@ -4,8 +4,14 @@ export function gotoServiceForRuntime(rt, params) {
4
4
  if (params?.tab === "AI") {
5
5
  type = 3;
6
6
  }
7
+ else if (params?.tab === "voip") {
8
+ type = 1;
9
+ }
7
10
  return new Promise((resolve, reject) => {
8
- const url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
11
+ let url = `godzilla://tyawqoyej4wi3pqebb?deviceId=${rt.config.devInfo.devId}&commodityType=${type}`;
12
+ if (params?.showGift) {
13
+ url += `&showGift=true`;
14
+ }
9
15
  navigateToMiniProgram({
10
16
  position: "bottom",
11
17
  shortLink: url,
@@ -0,0 +1,4 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const getCloudServiceStatusForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").CloudServiceStatus>;
3
+ export declare const getServicePopupListForRuntime: (rt: LockDeviceRuntime) => Promise<import("../../api/service").ServiceBenefitPopupItem[]>;
4
+ export declare const claimServiceForRuntime: (rt: LockDeviceRuntime, batchId: string) => Promise<import("../../api/service").ClaimResultItem[]>;
@@ -0,0 +1,4 @@
1
+ import { getCloudServiceStatusApi, getServicePopupListApi, claimServiceApi, } from "../../api/service";
2
+ export const getCloudServiceStatusForRuntime = (rt) => getCloudServiceStatusApi(rt.config.devInfo.devId);
3
+ export const getServicePopupListForRuntime = (rt) => getServicePopupListApi(rt.config.devInfo.devId);
4
+ export const claimServiceForRuntime = (rt, batchId) => claimServiceApi(rt.config.devInfo.devId, batchId);
@@ -8,6 +8,7 @@ export function clearStateForRuntime(runtime) {
8
8
  runtime.cache.currentUser = null;
9
9
  runtime.cache.offlineDpCache = undefined;
10
10
  runtime.cache.deviceAdvanceAbilityCache = undefined;
11
+ runtime.cache.fitDeviceBvCache = undefined;
11
12
  runtime.cache.isActiveThreadCache = false;
12
13
  runtime.sync.hasSyncedT0 = false;
13
14
  runtime.sync.syncDeleteUsersBusy = false;
@@ -1,4 +1,4 @@
1
- import { hasCapabilityForRuntime } from "../misc/capability";
1
+ import { hasCapabilityForRuntime, isActiveThreadForRuntime, } from "../misc/capability";
2
2
  import { hasDpForRuntime } from "../dp/has-dp";
3
3
  import dpCodes from "../../config/dp-code";
4
4
  import { ProductCommunicationType } from "../../constant";
@@ -13,9 +13,14 @@ import { getDpValueForRuntime } from "../dp/get-dp-value";
13
13
  import { readIsSleepForRuntime } from "./internal/read-is-sleep";
14
14
  import { isShareThreadRuntimeLocal } from "./internal/share-thread-local";
15
15
  export const updateOnlineType = async (runtime) => {
16
+ const hasThreadBle = hasCapabilityForRuntime(runtime, ProductCommunicationType.THREAD) &&
17
+ hasCapabilityForRuntime(runtime, ProductCommunicationType.BLUETOOTH);
16
18
  const [devInfo, onlineType] = await Promise.all([
17
19
  getDeviceInfo(runtime.config.devInfo.devId),
18
20
  getDeviceOnlineType(runtime.config.devInfo.devId),
21
+ hasThreadBle && runtime.cache.isActiveThreadCache !== true
22
+ ? isActiveThreadForRuntime(runtime)
23
+ : Promise.resolve(false),
19
24
  ]);
20
25
  runtime.config.onlineType = onlineType;
21
26
  runtime.config.devInfo = devInfo;
@@ -23,7 +28,7 @@ export const updateOnlineType = async (runtime) => {
23
28
  updateDeviceStatus(runtime);
24
29
  };
25
30
  export const getDeviceStatusForRuntime = (runtime) => {
26
- const { onlineType, devInfo: { isCloudOnline, isOnline, wifiEnableState, isMatter }, } = runtime.config;
31
+ const { onlineType, notSupportWake, devInfo: { isCloudOnline, isOnline, wifiEnableState, isMatter }, } = runtime.config;
27
32
  const supportWifi = hasCapabilityForRuntime(runtime, ProductCommunicationType.WIFI);
28
33
  const supportBle = hasCapabilityForRuntime(runtime, ProductCommunicationType.BLUETOOTH);
29
34
  const supportThread = hasCapabilityForRuntime(runtime, ProductCommunicationType.THREAD);
@@ -34,11 +39,18 @@ export const getDeviceStatusForRuntime = (runtime) => {
34
39
  onlineTypes: [],
35
40
  isWifiActive: wifiEnableState !== 1,
36
41
  isWifiMatter: !!isMatter && supportWifi,
42
+ isActiveThread: runtime.cache.isActiveThreadCache ?? false,
43
+ isShareThread: isShareThreadRuntimeLocal(runtime),
37
44
  };
38
45
  const isMatterLocal = isOnlineByType(onlineType, 8);
39
46
  const isBleOnline = isOnlineByType(onlineType, 2);
40
- const isLocalOnline = !isCloudOnline && isOnlineByType(onlineType, 1);
41
- const hasWirelessAwakeDp = hasDpForRuntime(runtime, dpCodes.wirelessAwake);
47
+ let isLocalOnline = !isCloudOnline && isOnlineByType(onlineType, 1);
48
+ if (isLocalOnline &&
49
+ runtime.cache.isActiveThreadCache !== true &&
50
+ supportThread) {
51
+ isLocalOnline = false;
52
+ }
53
+ const hasWirelessAwakeDp = !notSupportWake && hasDpForRuntime(runtime, dpCodes.wirelessAwake);
42
54
  const wirelessAwake = getDpValueForRuntime(runtime, dpCodes.wirelessAwake);
43
55
  status.connectEnable = isSupportBleControlForRuntime(runtime) && !isOnline;
44
56
  if (supportWifi) {
@@ -76,8 +88,7 @@ export const getDeviceStatusForRuntime = (runtime) => {
76
88
  }
77
89
  }
78
90
  if (supportThread && supportBle) {
79
- const isShareThread = isShareThreadRuntimeLocal(runtime);
80
- if (isShareThread && isOnline) {
91
+ if (status.isShareThread && isOnline) {
81
92
  if (!status.onlineTypes.includes("local")) {
82
93
  status.onlineTypes = ["local"];
83
94
  }
@@ -1,7 +1,8 @@
1
1
  import dpCodes from "../../config/dp-code";
2
2
  import { getDeviceSkill, getIPCConfig, getRotateInfo } from "../../api/video";
3
3
  import { getDataWithPreFetchForRuntime } from "../utils";
4
- import { getDeviceAdvancedAbilitiesForRuntime } from "../misc/capability";
4
+ import { getWithLocalCache } from "../storage/swr-cache";
5
+ import { getDeviceAdvancedAbilitiesForRuntime, hasCapabilityForRuntime, isActiveThreadForRuntime, } from "../misc/capability";
5
6
  import { getCurrentUserForRuntime } from "../user/current-user";
6
7
  import { checkOfflineDpUpdateForRuntime } from "../offline-dps";
7
8
  import { autoSyncTemp } from "../password/sync-temp";
@@ -13,9 +14,9 @@ import syncT0 from "./sync/t0";
13
14
  import { getDeviceStatusForRuntime, updateOnlineType } from "./device-status";
14
15
  import { handleDpChange } from "./dp-change";
15
16
  import { fetchDeviceProperties } from "./remote-permissions";
16
- import { ipc, yuChannelSyncSingleSync } from "../../platform";
17
+ import { ipc, yuChannelSyncSingleSync, } from "../../platform";
17
18
  import { sdkLog } from "../../utils/sdk-log";
18
- import { RotateType } from "../../constant";
19
+ import { ProductCommunicationType, RotateType } from "../../constant";
19
20
  import { isHarmony } from "../../utils";
20
21
  export const initState = async (runtime) => {
21
22
  const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
@@ -30,6 +31,7 @@ export const initState = async (runtime) => {
30
31
  try {
31
32
  handleDpChange(runtime, dps, true);
32
33
  const isSupportVideo = !!dpSchema[dpCodes.initiativeMessage];
34
+ const hasThread = hasCapabilityForRuntime(runtime, ProductCommunicationType.THREAD);
33
35
  runtime.deviceStatus = getDeviceStatusForRuntime(runtime);
34
36
  sdkLog("debug", "initState", "baseStateReady", {
35
37
  devId,
@@ -39,23 +41,29 @@ export const initState = async (runtime) => {
39
41
  isSupportVideo,
40
42
  },
41
43
  });
42
- const [, , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
44
+ const [, , , advanceAbilities, isActiveThread, rotateInfo, deviceSkill, ipcConfig,] = await Promise.allSettled([
43
45
  updateOnlineType(runtime),
44
46
  getCurrentUserForRuntime(runtime),
47
+ fetchDeviceProperties(runtime),
48
+ getDeviceAdvancedAbilitiesForRuntime(runtime),
49
+ hasThread ? isActiveThreadForRuntime(runtime) : Promise.resolve(false),
45
50
  isSupportVideo
46
- ? getDataWithPreFetchForRuntime(runtime, "getRotate", () => getRotateInfo(devId))
51
+ ?
52
+ getDataWithPreFetchForRuntime(runtime, "getRotate", () => getWithLocalCache(runtime, "rotateInfo", () => getRotateInfo(devId), {
53
+ version: 1,
54
+ }))
47
55
  : Promise.resolve({
48
56
  angle: 0,
49
57
  actualAngle: 0,
50
58
  }),
51
59
  isSupportVideo
52
- ? getDeviceSkill(devId)
60
+ ? getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId))
53
61
  : Promise.resolve({
54
62
  devId,
55
63
  json: { videos: [{ width: 0, height: 0 }] },
56
64
  }),
57
65
  isSupportVideo
58
- ? getIPCConfig(devId)
66
+ ? getWithLocalCache(runtime, "ipcConfig", () => getIPCConfig(devId))
59
67
  : Promise.resolve({
60
68
  audioAttributes: {
61
69
  hardwareCapability: [],
@@ -84,8 +92,8 @@ export const initState = async (runtime) => {
84
92
  }
85
93
  else {
86
94
  try {
87
- const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
88
95
  runtime.config.supportTalk = true;
96
+ const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
89
97
  runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
90
98
  sdkLog("info", "initState", "supportTalk", {
91
99
  devId,
@@ -99,7 +107,7 @@ export const initState = async (runtime) => {
99
107
  sdkLog("error", "initState", "supportTalk", {
100
108
  devId,
101
109
  duration: Date.now() - startedAt,
102
- data: {},
110
+ error: e,
103
111
  });
104
112
  }
105
113
  }
@@ -111,7 +119,6 @@ export const initState = async (runtime) => {
111
119
  runtime.config.mediaHeight = temp;
112
120
  }
113
121
  }
114
- await fetchDeviceProperties(runtime);
115
122
  sdkLog("info", "initState", "ready", {
116
123
  devId,
117
124
  duration: Date.now() - startedAt,
@@ -121,7 +128,8 @@ export const initState = async (runtime) => {
121
128
  videoAngle: runtime.config.videoAngle,
122
129
  },
123
130
  });
124
- getDeviceAdvancedAbilitiesForRuntime(runtime).then((abilities) => {
131
+ if (advanceAbilities.status === "fulfilled") {
132
+ const abilities = advanceAbilities.value;
125
133
  sdkLog("debug", "initState", "advancedAbilitiesFetched", {
126
134
  devId,
127
135
  data: {
@@ -145,7 +153,7 @@ export const initState = async (runtime) => {
145
153
  yuChannelSyncSingleSync(devId);
146
154
  }
147
155
  }
148
- });
156
+ }
149
157
  syncRemoteSerectKey(runtime);
150
158
  checkOfflineDpUpdateForRuntime(runtime, {}, true).then(() => {
151
159
  sdkLog("debug", "initState", "offlineDpCheckDone", { devId });
@@ -3,6 +3,7 @@ import { getRuntimeByDevId, listRegisteredRuntimes, } from "../../runtime/regist
3
3
  import emitter from "../../utils/event";
4
4
  import { getWiFiSignalChangeEvent } from "../misc/signal";
5
5
  import { autoSyncTemp } from "../password/sync-temp";
6
+ import { syncFitBindingsForRuntime } from "../fit/sync";
6
7
  import syncT0 from "./sync/t0";
7
8
  import syncRemoteSerectKey from "./sync/remote-serect-key";
8
9
  import { syncOfflineDps } from "./sync/offline-dps";
@@ -38,7 +39,6 @@ const globalHandleDeviceInfoChange = async ({ dps, deviceId, }) => {
38
39
  handleDpChange(rt, dps);
39
40
  }
40
41
  await updateOnlineType(rt);
41
- updateDeviceStatus(rt);
42
42
  };
43
43
  const globalUpdateAllOnlineTypes = async (data) => {
44
44
  if (!data?.deviceId) {
@@ -90,8 +90,17 @@ const globalHandleBleChange = ({ deviceId, status }) => {
90
90
  devId: deviceId,
91
91
  data: { status, registered: !!rt },
92
92
  });
93
- if (!rt || status !== "CONNECTED") {
94
- return;
93
+ if (rt) {
94
+ updateOnlineType(rt);
95
+ if (status === "CONNECTED") {
96
+ if (rt.config.isFitting) {
97
+ syncFitBindingsForRuntime(rt).catch(() => { });
98
+ }
99
+ void syncRemoteSerectKey(rt);
100
+ autoSyncTemp(rt);
101
+ void syncT0(rt);
102
+ void syncOfflineDps(rt);
103
+ }
95
104
  }
96
105
  };
97
106
  const globalHandleAppShow = () => {
@@ -1,6 +1,7 @@
1
1
  import { getDeviceProperties } from "../../api/setting";
2
2
  import { getDataWithPreFetchForRuntime } from "../utils";
3
3
  import { RemotePermissionType } from "../../constant";
4
+ import { cameraPositionMap } from "../../utils/constant";
4
5
  export const permissions = [
5
6
  RemotePermissionType.ADMINS_ONLY,
6
7
  RemotePermissionType.EVERY_ONE,
@@ -10,10 +11,12 @@ var DeviceProperties;
10
11
  (function (DeviceProperties) {
11
12
  DeviceProperties["REMOTE_UNLOCK_AUTH"] = "REMOTE_UNLOCK_AUTH";
12
13
  DeviceProperties["UNLOCK_PHONE_REMOTE"] = "UNLOCK_PHONE_REMOTE";
14
+ DeviceProperties["LOCK_POS_ROT_ANGLE"] = "LOCK_POS_ROT_ANGLE";
13
15
  })(DeviceProperties || (DeviceProperties = {}));
14
16
  const propsList = [
15
17
  DeviceProperties.REMOTE_UNLOCK_AUTH,
16
18
  DeviceProperties.UNLOCK_PHONE_REMOTE,
19
+ DeviceProperties.LOCK_POS_ROT_ANGLE,
17
20
  ];
18
21
  export async function fetchDeviceProperties(runtime, isForce) {
19
22
  let result = null;
@@ -27,4 +30,18 @@ export async function fetchDeviceProperties(runtime, isForce) {
27
30
  result[DeviceProperties.UNLOCK_PHONE_REMOTE] === "true";
28
31
  runtime.config.remoteOpenPermission =
29
32
  permissions[+result[DeviceProperties.REMOTE_UNLOCK_AUTH] || 0];
33
+ if (result[DeviceProperties.LOCK_POS_ROT_ANGLE]) {
34
+ try {
35
+ const data = JSON.parse(result[DeviceProperties.LOCK_POS_ROT_ANGLE]);
36
+ runtime.config.cameraConfig = data.map((item) => ({
37
+ isVR: !!item.vr,
38
+ width: item.w,
39
+ height: item.h,
40
+ rotate: item.al,
41
+ location: cameraPositionMap[item.p],
42
+ }));
43
+ }
44
+ catch (e) {
45
+ }
46
+ }
30
47
  }
@@ -11,6 +11,13 @@ import { reportSetKey as reportSetKeyMap, setKey as setKeyMap, } from "../../../
11
11
  import { sdkLog } from "../../../utils/sdk-log";
12
12
  const syncRemoteSerectKey = async (runtime, force) => {
13
13
  const rt = runtime;
14
+ if (rt.config.isFitting || !rt.config.idsByCode[dpCodes.remoteNoPdSetkey]) {
15
+ sdkLog("debug", "syncKey", "skipped", {
16
+ devId: rt.devId,
17
+ data: { reason: "unsupported", force: !!force },
18
+ });
19
+ return;
20
+ }
14
21
  const useNear = isUseNearChannelForRuntime(rt);
15
22
  if (!useNear) {
16
23
  sdkLog("debug", "syncKey", "skipped", {
@@ -0,0 +1,5 @@
1
+ import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
+ export declare const setStorageForRuntime: (rt: LockDeviceRuntime, key: string, data: unknown) => void;
3
+ export declare const getStorageForRuntime: <T = unknown>(rt: LockDeviceRuntime, key: string) => T | null;
4
+ export declare const removeStorageForRuntime: (rt: LockDeviceRuntime, key: string) => void;
5
+ export declare const clearStorageForRuntime: (rt: LockDeviceRuntime, keys: string[]) => void;