@kuriousdesign/machine-sdk 1.0.65 → 1.0.70

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 (78) hide show
  1. package/.github/workflows/publish.yml +28 -0
  2. package/README.md +28 -51
  3. package/dist/custom-types/BaseDevice/Device.d.ts +1 -1
  4. package/dist/custom-types/BaseDevice/Device.js +1 -1
  5. package/dist/custom-types/BaseDevice/index.d.ts +1 -0
  6. package/dist/custom-types/BaseDevice/index.js +1 -0
  7. package/dist/custom-types/Devices/Conductor.js +0 -1
  8. package/dist/custom-types/Devices/index.d.ts +0 -2
  9. package/dist/custom-types/Devices/index.js +0 -2
  10. package/dist/custom-types/Recipe.d.ts +1 -0
  11. package/dist/custom-types/Recipe.js +2 -0
  12. package/package.json +1 -1
  13. package/src/abb/enums/GCs.mod +44 -44
  14. package/src/abb/enums/PartLocationIds.mod +13 -13
  15. package/src/abb/enums/RobTasks.mod +18 -18
  16. package/src/abb/enums/States.mod +20 -20
  17. package/src/abb/procs/MainModule.mod +188 -188
  18. package/src/abb/records/DeviceDataTypes.mod +35 -35
  19. package/src/custom-types/AppState.ts +115 -115
  20. package/src/custom-types/BaseDevice/Actions.ts +45 -45
  21. package/src/custom-types/BaseDevice/ApiOpcua.ts +71 -71
  22. package/src/custom-types/BaseDevice/Device.ts +224 -224
  23. package/src/custom-types/BaseDevice/DeviceCmds.ts +45 -45
  24. package/src/custom-types/BaseDevice/DeviceConstants.ts +9 -9
  25. package/src/custom-types/{Devices → BaseDevice}/DeviceTypes.ts +60 -60
  26. package/src/custom-types/BaseDevice/Processes.ts +38 -38
  27. package/src/custom-types/BaseDevice/index.ts +7 -6
  28. package/src/custom-types/Bridge.ts +8 -8
  29. package/src/custom-types/Com.ts +19 -19
  30. package/src/custom-types/Devices/Axis.ts +222 -222
  31. package/src/custom-types/Devices/Conductor.ts +14 -14
  32. package/src/custom-types/Devices/Pot.ts +24 -24
  33. package/src/custom-types/Devices/Robot.ts +208 -208
  34. package/src/custom-types/Devices/index.ts +3 -4
  35. package/src/custom-types/GlobalConstants.ts +98 -98
  36. package/src/custom-types/HMI.ts +52 -52
  37. package/src/custom-types/Machine.ts +130 -130
  38. package/src/custom-types/Part.ts +238 -238
  39. package/src/custom-types/RackData.ts +22 -22
  40. package/src/custom-types/Recipe.ts +250 -247
  41. package/src/custom-types/RecipeManagerFB.ts +10 -10
  42. package/src/custom-types/TaskQueue.ts +86 -86
  43. package/src/custom-types/UserManagerFB.ts +7 -7
  44. package/src/custom-types/index.ts +14 -14
  45. package/src/enums/Colors.ts +79 -79
  46. package/src/enums/DeviceId.ts +116 -116
  47. package/src/enums/ExtrusionType.ts +5 -5
  48. package/src/enums/OpcuaDatatype.ts +27 -27
  49. package/src/enums/Pages.ts +21 -21
  50. package/src/enums/States.ts +173 -173
  51. package/src/enums/TaskId.ts +37 -37
  52. package/src/enums/index.ts +9 -9
  53. package/src/functions/colorMapping.ts +43 -43
  54. package/src/functions/index.ts +2 -2
  55. package/src/functions/mqtt-helpers.ts +20 -20
  56. package/src/functions/topicMapping.ts +6 -6
  57. package/src/index.ts +3 -3
  58. package/src/plc-tags/index.ts +38 -38
  59. package/src/plc-tags/mqtt.ts +9 -9
  60. package/src/plc-tags/opcua.ts +3 -3
  61. package/src/styles/animations.css +15 -15
  62. package/tsconfig.json +13 -13
  63. package/dist/custom-types/Devices/Device.d.ts +0 -111
  64. package/dist/custom-types/Devices/Device.js +0 -108
  65. package/dist/custom-types/PartData.d.ts +0 -11
  66. package/dist/custom-types/PartData.js +0 -2
  67. package/dist/custom-types/RecipeData.d.ts +0 -7
  68. package/dist/custom-types/RecipeData.js +0 -2
  69. package/dist/enums/Errors.d.ts +0 -6
  70. package/dist/enums/Errors.js +0 -28
  71. package/dist/enums/Priorities.d.ts +0 -18
  72. package/dist/enums/Priorities.js +0 -24
  73. package/dist/enums/RobPositions.d.ts +0 -12
  74. package/dist/enums/RobPositions.js +0 -16
  75. package/dist/enums/Warnings.d.ts +0 -6
  76. package/dist/enums/Warnings.js +0 -18
  77. /package/dist/custom-types/{Devices → BaseDevice}/DeviceTypes.d.ts +0 -0
  78. /package/dist/custom-types/{Devices → BaseDevice}/DeviceTypes.js +0 -0
