@ray-js/robot-data-stream 0.0.17-beta.6 → 0.0.17-beta.8
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.
|
@@ -12,6 +12,8 @@ export interface SetCruiseData {
|
|
|
12
12
|
cruiseType?: CruiseType;
|
|
13
13
|
/** spot 定点巡航时的净化点坐标列表,格式 "x, y";不传表示全部净化点 */
|
|
14
14
|
polygons?: string[];
|
|
15
|
+
/** spot 定点巡航时的净化点数量,= polygons.length;不传时由设备侧根据 polygons 长度推断 */
|
|
16
|
+
num?: number;
|
|
15
17
|
version?: string;
|
|
16
18
|
}
|
|
17
19
|
export interface RequestCruiseData {
|
|
@@ -25,6 +27,8 @@ export interface CruiseResponse extends BaseResponse {
|
|
|
25
27
|
cruiseType?: CruiseType;
|
|
26
28
|
/** spot 定点巡航时的净化点坐标列表,格式 "x, y" */
|
|
27
29
|
polygons?: string[];
|
|
30
|
+
/** spot 定点巡航时的净化点数量 */
|
|
31
|
+
num?: number;
|
|
28
32
|
/** 当前正在净化的坐标 "x, y" */
|
|
29
33
|
currentPolygon?: string;
|
|
30
34
|
}
|
|
@@ -3,6 +3,7 @@ export interface SetSpotCleanData extends RoomPreferenceFields {
|
|
|
3
3
|
spots: Point[];
|
|
4
4
|
origin?: Point;
|
|
5
5
|
names?: string[];
|
|
6
|
+
spotNames?: string[];
|
|
6
7
|
}
|
|
7
8
|
export interface SpotCleanResponse extends BaseResponse {
|
|
8
9
|
suctions?: string[];
|
|
@@ -15,6 +16,7 @@ export interface SpotCleanResponse extends BaseResponse {
|
|
|
15
16
|
ids?: number[];
|
|
16
17
|
polygons: string[];
|
|
17
18
|
names?: string[];
|
|
19
|
+
spotNames?: string[];
|
|
18
20
|
}
|
|
19
21
|
export type TRequestSpotClean = () => Promise<SpotCleanResponse>;
|
|
20
22
|
export type TSetSpotClean = (data: SetSpotCleanData) => Promise<SpotCleanResponse>;
|
package/lib/mqtt/useSpotClean.js
CHANGED
|
@@ -62,10 +62,11 @@ export const useSpotClean = () => {
|
|
|
62
62
|
yMops = new Array(num).fill(-1),
|
|
63
63
|
sweepMopModes = new Array(num).fill('only_sweep'),
|
|
64
64
|
routePreferences,
|
|
65
|
-
names
|
|
65
|
+
names,
|
|
66
|
+
spotNames
|
|
66
67
|
} = message;
|
|
67
68
|
if (useMqtt) {
|
|
68
|
-
sendStructuredMessage(SpotCleanEnum.set, _objectSpread(_objectSpread(_objectSpread({
|
|
69
|
+
sendStructuredMessage(SpotCleanEnum.set, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
69
70
|
num,
|
|
70
71
|
polygons: spots.map(spot => pointsToString([spot], origin)),
|
|
71
72
|
suctions
|
|
@@ -77,6 +78,8 @@ export const useSpotClean = () => {
|
|
|
77
78
|
routePreferences
|
|
78
79
|
}), names && {
|
|
79
80
|
names
|
|
81
|
+
}), spotNames && {
|
|
82
|
+
spotNames
|
|
80
83
|
}), resolve, error => reject(handleMqttError(error, 'Failed to set spot clean')), SpotCleanEnum.query // 响应类型是 query,不是 set
|
|
81
84
|
);
|
|
82
85
|
return;
|
|
@@ -89,7 +92,7 @@ export const useSpotClean = () => {
|
|
|
89
92
|
point: spots[0]
|
|
90
93
|
});
|
|
91
94
|
devices.common.model.actions.command_trans.set(command);
|
|
92
|
-
resolve(_objectSpread(_objectSpread(_objectSpread({
|
|
95
|
+
resolve(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
93
96
|
success: true,
|
|
94
97
|
errCode: 0,
|
|
95
98
|
reqType: SpotCleanEnum.query,
|
|
@@ -105,6 +108,8 @@ export const useSpotClean = () => {
|
|
|
105
108
|
routePreferences
|
|
106
109
|
}), names && {
|
|
107
110
|
names
|
|
111
|
+
}), spotNames && {
|
|
112
|
+
spotNames
|
|
108
113
|
}));
|
|
109
114
|
} catch (error) {
|
|
110
115
|
reject(handleMqttError(error, 'Failed to set spot clean'));
|