@ray-js/ray-ipc-utils 1.1.0-beta-9 → 1.1.0-beta-11
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.
- package/lib/index.d.ts +6 -4
- package/lib/kit/ipc/index.d.ts +10 -3
- package/lib/kit/ipc/index.js +40 -3
- package/lib/service/index.js +51 -47
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -12,14 +12,15 @@ declare const IpcUtils: {
|
|
|
12
12
|
getInitUtmTid: () => string;
|
|
13
13
|
getDevInfo: <T_6>(deviceId: string) => Promise<import("./kit/interface").IRes<T_6>>;
|
|
14
14
|
getNativeStorage: <T_7>(key: string) => Promise<import("./kit/interface").IRes<T_7>>;
|
|
15
|
-
setNativeStorage: <T_8>(key: string, data:
|
|
15
|
+
setNativeStorage: <T_8>(key: string, data: string) => Promise<import("./kit/interface").IRes<T_8>>;
|
|
16
16
|
removeNativeStorage: <T_9>(key: string) => Promise<import("./kit/interface").IRes<T_9>>;
|
|
17
17
|
publishDps: <T_10>(deviceId: string, dps: any) => Promise<import("./kit/interface").IRes<T_10>>;
|
|
18
18
|
getDpStateValue: <T_11>(deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T_11>>;
|
|
19
19
|
getDpIdByCode: <T_12>(deviceId: string, dpCode: string) => Promise<import("./kit/interface").IRes<T_12>>;
|
|
20
20
|
goToMiniProgramByShortLink: <T_13>(url: string, position?: string) => Promise<import("./kit/interface").IRes<T_13>>;
|
|
21
21
|
getVideoBitrateKbps: <T_14>(deviceId: string, extendParam?: {}) => Promise<import("./kit/interface").IRes<T_14>>;
|
|
22
|
-
networkStatusDidChangedEvent: (callback: any) => void;
|
|
22
|
+
networkStatusDidChangedEvent: (callback: (res: any) => void) => void;
|
|
23
|
+
offNetworkStatusDidChangedEvent: (callback: (res: any) => void) => void;
|
|
23
24
|
getMobileOrientation: <T_15>() => Promise<import("./kit/interface").IRes<T_15>>;
|
|
24
25
|
jumpToWebView: <T_16>(url: string) => Promise<import("./kit/interface").IRes<T_16>>;
|
|
25
26
|
setScreenOrientation: <T_17>(pageOrientation: string) => Promise<import("./kit/interface").IRes<T_17>>;
|
|
@@ -41,8 +42,9 @@ declare const IpcUtils: {
|
|
|
41
42
|
data: boolean;
|
|
42
43
|
msg: string | boolean | import("./kit/interface").IApiError | undefined;
|
|
43
44
|
}>;
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
ipcTTTOperatorLog: <T_25>(ipcLogString: string) => Promise<import("./kit/interface").IRes<T_25>>;
|
|
46
|
+
requestWifiSignal: <T_26>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_26>>;
|
|
47
|
+
wakeUpDevice: <T_27>(deviceId: string, dps?: {}) => Promise<import("./kit/interface").IRes<T_27>>;
|
|
46
48
|
useTrafficViewTip: () => boolean;
|
|
47
49
|
};
|
|
48
50
|
export default IpcUtils;
|
package/lib/kit/ipc/index.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare const getNativeStorage: <T>(key: string) => Promise<IRes<T>>;
|
|
|
16
16
|
* @param key 保存的key属性
|
|
17
17
|
*
|
|
18
18
|
*/
|
|
19
|
-
export declare const setNativeStorage: <T>(key: string, data:
|
|
19
|
+
export declare const setNativeStorage: <T>(key: string, data: string) => Promise<IRes<T>>;
|
|
20
20
|
/**
|
|
21
21
|
* 清除本地缓存
|
|
22
22
|
* @param key 保存的key属性
|
|
@@ -55,7 +55,8 @@ export declare const goToMiniProgramByShortLink: <T>(url: string, position?: str
|
|
|
55
55
|
* @returns
|
|
56
56
|
*/
|
|
57
57
|
export declare const getVideoBitrateKbps: <T>(deviceId: string, extendParam?: {}) => Promise<IRes<T>>;
|
|
58
|
-
export declare const networkStatusDidChangedEvent: (callback: any) => void;
|
|
58
|
+
export declare const networkStatusDidChangedEvent: (callback: (res: any) => void) => void;
|
|
59
|
+
export declare const offNetworkStatusDidChangedEvent: (callback: (res: any) => void) => void;
|
|
59
60
|
/**
|
|
60
61
|
* 获取手机当前横竖屏状态
|
|
61
62
|
* 需引入IPCKit,且在>=1.0.0-TTT432.1版本才可使用
|
|
@@ -123,7 +124,7 @@ export declare const goToGeneralHelpMini: <T>() => Promise<IRes<T>>;
|
|
|
123
124
|
*/
|
|
124
125
|
export declare const goToIpcHelpMini: <T>(errCode: number, deviceId: string, helpNum: number, helpFeedBack: boolean, brandColor?: string) => Promise<IRes<T>>;
|
|
125
126
|
/**
|
|
126
|
-
*
|
|
127
|
+
* 获取是否支持云存储
|
|
127
128
|
* @param deviceId 设备id
|
|
128
129
|
* @returns true/false
|
|
129
130
|
*/
|
|
@@ -136,3 +137,9 @@ export declare const getIsSupportedCloudStorageSync: (deviceId: string) => Promi
|
|
|
136
137
|
data: boolean;
|
|
137
138
|
msg: string | boolean | import("../interface").IApiError | undefined;
|
|
138
139
|
}>;
|
|
140
|
+
/**
|
|
141
|
+
* 预埋业务日志
|
|
142
|
+
* @param ipcLogString 日志字符串
|
|
143
|
+
* @returns true/false
|
|
144
|
+
*/
|
|
145
|
+
export declare const ipcTTTOperatorLog: <T>(ipcLogString: string) => Promise<IRes<T>>;
|
package/lib/kit/ipc/index.js
CHANGED
|
@@ -82,7 +82,7 @@ export const setNativeStorage = (key, data) => {
|
|
|
82
82
|
success: res => {
|
|
83
83
|
resolve({
|
|
84
84
|
code: 0,
|
|
85
|
-
data: res
|
|
85
|
+
data: res
|
|
86
86
|
});
|
|
87
87
|
},
|
|
88
88
|
fail: err => {
|
|
@@ -115,7 +115,7 @@ export const removeNativeStorage = key => {
|
|
|
115
115
|
success: res => {
|
|
116
116
|
resolve({
|
|
117
117
|
code: 0,
|
|
118
|
-
data: res
|
|
118
|
+
data: res
|
|
119
119
|
});
|
|
120
120
|
},
|
|
121
121
|
fail: err => {
|
|
@@ -327,6 +327,9 @@ export const getVideoBitrateKbps = function (deviceId) {
|
|
|
327
327
|
export const networkStatusDidChangedEvent = callback => {
|
|
328
328
|
ty.onNetworkStatusChange(callback);
|
|
329
329
|
};
|
|
330
|
+
export const offNetworkStatusDidChangedEvent = callback => {
|
|
331
|
+
ty.offNetworkStatusChange(callback);
|
|
332
|
+
};
|
|
330
333
|
|
|
331
334
|
/**
|
|
332
335
|
* 获取手机当前横竖屏状态
|
|
@@ -736,7 +739,7 @@ export const goToIpcHelpMini = async function (errCode, deviceId, helpNum, helpF
|
|
|
736
739
|
};
|
|
737
740
|
|
|
738
741
|
/**
|
|
739
|
-
*
|
|
742
|
+
* 获取是否支持云存储
|
|
740
743
|
* @param deviceId 设备id
|
|
741
744
|
* @returns true/false
|
|
742
745
|
*/
|
|
@@ -766,4 +769,38 @@ export const getIsSupportedCloudStorageSync = async deviceId => {
|
|
|
766
769
|
data: false,
|
|
767
770
|
msg: msg
|
|
768
771
|
};
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* 预埋业务日志
|
|
776
|
+
* @param ipcLogString 日志字符串
|
|
777
|
+
* @returns true/false
|
|
778
|
+
*/
|
|
779
|
+
export const ipcTTTOperatorLog = ipcLogString => {
|
|
780
|
+
return new Promise(resolve => {
|
|
781
|
+
try {
|
|
782
|
+
ty.ipc.ipcTTTOperatorLog({
|
|
783
|
+
ipcLogString,
|
|
784
|
+
success: res => {
|
|
785
|
+
console.log(res, 'res');
|
|
786
|
+
resolve({
|
|
787
|
+
code: 0,
|
|
788
|
+
data: res
|
|
789
|
+
});
|
|
790
|
+
},
|
|
791
|
+
fail: error => {
|
|
792
|
+
console.log(error, 'error');
|
|
793
|
+
resolve({
|
|
794
|
+
code: -1,
|
|
795
|
+
msg: error
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
} catch (err) {
|
|
800
|
+
resolve({
|
|
801
|
+
code: -1,
|
|
802
|
+
msg: String(err)
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
});
|
|
769
806
|
};
|
package/lib/service/index.js
CHANGED
|
@@ -147,59 +147,62 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
147
147
|
})) {
|
|
148
148
|
// 非虚拟机设备,请求接口
|
|
149
149
|
if (!isVirtualDevice) {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
const rtcInfo = await getIpcConfigInfo(deviceId);
|
|
151
|
+
if (rtcInfo.code === 0) {
|
|
152
|
+
var _rtcApiResult$audioAt, _rtcApiResult$audioAt2, _rtcApiResult$audioAt3;
|
|
153
|
+
const rtcApiResult = rtcInfo.data;
|
|
154
|
+
// 1. 拾音器模块
|
|
155
|
+
const isMicrophoneSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt === void 0 || (_rtcApiResult$audioAt = _rtcApiResult$audioAt.hardwareCapability) === null || _rtcApiResult$audioAt === void 0 ? void 0 : _rtcApiResult$audioAt.includes(1);
|
|
156
|
+
// 拾音器默认声音都为关闭, 若接口返回不支持,则将缓存值设置为关闭
|
|
157
|
+
microphoneSettings.isMicrophoneSupported = isMicrophoneSupported;
|
|
158
|
+
const muteStatus = isMicrophoneSupported ? microphoneSettings.cachedMuteMode : defaultMuteMode;
|
|
159
|
+
microphoneSettings.cachedMuteMode = muteStatus; // 设置默认值
|
|
152
160
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
intercomInfo.supportedIntercomModes = supportedIntercomModes.map(mode => intercomCallMode[mode]);
|
|
169
|
-
// 获取APP当前存储的对讲模式, 因目前设置页对讲设置使用的还是原生页面,需要读取APP缓存保持一致
|
|
170
|
-
const appIntercomCached = await getCurrentSupportedTalkMode(deviceId);
|
|
171
|
-
if (appIntercomCached.code !== 0) {
|
|
172
|
-
throw appIntercomCached.msg;
|
|
161
|
+
// 2. 对讲功能模块
|
|
162
|
+
const isIntercomSupported = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt2 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt2 === void 0 || (_rtcApiResult$audioAt2 = _rtcApiResult$audioAt2.hardwareCapability) === null || _rtcApiResult$audioAt2 === void 0 ? void 0 : _rtcApiResult$audioAt2.includes(2);
|
|
163
|
+
intercomInfo.isIntercomSupported = isIntercomSupported;
|
|
164
|
+
// 获取支持的对讲方式
|
|
165
|
+
const supportedIntercomModes = rtcApiResult === null || rtcApiResult === void 0 || (_rtcApiResult$audioAt3 = rtcApiResult.audioAttributes) === null || _rtcApiResult$audioAt3 === void 0 ? void 0 : _rtcApiResult$audioAt3.callMode;
|
|
166
|
+
if (isIntercomSupported && supportedIntercomModes.length > 0) {
|
|
167
|
+
var _appIntercomCached$da;
|
|
168
|
+
intercomInfo.defaultIntercomMode = intercomCallMode[supportedIntercomModes[0]];
|
|
169
|
+
intercomInfo.supportedIntercomModes = supportedIntercomModes.map(mode => intercomCallMode[mode]);
|
|
170
|
+
// 获取APP当前存储的对讲模式, 因目前设置页对讲设置使用的还是原生页面,需要读取APP缓存保持一致
|
|
171
|
+
const appIntercomCached = await getCurrentSupportedTalkMode(deviceId);
|
|
172
|
+
if (appIntercomCached.code !== 0) {
|
|
173
|
+
throw appIntercomCached.msg;
|
|
174
|
+
}
|
|
175
|
+
intercomInfo.cachedIntercomMode = intercomCallMode[appIntercomCached === null || appIntercomCached === void 0 || (_appIntercomCached$da = appIntercomCached.data) === null || _appIntercomCached$da === void 0 ? void 0 : _appIntercomCached$da.talkbackMode];
|
|
173
176
|
}
|
|
174
|
-
intercomInfo.cachedIntercomMode = intercomCallMode[appIntercomCached === null || appIntercomCached === void 0 || (_appIntercomCached$da = appIntercomCached.data) === null || _appIntercomCached$da === void 0 ? void 0 : _appIntercomCached$da.talkbackMode];
|
|
175
|
-
}
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
// 3. 视频分辨率模块
|
|
179
|
+
videoResolution.defaultResolution = videoResolutionMode[rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClarity];
|
|
180
|
+
console.log(rtcApiResult, 'rtcApiResult');
|
|
181
|
+
const supportedVideoClarity = rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.vedioClaritys;
|
|
182
|
+
videoResolution.availableResolutions = supportedVideoClarity.map(mode => videoResolutionMode[mode]);
|
|
181
183
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
// 4. 最大倍数模块
|
|
185
|
+
maxZoomSettings = (rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes) !== 0 ? rtcApiResult === null || rtcApiResult === void 0 ? void 0 : rtcApiResult.maxZoomInTimes : 6;
|
|
186
|
+
}
|
|
185
187
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
188
|
+
// 1. 设置拾音器缓存
|
|
189
|
+
if (!microphoneStorage.data) {
|
|
190
|
+
setNativeStorage(`${deviceId}_microphone`, microphoneSettings);
|
|
191
|
+
}
|
|
192
|
+
// 2. 设置对讲缓存
|
|
193
|
+
if (!intercomStorage.data) {
|
|
194
|
+
setNativeStorage(`${deviceId}_intercom`, intercomInfo);
|
|
195
|
+
}
|
|
194
196
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
// 3. 设置视频清晰度缓存
|
|
198
|
+
if (!resolutionStorage.data) {
|
|
199
|
+
setNativeStorage(`${deviceId}_resolution`, videoResolution);
|
|
200
|
+
}
|
|
199
201
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
202
|
+
// 4. 设置最大倍数缓存
|
|
203
|
+
if (!maxZoomSettingsStorage.data) {
|
|
204
|
+
setNativeStorage(`${deviceId}_maxZoomSettings`, maxZoomSettings);
|
|
205
|
+
}
|
|
203
206
|
}
|
|
204
207
|
} else {
|
|
205
208
|
var _appIntercomCached$da2, _intercomStorage$data;
|
|
@@ -228,13 +231,14 @@ export const getCameraConfigInfo = async deviceId => {
|
|
|
228
231
|
data: ipcConfig
|
|
229
232
|
});
|
|
230
233
|
} catch (err) {
|
|
234
|
+
console.log(err, 'err');
|
|
231
235
|
ty.showToast({
|
|
232
236
|
title: I18n.t('get_ipc_config_info_api_err'),
|
|
233
237
|
icon: 'error'
|
|
234
238
|
});
|
|
235
239
|
return Promise.resolve({
|
|
236
240
|
code: -1,
|
|
237
|
-
msg: String(err)
|
|
241
|
+
msg: err.errorMsg ? err.errorMsg : String(err)
|
|
238
242
|
});
|
|
239
243
|
}
|
|
240
244
|
};
|