@ray-js/lock-sdk 1.2.1-beta.3 → 1.2.1-beta.5

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.
@@ -76,6 +76,8 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
76
76
  "tyabipd4hh",
77
77
  "tyabin4u5v",
78
78
  "visual_door_lock_cloud_store",
79
+ "tyabixkep7",
80
+ "tyabig3wt9",
79
81
  ])),
80
82
  getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
81
83
  ipc.getTTTAbilityKeyList("isSupportedVRMode"),
@@ -83,6 +85,10 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
83
85
  const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
84
86
  const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
85
87
  const deviceAdvanceAbilityCache = {
88
+ videoConfig: {
89
+ isLowResolution: false,
90
+ isHighResolution: false,
91
+ },
86
92
  cloudStorage: {
87
93
  support: false,
88
94
  },
@@ -91,6 +97,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
91
97
  defaultMode: "VR",
92
98
  modes: [],
93
99
  coverMode: "VR",
100
+ options: {},
94
101
  },
95
102
  ai: {
96
103
  support: false,
@@ -122,6 +129,14 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
122
129
  if (item.isOpen) {
123
130
  const data = item.extConfig ? JSON.parse(item.extConfig) : {};
124
131
  switch (item.abilityCode) {
132
+ case "tyabixkep7": {
133
+ deviceAdvanceAbilityCache.videoConfig.isHighResolution = true;
134
+ break;
135
+ }
136
+ case "tyabig3wt9": {
137
+ deviceAdvanceAbilityCache.videoConfig.isLowResolution = true;
138
+ break;
139
+ }
125
140
  case "visual_door_lock_cloud_store":
126
141
  deviceAdvanceAbilityCache.cloudStorage.support = true;
127
142
  break;
@@ -151,6 +166,24 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
151
166
  deviceAdvanceAbilityCache.vr.modes?.[0]?.mode;
152
167
  }
153
168
  deviceAdvanceAbilityCache.vr.coverMode = data.photo_cover_format;
169
+ if (data.configs) {
170
+ let options;
171
+ try {
172
+ options = JSON.parse(data.configs);
173
+ }
174
+ catch (e) {
175
+ }
176
+ if (options.zoomIn) {
177
+ deviceAdvanceAbilityCache.vr.options.zoomIn =
178
+ Number(options.zoomIn?.value) > 0
179
+ ? Number(options.zoomIn?.value)
180
+ : undefined;
181
+ deviceAdvanceAbilityCache.vr.options.radialEmphasis =
182
+ Number(options.radialEmphasis?.value) > 0
183
+ ? Number(options.radialEmphasis?.value)
184
+ : undefined;
185
+ }
186
+ }
154
187
  }
155
188
  break;
156
189
  }
@@ -18,6 +18,7 @@ import { ipc, yuChannelSyncSingleSync } from "../../platform";
18
18
  import { sdkLog } from "../../utils/sdk-log";
19
19
  import { ProductCommunicationType, RotateType } from "../../constant";
20
20
  import { isHarmony } from "../../utils";
