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

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
  },
@@ -122,6 +128,14 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
122
128
  if (item.isOpen) {
123
129
  const data = item.extConfig ? JSON.parse(item.extConfig) : {};
124
130
  switch (item.abilityCode) {
131
+ case "tyabixkep7": {
132
+ deviceAdvanceAbilityCache.videoConfig.isHighResolution = true;
133
+ break;
134
+ }
135
+ case "tyabig3wt9": {
136
+ deviceAdvanceAbilityCache.videoConfig.isLowResolution = true;
137
+ break;
138
+ }
125
139
  case "visual_door_lock_cloud_store":
126
140
  deviceAdvanceAbilityCache.cloudStorage.support = true;
127
141
  break;
@@ -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
  };
@@ -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.4",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"