@@ -1,21 +1,21 @@
1
- export enum Page {
2
- UNCONTROLLED = 0,
3
- LOGIN = 1,
4
- OPERATION = 2,
5
- HOME = 3,
6
- SETTINGS = 4,
7
-
8
- RAW_SHELF = 5,
9
- EDIT_RAW_SHELF = 6,
10
- DONE_SHELF = 7,
11
- EDIT_DONE_SHELF = 8,
12
-
13
- RECIPES = 9,
14
- EDIT_RECIPES = 10,
15
- CHANGE_RECIPE = 11,
16
- JOB_SETUP = 13,
17
-
18
- ERRORS = 14,
19
- WARNINGS = 15,
20
- ROBOT = 16,
21
- }
1
+ export enum Page {
2
+ UNCONTROLLED = 0,
3
+ LOGIN = 1,
4
+ OPERATION = 2,
5
+ HOME = 3,
6
+ SETTINGS = 4,
7
+
8
+ RAW_SHELF = 5,
9
+ EDIT_RAW_SHELF = 6,
10
+ DONE_SHELF = 7,
11
+ EDIT_DONE_SHELF = 8,
12
+
13
+ RECIPES = 9,
14
+ EDIT_RECIPES = 10,
15
+ CHANGE_RECIPE = 11,
16
+ JOB_SETUP = 13,
17
+
18
+ ERRORS = 14,
19
+ WARNINGS = 15,
20
+ ROBOT = 16,
21
+ }
@@ -1,173 +1,173 @@
1
- export enum VisibilityState {
2
- Invisible = 0,
3
- Visible = 1,
4
- FlashingFast = 2,
5
- FlashingMed = 3,
6
- FlashingSlow = 4,
7
- StrobingFast = 5,
8
- StrobingSlow = 6,
9
- GrowingSlow = 7,
10
- Disabled = 8
11
- };
12
-
13
- export enum States {
14
- ABORTING = -3,
15
- ERROR = -2,
16
- KILLED = -1,
17
- INACTIVE = 0,
18
- RESETTING = 50,
19
- IDLE = 100,
20
- RUNNING = 500,
21
- STOPPING = 900,
22
- PAUSED = 999,
23
- DONE = 1000,
24
- MANUAL = 1100,
25
- UNKNOWN = 9999,
26
- };
27
-
28
- export function convertStateToString(state: States) {
29
- switch (state) {
30
- case States.ABORTING:
31
- return "ABORTING";
32
- case States.ERROR:
33
- return "ERROR";
34
- case States.KILLED:
35
- return "KILLED";
36
- case States.INACTIVE:
37
- return "INACTIVE";
38
- case States.RESETTING:
39
- return "RESETTING";
40
- case States.IDLE:
41
- return "IDLE";
42
- case States.RUNNING:
43
- return "RUNNING";
44
- case States.STOPPING:
45
- return "STOPPING";
46
- case States.PAUSED:
47
- return "PAUSED";
48
- case States.DONE:
49
- return "DONE";
50
- case States.MANUAL:
51
- return "MANUAL";
52
- case States.UNKNOWN:
53
- return "UNKNOWN";
54
- default:
55
- return "UNKNOWN";
56
- }
57
- }
58
-
59
- export function convertStateToColor(state: States) {
60
-
61
- switch (state) {
62
- case States.ABORTING:
63
- return "text-darkred-500";
64
- case States.ERROR:
65
- return "text-red-500";
66
- case States.KILLED:
67
- return "text-gray-500";
68
- case States.INACTIVE:
69
- return "text-white";
70
- case States.RESETTING:
71
- return "text-lightblue-500";
72
- case States.IDLE:
73
- return "text-blue-500";
74
- case States.RUNNING:
75
- return "text-green-500";
76
- case States.STOPPING:
77
- return "text-orange-500";
78
- case States.MANUAL:
79
- return "text-purple-500";
80
- case States.UNKNOWN:
81
- return "text-pink-500";
82
- }
83
- }
84
-
85
- export function getStateFromStep(step:number): States {
86
- let state = States.UNKNOWN;
87
- switch (step) {
88
- case States.ABORTING:
89
- state = States.ABORTING;
90
- break;
91
- case States.ERROR:
92
- state = States.ERROR;
93
- break;
94
- case States.KILLED:
95
- state = States.KILLED;
96
- break;
97
- case States.INACTIVE:
98
- state = States.INACTIVE;
99
- break;
100
- case States.RESETTING:
101
- state = States.RESETTING;
102
- break;
103
- case States.IDLE:
104
- state = States.IDLE;
105
- break;
106
- case States.RUNNING:
107
- state = States.RUNNING;
108
- break;
109
- case States.STOPPING:
110
- state = States.STOPPING;
111
- break;
112
- case States.PAUSED:
113
- state = States.PAUSED;
114
- break;
115
- case States.DONE:
116
- state = States.DONE;
117
- break;
118
- case States.MANUAL:
119
- state = States.MANUAL;
120
- break;
121
- case States.UNKNOWN:
122
- state = States.UNKNOWN;
123
- break;
124
- }
125
-
126
- if(state === States.UNKNOWN){
127
- if (state >= States.RESETTING && state < States.IDLE) {
128
- state = States.RESETTING;
129
- } else if (state > States.IDLE && state < States.STOPPING) {
130
- state = States.RUNNING;
131
- } else if (state >= States.STOPPING && state < States.PAUSED) {
132
- state = States.STOPPING;
133
- } else if (state >= States.MANUAL && state < States.UNKNOWN) {
134
- state = States.MANUAL;
135
- }
136
- }
137
- return state;
138
- }
139
-
140
- export enum PartStateDeprecated {
141
- Empty = 0, //no part present
142
- Raw = 10,
143
- DeburrBottomStarted = 11,
144
- DeburrBottomFinished = 12,
145
- DeburrTopStarted = 15,
146
- Deburred = 20, //completely deburred, both bottom and top
147
- MachiningStarted = 45,
148
- Machined = 50,
149
- WashStarted = 55,
150
- Washed = 60,
151
- DryStarted = 65,
152
- Dryed = 70,
153
- Finished = 100,
154
- Scrapped = 911,
155
- Error = 999,
156
- }
157
-
158
- export enum TaskItemState {
159
- TaskDone = 48,
160
- TaskActive = 49,
161
- TaskFuture = 50,
162
- }
163
-
164
- export enum StatusMsg {
165
- Running = 0,
166
- Faulted = 2,
167
- }
168
-
169
- export enum BannerMode {
170
- Good = 0,
171
- Warning = 1,
172
- Faulted = 2,
173
- }
1
+ export enum VisibilityState {
2
+ Invisible = 0,
3
+ Visible = 1,
4
+ FlashingFast = 2,
5
+ FlashingMed = 3,
6
+ FlashingSlow = 4,
7
+ StrobingFast = 5,
8
+ StrobingSlow = 6,
9
+ GrowingSlow = 7,
10
+ Disabled = 8
11
+ };
12
+
13
+ export enum States {
14
+ ABORTING = -3,
15
+ ERROR = -2,
16
+ KILLED = -1,
17
+ INACTIVE = 0,
18
+ RESETTING = 50,
19
+ IDLE = 100,
20
+ RUNNING = 500,
21
+ STOPPING = 900,
22
+ PAUSED = 999,
23
+ DONE = 1000,
24
+ MANUAL = 1100,
25
+ UNKNOWN = 9999,
26
+ };
27
+
28
+ export function convertStateToString(state: States) {
29
+ switch (state) {
30
+ case States.ABORTING:
31
+ return "ABORTING";
32
+ case States.ERROR:
33
+ return "ERROR";
34
+ case States.KILLED:
35
+ return "KILLED";
36
+ case States.INACTIVE:
37
+ return "INACTIVE";
38
+ case States.RESETTING:
39
+ return "RESETTING";
40
+ case States.IDLE:
41
+ return "IDLE";
42
+ case States.RUNNING:
43
+ return "RUNNING";
44
+ case States.STOPPING:
45
+ return "STOPPING";
46
+ case States.PAUSED:
47
+ return "PAUSED";
48
+ case States.DONE:
49
+ return "DONE";
50
+ case States.MANUAL:
51
+ return "MANUAL";
52
+ case States.UNKNOWN:
53
+ return "UNKNOWN";
54
+ default:
55
+ return "UNKNOWN";
56
+ }
57
+ }
58
+
59
+ export function convertStateToColor(state: States) {
60
+
61
+ switch (state) {
62
+ case States.ABORTING:
63
+ return "text-darkred-500";
64
+ case States.ERROR:
65
+ return "text-red-500";
66
+ case States.KILLED:
67
+ return "text-gray-500";
68
+ case States.INACTIVE:
69
+ return "text-white";
70
+ case States.RESETTING:
71
+ return "text-lightblue-500";
72
+ case States.IDLE:
73
+ return "text-blue-500";
74
+ case States.RUNNING:
75
+ return "text-green-500";
76
+ case States.STOPPING:
77
+ return "text-orange-500";
78
+ case States.MANUAL:
79
+ return "text-purple-500";
80
+ case States.UNKNOWN:
81
+ return "text-pink-500";
82
+ }
83
+ }
84
+
85
+ export function getStateFromStep(step:number): States {
86
+ let state = States.UNKNOWN;
87
+ switch (step) {
88
+ case States.ABORTING:
89
+ state = States.ABORTING;
90
+ break;
91
+ case States.ERROR:
92
+ state = States.ERROR;
93
+ break;
94
+ case States.KILLED:
95
+ state = States.KILLED;
96
+ break;
97
+ case States.INACTIVE:
98
+ state = States.INACTIVE;
99
+ break;
100
+ case States.RESETTING:
101
+ state = States.RESETTING;
102
+ break;
103
+ case States.IDLE:
104
+ state = States.IDLE;
105
+ break;
106
+ case States.RUNNING:
107
+ state = States.RUNNING;
108
+ break;
109
+ case States.STOPPING:
110
+ state = States.STOPPING;
111
+ break;
112
+ case States.PAUSED:
113
+ state = States.PAUSED;
114
+ break;
115
+ case States.DONE:
116
+ state = States.DONE;
117
+ break;
118
+ case States.MANUAL:
119
+ state = States.MANUAL;
120
+ break;
121
+ case States.UNKNOWN:
122
+ state = States.UNKNOWN;
123
+ break;
124
+ }
125
+
126
+ if(state === States.UNKNOWN){
127
+ if (state >= States.RESETTING && state < States.IDLE) {
128
+ state = States.RESETTING;
129
+ } else if (state > States.IDLE && state < States.STOPPING) {
130
+ state = States.RUNNING;
131
+ } else if (state >= States.STOPPING && state < States.PAUSED) {
132
+ state = States.STOPPING;
133
+ } else if (state >= States.MANUAL && state < States.UNKNOWN) {
134
+ state = States.MANUAL;
135
+ }
136
+ }
137
+ return state;
138
+ }
139
+
140
+ export enum PartStateDeprecated {
141
+ Empty = 0, //no part present
142
+ Raw = 10,
143
+ DeburrBottomStarted = 11,
144
+ DeburrBottomFinished = 12,
145
+ DeburrTopStarted = 15,
146
+ Deburred = 20, //completely deburred, both bottom and top
147
+ MachiningStarted = 45,
148
+ Machined = 50,
149
+ WashStarted = 55,
150
+ Washed = 60,
151
+ DryStarted = 65,
152
+ Dryed = 70,
153
+ Finished = 100,
154
+ Scrapped = 911,
155
+ Error = 999,
156
+ }
157
+
158
+ export enum TaskItemState {
159
+ TaskDone = 48,
160
+ TaskActive = 49,
161
+ TaskFuture = 50,
162
+ }
163
+
164
+ export enum StatusMsg {
165
+ Running = 0,
166
+ Faulted = 2,
167
+ }
168
+
169
+ export enum BannerMode {
170
+ Good = 0,
171
+ Warning = 1,
172
+ Faulted = 2,
173
+ }
@@ -1,37 +1,37 @@
1
- export enum TaskId {
2
- NoTask = 0,
3
- WayPointMove = 1, //use endPositionId as the destination to communicate to robot, all other parameters are useless.
4
- PickRawShelf_R = 2, //pick raw shelf with Right Gripper, left gripper must be empty
5
- DeburrBottom_R = 3, //Right Gripper Side Only, params(top/bottom/both
6
- DeburrTop_R = 4, //Right Gripper Side Only, params(top/bottom/both
7
- LoadPreOp2_L = 5, //rarely used (only be used if robot were ready to load cnc but had to abandon that to go wash parts or something like that), position 2 on pre op is on the right, left gripper must be empty
8
- LoadPreOp2_R = 6, //position 2 on pre op is on the right, left gripper must be empty
9
- LoadPreOp1_R = 7, //position 1 on pre op is on the left
10
- PickPreOp1_R = 8, //position 1 on pre op is on the left
11
- PickPreOp2_L = 9, //position 2 on pre op is on the right
12
- LoadCnc2_L = 10,
13
- LoadCnc1_R = 11,
14
- PickCnc1_R = 12,
15
- PickCnc2_L = 13,
16
- LoadPostOp2_L = 14,
17
- LoadPostOp1_R = 15,
18
- PickPostOp1_R = 16,
19
- PickPostOp2_L = 17,
20
- PickPostOp2_R = 18, //left gripper must be empty
21
- WashAndDry = 19,
22
- LoadDoneShelf_R = 20, //uses a PLC PR offset for done shelf user frame
23
- RejectPart_L = 21, //start and end at rack perch
24
- RejectPart_R = 22, //start and end at rack perch
25
- WaitToUnload = 23, //MARTIN WE WILL USE WayPointMove FOR THIS,
26
- WaitToLoad = 24, //MARTIN WE WILL USE WayPointMove FOR THIS, wait in front of cnc with deburred parts in both robot gripppers, only used when cnc is empty and waiting to be filled, REPLACE WITH WAYPOINT MOVE?
27
- ExitCnc = 25, //MARTIN WE WILL USE WayPointMove FOR THIS, move from cnc hover position to cnc perch position, REPLACE WITH WAYPOINT MOVE?
28
- EnterCnc = 26, //MARTIN WE WILL USE WayPointMove FOR THIS, move to cnc hover position, MARTIN WE WILL USE WayPointMove FOR THIS
29
-
30
- //non-robot tasks
31
- ChangeCncProgram = 27,
32
- StartCnc = 28,
33
- StopCnc = 29,
34
- ResetCnc = 30,
35
- OpenCncDoor = 31,
36
- CloseCncDoor = 32,
37
- }
1
+ export enum TaskId {
2
+ NoTask = 0,
3
+ WayPointMove = 1, //use endPositionId as the destination to communicate to robot, all other parameters are useless.
4
+ PickRawShelf_R = 2, //pick raw shelf with Right Gripper, left gripper must be empty
5
+ DeburrBottom_R = 3, //Right Gripper Side Only, params(top/bottom/both
6
+ DeburrTop_R = 4, //Right Gripper Side Only, params(top/bottom/both
7
+ LoadPreOp2_L = 5, //rarely used (only be used if robot were ready to load cnc but had to abandon that to go wash parts or something like that), position 2 on pre op is on the right, left gripper must be empty
8
+ LoadPreOp2_R = 6, //position 2 on pre op is on the right, left gripper must be empty
9
+ LoadPreOp1_R = 7, //position 1 on pre op is on the left
10
+ PickPreOp1_R = 8, //position 1 on pre op is on the left
11
+ PickPreOp2_L = 9, //position 2 on pre op is on the right
12
+ LoadCnc2_L = 10,
13
+ LoadCnc1_R = 11,
14
+ PickCnc1_R = 12,
15
+ PickCnc2_L = 13,
16
+ LoadPostOp2_L = 14,
17
+ LoadPostOp1_R = 15,
18
+ PickPostOp1_R = 16,
19
+ PickPostOp2_L = 17,
20
+ PickPostOp2_R = 18, //left gripper must be empty
21
+ WashAndDry = 19,
22
+ LoadDoneShelf_R = 20, //uses a PLC PR offset for done shelf user frame
23
+ RejectPart_L = 21, //start and end at rack perch
24
+ RejectPart_R = 22, //start and end at rack perch
25
+ WaitToUnload = 23, //MARTIN WE WILL USE WayPointMove FOR THIS,
26
+ WaitToLoad = 24, //MARTIN WE WILL USE WayPointMove FOR THIS, wait in front of cnc with deburred parts in both robot gripppers, only used when cnc is empty and waiting to be filled, REPLACE WITH WAYPOINT MOVE?
27
+ ExitCnc = 25, //MARTIN WE WILL USE WayPointMove FOR THIS, move from cnc hover position to cnc perch position, REPLACE WITH WAYPOINT MOVE?
28
+ EnterCnc = 26, //MARTIN WE WILL USE WayPointMove FOR THIS, move to cnc hover position, MARTIN WE WILL USE WayPointMove FOR THIS
29
+
30
+ //non-robot tasks
31
+ ChangeCncProgram = 27,
32
+ StartCnc = 28,
33
+ StopCnc = 29,
34
+ ResetCnc = 30,
35
+ OpenCncDoor = 31,
36
+ CloseCncDoor = 32,
37
+ }
@@ -1,9 +1,9 @@
1
- export * from "./Colors";
2
- export * from "./States";
3
- export * from "./OpcuaDatatype";
4
- export * from "./ExtrusionType";
5
-
6
- export * from "./DeviceId";
7
- export * from "./TaskId";
8
-
9
- export * from "./Pages";
1
+ export * from "./Colors";
2
+ export * from "./States";
3
+ export * from "./OpcuaDatatype";
4
+ export * from "./ExtrusionType";
5
+
6
+ export * from "./DeviceId";
7
+ export * from "./TaskId";
8
+
9
+ export * from "./Pages";
@@ -1,43 +1,43 @@
1
- import { Color } from "../enums/Colors";
2
- import { States, PartStateDeprecated } from "../enums/States";
3
-
4
- export function deviceStateToColorMap(state: States): Color {
5
- const colorMap: { [key in States]: Color } = {
6
- [States.KILLED]: Color.Black,
7
- [States.INACTIVE]: Color.Inactive,
8
- [States.RESETTING]: Color.Resetting,
9
- [States.IDLE]: Color.Idle,
10
- [States.RUNNING]: Color.Running,
11
- [States.STOPPING]: Color.Processing,
12
- [States.DONE]: Color.Done,
13
- [States.ABORTING]: Color.Error,
14
- [States.MANUAL]: Color.Manual,
15
- [States.PAUSED]: Color.Processing,
16
- [States.ERROR]: Color.Error,
17
- [States.UNKNOWN]: Color.Error,
18
- };
19
-
20
- return colorMap[state];
21
- }
22
-
23
- export function partStateToColorMap(state: PartStateDeprecated): Color {
24
- const colorMap: { [key in PartStateDeprecated]: Color } = {
25
- [PartStateDeprecated.Empty]: Color.Empty,
26
- [PartStateDeprecated.Raw]: Color.Raw,
27
- [PartStateDeprecated.DeburrBottomStarted]: Color.Processing,
28
- [PartStateDeprecated.DeburrBottomFinished]: Color.DeburrBottomFinished,
29
- [PartStateDeprecated.DeburrTopStarted]: Color.Processing,
30
- [PartStateDeprecated.Deburred]: Color.Deburred,
31
- [PartStateDeprecated.MachiningStarted]: Color.Processing,
32
- [PartStateDeprecated.Machined]: Color.Machined,
33
- [PartStateDeprecated.WashStarted]: Color.Processing,
34
- [PartStateDeprecated.Washed]: Color.Processing,
35
- [PartStateDeprecated.DryStarted]: Color.Processing,
36
- [PartStateDeprecated.Dryed]: Color.Dryed,
37
- [PartStateDeprecated.Finished]: Color.Finished,
38
- [PartStateDeprecated.Scrapped]: Color.Scrapped,
39
- [PartStateDeprecated.Error]: Color.Error,
40
- };
41
-
42
- return colorMap[state];
43
- }
1
+ import { Color } from "../enums/Colors";
2
+ import { States, PartStateDeprecated } from "../enums/States";
3
+
4
+ export function deviceStateToColorMap(state: States): Color {
5
+ const colorMap: { [key in States]: Color } = {
6
+ [States.KILLED]: Color.Black,
7
+ [States.INACTIVE]: Color.Inactive,
8
+ [States.RESETTING]: Color.Resetting,
9
+ [States.IDLE]: Color.Idle,
10
+ [States.RUNNING]: Color.Running,
11
+ [States.STOPPING]: Color.Processing,
12
+ [States.DONE]: Color.Done,
13
+ [States.ABORTING]: Color.Error,
14
+ [States.MANUAL]: Color.Manual,
15
+ [States.PAUSED]: Color.Processing,
16
+ [States.ERROR]: Color.Error,
17
+ [States.UNKNOWN]: Color.Error,
18
+ };
19
+
20
+ return colorMap[state];
21
+ }
22
+
23
+ export function partStateToColorMap(state: PartStateDeprecated): Color {
24
+ const colorMap: { [key in PartStateDeprecated]: Color } = {
25
+ [PartStateDeprecated.Empty]: Color.Empty,
26
+ [PartStateDeprecated.Raw]: Color.Raw,
27
+ [PartStateDeprecated.DeburrBottomStarted]: Color.Processing,
28
+ [PartStateDeprecated.DeburrBottomFinished]: Color.DeburrBottomFinished,
29
+ [PartStateDeprecated.DeburrTopStarted]: Color.Processing,
30
+ [PartStateDeprecated.Deburred]: Color.Deburred,
31
+ [PartStateDeprecated.MachiningStarted]: Color.Processing,
32
+ [PartStateDeprecated.Machined]: Color.Machined,
33
+ [PartStateDeprecated.WashStarted]: Color.Processing,
34
+ [PartStateDeprecated.Washed]: Color.Processing,
35
+ [PartStateDeprecated.DryStarted]: Color.Processing,
36
+ [PartStateDeprecated.Dryed]: Color.Dryed,
37
+ [PartStateDeprecated.Finished]: Color.Finished,
38
+ [PartStateDeprecated.Scrapped]: Color.Scrapped,
39
+ [PartStateDeprecated.Error]: Color.Error,
40
+ };
41
+
42
+ return colorMap[state];
43
+ }
@@ -1,3 +1,3 @@
1
- export * from "./colorMapping";
2
- export * from "./topicMapping";
1
+ export * from "./colorMapping";
2
+ export * from "./topicMapping";
3
3
  export * from "./mqtt-helpers";