21
+ import { getError } from "src/utils/errors";
21
22
  export const initState = async (runtime) => {
22
23
  const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
23
24
  const startedAt = Date.now();
@@ -74,6 +75,40 @@ export const initState = async (runtime) => {
74
75
  if (userInfoResult.status === "rejected") {
75
76
  throw userInfoResult.reason;
76
77
  }
78
+ if (advanceAbilities.status === "fulfilled") {
79
+ const abilities = advanceAbilities.value;
80
+ sdkLog("debug", "initState", "advancedAbilitiesFetched", {
81
+ devId,
82
+ data: {
83
+ yuChannelSupport: abilities.yuChannel.support,
84
+ yuChannelValue: abilities.yuChannel.value,
85
+ },
86
+ });
87
+ if (isSupportVideo &&
88
+ !abilities.videoConfig.isHighResolution &&
89
+ !abilities.videoConfig.isLowResolution) {
90
+ throw getError(1107);
91
+ }
92
+ if (abilities.yuChannel.support) {
93
+ if (abilities.yuChannel.value === 1) {
94
+ sdkLog("debug", "initState", "yuChannelSync", {
95
+ devId,
96
+ data: { reason: "abilityEnabled" },
97
+ });
98
+ yuChannelSyncSingleSync(devId);
99
+ }
100
+ else if (yuNetState === 1) {
101
+ sdkLog("debug", "initState", "yuChannelSync", {
102
+ devId,
103
+ data: { reason: "yuNetState" },
104
+ });
105
+ yuChannelSyncSingleSync(devId);
106
+ }
107
+ }
108
+ }
109
+ else {
110
+ throw getError(1108);
111
+ }
77
112
  if (isSupportVideo) {
78
113
  const isSEI = runtime.config.capabilities?.rotateType === RotateType.SEI;
79
114
  if (rotateInfo.status === "fulfilled") {
@@ -128,32 +163,6 @@ export const initState = async (runtime) => {
128
163
  videoAngle: runtime.config.videoAngle,
129
164
  },
130
165
  });
131
- if (advanceAbilities.status === "fulfilled") {
132
- const abilities = advanceAbilities.value;
133
- sdkLog("debug", "initState", "advancedAbilitiesFetched", {
134
- devId,
135
- data: {
136
- yuChannelSupport: abilities.yuChannel.support,
137
- yuChannelValue: abilities.yuChannel.value,
138
- },
139
- });
140
- if (abilities.yuChannel.support) {
141
- if (abilities.yuChannel.value === 1) {
142
- sdkLog("debug", "initState", "yuChannelSync", {
143
- devId,
144
- data: { reason: "abilityEnabled" },
145
- });
146
- yuChannelSyncSingleSync(devId);
147
- }
148
- else if (yuNetState === 1) {
149
- sdkLog("debug", "initState", "yuChannelSync", {
150
- devId,
151
- data: { reason: "yuNetState" },
152
- });
153
- yuChannelSyncSingleSync(devId);
154
- }
155
- }
156
- }
157
166
  syncRemoteSerectKey(runtime);
158
167
  checkOfflineDpUpdateForRuntime(runtime, {}, true).then(() => {
159
168
  sdkLog("debug", "initState", "offlineDpCheckDone", { devId });
@@ -26,7 +26,7 @@ export async function updateUnlockMethodForRuntime(rt, params) {
26
26
  await editUnlockMethod({
27
27
  devId: cfg.devInfo.devId,
28
28
  opModeId: params.id,
29
- unlockName: params.name,
29
+ unlockName: params.name || detail.unlockName,
30
30
  ...specialInfo,
31
31
  });
32
32
  sdkLog("info", "unlockMethod", "updateSuccess", {
@@ -359,6 +359,10 @@ export interface AlbumMessage extends MediaInfo {
359
359
  }
360
360
  export type VRModeType = "original" | "VR" | "horizontal" | "vertical";
361
361
  export interface DeviceAdvancedAbility {
362
+ videoConfig: {
363
+ isLowResolution: boolean;
364
+ isHighResolution: boolean;
365
+ };
362
366
  cloudStorage: {
363
367
  support: boolean;
364
368
  };
@@ -370,6 +374,10 @@ export interface DeviceAdvancedAbility {
370
374
  value: number;
371
375
  }>;
372
376
  defaultMode: VRModeType;
377
+ options: {
378
+ zoomIn?: number;
379
+ radialEmphasis?: number;
380
+ };
373
381
  };
374
382
  ai: {
375
383
  support: boolean;
@@ -106,6 +106,8 @@ const errors = {
106
106
  1104: "Failed to switch cameras",
107
107
  1105: "Camera switching is not supported",
108
108
  1106: "No validity configuration data",
109
+ 1107: "Invalid device, please re-authorize",
110
+ 1108: "Failed to get configuration",
109
111
  };
110
112
  export const getError = (code, ...places) => {
111
113
  if (errors[code]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.1-beta.3",
3
+ "version": "1.2.1-beta.5",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"