@kuriousdesign/machine-sdk 1.0.10 → 1.0.11

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.
@@ -0,0 +1,8 @@
1
+ export declare enum BridgeCmds {
2
+ NONE = 1,
3
+ CONNECT = 2,
4
+ DISCONNECT = 3
5
+ }
6
+ export interface BridgeData {
7
+ connectedClients: number[];
8
+ }
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BridgeCmds = void 0;
4
+ var BridgeCmds;
5
+ (function (BridgeCmds) {
6
+ BridgeCmds[BridgeCmds["NONE"] = 1] = "NONE";
7
+ BridgeCmds[BridgeCmds["CONNECT"] = 2] = "CONNECT";
8
+ BridgeCmds[BridgeCmds["DISCONNECT"] = 3] = "DISCONNECT";
9
+ })(BridgeCmds || (exports.BridgeCmds = BridgeCmds = {}));
@@ -1,4 +1,25 @@
1
1
  import { DeviceTypes } from './DeviceTypes';
2
+ export declare const DeviceConstants: {
3
+ DEVICE_CHILDREN_ARRAY_LEN: number;
4
+ DEVICE_FAULTCODEARRAY_LEN: number;
5
+ MAX_NUM_PARAMS: number;
6
+ NUM_ACTION_TYPES: number;
7
+ NUM_LOG_ENTRIES: number;
8
+ MAX_NUM_OUTBOUND_AXIS_INTERLOCKS: number;
9
+ UNIT_TEST_PROCESS_ID: number;
10
+ TIME_MS_AUTOCLEAR_DONE_BIT_TASK_OR_PROCESS: number;
11
+ };
12
+ export interface DebugLogData {
13
+ Msg: string;
14
+ TimeStamp: Date;
15
+ Id: number;
16
+ }
17
+ export declare const initialDebugLogData: DebugLogData;
18
+ export interface DeviceLogData {
19
+ List: DebugLogData[];
20
+ LastIndex: number;
21
+ }
22
+ export declare const initialDeviceLogData: DeviceLogData;
2
23
  export interface DeviceRegistration {
3
24
  mnemonic: string;
4
25
  id: number;
@@ -6,6 +27,13 @@ export interface DeviceRegistration {
6
27
  parentId: number;
7
28
  deviceType: DeviceTypes;
8
29
  }
30
+ export interface DeviceActionRequestData {
31
+ SenderId: number;
32
+ ActionType: number;
33
+ ActionId: number;
34
+ ParamArray: number[];
35
+ }
36
+ export declare const initialDeviceActionRequestData: DeviceActionRequestData;
9
37
  export declare const initialDeviceRegistration: DeviceRegistration;
10
38
  export interface DeviceCfg {
11
39
  safetyZoneId: number;
@@ -63,6 +91,15 @@ export interface DeviceStatus {
63
91
  recordingLogs: boolean;
64
92
  }
65
93
  export declare const initialDeviceStatus: DeviceStatus;
94
+ export declare enum ActionTypes {
95
+ MISSION = 0,
96
+ CMD = 1,
97
+ TASK = 2,
98
+ PROCESS = 3,
99
+ EXEC_METHOD = 4,
100
+ SCRIPT = 5,
101
+ COUNT = 6
102
+ }
66
103
  export interface Device {
67
104
  is: DeviceStatus;
68
105
  errors: DeviceFaultData;
@@ -1,7 +1,34 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.initialDevice = exports.initialDeviceStatus = exports.initialDeviceFaultData = exports.initialFaultData = exports.initialDeviceCfg = exports.initialDeviceRegistration = void 0;
3
+ exports.initialDevice = exports.ActionTypes = exports.initialDeviceStatus = exports.initialDeviceFaultData = exports.initialFaultData = exports.initialDeviceCfg = exports.initialDeviceRegistration = exports.initialDeviceActionRequestData = exports.initialDeviceLogData = exports.initialDebugLogData = exports.DeviceConstants = void 0;
4
4
  const DeviceTypes_1 = require("./DeviceTypes");
5
+ exports.DeviceConstants = {
6
+ DEVICE_CHILDREN_ARRAY_LEN: 10,
7
+ DEVICE_FAULTCODEARRAY_LEN: 10, //this value should be greater than equal to children array len
8
+ MAX_NUM_PARAMS: 10, //used for tasks and processes
9
+ NUM_ACTION_TYPES: 6, //this includes NONE
10
+ NUM_LOG_ENTRIES: 50,
11
+ MAX_NUM_OUTBOUND_AXIS_INTERLOCKS: 10,
12
+ UNIT_TEST_PROCESS_ID: 1100,
13
+ TIME_MS_AUTOCLEAR_DONE_BIT_TASK_OR_PROCESS: 250
14
+ };
15
+ exports.initialDebugLogData = {
16
+ Msg: '',
17
+ TimeStamp: new Date(),
18
+ Id: 0
19
+ };
20
+ exports.initialDeviceLogData = {
21
+ List: new Array(exports.DeviceConstants.NUM_LOG_ENTRIES).fill(null),
22
+ LastIndex: 0
23
+ };
24
+ ;
25
+ ;
26
+ exports.initialDeviceActionRequestData = {
27
+ SenderId: 0,
28
+ ActionType: 0,
29
+ ActionId: 0,
30
+ ParamArray: new Array(exports.DeviceConstants.MAX_NUM_PARAMS).fill(0)
31
+ };
5
32
  exports.initialDeviceRegistration = {
6
33
  mnemonic: '',
7
34
  id: 0,
@@ -61,6 +88,16 @@ exports.initialDeviceStatus = {
61
88
  commanderId: 0,
62
89
  recordingLogs: false
63
90
  };
91
+ var ActionTypes;
92
+ (function (ActionTypes) {
93
+ ActionTypes[ActionTypes["MISSION"] = 0] = "MISSION";
94
+ ActionTypes[ActionTypes["CMD"] = 1] = "CMD";
95
+ ActionTypes[ActionTypes["TASK"] = 2] = "TASK";
96
+ ActionTypes[ActionTypes["PROCESS"] = 3] = "PROCESS";
97
+ ActionTypes[ActionTypes["EXEC_METHOD"] = 4] = "EXEC_METHOD";
98
+ ActionTypes[ActionTypes["SCRIPT"] = 5] = "SCRIPT";
99
+ ActionTypes[ActionTypes["COUNT"] = 6] = "COUNT"; // Update this value to match the number of action types
100
+ })(ActionTypes || (exports.ActionTypes = ActionTypes = {}));
64
101
  exports.initialDevice = {
65
102
  is: exports.initialDeviceStatus,
66
103
  errors: exports.initialDeviceFaultData,
@@ -3,5 +3,9 @@ export declare enum DeviceTypes {
3
3
  Axis = 1,
4
4
  BoschAxis = 2,//need to deprecate this soon
5
5
  DualAxis = 3,
6
- Gantry = 4
6
+ Gantry = 4,
7
+ Bridge = 5,//used for communication
8
+ Machine = 6,
9
+ Robot = 7
7
10
  }
11
+ export declare function deviceTypeToString(deviceType: DeviceTypes): string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DeviceTypes = void 0;
4
+ exports.deviceTypeToString = deviceTypeToString;
4
5
  var DeviceTypes;
5
6
  (function (DeviceTypes) {
6
7
  DeviceTypes[DeviceTypes["Base"] = 0] = "Base";
@@ -8,4 +9,31 @@ var DeviceTypes;
8
9
  DeviceTypes[DeviceTypes["BoschAxis"] = 2] = "BoschAxis";
9
10
  DeviceTypes[DeviceTypes["DualAxis"] = 3] = "DualAxis";
10
11
  DeviceTypes[DeviceTypes["Gantry"] = 4] = "Gantry";
12
+ DeviceTypes[DeviceTypes["Bridge"] = 5] = "Bridge";
13
+ DeviceTypes[DeviceTypes["Machine"] = 6] = "Machine";
14
+ DeviceTypes[DeviceTypes["Robot"] = 7] = "Robot";
11
15
  })(DeviceTypes || (exports.DeviceTypes = DeviceTypes = {}));
16
+ ;
17
+ function deviceTypeToString(deviceType) {
18
+ switch (deviceType) {
19
+ case DeviceTypes.Base:
20
+ return 'Base';
21
+ case DeviceTypes.Axis:
22
+ return 'Axis';
23
+ case DeviceTypes.BoschAxis:
24
+ return 'Bosch Axis';
25
+ case DeviceTypes.DualAxis:
26
+ return 'Dual Axis';
27
+ case DeviceTypes.Gantry:
28
+ return 'Gantry';
29
+ case DeviceTypes.Bridge:
30
+ return 'Bridge';
31
+ case DeviceTypes.Machine:
32
+ return 'Machine';
33
+ case DeviceTypes.Robot:
34
+ return 'Robot';
35
+ default:
36
+ return 'Unknown';
37
+ }
38
+ }
39
+ ;
@@ -1,2 +1,3 @@
1
- export * from "./Device";
2
1
  export * from "./Axis";
2
+ export * from "./Device";
3
+ export * from "./DeviceTypes";
@@ -14,5 +14,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Device"), exports);
18
17
  __exportStar(require("./Axis"), exports);
18
+ __exportStar(require("./Device"), exports);
19
+ __exportStar(require("./DeviceTypes"), exports);
@@ -1,5 +1,5 @@
1
1
  import { FaultCodeData } from "./Machine";
2
- import { BannerMode, Color, DeviceState, VisibilityState } from "..";
2
+ import { BannerMode, Color, States, VisibilityState } from "..";
3
3
  export interface ComponentAnimation {
4
4
  visibility: VisibilityState;
5
5
  needsExpertUser: boolean;
@@ -22,7 +22,7 @@ export interface ButtonBar {
22
22
  }
23
23
  export interface StatusBar {
24
24
  jobName: string;
25
- statusMsg: DeviceState;
25
+ statusMsg: States;
26
26
  status: number;
27
27
  cncTimeLeft: number[];
28
28
  goodCnt: number;
@@ -11,3 +11,4 @@ export * from "./UserManagerFB";
11
11
  export * from "./TaskQueue";
12
12
  export * from "./RobData";
13
13
  export * from "./Devices";
14
+ export * from "./Bridge";
@@ -27,3 +27,4 @@ __exportStar(require("./UserManagerFB"), exports);
27
27
  __exportStar(require("./TaskQueue"), exports);
28
28
  __exportStar(require("./RobData"), exports);
29
29
  __exportStar(require("./Devices"), exports);
30
+ __exportStar(require("./Bridge"), exports);
@@ -8,19 +8,23 @@ export declare enum VisibilityState {
8
8
  StrobingSlow = 6,
9
9
  GrowingSlow = 7
10
10
  }
11
- export declare enum DeviceState {
12
- Faulted = -2,
13
- Killed = -1,
14
- Inactive = 0,
15
- Resetting = 50,
16
- Idle = 100,
17
- Running = 500,
18
- Stopping = 900,
19
- Aborting = 911,
20
- Paused = 999,
21
- Done = 1000,
22
- Manual = 2000
11
+ export declare enum States {
12
+ ABORTING = -3,
13
+ ERROR = -2,
14
+ KILLED = -1,
15
+ INACTIVE = 0,
16
+ RESETTING = 50,
17
+ IDLE = 100,
18
+ RUNNING = 500,
19
+ STOPPING = 900,
20
+ PAUSED = 999,
21
+ DONE = 1000,
22
+ MANUAL = 1100,
23
+ UNKNOWN = 9999
23
24
  }
25
+ export declare function convertStateToString(state: States): "ABORTING" | "ERROR" | "KILLED" | "INACTIVE" | "RESETTING" | "IDLE" | "RUNNING" | "STOPPING" | "PAUSED" | "DONE" | "MANUAL" | "UNKNOWN";
26
+ export declare function convertStateToColor(state: States): "text-darkred-500" | "text-red-500" | "text-gray-500" | "text-white" | "text-lightblue-500" | "text-blue-500" | "text-green-500" | "text-orange-500" | "text-purple-500" | "text-pink-500" | undefined;
27
+ export declare function getStateFromStep(step: number): States;
24
28
  export declare enum PartState {
25
29
  Empty = 0,//no part present
26
30
  Raw = 10,
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BannerMode = exports.StatusMsg = exports.TaskItemState = exports.PartState = exports.DeviceState = exports.VisibilityState = void 0;
3
+ exports.BannerMode = exports.StatusMsg = exports.TaskItemState = exports.PartState = exports.States = exports.VisibilityState = void 0;
4
+ exports.convertStateToString = convertStateToString;
5
+ exports.convertStateToColor = convertStateToColor;
6
+ exports.getStateFromStep = getStateFromStep;
4
7
  var VisibilityState;
5
8
  (function (VisibilityState) {
6
9
  VisibilityState[VisibilityState["Invisible"] = 0] = "Invisible";
@@ -12,20 +15,133 @@ var VisibilityState;
12
15
  VisibilityState[VisibilityState["StrobingSlow"] = 6] = "StrobingSlow";
13
16
  VisibilityState[VisibilityState["GrowingSlow"] = 7] = "GrowingSlow";
14
17
  })(VisibilityState || (exports.VisibilityState = VisibilityState = {}));
15
- var DeviceState;
16
- (function (DeviceState) {
17
- DeviceState[DeviceState["Faulted"] = -2] = "Faulted";
18
- DeviceState[DeviceState["Killed"] = -1] = "Killed";
19
- DeviceState[DeviceState["Inactive"] = 0] = "Inactive";
20
- DeviceState[DeviceState["Resetting"] = 50] = "Resetting";
21
- DeviceState[DeviceState["Idle"] = 100] = "Idle";
22
- DeviceState[DeviceState["Running"] = 500] = "Running";
23
- DeviceState[DeviceState["Stopping"] = 900] = "Stopping";
24
- DeviceState[DeviceState["Aborting"] = 911] = "Aborting";
25
- DeviceState[DeviceState["Paused"] = 999] = "Paused";
26
- DeviceState[DeviceState["Done"] = 1000] = "Done";
27
- DeviceState[DeviceState["Manual"] = 2000] = "Manual";
28
- })(DeviceState || (exports.DeviceState = DeviceState = {}));
18
+ ;
19
+ var States;
20
+ (function (States) {
21
+ States[States["ABORTING"] = -3] = "ABORTING";
22
+ States[States["ERROR"] = -2] = "ERROR";
23
+ States[States["KILLED"] = -1] = "KILLED";
24
+ States[States["INACTIVE"] = 0] = "INACTIVE";
25
+ States[States["RESETTING"] = 50] = "RESETTING";
26
+ States[States["IDLE"] = 100] = "IDLE";
27
+ States[States["RUNNING"] = 500] = "RUNNING";
28
+ States[States["STOPPING"] = 900] = "STOPPING";
29
+ States[States["PAUSED"] = 999] = "PAUSED";
30
+ States[States["DONE"] = 1000] = "DONE";
31
+ States[States["MANUAL"] = 1100] = "MANUAL";
32
+ States[States["UNKNOWN"] = 9999] = "UNKNOWN";
33
+ })(States || (exports.States = States = {}));
34
+ ;
35
+ function convertStateToString(state) {
36
+ switch (state) {
37
+ case States.ABORTING:
38
+ return "ABORTING";
39
+ case States.ERROR:
40
+ return "ERROR";
41
+ case States.KILLED:
42
+ return "KILLED";
43
+ case States.INACTIVE:
44
+ return "INACTIVE";
45
+ case States.RESETTING:
46
+ return "RESETTING";
47
+ case States.IDLE:
48
+ return "IDLE";
49
+ case States.RUNNING:
50
+ return "RUNNING";
51
+ case States.STOPPING:
52
+ return "STOPPING";
53
+ case States.PAUSED:
54
+ return "PAUSED";
55
+ case States.DONE:
56
+ return "DONE";
57
+ case States.MANUAL:
58
+ return "MANUAL";
59
+ case States.UNKNOWN:
60
+ return "UNKNOWN";
61
+ default:
62
+ return "UNKNOWN";
63
+ }
64
+ }
65
+ function convertStateToColor(state) {
66
+ switch (state) {
67
+ case States.ABORTING:
68
+ return "text-darkred-500";
69
+ case States.ERROR:
70
+ return "text-red-500";
71
+ case States.KILLED:
72
+ return "text-gray-500";
73
+ case States.INACTIVE:
74
+ return "text-white";
75
+ case States.RESETTING:
76
+ return "text-lightblue-500";
77
+ case States.IDLE:
78
+ return "text-blue-500";
79
+ case States.RUNNING:
80
+ return "text-green-500";
81
+ case States.STOPPING:
82
+ return "text-orange-500";
83
+ case States.MANUAL:
84
+ return "text-purple-500";
85
+ case States.UNKNOWN:
86
+ return "text-pink-500";
87
+ }
88
+ }
89
+ function getStateFromStep(step) {
90
+ let state = States.UNKNOWN;
91
+ switch (step) {
92
+ case States.ABORTING:
93
+ state = States.ABORTING;
94
+ break;
95
+ case States.ERROR:
96
+ state = States.ERROR;
97
+ break;
98
+ case States.KILLED:
99
+ state = States.KILLED;
100
+ break;
101
+ case States.INACTIVE:
102
+ state = States.INACTIVE;
103
+ break;
104
+ case States.RESETTING:
105
+ state = States.RESETTING;
106
+ break;
107
+ case States.IDLE:
108
+ state = States.IDLE;
109
+ break;
110
+ case States.RUNNING:
111
+ state = States.RUNNING;
112
+ break;
113
+ case States.STOPPING:
114
+ state = States.STOPPING;
115
+ break;
116
+ case States.PAUSED:
117
+ state = States.PAUSED;
118
+ break;
119
+ case States.DONE:
120
+ state = States.DONE;
121
+ break;
122
+ case States.MANUAL:
123
+ state = States.MANUAL;
124
+ break;
125
+ case States.UNKNOWN:
126
+ state = States.UNKNOWN;
127
+ break;
128
+ }
129
+ if (state === States.UNKNOWN) {
130
+ if (state >= States.RESETTING && state < States.IDLE) {
131
+ state = States.RESETTING;
132
+ }
133
+ else if (state > States.IDLE && state < States.STOPPING) {
134
+ state = States.RUNNING;
135
+ }
136
+ else if (state >= States.STOPPING && state < States.PAUSED) {
137
+ state = States.STOPPING;
138
+ }
139
+ else if (state >= States.MANUAL && state < States.UNKNOWN) {
140
+ state = States.MANUAL;
141
+ }
142
+ }
143
+ return state;
144
+ }
29
145
  var PartState;
30
146
  (function (PartState) {
31
147
  PartState[PartState["Empty"] = 0] = "Empty";
@@ -1,4 +1,4 @@
1
1
  import { Color } from "../enums/Colors";
2
- import { DeviceState, PartState } from "../enums/States";
3
- export declare function deviceStateToColorMap(state: DeviceState): Color;
2
+ import { States, PartState } from "../enums/States";
3
+ export declare function deviceStateToColorMap(state: States): Color;
4
4
  export declare function partStateToColorMap(state: PartState): Color;
@@ -6,17 +6,18 @@ const Colors_1 = require("../enums/Colors");
6
6
  const States_1 = require("../enums/States");
7
7
  function deviceStateToColorMap(state) {
8
8
  const colorMap = {
9
- [States_1.DeviceState.Killed]: Colors_1.Color.Black,
10
- [States_1.DeviceState.Inactive]: Colors_1.Color.Inactive,
11
- [States_1.DeviceState.Resetting]: Colors_1.Color.Resetting,
12
- [States_1.DeviceState.Idle]: Colors_1.Color.Idle,
13
- [States_1.DeviceState.Running]: Colors_1.Color.Running,
14
- [States_1.DeviceState.Stopping]: Colors_1.Color.Processing,
15
- [States_1.DeviceState.Done]: Colors_1.Color.Done,
16
- [States_1.DeviceState.Aborting]: Colors_1.Color.Error,
17
- [States_1.DeviceState.Manual]: Colors_1.Color.Manual,
18
- [States_1.DeviceState.Paused]: Colors_1.Color.Processing,
19
- [States_1.DeviceState.Faulted]: Colors_1.Color.Error,
9
+ [States_1.States.KILLED]: Colors_1.Color.Black,
10
+ [States_1.States.INACTIVE]: Colors_1.Color.Inactive,
11
+ [States_1.States.RESETTING]: Colors_1.Color.Resetting,
12
+ [States_1.States.IDLE]: Colors_1.Color.Idle,
13
+ [States_1.States.RUNNING]: Colors_1.Color.Running,
14
+ [States_1.States.STOPPING]: Colors_1.Color.Processing,
15
+ [States_1.States.DONE]: Colors_1.Color.Done,
16
+ [States_1.States.ABORTING]: Colors_1.Color.Error,
17
+ [States_1.States.MANUAL]: Colors_1.Color.Manual,
18
+ [States_1.States.PAUSED]: Colors_1.Color.Processing,
19
+ [States_1.States.ERROR]: Colors_1.Color.Error,
20
+ [States_1.States.UNKNOWN]: Colors_1.Color.Error,
20
21
  };
21
22
  return colorMap[state];
22
23
  }
@@ -7,7 +7,3 @@ export declare const MqttTopics: {
7
7
  readonly BRIDGE_CMD: "bridge/cmd";
8
8
  readonly DEVICE_MAP: "deviceMap";
9
9
  };
10
- export declare const BridgeCmds: {
11
- readonly CONNECT: "connect";
12
- readonly DISCONNECT: "disconnect";
13
- };
@@ -1,12 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BridgeCmds = exports.MqttTopics = void 0;
3
+ exports.MqttTopics = void 0;
4
4
  exports.MqttTopics = {
5
5
  BRIDGE_STATUS: 'bridge/status',
6
6
  BRIDGE_CMD: 'bridge/cmd',
7
7
  DEVICE_MAP: 'deviceMap',
8
8
  };
9
- exports.BridgeCmds = {
10
- CONNECT: 'connect',
11
- DISCONNECT: 'disconnect'
12
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kuriousdesign/machine-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "Shared data types and helpers for machine-related repositories",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,5 +1,5 @@
1
1
  import { FaultCodeData } from "./Machine";
2
- import { BannerMode, Color, DeviceState, VisibilityState } from "..";
2
+ import { BannerMode, Color, States, VisibilityState } from "..";
3
3
 
4
4
 
5
5
  export interface ComponentAnimation {
@@ -26,7 +26,7 @@ export interface ButtonBar {
26
26
 
27
27
  export interface StatusBar {
28
28
  jobName: string;
29
- statusMsg: DeviceState;
29
+ statusMsg: States;
30
30
  status: number;
31
31
  cncTimeLeft: number[]; // get the second element in the array
32
32
  goodCnt: number;
@@ -1,19 +1,20 @@
1
1
  import { Color } from "../enums/Colors";
2
- import { DeviceState, PartState } from "../enums/States";
2
+ import { States, PartState } from "../enums/States";
3
3
 
4
- export function deviceStateToColorMap(state: DeviceState): Color {
5
- const colorMap: { [key in DeviceState]: Color } = {
6
- [DeviceState.Killed]: Color.Black,
7
- [DeviceState.Inactive]: Color.Inactive,
8
- [DeviceState.Resetting]: Color.Resetting,
9
- [DeviceState.Idle]: Color.Idle,
10
- [DeviceState.Running]: Color.Running,
11
- [DeviceState.Stopping]: Color.Processing,
12
- [DeviceState.Done]: Color.Done,
13
- [DeviceState.Aborting]: Color.Error,
14
- [DeviceState.Manual]: Color.Manual,
15
- [DeviceState.Paused]: Color.Processing,
16
- [DeviceState.Faulted]: Color.Error,
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,
17
18
  };
18
19
 
19
20
  return colorMap[state];