@ray-js/lock-sdk 1.2.0-beta.7 → 1.2.0-beta.9

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.
@@ -28,4 +28,13 @@ export declare const getIPCConfig: (devId: string) => Promise<{
28
28
  hardwareCapability: number[];
29
29
  };
30
30
  }>;
31
+ export interface MediaViewTimesResult {
32
+ count: number;
33
+ }
34
+ export declare const getMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
35
+ export declare const setMediaViewTimes: (devId: string) => Promise<MediaViewTimesResult>;
36
+ export interface getAlbumDateListResult {
37
+ dateList: string[];
38
+ }
39
+ export declare const getAlbumDateList: (devId: string) => Promise<getAlbumDateListResult>;
31
40
  export {};
package/lib/api/video.js CHANGED
@@ -30,3 +30,33 @@ export const getIPCConfig = (devId) => {
30
30
  },
31
31
  });
32
32
  };
33
+ export const getMediaViewTimes = (devId) => {
34
+ return requestApi({
35
+ logName: "getMediaViewTimes",
36
+ api: `${THING}.m.device.lock.media.view.times.get`,
37
+ version: "1.0",
38
+ data: {
39
+ devId,
40
+ },
41
+ });
42
+ };
43
+ export const setMediaViewTimes = (devId) => {
44
+ return requestApi({
45
+ logName: "setMediaViewTimes",
46
+ api: `${THING}.m.device.lock.media.view.times.set`,
47
+ version: "1.0",
48
+ data: {
49
+ devId,
50
+ },
51
+ });
52
+ };
53
+ export const getAlbumDateList = (devId) => {
54
+ return requestApi({
55
+ logName: "getAlbumDateList",
56
+ api: "m.lock.album.media.date.list",
57
+ version: "1.0",
58
+ data: {
59
+ devId,
60
+ },
61
+ });
62
+ };
@@ -6,6 +6,10 @@ export declare function getMediaInfo(): import("../../../feature/media/media").M
6
6
  export declare function openLocalAlbum(params?: OpenLocalAlbumParams): Promise<void>;
7
7
  export declare function gotoPlayback(params?: GotoPlaybackParams): Promise<void>;
8
8
  export declare function isSupportMultiCamera(): boolean;
9
- export declare function getCameraInfo(): import("../../../feature/media/camera").CameraInfo | undefined;
9
+ export declare function getCameraInfo(): import("../../../feature/media/camera").CameraDpInfo | undefined;
10
10
  export declare function queryCameraInfo(): Promise<import("../../../feature/media/camera").CameraInfo | undefined>;
11
11
  export declare function switchCamera(index: number): Promise<true>;
12
+ export declare function getMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
13
+ export declare function addMediaViewTimes(): Promise<import("../../../api/video").MediaViewTimesResult>;
14
+ export declare function getAlbumDateList(): Promise<import("../../../api/video").getAlbumDateListResult>;
15
+ export declare function getCameraConfig(): import("../../..").CameraConfig[];
@@ -1,7 +1,7 @@
1
1
  import { resolveRuntimeFromExportThis } from "../bootstrap/resolve-runtime-from-export-this";
2
- import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, gotoPlaybackForRuntime, getMediaInfoForRuntime, } from "../../../feature/media/media";
2
+ import { getMediaUrlForRuntime, isSupportMediaForRuntime, openLocalAlbumForRuntime, gotoPlaybackForRuntime, getMediaInfoForRuntime, getMediaViewTimesForRuntime, setMediaViewTimesForRuntime, getAlbumDateListForRuntime, } from "../../../feature/media/media";
3
3
  import { getMediaRotateForRuntime } from "../../../feature/media/rotate";
4
- import { isSupportMultiCameraForRuntime, getCameraInfoForRuntime, queryCameraInfoForRuntime, switchCameraForRuntime, } from "../../../feature/media/camera";
4
+ import { isSupportMultiCameraForRuntime, getCameraInfoForRuntime, queryCameraInfoForRuntime, switchCameraForRuntime, getCameraConfigForRuntime, } from "../../../feature/media/camera";
5
5
  export async function getMediaUrl(params) {
6
6
  return getMediaUrlForRuntime(resolveRuntimeFromExportThis(this), params);
7
7
  }
