@ray-js/robot-data-stream 0.1.2 → 0.1.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/README.md +68 -13
- package/docs/reference/message-format.md +339 -0
- package/docs/reference/mqtt-hooks.md +935 -0
- package/lib/mqtt/index.d.ts +2 -1
- package/lib/mqtt/index.js +2 -1
- package/lib/mqtt/type/protocols/index.d.ts +1 -0
- package/lib/mqtt/type/protocols/index.js +1 -0
- package/lib/mqtt/type/protocols/resetPartDivisionProtocol.d.ts +3 -0
- package/lib/mqtt/type/protocols/resetPartDivisionProtocol.js +1 -0
- package/lib/mqtt/type/requestType.d.ts +4 -0
- package/lib/mqtt/type/requestType.js +7 -0
- package/lib/mqtt/useResetPartDivision.d.ts +4 -0
- package/lib/mqtt/useResetPartDivision.js +14 -0
- package/package.json +4 -2
package/lib/mqtt/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { MqttProvider } from './mqttProvider';
|
|
|
2
2
|
import { useDevInfo } from './useDevInfo';
|
|
3
3
|
import { usePartDivision } from './usePartDivision';
|
|
4
4
|
import { usePartMerge } from './usePartMerge';
|
|
5
|
+
import { useResetPartDivision } from './useResetPartDivision';
|
|
5
6
|
import { usePassword } from './usePassword';
|
|
6
7
|
import { useWifiMap } from './useWifiMap';
|
|
7
8
|
import { useQuiteHours } from './useQuiteHours';
|
|
@@ -26,7 +27,7 @@ import { useMcsRoomInfo } from './useMcsRoomInfo';
|
|
|
26
27
|
import { useThreshold } from './useThreshold';
|
|
27
28
|
import { useCustomCommand } from './useCustomCommand';
|
|
28
29
|
import { defineRobotCommand } from './defineRobotCommand';
|
|
29
|
-
export { useCarpet, useCarpetClean, useVoice, MqttProvider, useDeviceModel, useFurnitureModel, useDevInfo, usePartMerge, usePartDivision, usePassword, useWifiMap, useQuiteHours, useVirtualArea, useSpotClean, useZoneClean, useSelectRoomClean, useVirtualWall, useSchedule, useHistoryMap, useRoomProperty, useResetMap, usePurifierSchedule, useCruise, useSpotPolygons, useMcsRoomInfo, useThreshold, useCustomCommand, defineRobotCommand, };
|
|
30
|
+
export { useCarpet, useCarpetClean, useVoice, MqttProvider, useDeviceModel, useFurnitureModel, useDevInfo, usePartMerge, usePartDivision, useResetPartDivision, usePassword, useWifiMap, useQuiteHours, useVirtualArea, useSpotClean, useZoneClean, useSelectRoomClean, useVirtualWall, useSchedule, useHistoryMap, useRoomProperty, useResetMap, usePurifierSchedule, useCruise, useSpotPolygons, useMcsRoomInfo, useThreshold, useCustomCommand, defineRobotCommand, };
|
|
30
31
|
export type { CustomCommandOptions, TSendCustomCommand } from './useCustomCommand';
|
|
31
32
|
export type { RobotCommandConfig, DefinedRobotCommand } from './defineRobotCommand';
|
|
32
33
|
export * from './type/protocols';
|
package/lib/mqtt/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { MqttProvider } from './mqttProvider';
|
|
|
2
2
|
import { useDevInfo } from './useDevInfo';
|
|
3
3
|
import { usePartDivision } from './usePartDivision';
|
|
4
4
|
import { usePartMerge } from './usePartMerge';
|
|
5
|
+
import { useResetPartDivision } from './useResetPartDivision';
|
|
5
6
|
import { usePassword } from './usePassword';
|
|
6
7
|
import { useWifiMap } from './useWifiMap';
|
|
7
8
|
import { useQuiteHours } from './useQuiteHours';
|
|
@@ -26,7 +27,7 @@ import { useMcsRoomInfo } from './useMcsRoomInfo';
|
|
|
26
27
|
import { useThreshold } from './useThreshold';
|
|
27
28
|
import { useCustomCommand } from './useCustomCommand';
|
|
28
29
|
import { defineRobotCommand } from './defineRobotCommand';
|
|
29
|
-
export { useCarpet, useCarpetClean, useVoice, MqttProvider, useDeviceModel, useFurnitureModel, useDevInfo, usePartMerge, usePartDivision, usePassword, useWifiMap, useQuiteHours, useVirtualArea, useSpotClean, useZoneClean, useSelectRoomClean, useVirtualWall, useSchedule, useHistoryMap, useRoomProperty, useResetMap, usePurifierSchedule, useCruise, useSpotPolygons, useMcsRoomInfo, useThreshold, useCustomCommand, defineRobotCommand };
|
|
30
|
+
export { useCarpet, useCarpetClean, useVoice, MqttProvider, useDeviceModel, useFurnitureModel, useDevInfo, usePartMerge, usePartDivision, useResetPartDivision, usePassword, useWifiMap, useQuiteHours, useVirtualArea, useSpotClean, useZoneClean, useSelectRoomClean, useVirtualWall, useSchedule, useHistoryMap, useRoomProperty, useResetMap, usePurifierSchedule, useCruise, useSpotPolygons, useMcsRoomInfo, useThreshold, useCustomCommand, defineRobotCommand };
|
|
30
31
|
|
|
31
32
|
// 自定义指令相关类型
|
|
32
33
|
|
|
@@ -13,6 +13,7 @@ export * from './quietHoursProtocol';
|
|
|
13
13
|
export * from './passwordProtocol';
|
|
14
14
|
export * from './partMergeProtocol';
|
|
15
15
|
export * from './partDivisionProtocol';
|
|
16
|
+
export * from './resetPartDivisionProtocol';
|
|
16
17
|
export * from './historyMapProtocol';
|
|
17
18
|
export * from './furnitureModelProtocol';
|
|
18
19
|
export * from './deviceModelProtocol';
|
|
@@ -13,6 +13,7 @@ export * from './quietHoursProtocol';
|
|
|
13
13
|
export * from './passwordProtocol';
|
|
14
14
|
export * from './partMergeProtocol';
|
|
15
15
|
export * from './partDivisionProtocol';
|
|
16
|
+
export * from './resetPartDivisionProtocol';
|
|
16
17
|
export * from './historyMapProtocol';
|
|
17
18
|
export * from './furnitureModelProtocol';
|
|
18
19
|
export * from './deviceModelProtocol';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -14,6 +14,10 @@ export declare enum PartDivisionEnum {
|
|
|
14
14
|
set = "partDivisionSet",
|
|
15
15
|
query = "partDivisionRst"
|
|
16
16
|
}
|
|
17
|
+
export declare enum ResetPartDivisionEnum {
|
|
18
|
+
set = "resetPartDivisionSet",
|
|
19
|
+
rst = "resetPartDivisionRst"
|
|
20
|
+
}
|
|
17
21
|
export declare enum PasswordEnum {
|
|
18
22
|
query = "passwordQry",
|
|
19
23
|
set = "passwordSet",
|
|
@@ -24,6 +24,13 @@ export let PartDivisionEnum = /*#__PURE__*/function (PartDivisionEnum) {
|
|
|
24
24
|
PartDivisionEnum["query"] = "partDivisionRst";
|
|
25
25
|
return PartDivisionEnum;
|
|
26
26
|
}({});
|
|
27
|
+
|
|
28
|
+
// 恢复当前地图的默认分区
|
|
29
|
+
export let ResetPartDivisionEnum = /*#__PURE__*/function (ResetPartDivisionEnum) {
|
|
30
|
+
ResetPartDivisionEnum["set"] = "resetPartDivisionSet";
|
|
31
|
+
ResetPartDivisionEnum["rst"] = "resetPartDivisionRst";
|
|
32
|
+
return ResetPartDivisionEnum;
|
|
33
|
+
}({});
|
|
27
34
|
export let PasswordEnum = /*#__PURE__*/function (PasswordEnum) {
|
|
28
35
|
PasswordEnum["query"] = "passwordQry";
|
|
29
36
|
PasswordEnum["set"] = "passwordSet";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { handleMqttError, useStructuredMessage } from './hooks/useStructuredMessage';
|
|
2
|
+
import { ResetPartDivisionEnum } from './type';
|
|
3
|
+
export const useResetPartDivision = () => {
|
|
4
|
+
const {
|
|
5
|
+
sendStructuredMessage
|
|
6
|
+
} = useStructuredMessage();
|
|
7
|
+
return {
|
|
8
|
+
setResetPartDivision: () => new Promise((resolve, reject) => {
|
|
9
|
+
sendStructuredMessage(ResetPartDivisionEnum.set, {}, resolve, error => reject(handleMqttError(error, 'Failed to restore default partitions')), {
|
|
10
|
+
responseType: ResetPartDivisionEnum.rst
|
|
11
|
+
});
|
|
12
|
+
})
|
|
13
|
+
};
|
|
14
|
+
};
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ray-js/robot-data-stream",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "扫地机P2P数据流标准化组件",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"files": [
|
|
7
|
-
"lib"
|
|
7
|
+
"lib",
|
|
8
|
+
"docs/reference/mqtt-hooks.md",
|
|
9
|
+
"docs/reference/message-format.md"
|
|
8
10
|
],
|
|
9
11
|
"license": "MIT",
|
|
10
12
|
"types": "lib/index.d.ts",
|