@ray-js/lock-sdk 1.2.2-beta.0 → 1.2.2-beta.1

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.
@@ -11,6 +11,7 @@ interface DeviceSkillResult {
11
11
  height: number;
12
12
  }
13
13
  ];
14
+ cloudP2P: 1 | 0;
14
15
  audios: [
15
16
  {
16
17
  channel: number;
@@ -4,8 +4,6 @@ import { checkShowMatterMutilpleShare } from "../../platform/device";
4
4
  import { ipc } from "../../platform";
5
5
  import { getWithLocalCache } from "../storage/swr-cache";
6
6
  import { getVideoResolutionMark } from "../../api/video";
7
- import dpCodes from "../../config/dp-code";
8
- import { hasDpForRuntime } from "../dp/has-dp";
9
7
  import { sdkLog } from "../../utils/sdk-log";
10
8
  export const hasCapabilityForRuntime = (runtime, capability) => runtime.config.communication.includes(capability);
11
9
  export const isBlePureDeviceForRuntime = (rt) => hasCapabilityForRuntime(rt, ProductCommunicationType.BLUETOOTH) &&
@@ -83,12 +81,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
83
81
  ])),
84
82
  getWithLocalCache(rt, "deviceAdvancedAbility", () => getDeviceAdvancedAbility(devId)),
85
83
  ipc.getTTTAbilityKeyList("isSupportedVRMode"),
86
- hasDpForRuntime(rt, dpCodes.initiativeMessage)
87
- ? getWithLocalCache(rt, "videoResolutionMark", () => getVideoResolutionMark(devId))
88
- : Promise.resolve({
89
- capability: [],
90
- cloudCapability: [],
91
- }),
84
+ getWithLocalCache(rt, "videoResolutionMark", () => getVideoResolutionMark(devId)),
92
85
  ]);
93
86
  const productAbilities = productAbilitiesRes.status === "fulfilled" ? productAbilitiesRes.value : [];
94
87
  const tttAbList = tttList.status === "fulfilled" ? tttList.value.abilityList : [];
@@ -103,6 +96,7 @@ export const getDeviceAdvancedAbilitiesForRuntime = async (rt) => {
103
96
  videoConfig: {
104
97
  isLowResolution: videoMark?.cloudCapability?.includes("tyabig3wt9"),
105
98
  isHighResolution: videoMark?.cloudCapability?.includes("tyabixkep7"),
99
+ isSpecial: videoMark?.cloudCapability?.includes("tyabifck5x"),
106
100
  },
107
101
  cloudStorage: {
108
102
  support: false,
@@ -19,6 +19,7 @@ import { sdkLog } from "../../utils/sdk-log";
19
19
  import { ProductCommunicationType, RotateType } from "../../constant";
20
20
  import { isHarmony, isVirtualDevice } from "../../utils";
21
21
  import { getError } from "../../utils/errors";
22
+ import { isSupportMediaForRuntime } from "../media/media";
22
23
  export const initState = async (runtime) => {
23
24
  const { devInfo: { dps, devId, yuNetState }, dpSchema, } = runtime.config;
24
25
  const startedAt = Date.now();
@@ -57,12 +58,7 @@ export const initState = async (runtime) => {
57
58
  angle: 0,
58
59
  actualAngle: 0,
59
60
  }),
60
- isSupportVideo
61
- ? getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId))
62
- : Promise.resolve({
63
- devId,
64
- json: { videos: [{ width: 0, height: 0 }] },
65
- }),
61
+ getWithLocalCache(runtime, "deviceSkill", () => getDeviceSkill(devId)),
66
62
  isSupportVideo
67
63
  ? getWithLocalCache(runtime, "ipcConfig", () => getIPCConfig(devId))
