Implement AXIS parity UI and execution baseline
This commit is contained in:
96
wasm-core/include/sim_task.h
Normal file
96
wasm-core/include/sim_task.h
Normal file
@@ -0,0 +1,96 @@
|
||||
#ifndef LINUXCNC_WEB_WASM_SIM_TASK_H
|
||||
#define LINUXCNC_WEB_WASM_SIM_TASK_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SIM_TASK_SCHEMA_VERSION 1U
|
||||
#define SIM_TASK_CONTEXT_CAPACITY 128U
|
||||
#define SIM_TASK_SESSION_CAPACITY 128U
|
||||
#define SIM_TASK_CANONICAL_CAPACITY 512U
|
||||
#define SIM_TASK_NO_LINE UINT32_MAX
|
||||
|
||||
enum sim_task_result {
|
||||
SIM_TASK_OK = 0,
|
||||
SIM_TASK_ERR_ARGUMENT = -1000,
|
||||
SIM_TASK_ERR_STATE = -1001,
|
||||
SIM_TASK_ERR_TRANSITION = -1002,
|
||||
SIM_TASK_ERR_SEQUENCE = -1003,
|
||||
SIM_TASK_ERR_TICK = -1004,
|
||||
SIM_TASK_ERR_RANGE = -1005,
|
||||
SIM_TASK_ERR_NONFINITE = -1006,
|
||||
SIM_TASK_ERR_BUFFER = -1007,
|
||||
SIM_TASK_ERR_DESTROYED = -1008,
|
||||
};
|
||||
|
||||
enum sim_task_state_value {
|
||||
SIM_TASK_NEW = 0,
|
||||
SIM_TASK_READY = 1,
|
||||
SIM_TASK_RUNNING = 2,
|
||||
SIM_TASK_PAUSED = 3,
|
||||
SIM_TASK_ESTOP = 4,
|
||||
SIM_TASK_FAULT = 5,
|
||||
SIM_TASK_STOPPED = 6,
|
||||
SIM_TASK_DESTROYED = 7,
|
||||
};
|
||||
|
||||
enum sim_task_mode_value {
|
||||
SIM_TASK_MODE_MANUAL = 0,
|
||||
SIM_TASK_MODE_MDI = 1,
|
||||
SIM_TASK_MODE_AUTO = 2,
|
||||
};
|
||||
|
||||
enum sim_task_program_value {
|
||||
SIM_TASK_PROGRAM_IDLE = 0,
|
||||
SIM_TASK_PROGRAM_LOADED = 1,
|
||||
SIM_TASK_PROGRAM_RUNNING = 2,
|
||||
SIM_TASK_PROGRAM_PAUSED = 3,
|
||||
SIM_TASK_PROGRAM_COMPLETED = 4,
|
||||
SIM_TASK_PROGRAM_ABORTED = 5,
|
||||
SIM_TASK_PROGRAM_FAULT = 6,
|
||||
};
|
||||
|
||||
typedef struct sim_task_state {
|
||||
char context_id[SIM_TASK_CONTEXT_CAPACITY];
|
||||
char session_id[SIM_TASK_SESSION_CAPACITY];
|
||||
uint32_t state;
|
||||
uint32_t mode;
|
||||
uint32_t program_status;
|
||||
uint32_t seq;
|
||||
uint32_t simulation_tick;
|
||||
uint32_t current_line;
|
||||
int32_t last_error;
|
||||
} sim_task_state;
|
||||
|
||||
typedef struct sim_task {
|
||||
sim_task_state state;
|
||||
} sim_task;
|
||||
|
||||
uint32_t sim_task_size(void);
|
||||
int32_t sim_task_init(sim_task *task, const char *context_id, const char *session_id);
|
||||
int32_t sim_task_reset(sim_task *task);
|
||||
int32_t sim_task_attach(sim_task *task);
|
||||
int32_t sim_task_set_command(sim_task *task, uint32_t seq, uint32_t simulation_tick);
|
||||
int32_t sim_task_set_tick(sim_task *task, uint32_t simulation_tick);
|
||||
int32_t sim_task_set_mode(sim_task *task, uint32_t mode);
|
||||
int32_t sim_task_set_program(sim_task *task, uint32_t program_status, uint32_t current_line);
|
||||
int32_t sim_task_transition(sim_task *task, uint32_t state);
|
||||
int32_t sim_task_fault(sim_task *task, int32_t error_code);
|
||||
int32_t sim_task_estop(sim_task *task, int32_t error_code);
|
||||
int32_t sim_task_recover(sim_task *task);
|
||||
int32_t sim_task_restore(sim_task *task, uint32_t state, uint32_t mode,
|
||||
uint32_t program_status, uint32_t seq,
|
||||
uint32_t simulation_tick, uint32_t current_line,
|
||||
int32_t error_code);
|
||||
int32_t sim_task_read_state(const sim_task *task, sim_task_state *out);
|
||||
uint32_t sim_task_canonical(const sim_task *task, char *output, uint32_t capacity);
|
||||
uint64_t sim_task_state_hash(const sim_task *task);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user