@dobot-plus/template 1.2.6 → 1.2.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.
Files changed (64) hide show
  1. package/.dobot/components/DobotPlusApp.tsx +78 -78
  2. package/.dobot/http/axios.ts +52 -52
  3. package/.dobot/http/http.ts +22 -22
  4. package/.dobot/index.ts +2 -2
  5. package/.dobot/protocol/methodsHandler.ts +15 -15
  6. package/.dobot/protocol/postMessageHandler.ts +289 -289
  7. package/.dobot/shim.d.ts +3 -3
  8. package/.dobot/store/actions/toolActions.ts +69 -69
  9. package/.dobot/store/reducers/index.ts +8 -8
  10. package/.dobot/store/reducers/toolReducer.ts +152 -152
  11. package/.dobot/store/types.ts +240 -240
  12. package/.dobot/template/default.tsx.mustache +19 -19
  13. package/.dobot/template/entry.css +25 -25
  14. package/.dobot/template/entry.tsx +53 -53
  15. package/.dobot/template/index.html +23 -23
  16. package/.dobot/template/index.scss +5 -5
  17. package/.dobot/utils/i18n.ts +31 -31
  18. package/.dobot/utils/mqtt.ts +61 -61
  19. package/.dobot/utils/rem.js +21 -21
  20. package/.dobot/utils/tool.ts +15 -15
  21. package/.eslintrc.cjs +18 -18
  22. package/.luarc.json +8 -8
  23. package/.vscode/Api.schema.json +103 -103
  24. package/.vscode/Blocks.schema.json +94 -94
  25. package/.vscode/Main.schema.json +42 -42
  26. package/.vscode/Script.schema.json +22 -22
  27. package/.vscode/Toolbar.schema.json +19 -19
  28. package/.vscode/extensions.json +8 -8
  29. package/.vscode/settings.json +51 -51
  30. package/Resources/i18n/client/de.json +11 -11
  31. package/Resources/i18n/client/en.json +11 -11
  32. package/Resources/i18n/client/es.json +11 -11
  33. package/Resources/i18n/client/hk.json +11 -11
  34. package/Resources/i18n/client/ja.json +11 -11
  35. package/Resources/i18n/client/ko.json +11 -11
  36. package/Resources/i18n/client/ru.json +11 -11
  37. package/Resources/i18n/client/zh.json +11 -11
  38. package/Resources/i18n/plugin/de.json +3 -3
  39. package/Resources/i18n/plugin/en.json +3 -3
  40. package/Resources/i18n/plugin/es.json +3 -3
  41. package/Resources/i18n/plugin/hk.json +3 -3
  42. package/Resources/i18n/plugin/ja.json +3 -3
  43. package/Resources/i18n/plugin/ko.json +3 -3
  44. package/Resources/i18n/plugin/ru.json +3 -3
  45. package/Resources/i18n/plugin/zh.json +3 -3
  46. package/configs/Blocks.json +21 -21
  47. package/configs/Main.json +5 -5
  48. package/configs/Scripts.json +7 -7
  49. package/configs/Toolbar.json +5 -5
  50. package/dpt.json +4 -4
  51. package/lua/control.lua +18 -18
  52. package/lua/daemon.lua +22 -22
  53. package/lua/httpAPI.lua +66 -66
  54. package/lua/userAPI.lua +51 -51
  55. package/lua/utils/mqtt.lua +16 -16
  56. package/lua/utils/num_convert.lua +41 -41
  57. package/lua/utils/tcp.lua +30 -30
  58. package/lua/utils/util.lua +30 -30
  59. package/package.json +58 -48
  60. package/project.json +3 -3
  61. package/tsconfig.json +26 -26
  62. package/ui/Blocks.tsx +5 -5
  63. package/ui/Main.tsx +31 -31
  64. package/ui/Toolbar.tsx +5 -5
