@ray-js/robot-data-stream 0.0.12-beta-1 → 0.0.12-beta-3
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/p2pApi.js +1 -2
- package/lib/api/sweeperP2p.js +20 -4
- package/lib/mqtt/promise.js +1 -1
- package/package.json +1 -1
package/lib/api/p2pApi.js
CHANGED
|
@@ -108,8 +108,7 @@ export default class P2pApi {
|
|
|
108
108
|
},
|
|
109
109
|
fail: params => {
|
|
110
110
|
logger('warn', {
|
|
111
|
-
msg:
|
|
112
|
-
params
|
|
111
|
+
msg: `p2p connectDevice failed ==> ${JSON.stringify(params.innerError)}`
|
|
113
112
|
}, this.onLogger);
|
|
114
113
|
typeof failCb === 'function' && failCb();
|
|
115
114
|
resolve(false);
|
package/lib/api/sweeperP2p.js
CHANGED
|
@@ -2,11 +2,11 @@ import "core-js/modules/esnext.iterator.constructor.js";
|
|
|
2
2
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
3
3
|
import "core-js/modules/esnext.iterator.map.js";
|
|
4
4
|
/* eslint-disable no-shadow */
|
|
5
|
-
import P2pApi from './p2pApi';
|
|
6
5
|
import Base64 from 'base64-js';
|
|
7
|
-
import {
|
|
8
|
-
import { logger } from '../utils';
|
|
6
|
+
import { join, map, padStart } from 'lodash-es';
|
|
9
7
|
import { trace } from '../trace';
|
|
8
|
+
import { logger } from '../utils';
|
|
9
|
+
import P2pApi from './p2pApi';
|
|
10
10
|
/**
|
|
11
11
|
* 基于P2p工具类的扫地机扩展实现
|
|
12
12
|
*/
|
|
@@ -275,7 +275,23 @@ export class SweeperP2p extends P2pApi {
|
|
|
275
275
|
// 开启p2p流传输
|
|
276
276
|
await this.downloadStream({
|
|
277
277
|
files: exitFiles
|
|
278
|
-
}, this.albumName)
|
|
278
|
+
}, this.albumName, () => {
|
|
279
|
+
logger('info', {
|
|
280
|
+
msg: 'p2p downloadStream success===>'
|
|
281
|
+
}, this.onLogger);
|
|
282
|
+
}, () => {
|
|
283
|
+
logger('error', {
|
|
284
|
+
msg: 'p2p downloadStream failed and try reConnect Device===>'
|
|
285
|
+
}, this.onLogger);
|
|
286
|
+
this.removeP2pDownloadEvent();
|
|
287
|
+
this.disconnectDevice();
|
|
288
|
+
this.isConnected = false;
|
|
289
|
+
this.isConnecting = false;
|
|
290
|
+
this.reconnectP2p(() => {
|
|
291
|
+
// 重连之后重新开启文件下载, 这里的成功不需要注册断开事件
|
|
292
|
+
this.startObserverSweeperDataByP2P(this.downloadType, this.devId, this.onReceiveMapData, this.onReceivePathData, this.onReceiveAIPicData, this.onReceiveAIPicHDData);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
279
295
|
} else if (await this.initFilePath(this.dataFilePath)) {
|
|
280
296
|
await this.downloadFile({
|
|
281
297
|
files: exitFiles
|
package/lib/mqtt/promise.js
CHANGED
|
@@ -22,7 +22,7 @@ export function normalResolve(reqType, taskId) {
|
|
|
22
22
|
return new Promise((resolve, reject) => {
|
|
23
23
|
// 设置超时定时器
|
|
24
24
|
const timer = setTimeout(() => {
|
|
25
|
-
reject(new MyError(`${taskId} Request timed out `, {
|
|
25
|
+
reject(new MyError(`${taskId} ${reqType} Request timed out `, {
|
|
26
26
|
errCode: -1,
|
|
27
27
|
reqType
|
|
28
28
|
}));
|