68
64
  : Promise.resolve({
@@ -75,6 +71,14 @@ export const initState = async (runtime) => {
75
71
  if (userInfoResult.status === "rejected") {
76
72
  throw userInfoResult.reason;
77
73
  }
74
+ if (deviceSkill.status === "fulfilled") {
75
+ runtime.config.mediaWidth =
76
+ deviceSkill.value?.json?.videos?.[0]?.width ?? 0;
77
+ runtime.config.mediaHeight =
78
+ deviceSkill.value?.json?.videos?.[0]?.height ?? 0;
79
+ runtime.config.deviceSkill.cloudP2P =
80
+ deviceSkill.value?.json?.cloudP2P || 0;
81
+ }
78
82
  if (advanceAbilities.status === "fulfilled") {
79
83
  const abilities = advanceAbilities.value;
80
84
  sdkLog("debug", "initState", "advancedAbilitiesFetched", {
@@ -84,12 +88,17 @@ export const initState = async (runtime) => {
84
88
  yuChannelValue: abilities.yuChannel.value,
85
89
  },
86
90
  });
87
- if (isSupportVideo &&
91
+ if (isSupportMediaForRuntime(runtime) &&
88
92
  !isVirtualDevice(devId) &&
89
93
  !abilities.videoConfig.isHighResolution &&
90
94
  !abilities.videoConfig.isLowResolution) {
91
95
  throw getError(1107);
92
96
  }
97
+ if (!isSupportVideo &&
98
+ runtime.config.deviceSkill.cloudP2P === 1 &&
99
+ !abilities.videoConfig.isSpecial) {
100
+ throw getError(1109);
101
+ }
93
102
  if (abilities.yuChannel.support) {
94
103
  if (abilities.yuChannel.value === 1) {
95
104
  sdkLog("debug", "initState", "yuChannelSync", {
@@ -116,12 +125,6 @@ export const initState = async (runtime) => {
116
125
  runtime.config.imageAngle = isSEI ? 0 : rotateInfo.value.angle;
117
126
  runtime.config.videoAngle = isSEI ? 0 : rotateInfo.value.actualAngle;
118
127
  }
119
- if (deviceSkill.status === "fulfilled") {
120
- runtime.config.mediaWidth =
121
- deviceSkill.value?.json?.videos?.[0]?.width ?? 0;
122
- runtime.config.mediaHeight =
123
- deviceSkill.value?.json?.videos?.[0]?.height ?? 0;
124
- }
125
128
  if (ipcConfig.status === "fulfilled" &&
126
129
  ipcConfig.value?.audioAttributes?.hardwareCapability?.includes(2)) {
127
130
  runtime.config.supportTalk = true;
@@ -362,6 +362,7 @@ export interface DeviceAdvancedAbility {
362
362
  videoConfig: {
363
363
  isLowResolution: boolean;
364
364
  isHighResolution: boolean;
365
+ isSpecial: boolean;
365
366
  };
366
367
  cloudStorage: {
367
368
  support: boolean;
@@ -27,6 +27,9 @@ export type LockConfigState = {
27
27
  cameraConfig: CameraConfig[];
28
28
  notSupportWake: boolean;
29
29
  isFitting: boolean;
30
+ deviceSkill: {
31
+ cloudP2P: 0 | 1;
32
+ };
30
33
  };
31
34
  export declare function createDefaultDeviceStatus(): DeviceStatus;
32
35
  export declare function createLockConfigState(): LockConfigState;
@@ -38,6 +38,9 @@ export function createLockConfigState() {
38
38
  isTwoWayTalk: false,
39
39
  cameraConfig: [],
40
40
  notSupportWake: false,
41
- isFitting: false
41
+ isFitting: false,
42
+ deviceSkill: {
43
+ cloudP2P: 0,
44
+ },
42
45
  };
43
46
  }
@@ -108,6 +108,7 @@ const errors = {
108
108
  1106: "No validity configuration data",
109
109
  1107: "Invalid device, please re-authorize",
110
110
  1108: "Failed to get configuration",
111
+ 1109: "Invalid device, please re-authorize",
111
112
  };
112
113
  export const getError = (code, ...places) => {
113
114
  if (errors[code]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.2-beta.0",
3
+ "version": "1.2.2-beta.1",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"