@@ -32,3 +32,15 @@ export async function queryCameraInfo() {
32
32
  export async function switchCamera(index) {
33
33
  return switchCameraForRuntime(resolveRuntimeFromExportThis(this), index);
34
34
  }
35
+ export async function getMediaViewTimes() {
36
+ return getMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
37
+ }
38
+ export async function addMediaViewTimes() {
39
+ return setMediaViewTimesForRuntime(resolveRuntimeFromExportThis(this));
40
+ }
41
+ export async function getAlbumDateList() {
42
+ return getAlbumDateListForRuntime(resolveRuntimeFromExportThis(this));
43
+ }
44
+ export function getCameraConfig() {
45
+ return getCameraConfigForRuntime(resolveRuntimeFromExportThis(this));
46
+ }
@@ -1,8 +1,18 @@
1
1
  import type { LockDeviceRuntime } from "../../runtime/LockDeviceRuntime";
2
- import type { DpMapDataType } from "../../interface";
2
+ import type { CameraConfig, DpMapDataType } from "../../interface";
3
3
  import { locationSelectReportMap } from "../../config/dp-map/media";
4
4
  export type CameraInfo = DpMapDataType<typeof locationSelectReportMap>;
5
5
  export declare const isSupportMultiCameraForRuntime: (runtime: LockDeviceRuntime) => boolean;
6
- export declare const getCameraInfoForRuntime: (runtime: LockDeviceRuntime) => CameraInfo | undefined;
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;
7
15
  export declare const queryCameraInfoForRuntime: (runtime: LockDeviceRuntime) => Promise<CameraInfo | undefined>;
8
16
  export declare const switchCameraForRuntime: (runtime: LockDeviceRuntime, index: number) => Promise<true>;
17
+ export declare const getCameraConfigForRuntime: (runtime: LockDeviceRuntime) => CameraConfig[];
18
+ export {};
@@ -31,3 +31,6 @@ export const switchCameraForRuntime = async (runtime, index) => {
31
31
  throw getError(1104);
32
32
  }
33
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;
@@ -35,3 +36,6 @@ export interface MediaInfo {
35
36
  isTwoWayTalk: boolean;
36
37
  }
37
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) {
@@ -85,3 +86,12 @@ export const getMediaInfoForRuntime = (runtime) => {
85
86
  isTwoWayTalk: runtime.config.isTwoWayTalk,
86
87
  };
87
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
+ };
@@ -39,9 +39,10 @@ export const initState = async (runtime) => {
39
39
  isSupportVideo,
40
40
  },
41
41
  });
