@ray-js/robot-data-stream 0.0.13-beta-7 → 0.0.13-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.
- package/lib/api/index.d.ts +2 -12
- package/lib/api/index.js +1 -172
- package/lib/api/p2pApi.d.ts +8 -27
- package/lib/api/p2pApi.js +271 -169
- package/lib/api/sweeperP2p.d.ts +55 -21
- package/lib/api/sweeperP2p.js +376 -246
- package/lib/constant.d.ts +0 -52
- package/lib/constant.js +0 -54
- package/lib/index.d.ts +12 -1
- package/lib/index.js +187 -2
- package/lib/mqtt/createCommonOptions.d.ts +15 -56
- package/lib/mqtt/createCommonOptions.js +8 -44
- package/lib/mqtt/mqttProvider.d.ts +15 -23
- package/lib/mqtt/mqttProvider.js +26 -63
- package/lib/mqtt/myError.d.ts +4 -0
- package/lib/mqtt/myError.js +6 -0
- package/lib/mqtt/promise.js +3 -8
- package/lib/mqtt/type/index.d.ts +0 -9
- package/lib/mqtt/type/index.js +0 -8
- package/lib/mqtt/type/requestType.d.ts +0 -3
- package/lib/mqtt/type/requestType.js +0 -4
- package/lib/mqtt/useDevInfo.d.ts +7 -2
- package/lib/mqtt/useDevInfo.js +9 -25
- package/lib/mqtt/useHistoryMap.d.ts +21 -13
- package/lib/mqtt/useHistoryMap.js +32 -82
- package/lib/mqtt/usePartDivision.d.ts +7 -5
- package/lib/mqtt/usePartDivision.js +16 -41
- package/lib/mqtt/usePartMerge.d.ts +7 -5
- package/lib/mqtt/usePartMerge.js +18 -36
- package/lib/mqtt/usePassword.js +28 -59
- package/lib/mqtt/useQuiteHours.d.ts +24 -9
- package/lib/mqtt/useQuiteHours.js +52 -95
- package/lib/mqtt/useResetMap.d.ts +7 -10
- package/lib/mqtt/useResetMap.js +11 -40
- package/lib/mqtt/useRoomProperty.js +16 -23
- package/lib/mqtt/useSchedule.d.ts +4 -17
- package/lib/mqtt/useSchedule.js +49 -101
- package/lib/mqtt/useSelectRoomClean.d.ts +16 -20
- package/lib/mqtt/useSelectRoomClean.js +49 -145
- package/lib/mqtt/useSpotClean.d.ts +3 -3
- package/lib/mqtt/useSpotClean.js +51 -71
- package/lib/mqtt/useVirtualArea.d.ts +9 -6
- package/lib/mqtt/useVirtualArea.js +42 -112
- package/lib/mqtt/useVirtualWall.d.ts +10 -13
- package/lib/mqtt/useVirtualWall.js +34 -97
- package/lib/mqtt/useVoice.d.ts +6 -3
- package/lib/mqtt/useVoice.js +33 -73
- package/lib/mqtt/useWifiMap.js +18 -34
- package/lib/mqtt/useZoneClean.d.ts +13 -13
- package/lib/mqtt/useZoneClean.js +76 -149
- package/lib/utils/index.d.ts +7 -18
- package/lib/utils/index.js +13 -15
- package/package.json +1 -1
- package/lib/ttt/index.d.ts +0 -153
- package/lib/ttt/index.js +0 -458
package/lib/mqtt/useZoneClean.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
2
2
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
3
|
-
import "core-js/modules/esnext.iterator.map.js";
|
|
4
3
|
// 划区清扫
|
|
4
|
+
|
|
5
5
|
import { isArray } from 'lodash-es';
|
|
6
6
|
import { createSetCommonParams } from './createCommonOptions';
|
|
7
7
|
import { normalResolve } from './promise';
|
|
@@ -10,19 +10,9 @@ import { useContext } from 'react';
|
|
|
10
10
|
import { SingletonContext } from './mqttProvider';
|
|
11
11
|
import { encodeZoneClean0x3a, requestZoneClean0x3b } from '@ray-js/robot-protocol';
|
|
12
12
|
import { pointsToString } from '../utils';
|
|
13
|
-
|
|
14
|
-
// 划区清扫响应类型
|
|
15
|
-
|
|
16
|
-
// 设置划区清扫参数类型
|
|
17
|
-
|
|
18
|
-
// 请求划区清扫函数类型定义
|
|
19
|
-
|
|
20
|
-
// 设置划区清扫函数类型定义
|
|
21
|
-
|
|
22
13
|
/**
|
|
23
|
-
*
|
|
24
|
-
* @
|
|
25
|
-
* @returns 包含 requestZoneClean 和 setZoneClean 函数的对象
|
|
14
|
+
* 划区清扫
|
|
15
|
+
* @returns
|
|
26
16
|
*/
|
|
27
17
|
export const useZoneClean = devId => {
|
|
28
18
|
const {
|
|
@@ -31,158 +21,95 @@ export const useZoneClean = devId => {
|
|
|
31
21
|
devices
|
|
32
22
|
} = useContext(SingletonContext);
|
|
33
23
|
|
|
34
|
-
|
|
35
|
-
* 请求划区清扫信息
|
|
36
|
-
* @returns Promise<ZoneCleanResponse> 响应结果
|
|
37
|
-
*/
|
|
24
|
+
// 请求划区清扫信息
|
|
38
25
|
|
|
39
|
-
|
|
40
|
-
* 设置划区清扫
|
|
41
|
-
* @param params 包含划区清扫设置参数的对象
|
|
42
|
-
* @param params.zones 区域数组
|
|
43
|
-
* @param params.origin 原点坐标
|
|
44
|
-
* @returns Promise<ZoneCleanResponse> 响应结果
|
|
45
|
-
*/
|
|
26
|
+
// 设置划区清扫
|
|
46
27
|
|
|
47
28
|
return {
|
|
48
29
|
requestZoneClean: () => {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
reqType: ZoneCleanEnum.query
|
|
54
|
-
});
|
|
55
|
-
ty.device.sendMqttMessage(params);
|
|
56
|
-
const {
|
|
57
|
-
taskId
|
|
58
|
-
} = params.message;
|
|
59
|
-
return normalResolve(ZoneCleanEnum.query, taskId);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// 非 MQTT 模式:使用命令传输
|
|
63
|
-
devices.common.model.actions.command_trans.set(requestZoneClean0x3b({
|
|
64
|
-
version: commandVersion
|
|
65
|
-
}));
|
|
66
|
-
|
|
67
|
-
// 非 MQTT 模式下无法立即获取响应数据,返回默认响应
|
|
68
|
-
return Promise.resolve({
|
|
69
|
-
success: true,
|
|
70
|
-
errCode: 0,
|
|
71
|
-
reqType: ZoneCleanEnum.query,
|
|
72
|
-
version: commandVersion,
|
|
73
|
-
taskId: `${Date.now()}`,
|
|
74
|
-
polygons: [],
|
|
75
|
-
names: []
|
|
30
|
+
if (useMqtt) {
|
|
31
|
+
const params = createSetCommonParams({
|
|
32
|
+
deviceId: devId,
|
|
33
|
+
reqType: ZoneCleanEnum.query
|
|
76
34
|
});
|
|
77
|
-
|
|
78
|
-
return
|
|
35
|
+
ty.device.sendMqttMessage(params);
|
|
36
|
+
return normalResolve(ZoneCleanEnum.query, params.message.taskId);
|
|
79
37
|
}
|
|
38
|
+
return devices.common.model.actions.command_trans.set(requestZoneClean0x3b({
|
|
39
|
+
version: commandVersion
|
|
40
|
+
}));
|
|
80
41
|
},
|
|
81
|
-
setZoneClean:
|
|
42
|
+
setZoneClean: message => {
|
|
82
43
|
const {
|
|
83
44
|
zones,
|
|
84
45
|
origin
|
|
85
|
-
} =
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
throw new Error('zones is required and must be a non-empty array');
|
|
90
|
-
}
|
|
91
|
-
if (!origin || typeof origin.x !== 'number' || typeof origin.y !== 'number') {
|
|
92
|
-
throw new Error('origin is required and must be a valid Point object with x and y properties');
|
|
93
|
-
}
|
|
94
|
-
try {
|
|
95
|
-
if (useMqtt) {
|
|
96
|
-
const num = zones.length;
|
|
97
|
-
const {
|
|
98
|
-
suctions = new Array(num).fill(''),
|
|
99
|
-
cisterns = new Array(num).fill(''),
|
|
100
|
-
cleanCounts = new Array(num).fill(1),
|
|
101
|
-
yMops = new Array(num).fill(-1),
|
|
102
|
-
sweepMopModes = new Array(num).fill('only_sweep')
|
|
103
|
-
} = params;
|
|
104
|
-
if (suctions && !isArray(suctions)) {
|
|
105
|
-
throw new Error('suctions is illegal');
|
|
106
|
-
}
|
|
107
|
-
if (cisterns && !isArray(cisterns)) {
|
|
108
|
-
throw new Error('cisterns is illegal');
|
|
109
|
-
}
|
|
110
|
-
if (cleanCounts && !isArray(cleanCounts)) {
|
|
111
|
-
throw new Error('cleanCounts is illegal');
|
|
112
|
-
}
|
|
113
|
-
if (yMops && !isArray(yMops)) {
|
|
114
|
-
throw new Error('yMops is illegal');
|
|
115
|
-
}
|
|
116
|
-
if (sweepMopModes && !isArray(sweepMopModes)) {
|
|
117
|
-
throw new Error('sweepMopModes is illegal');
|
|
118
|
-
}
|
|
119
|
-
if (num !== suctions.length || num !== cisterns.length || num !== cleanCounts.length || num !== yMops.length || num !== sweepMopModes.length) {
|
|
120
|
-
throw new Error('The length of the parameters is inconsistent');
|
|
121
|
-
}
|
|
122
|
-
const polygons = [];
|
|
123
|
-
const names = [];
|
|
124
|
-
zones.forEach(_ref => {
|
|
125
|
-
let {
|
|
126
|
-
points,
|
|
127
|
-
name
|
|
128
|
-
} = _ref;
|
|
129
|
-
polygons.push(pointsToString(points, origin));
|
|
130
|
-
names.push(name || '');
|
|
131
|
-
});
|
|
132
|
-
const mqttParams = createSetCommonParams({
|
|
133
|
-
deviceId: devId,
|
|
134
|
-
reqType: ZoneCleanEnum.set,
|
|
135
|
-
message: {
|
|
136
|
-
num: zones.length,
|
|
137
|
-
switchGo: true,
|
|
138
|
-
polygons,
|
|
139
|
-
suctions,
|
|
140
|
-
cisterns,
|
|
141
|
-
cleanCounts,
|
|
142
|
-
yMops,
|
|
143
|
-
sweepMopModes,
|
|
144
|
-
names
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
ty.device.sendMqttMessage(mqttParams);
|
|
148
|
-
const {
|
|
149
|
-
taskId
|
|
150
|
-
} = mqttParams.message;
|
|
151
|
-
return normalResolve(ZoneCleanEnum.query, taskId);
|
|
46
|
+
} = message;
|
|
47
|
+
if (useMqtt) {
|
|
48
|
+
if (!isArray(zones) || isArray(zones) && zones.length === 0) {
|
|
49
|
+
return Promise.reject(new Error('message is required'));
|
|
152
50
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
51
|
+
const num = zones.length;
|
|
52
|
+
const {
|
|
53
|
+
suctions = new Array(num).fill(''),
|
|
54
|
+
cisterns = new Array(num).fill(''),
|
|
55
|
+
cleanCounts = new Array(num).fill(1),
|
|
56
|
+
yMops = new Array(num).fill(-1),
|
|
57
|
+
sweepMopModes = new Array(num).fill('only_sweep')
|
|
58
|
+
} = message;
|
|
59
|
+
if (suctions && !isArray(suctions)) {
|
|
60
|
+
return Promise.reject(new Error('suctions is illegal'));
|
|
61
|
+
}
|
|
62
|
+
if (cisterns && !isArray(cisterns)) {
|
|
63
|
+
return Promise.reject(new Error('cisterns is illegal'));
|
|
64
|
+
}
|
|
65
|
+
if (cleanCounts && !isArray(cleanCounts)) {
|
|
66
|
+
return Promise.reject(new Error('cleanCounts is illegal'));
|
|
67
|
+
}
|
|
68
|
+
if (yMops && !isArray(yMops)) {
|
|
69
|
+
return Promise.reject(new Error('yMops is illegal'));
|
|
70
|
+
}
|
|
71
|
+
if (sweepMopModes && !isArray(sweepMopModes)) {
|
|
72
|
+
return Promise.reject(new Error('sweepMopModes is illegal'));
|
|
73
|
+
}
|
|
74
|
+
if (num !== suctions.length || num !== cisterns.length || num !== cleanCounts.length || num !== yMops.length || num !== sweepMopModes.length) {
|
|
75
|
+
return Promise.reject(new Error('The length of the parameters is inconsistent'));
|
|
76
|
+
}
|
|
77
|
+
const polygons = [];
|
|
78
|
+
const names = [];
|
|
79
|
+
zones.forEach(_ref => {
|
|
169
80
|
let {
|
|
81
|
+
points,
|
|
170
82
|
name
|
|
171
|
-
} =
|
|
172
|
-
|
|
83
|
+
} = _ref;
|
|
84
|
+
polygons.push(pointsToString(points, origin));
|
|
85
|
+
names.push(name || '');
|
|
173
86
|
});
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
87
|
+
const params = createSetCommonParams({
|
|
88
|
+
deviceId: devId,
|
|
89
|
+
reqType: ZoneCleanEnum.set,
|
|
90
|
+
message: {
|
|
91
|
+
num: zones.length,
|
|
92
|
+
switchGo: true,
|
|
93
|
+
polygons,
|
|
94
|
+
suctions,
|
|
95
|
+
cisterns,
|
|
96
|
+
cleanCounts,
|
|
97
|
+
yMops,
|
|
98
|
+
sweepMopModes,
|
|
99
|
+
names
|
|
100
|
+
}
|
|
182
101
|
});
|
|
183
|
-
|
|
184
|
-
|
|
102
|
+
ty.device.sendMqttMessage(params);
|
|
103
|
+
return normalResolve(ZoneCleanEnum.query, params.message.taskId);
|
|
185
104
|
}
|
|
105
|
+
const command = encodeZoneClean0x3a({
|
|
106
|
+
protocolVersion: 1,
|
|
107
|
+
version: commandVersion,
|
|
108
|
+
origin,
|
|
109
|
+
zones
|
|
110
|
+
});
|
|
111
|
+
devices.common.model.actions.command_trans.set(command);
|
|
112
|
+
return Promise.resolve();
|
|
186
113
|
}
|
|
187
114
|
};
|
|
188
115
|
};
|
package/lib/utils/index.d.ts
CHANGED
|
@@ -9,23 +9,12 @@ export declare const parseJSON: (str: any) => any;
|
|
|
9
9
|
export declare const logger: (type: 'warn' | 'error' | 'info', params: {
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
msg: string;
|
|
12
|
-
}, onLogger
|
|
12
|
+
}, onLogger: (type: 'warn' | 'error' | 'info', v: string) => void) => void;
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param
|
|
16
|
-
* @
|
|
14
|
+
* 封装的 P2P 日志记录函数,根据 enableCustomLog 参数决定是否记录日志
|
|
15
|
+
* @param enableCustomLog 是否启用自定义日志
|
|
16
|
+
* @param devId 设备ID
|
|
17
|
+
* @param event 事件名称
|
|
18
|
+
* @param message 日志消息
|
|
17
19
|
*/
|
|
18
|
-
export declare const
|
|
19
|
-
info: (params: {
|
|
20
|
-
[key: string]: any;
|
|
21
|
-
msg: string;
|
|
22
|
-
}) => void;
|
|
23
|
-
warn: (params: {
|
|
24
|
-
[key: string]: any;
|
|
25
|
-
msg: string;
|
|
26
|
-
}) => void;
|
|
27
|
-
error: (params: {
|
|
28
|
-
[key: string]: any;
|
|
29
|
-
msg: string;
|
|
30
|
-
}) => void;
|
|
31
|
-
};
|
|
20
|
+
export declare const logP2PDataIfEnabled: (enableCustomLog: boolean, devId: string, event: string, message: string) => void;
|
package/lib/utils/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import mitt from 'mitt';
|
|
2
2
|
import { floor, join, map } from 'lodash-es';
|
|
3
3
|
import log4js from '@ray-js/log4js';
|
|
4
|
+
import { logP2PData as originalLogP2PData } from '@ray-js/robot-custom-log';
|
|
4
5
|
export const emitter = mitt();
|
|
5
6
|
const pointToString = point => {
|
|
6
7
|
return `${point.x},${point.y}`;
|
|
@@ -62,20 +63,17 @@ export const logger = (type, params, onLogger) => {
|
|
|
62
63
|
};
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
|
-
*
|
|
66
|
-
* @param
|
|
67
|
-
* @
|
|
66
|
+
* 封装的 P2P 日志记录函数,根据 enableCustomLog 参数决定是否记录日志
|
|
67
|
+
* @param enableCustomLog 是否启用自定义日志
|
|
68
|
+
* @param devId 设备ID
|
|
69
|
+
* @param event 事件名称
|
|
70
|
+
* @param message 日志消息
|
|
68
71
|
*/
|
|
69
|
-
export const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
},
|
|
77
|
-
error: params => {
|
|
78
|
-
logger('error', params, onLogger);
|
|
79
|
-
}
|
|
80
|
-
};
|
|
72
|
+
export const logP2PDataIfEnabled = (enableCustomLog, devId, event, message) => {
|
|
73
|
+
if (enableCustomLog) {
|
|
74
|
+
originalLogP2PData(devId, JSON.stringify({
|
|
75
|
+
event,
|
|
76
|
+
message
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
81
79
|
};
|
package/package.json
CHANGED
package/lib/ttt/index.d.ts
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* API 错误参数
|
|
3
|
-
*/
|
|
4
|
-
export interface ApiErrorParams {
|
|
5
|
-
errorMsg?: string;
|
|
6
|
-
errorCode?: string | number;
|
|
7
|
-
innerError?: {
|
|
8
|
-
errorCode: string | number;
|
|
9
|
-
errorMsg: string;
|
|
10
|
-
};
|
|
11
|
-
[key: string]: any;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* 通用 API 响应类型
|
|
15
|
-
* @template TSuccess 成功时的数据类型
|
|
16
|
-
* @template TError 失败时的错误类型,默认为 ApiErrorParams
|
|
17
|
-
*/
|
|
18
|
-
export interface ApiResponse<TSuccess = any, TError = ApiErrorParams> {
|
|
19
|
-
/** 操作是否成功 */
|
|
20
|
-
success: boolean;
|
|
21
|
-
/** 响应数据(成功时为 TSuccess,失败时为 TError) */
|
|
22
|
-
data?: TSuccess | TError;
|
|
23
|
-
/** 响应参数(P2P API 使用,成功时为 TSuccess,失败时为 TError) */
|
|
24
|
-
params?: TSuccess | TError;
|
|
25
|
-
/** 错误信息(失败时使用) */
|
|
26
|
-
error?: TError;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* 文件读取成功响应
|
|
30
|
-
*/
|
|
31
|
-
export interface FileReadSuccess {
|
|
32
|
-
/** 文件内容(Base64 编码) */
|
|
33
|
-
data: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 相册文件索引查询成功响应
|
|
37
|
-
*/
|
|
38
|
-
export interface AlbumFileIndexSuccess {
|
|
39
|
-
/** 文件数量 */
|
|
40
|
-
count: number;
|
|
41
|
-
/** 文件索引列表 */
|
|
42
|
-
items: ty.p2p.ThingP2PAlbumFileIndex[];
|
|
43
|
-
}
|
|
44
|
-
type TOnLogger = (type: 'warn' | 'error' | 'info', data: string) => void;
|
|
45
|
-
/**
|
|
46
|
-
* 创建文件路径(目录)
|
|
47
|
-
*
|
|
48
|
-
* @param filePath - 文件路径
|
|
49
|
-
* @returns Promise,成功时返回 true,失败时抛出错误
|
|
50
|
-
*/
|
|
51
|
-
export declare const createFilePath: (filePath: string, onLogger: TOnLogger) => Promise<boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* 检查目录是否存在
|
|
54
|
-
*
|
|
55
|
-
* @param filePath - 文件路径
|
|
56
|
-
* @returns Promise,返回检查结果
|
|
57
|
-
*/
|
|
58
|
-
export declare const checkIfDirIsExist: (filePath: string) => Promise<boolean>;
|
|
59
|
-
/**
|
|
60
|
-
* 读取文件内容(Base64 编码)
|
|
61
|
-
*
|
|
62
|
-
* @param filePath - 文件路径
|
|
63
|
-
* @returns Promise,返回文件读取结果
|
|
64
|
-
*/
|
|
65
|
-
export declare const readFile: (filePath: string, onLogger: TOnLogger) => Promise<ApiResponse<FileReadSuccess, ApiErrorParams>>;
|
|
66
|
-
/**
|
|
67
|
-
* 初始化 P2P SDK
|
|
68
|
-
*
|
|
69
|
-
* @returns Promise,返回初始化结果
|
|
70
|
-
*/
|
|
71
|
-
export declare const initP2pSdk: (onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
72
|
-
/**
|
|
73
|
-
* 连接设备
|
|
74
|
-
*
|
|
75
|
-
* @param devId - 设备ID
|
|
76
|
-
* @returns Promise,返回连接结果
|
|
77
|
-
*/
|
|
78
|
-
export declare const connectDevice: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
79
|
-
/**
|
|
80
|
-
* 断开设备连接
|
|
81
|
-
*
|
|
82
|
-
* @param devId - 设备ID
|
|
83
|
-
* @returns Promise,返回断开连接结果
|
|
84
|
-
*/
|
|
85
|
-
export declare const disconnectDevice: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
86
|
-
/**
|
|
87
|
-
* 下载流数据
|
|
88
|
-
*
|
|
89
|
-
* @param devId - 设备ID
|
|
90
|
-
* @param albumName - 相册名称
|
|
91
|
-
* @param files - 文件列表
|
|
92
|
-
* @returns Promise,返回下载结果
|
|
93
|
-
*/
|
|
94
|
-
export declare const downloadStream: (devId: string, albumName: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
95
|
-
/**
|
|
96
|
-
* 追加下载流数据
|
|
97
|
-
*
|
|
98
|
-
* @param devId - 设备ID
|
|
99
|
-
* @param albumName - 相册名称
|
|
100
|
-
* @param files - 文件列表
|
|
101
|
-
* @param onLogger - 日志回调函数
|
|
102
|
-
* @returns Promise,返回追加下载结果
|
|
103
|
-
*/
|
|
104
|
-
export declare const appendDownloadStream: (devId: string, albumName: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
105
|
-
/**
|
|
106
|
-
* 下载文件
|
|
107
|
-
*
|
|
108
|
-
* @param devId - 设备ID
|
|
109
|
-
* @param albumName - 相册名称
|
|
110
|
-
* @param filePath - 文件保存路径
|
|
111
|
-
* @param files - 文件列表
|
|
112
|
-
* @returns Promise,返回下载结果
|
|
113
|
-
*/
|
|
114
|
-
export declare const downloadFile: (devId: string, albumName: string, filePath: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
115
|
-
/**
|
|
116
|
-
* 取消下载任务
|
|
117
|
-
*
|
|
118
|
-
* @param devId - 设备ID
|
|
119
|
-
* @returns Promise,返回取消结果
|
|
120
|
-
*/
|
|
121
|
-
export declare const cancelDownloadTask: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
122
|
-
/**
|
|
123
|
-
* 查询相册文件索引
|
|
124
|
-
*
|
|
125
|
-
* @param devId - 设备ID
|
|
126
|
-
* @param albumName - 相册名称
|
|
127
|
-
* @returns Promise,返回查询结果
|
|
128
|
-
*/
|
|
129
|
-
export declare const queryAlbumFileIndexs: (devId: string, albumName: string, onLogger: TOnLogger) => Promise<ApiResponse<AlbumFileIndexSuccess, ApiErrorParams>>;
|
|
130
|
-
/**
|
|
131
|
-
* 反初始化 P2P SDK
|
|
132
|
-
*
|
|
133
|
-
* @returns Promise,返回反初始化结果
|
|
134
|
-
*/
|
|
135
|
-
export declare const deInitP2pSdk: (onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
136
|
-
/**
|
|
137
|
-
* TTT API 集合
|
|
138
|
-
*/
|
|
139
|
-
export declare const apis: {
|
|
140
|
-
readonly createFilePath: (filePath: string, onLogger: TOnLogger) => Promise<boolean>;
|
|
141
|
-
readonly checkIfDirIsExist: (filePath: string) => Promise<boolean>;
|
|
142
|
-
readonly readFile: (filePath: string, onLogger: TOnLogger) => Promise<ApiResponse<FileReadSuccess, ApiErrorParams>>;
|
|
143
|
-
readonly initP2pSdk: (onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
144
|
-
readonly connectDevice: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
145
|
-
readonly disconnectDevice: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
146
|
-
readonly downloadStream: (devId: string, albumName: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
147
|
-
readonly appendDownloadStream: (devId: string, albumName: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
148
|
-
readonly downloadFile: (devId: string, albumName: string, filePath: string, files: string[], onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
149
|
-
readonly cancelDownloadTask: (devId: string, onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
150
|
-
readonly queryAlbumFileIndexs: (devId: string, albumName: string, onLogger: TOnLogger) => Promise<ApiResponse<AlbumFileIndexSuccess, ApiErrorParams>>;
|
|
151
|
-
readonly deInitP2pSdk: (onLogger: TOnLogger) => Promise<ApiResponse<null, ApiErrorParams>>;
|
|
152
|
-
};
|
|
153
|
-
export {};
|