@@ -1,69 +1,69 @@
1
- import { DeviceState } from '@dobot/store/types'
2
-
3
- export const TOOL_ACTIONS_TYPE = {
4
- SET_PORT_IP: 'setPortIp',
5
- SET_TCP_STATUS: 'setTcpStatus',
6
- SET_TCP_INFO: 'setTcpInfo',
7
- SET_EXTEND_IO_INDEX: 'setExtendIOData',
8
- SET_PORT: 'setPort',
9
- SET_ONROBOT_TOOL: 'setOnRobotTool',
10
- SET_DEVICE_STATE_DATA: 'setDeviceStateData',
11
- SET_PLUGIN_PORT: 'setPluginPort',
12
- SET_DOBOTPLUS_HOST: 'setDobotplusHost',
13
- SET_IO_DATA: 'setIoData',
14
- SET_POINT_DATA: 'setPointData',
15
- SET_JOG_IN_PAUSED: 'setJogInPaused'
16
- }
17
-
18
- class ToolActions {
19
- setPortIp = (params: string) => ({
20
- type: TOOL_ACTIONS_TYPE.SET_PORT_IP,
21
- params
22
- })
23
- setTcpStatus = (params: any) => ({
24
- type: TOOL_ACTIONS_TYPE.SET_TCP_STATUS,
25
- params
26
- })
27
- setTcpInfo = (params: any) => ({
28
- type: TOOL_ACTIONS_TYPE.SET_TCP_INFO,
29
- params
30
- })
31
- setExtendIOData = (params: any) => ({
32
- type: TOOL_ACTIONS_TYPE.SET_EXTEND_IO_INDEX,
33
- params
34
- })
35
- setPort = (params: any) => ({
36
- type: TOOL_ACTIONS_TYPE.SET_PORT,
37
- params
38
- })
39
- setOnRobotTool = (params: string[]) => ({
40
- type: TOOL_ACTIONS_TYPE.SET_ONROBOT_TOOL,
41
- params
42
- })
43
- setDeviceStateData = (params: DeviceState) => ({
44
- type: TOOL_ACTIONS_TYPE.SET_DEVICE_STATE_DATA,
45
- params
46
- })
47
- setPluginPort = (params: DeviceState) => ({
48
- type: TOOL_ACTIONS_TYPE.SET_PLUGIN_PORT,
49
- params
50
- })
51
- setDobotplusHost = (params: string) => ({
52
- type: TOOL_ACTIONS_TYPE.SET_DOBOTPLUS_HOST,
53
- params
54
- })
55
- setIoData = (params: DeviceState) => ({
56
- type: TOOL_ACTIONS_TYPE.SET_IO_DATA,
57
- params
58
- })
59
- setPointData = (params: any[]) => ({
60
- type: TOOL_ACTIONS_TYPE.SET_POINT_DATA,
61
- params
62
- })
63
- setJogInPaused = (params: boolean) => ({
64
- type: TOOL_ACTIONS_TYPE.SET_JOG_IN_PAUSED,
65
- params
66
- })
67
- }
68
-
69
- export const toolActions = new ToolActions()
1
+ import { DeviceState } from '@dobot/store/types'
2
+
3
+ export const TOOL_ACTIONS_TYPE = {
4
+ SET_PORT_IP: 'setPortIp',
5
+ SET_TCP_STATUS: 'setTcpStatus',
6
+ SET_TCP_INFO: 'setTcpInfo',
7
+ SET_EXTEND_IO_INDEX: 'setExtendIOData',
8
+ SET_PORT: 'setPort',
9
+ SET_ONROBOT_TOOL: 'setOnRobotTool',
10
+ SET_DEVICE_STATE_DATA: 'setDeviceStateData',
11
+ SET_PLUGIN_PORT: 'setPluginPort',
12
+ SET_DOBOTPLUS_HOST: 'setDobotplusHost',
13
+ SET_IO_DATA: 'setIoData',
14
+ SET_POINT_DATA: 'setPointData',
15
+ SET_JOG_IN_PAUSED: 'setJogInPaused'
16
+ }
17
+
18
+ class ToolActions {
19
+ setPortIp = (params: string) => ({
20
+ type: TOOL_ACTIONS_TYPE.SET_PORT_IP,
21
+ params
22
+ })
23
+ setTcpStatus = (params: any) => ({
24
+ type: TOOL_ACTIONS_TYPE.SET_TCP_STATUS,
25
+ params
26
+ })
27
+ setTcpInfo = (params: any) => ({
28
+ type: TOOL_ACTIONS_TYPE.SET_TCP_INFO,
29
+ params
30
+ })
31
+ setExtendIOData = (params: any) => ({
32
+ type: TOOL_ACTIONS_TYPE.SET_EXTEND_IO_INDEX,
33
+ params
34
+ })
35
+ setPort = (params: any) => ({
36
+ type: TOOL_ACTIONS_TYPE.SET_PORT,
37
+ params
38
+ })
39
+ setOnRobotTool = (params: string[]) => ({
40
+ type: TOOL_ACTIONS_TYPE.SET_ONROBOT_TOOL,
41
+ params
42
+ })
43
+ setDeviceStateData = (params: DeviceState) => ({
44
+ type: TOOL_ACTIONS_TYPE.SET_DEVICE_STATE_DATA,
45
+ params
46
+ })
47
+ setPluginPort = (params: DeviceState) => ({
48
+ type: TOOL_ACTIONS_TYPE.SET_PLUGIN_PORT,
49
+ params
50
+ })
51
+ setDobotplusHost = (params: string) => ({
52
+ type: TOOL_ACTIONS_TYPE.SET_DOBOTPLUS_HOST,
53
+ params
54
+ })
55
+ setIoData = (params: DeviceState) => ({
56
+ type: TOOL_ACTIONS_TYPE.SET_IO_DATA,
57
+ params
58
+ })
59
+ setPointData = (params: any[]) => ({
60
+ type: TOOL_ACTIONS_TYPE.SET_POINT_DATA,
61
+ params
62
+ })
63
+ setJogInPaused = (params: boolean) => ({
64
+ type: TOOL_ACTIONS_TYPE.SET_JOG_IN_PAUSED,
65
+ params
66
+ })
67
+ }
68
+
69
+ export const toolActions = new ToolActions()
@@ -1,8 +1,8 @@
1
- import { combineReducers } from 'redux'
2
- import toolReducer from './toolReducer'
3
- import userMagamentReducer from './userMagamentReducer'
4
-
5
- export default combineReducers({
6
- toolReducer,
7
- userMagamentReducer
8
- })
1
+ import { combineReducers } from 'redux'
2
+ import toolReducer from './toolReducer'
3
+ import userMagamentReducer from './userMagamentReducer'
4
+
5
+ export default combineReducers({
6
+ toolReducer,
7
+ userMagamentReducer
8
+ })
@@ -1,152 +1,152 @@
1
- import { TOOL_ACTIONS_TYPE } from '../actions/toolActions'
2
-
3
- const initialStore = {
4
- portData: {
5
- ip: '192.168.5.1',
6
- port: '22000',
7
- isSync: false
8
- },
9
- tcpStatus: false,
10
- tcpInfo: [],
11
- extendIoData: [],
12
- onRobotTool: [],
13
- pluginPort: undefined,
14
- dobotplusHost: 'http://localhost:9889',
15
- deviceStateData: {
16
- prjState: 'stopped'
17
- },
18
- ioData: {
19
- ioList: {
20
- input: [...Array(1)].map((item, index) => ({
21
- address: index + 1,
22
- init: `DI_${index + 1}`,
23
- name: `DI_${index + 1}`,
24
- editName: '',
25
- value: 1,
26
- isShow: true,
27
- diValue: 0,
28
- isDI: false,
29
- type: 'Common',
30
- configurationStr: '',
31
- safeIOKey: 0
32
- })),
33
- inputSimulation: [...Array(1)].map((item, index) => ({
34
- address: index + 1,
35
- init: `AD_${index + 1}`,
36
- name: `AD_${index + 1}`,
37
- editName: '',
38
- isShow: true,
39
- value: 3.3
40
- })),
41
- output: [...Array(1)].map((item, index) => ({
42
- address: index + 1,
43
- init: `DO_${index + 1}`,
44
- name: `DO_${index + 1}`,
45
- editName: '',
46
- value: 0,
47
- isShow: true,
48
- type: 'Common',
49
- configurationStr: '',
50
- safeIOKey: 0
51
- }))
52
- },
53
- endEffectorIo: {
54
- input: [...Array(1)].map((item, index) => ({
55
- address: index + 17,
56
- init: `DI_${index + 1}`,
57
- name: `DI_${index + 1}`,
58
- editName: '',
59
- value: 1,
60
- isShow: true,
61
- diValue: 0,
62
- isDI: false
63
- })),
64
- output: [...Array(1)].map((item, index) => ({
65
- address: index + 17,
66
- init: `DO_${index + 1}`,
67
- name: `DO_${index + 1}`,
68
- editName: '',
69
- value: 1,
70
- isShow: true
71
- }))
72
- },
73
- isShowInputAll: true,
74
- isShowOutputAll: true,
75
- ioAO: [0, 0],
76
- ioAI: [0, 0],
77
- ioAIUnit: { mode1: 0, mode2: 0 },
78
- ioAOUnit: { mode1: 0, mode2: 0 },
79
- endAIUnit: { mode1: 0, mode2: 0, mode3: 0, mode4: 0 },
80
- endAI: [0, 0, 0, 0],
81
- toolMode: { mode1: 1, mode2: 1 },
82
- ioData: {}
83
- },
84
- pointData: [],
85
- jogInPaused: false
86
- }
87
-
88
- const toolReducer = (
89
- state = initialStore,
90
- action: { type: string; params: any }
91
- ) => {
92
- switch (action.type) {
93
- case TOOL_ACTIONS_TYPE.SET_PORT_IP: {
94
- return Object.assign({}, state, {
95
- portData: {
96
- ip: action.params,
97
- port: state.portData.port,
98
- isSync: true
99
- }
100
- })
101
- }
102
- case TOOL_ACTIONS_TYPE.SET_PORT: {
103
- return Object.assign({}, state, {
104
- portData: {
105
- ip: state.portData.ip,
106
- port: action.params,
107
- isSync: true
108
- }
109
- })
110
- }
111
- case TOOL_ACTIONS_TYPE.SET_TCP_STATUS: {
112
- return Object.assign({}, state, { tcpStatus: action.params })
113
- }
114
- case TOOL_ACTIONS_TYPE.SET_TCP_INFO: {
115
- return Object.assign({}, state, { tcpInfo: action.params })
116
- }
117
- case TOOL_ACTIONS_TYPE.SET_EXTEND_IO_INDEX: {
118
- const newData = action.params.map((item: any) => {
119
- return {
120
- name: item.name,
121
- DONumber: item.doNumber,
122
- DOStart: item.doStart,
123
- DINumber: item.diNumber,
124
- DIStart: item.diStart
125
- }
126
- })
127
- return Object.assign({}, state, { extendIoData: newData })
128
- }
129
- case TOOL_ACTIONS_TYPE.SET_ONROBOT_TOOL: {
130
- return Object.assign({}, state, { onRobotTool: action.params })
131
- }
132
- case TOOL_ACTIONS_TYPE.SET_DEVICE_STATE_DATA: {
133
- return Object.assign({}, state, { deviceStateData: action.params })
134
- }
135
- case TOOL_ACTIONS_TYPE.SET_PLUGIN_PORT: {
136
- return Object.assign({}, state, { pluginPort: action.params })
137
- }
138
- case TOOL_ACTIONS_TYPE.SET_DOBOTPLUS_HOST:
139
- return Object.assign({}, state, { dobotplusHost: action.params })
140
- case TOOL_ACTIONS_TYPE.SET_IO_DATA: {
141
- return Object.assign({}, state, { deviceStateData: action.params })
142
- }
143
- case TOOL_ACTIONS_TYPE.SET_POINT_DATA:
144
- return Object.assign({}, state, { pointData: action.params })
145
- case TOOL_ACTIONS_TYPE.SET_JOG_IN_PAUSED:
146
- return Object.assign({}, state, { jogInPaused: action.params })
147
- default:
148
- return state
149
- }
150
- }
151
-
152
- export default toolReducer
1
+ import { TOOL_ACTIONS_TYPE } from '../actions/toolActions'
2
+
3
+ const initialStore = {
4
+ portData: {
5
+ ip: '192.168.5.1',
6
+ port: '22000',
7
+ isSync: false
8
+ },
9
+ tcpStatus: false,
10
+ tcpInfo: [],
11
+ extendIoData: [],
12
+ onRobotTool: [],
13
+ pluginPort: undefined,
14
+ dobotplusHost: 'http://localhost:9889',
15
+ deviceStateData: {
16
+ prjState: 'stopped'
17
+ },
18
+ ioData: {
19
+ ioList: {
20
+ input: [...Array(1)].map((item, index) => ({
21
+ address: index + 1,
22
+ init: `DI_${index + 1}`,
23
+ name: `DI_${index + 1}`,
24
+ editName: '',
25
+ value: 1,
26
+ isShow: true,
27
+ diValue: 0,
28
+ isDI: false,
29
+ type: 'Common',
30
+ configurationStr: '',
31
+ safeIOKey: 0
32
+ })),
33
+ inputSimulation: [...Array(1)].map((item, index) => ({
34
+ address: index + 1,
35
+ init: `AD_${index + 1}`,
36
+ name: `AD_${index + 1}`,
37
+ editName: '',
38
+ isShow: true,
39
+ value: 3.3
40
+ })),
41
+ output: [...Array(1)].map((item, index) => ({
42
+ address: index + 1,
43
+ init: `DO_${index + 1}`,
44
+ name: `DO_${index + 1}`,
45
+ editName: '',
46
+ value: 0,
47
+ isShow: true,
48
+ type: 'Common',
49
+ configurationStr: '',
50
+ safeIOKey: 0
51
+ }))
52
+ },
53
+ endEffectorIo: {
54
+ input: [...Array(1)].map((item, index) => ({
55
+ address: index + 17,
56
+ init: `DI_${index + 1}`,
57
+ name: `DI_${index + 1}`,
58
+ editName: '',
59
+ value: 1,
60
+ isShow: true,
61
+ diValue: 0,
62
+ isDI: false
63
+ })),
64
+ output: [...Array(1)].map((item, index) => ({
65
+ address: index + 17,
66
+ init: `DO_${index + 1}`,
67
+ name: `DO_${index + 1}`,
68
+ editName: '',
69
+ value: 1,
70
+ isShow: true
71
+ }))
72
+ },
73
+ isShowInputAll: true,
74
+ isShowOutputAll: true,
75
+ ioAO: [0, 0],
76
+ ioAI: [0, 0],
77
+ ioAIUnit: { mode1: 0, mode2: 0 },
78
+ ioAOUnit: { mode1: 0, mode2: 0 },
79
+ endAIUnit: { mode1: 0, mode2: 0, mode3: 0, mode4: 0 },
80
+ endAI: [0, 0, 0, 0],
81
+ toolMode: { mode1: 1, mode2: 1 },
82
+ ioData: {}
83
+ },
84
+ pointData: [],
85
+ jogInPaused: false
86
+ }
87
+
88
+ const toolReducer = (
89
+ state = initialStore,
90
+ action: { type: string; params: any }
91
+ ) => {
92
+ switch (action.type) {
93
+ case TOOL_ACTIONS_TYPE.SET_PORT_IP: {
94
+ return Object.assign({}, state, {
95
+ portData: {
96
+ ip: action.params,
97
+ port: state.portData.port,
98
+ isSync: true
99
+ }
100
+ })
101
+ }
102
+ case TOOL_ACTIONS_TYPE.SET_PORT: {
103
+ return Object.assign({}, state, {
104
+ portData: {
105
+ ip: state.portData.ip,
106
+ port: action.params,
107
+ isSync: true
108
+ }
109
+ })
110
+ }
111
+ case TOOL_ACTIONS_TYPE.SET_TCP_STATUS: {
112
+ return Object.assign({}, state, { tcpStatus: action.params })
113
+ }
114
+ case TOOL_ACTIONS_TYPE.SET_TCP_INFO: {
115
+ return Object.assign({}, state, { tcpInfo: action.params })
116
+ }
117
+ case TOOL_ACTIONS_TYPE.SET_EXTEND_IO_INDEX: {
118
+ const newData = action.params.map((item: any) => {
119
+ return {
120
+ name: item.name,
121
+ DONumber: item.doNumber,
122
+ DOStart: item.doStart,
123
+ DINumber: item.diNumber,
124
+ DIStart: item.diStart
125
+ }
126
+ })
127
+ return Object.assign({}, state, { extendIoData: newData })
128
+ }
129
+ case TOOL_ACTIONS_TYPE.SET_ONROBOT_TOOL: {
130
+ return Object.assign({}, state, { onRobotTool: action.params })
131
+ }
132
+ case TOOL_ACTIONS_TYPE.SET_DEVICE_STATE_DATA: {
133
+ return Object.assign({}, state, { deviceStateData: action.params })
134
+ }
135
+ case TOOL_ACTIONS_TYPE.SET_PLUGIN_PORT: {
136
+ return Object.assign({}, state, { pluginPort: action.params })
137
+ }
138
+ case TOOL_ACTIONS_TYPE.SET_DOBOTPLUS_HOST:
139
+ return Object.assign({}, state, { dobotplusHost: action.params })
140
+ case TOOL_ACTIONS_TYPE.SET_IO_DATA: {
141
+ return Object.assign({}, state, { deviceStateData: action.params })
142
+ }
143
+ case TOOL_ACTIONS_TYPE.SET_POINT_DATA:
144
+ return Object.assign({}, state, { pointData: action.params })
145
+ case TOOL_ACTIONS_TYPE.SET_JOG_IN_PAUSED:
146
+ return Object.assign({}, state, { jogInPaused: action.params })
147
+ default:
148
+ return state
149
+ }
150
+ }
151
+
152
+ export default toolReducer