@@ -1,21 +1,21 @@
1
- import { DeviceRegistration } from "../custom-types";
2
-
3
- export function buildFullTopicPath(device: DeviceRegistration, deviceMap: Map<number, DeviceRegistration>): string {
4
- const parts: number[] = [];
5
- let current: DeviceRegistration | undefined = device;
6
-
7
- while (current) {
8
- parts.unshift(current.id);
9
-
10
- if (!current.parentId || current.parentId === 0) break;
11
-
12
- const parent = deviceMap.get(current.parentId);
13
- if (!parent) {
14
- console.warn(`Parent device missing for device ${current.id}, parentId: ${current.parentId}`);
15
- break;
16
- }
17
- current = parent;
18
- }
19
-
20
- return 'machine/' + parts.join('/');
1
+ import { DeviceRegistration } from "../custom-types";
2
+
3
+ export function buildFullTopicPath(device: DeviceRegistration, deviceMap: Map<number, DeviceRegistration>): string {
4
+ const parts: number[] = [];
5
+ let current: DeviceRegistration | undefined = device;
6
+
7
+ while (current) {
8
+ parts.unshift(current.id);
9
+
10
+ if (!current.parentId || current.parentId === 0) break;
11
+
12
+ const parent = deviceMap.get(current.parentId);
13
+ if (!parent) {
14
+ console.warn(`Parent device missing for device ${current.id}, parentId: ${current.parentId}`);
15
+ break;
16
+ }
17
+ current = parent;
18
+ }
19
+
20
+ return 'machine/' + parts.join('/');
21
21
  }
@@ -1,6 +1,6 @@
1
- export function machineIdToTopicMap(id: string): string {
2
- const topicMap: { [key in string]: string } = {
3
- "BendPro G2 Demo": "BendProG2/2286/198C/#",
4
- };
5
- return topicMap[id];
6
- }
1
+ export function machineIdToTopicMap(id: string): string {
2
+ const topicMap: { [key in string]: string } = {
3
+ "BendPro G2 Demo": "BendProG2/2286/198C/#",
4
+ };
5
+ return topicMap[id];
6
+ }
package/src/index.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./custom-types";
2
- export * from "./enums";
3
- export * from "./functions";
1
+ export * from "./custom-types";
2
+ export * from "./enums";
3
+ export * from "./functions";
4
4
  export * from "./plc-tags";