42
- const [, , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
42
+ const [, , , rotateInfo, deviceSkill, ipcConfig] = await Promise.allSettled([
43
43
  updateOnlineType(runtime),
44
44
  getCurrentUserForRuntime(runtime),
45
+ fetchDeviceProperties(runtime),
45
46
  isSupportVideo
46
47
  ? getDataWithPreFetchForRuntime(runtime, "getRotate", () => getRotateInfo(devId))
47
48
  : Promise.resolve({
@@ -84,8 +85,8 @@ export const initState = async (runtime) => {
84
85
  }
85
86
  else {
86
87
  try {
87
- const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
88
88
  runtime.config.supportTalk = true;
89
+ const modeRes = await ipc.getCurrentSupportedTalkMode(devId);
89
90
  runtime.config.isTwoWayTalk = modeRes.talkbackMode === 2;
90
91
  sdkLog("info", "initState", "supportTalk", {
91
92
  devId,
@@ -99,7 +100,7 @@ export const initState = async (runtime) => {
99
100
  sdkLog("error", "initState", "supportTalk", {
100
101
  devId,
101
102
  duration: Date.now() - startedAt,
102
- data: {},
103
+ error: e,
103
104
  });
104
105
  }
105
106
  }
@@ -111,7 +112,6 @@ export const initState = async (runtime) => {
111
112
  runtime.config.mediaHeight = temp;
112
113
  }
113
114
  }
114
- await fetchDeviceProperties(runtime);
115
115
  sdkLog("info", "initState", "ready", {
116
116
  devId,
117
117
  duration: Date.now() - startedAt,
@@ -10,10 +10,12 @@ var DeviceProperties;
10
10
  (function (DeviceProperties) {
11
11
  DeviceProperties["REMOTE_UNLOCK_AUTH"] = "REMOTE_UNLOCK_AUTH";
12
12
  DeviceProperties["UNLOCK_PHONE_REMOTE"] = "UNLOCK_PHONE_REMOTE";
13
+ DeviceProperties["LOCK_POS_ROT_ANGLE"] = "LOCK_POS_ROT_ANGLE";
13
14
  })(DeviceProperties || (DeviceProperties = {}));
14
15
  const propsList = [
15
16
  DeviceProperties.REMOTE_UNLOCK_AUTH,
16
17
  DeviceProperties.UNLOCK_PHONE_REMOTE,
18
+ DeviceProperties.LOCK_POS_ROT_ANGLE,
17
19
  ];
18
20
  export async function fetchDeviceProperties(runtime, isForce) {
19
21
  let result = null;
@@ -27,4 +29,18 @@ export async function fetchDeviceProperties(runtime, isForce) {
27
29
  result[DeviceProperties.UNLOCK_PHONE_REMOTE] === "true";
28
30
  runtime.config.remoteOpenPermission =
29
31
  permissions[+result[DeviceProperties.REMOTE_UNLOCK_AUTH] || 0];
32
+ if (result[DeviceProperties.LOCK_POS_ROT_ANGLE]) {
33
+ try {
34
+ const data = JSON.parse(result[DeviceProperties.LOCK_POS_ROT_ANGLE]);
35
+ runtime.config.cameraConfig = data.map((item) => ({
36
+ isVR: !!item.vr,
37
+ width: item.w,
38
+ height: item.h,
39
+ rotate: item.al,
40
+ localtion: item.p,
41
+ }));
42
+ }
43
+ catch (e) {
44
+ }
45
+ }
30
46
  }
@@ -402,4 +402,11 @@ export interface AIReportPopup {
402
402
  reportId: string;
403
403
  yearMonth: number;
404
404
  }
405
+ export interface CameraConfig {
406
+ isVR: boolean;
407
+ width: number;
408
+ height: number;
409
+ rotate: number;
410
+ localtion: number;
411
+ }
405
412
  export {};
@@ -1,5 +1,5 @@
1
1
  import { ProductCommunicationType, RemotePermissionType } from "../constant";
2
- import { CapabilityInfo, DeviceInfo, DeviceStatus, DpSchema } from "../interface";
2
+ import { CameraConfig, CapabilityInfo, DeviceInfo, DeviceStatus, DpSchema } from "../interface";
3
3
  export type LockConfigState = {
4
4
  devInfo: DeviceInfo;
5
5
  dpSchema: Record<string, DpSchema>;
@@ -23,6 +23,7 @@ export type LockConfigState = {
23
23
  preFetch: boolean;
24
24
  supportTalk: boolean;
25
25
  isTwoWayTalk: boolean;
26
+ cameraConfig: CameraConfig[];
26
27
  };
27
28
  export declare function createDefaultDeviceStatus(): DeviceStatus;
28
29
  export declare function createLockConfigState(): LockConfigState;
@@ -33,5 +33,6 @@ export function createLockConfigState() {
33
33
  preFetch: false,
34
34
  supportTalk: false,
35
35
  isTwoWayTalk: false,
36
+ cameraConfig: [],
36
37
  };
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/lock-sdk",
3
- "version": "1.2.0-beta.7",
3
+ "version": "1.2.0-beta.9",
4
4
  "files": [
5
5
  "lib",
6
6
  "LICENSE.md"