@ray-js/robot-data-stream 0.0.12-beta-11 → 0.0.12-beta-13

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.
@@ -216,7 +216,7 @@ export class SweeperP2p extends P2pApi {
216
216
  this.reconnectP2p(() => {
217
217
  // 重连之后重新开启文件下载, 这里的成功不需要注册断开事件
218
218
  this.startObserverSweeperDataByP2P(this.downloadType, this.devId, this.onReceiveMapData, this.onReceivePathData, this.onReceiveAIPicData, this.onReceiveAIPicHDData);
219
- }, '1111');
219
+ }, '');
220
220
  } else {
221
221
  logger('warn', {
222
222
  msg: 'receive disconnect notice, but connectDevice is connecting'
package/lib/index.js CHANGED
@@ -51,9 +51,9 @@ const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
51
51
  deviceId: devId
52
52
  })}`
53
53
  }, onLogger);
54
- if (!isInit.current || !((_ty$p2p$isP2PActiveSy2 = (_ty$p2p2 = ty.p2p).isP2PActiveSync) !== null && _ty$p2p$isP2PActiveSy2 !== void 0 && _ty$p2p$isP2PActiveSy2.call(_ty$p2p2, {
54
+ if ((!isInit.current || !((_ty$p2p$isP2PActiveSy2 = (_ty$p2p2 = ty.p2p).isP2PActiveSync) !== null && _ty$p2p$isP2PActiveSy2 !== void 0 && _ty$p2p$isP2PActiveSy2.call(_ty$p2p2, {
55
55
  deviceId: devId
56
- }))) {
56
+ }))) && !SweeperP2pInstance.isConnecting) {
57
57
  connectP2p();
58
58
  }
59
59
  }, 500);
@@ -111,7 +111,6 @@ const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
111
111
  logger('info', {
112
112
  msg: 'hooks has been started connectP2p'
113
113
  }, onLogger);
114
- SweeperP2pInstance.isConnecting = true;
115
114
  SweeperP2pInstance.connectDevice(() => {
116
115
  trace.pointFn('p2p', {
117
116
  devId,
@@ -134,7 +133,7 @@ const useP2PDataStream = (devId, onReceiveMapData, onReceivePathData, opt) => {
134
133
  SweeperP2pInstance.startObserverSweeperDataByP2P(1, devId, onReceiveMapData, onReceivePathData, onReceiveAIPicData, onReceiveAIPicHDData);
135
134
  // 这里失败重连需要注册断开重连的事件
136
135
  offSessionStatusChange.current = SweeperP2pInstance.onSessionStatusChange(SweeperP2pInstance.sessionStatusCallback);
137
- }, '22222');
136
+ }, '');
138
137
  });
139
138
  };
140
139
 
@@ -1,5 +1,5 @@
1
1
  import { PromiseWithRejection } from './promise';
2
- type TRequestPassword = () => PromiseWithRejection;
2
+ type TRequestPassword = () => PromiseWithRejection | Promise<void>;
3
3
  type TSetPassword = (params: {
4
4
  password: string;
5
5
  oldPassword?: string;
@@ -17,7 +17,7 @@ export const usePassword = devId => {
17
17
 
18
18
  return {
19
19
  requestPassword: () => {
20
- if (!useMqtt) return null;
20
+ if (!useMqtt) return Promise.reject(new Error('useMqtt is not used'));
21
21
  const params = createSetCommonParams({
22
22
  deviceId: devId,
23
23
  reqType: PasswordEnum.query
@@ -15,7 +15,7 @@ export const useRoomProperty = devId => {
15
15
 
16
16
  return {
17
17
  requestRoomProperty: () => {
18
- if (!useMqtt) return null;
18
+ if (!useMqtt) return Promise.reject(new Error('useMqtt is not used'));
19
19
  const params = createSetCommonParams({
20
20
  deviceId: devId,
21
21
  reqType: RoomPropertyEnum.query
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/robot-data-stream",
3
- "version": "0.0.12-beta-11",
3
+ "version": "0.0.12-beta-13",
4
4
  "description": "扫地机P2P数据流标准化组件",
5
5
  "main": "lib/index",
6
6
  "files": [