50 lines
1.4 KiB
C
50 lines
1.4 KiB
C
#ifndef LINUXCNC_WEB_WASM_SIM_PROTOCOL_H
|
|
#define LINUXCNC_WEB_WASM_SIM_PROTOCOL_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
enum sim_protocol_result {
|
|
SIM_PROTOCOL_OK = 0,
|
|
SIM_PROTOCOL_ERR_SCHEMA = -100,
|
|
SIM_PROTOCOL_ERR_SEQUENCE = -101,
|
|
SIM_PROTOCOL_ERR_STATE = -102,
|
|
SIM_PROTOCOL_ERR_OPERATION_ID = -103,
|
|
SIM_PROTOCOL_ERR_KIND = -104,
|
|
SIM_PROTOCOL_ERR_ARGUMENT = -105,
|
|
SIM_PROTOCOL_ERR_TICK = -106,
|
|
};
|
|
|
|
enum sim_protocol_state {
|
|
SIM_PROTOCOL_NEW = 0,
|
|
SIM_PROTOCOL_HELLO = 1,
|
|
SIM_PROTOCOL_ATTACHED = 2,
|
|
SIM_PROTOCOL_READY = 3,
|
|
SIM_PROTOCOL_PAUSED = 4,
|
|
SIM_PROTOCOL_DESTROYED = 5,
|
|
};
|
|
|
|
/* The protocol validator is deliberately independent of JSON and malloc. */
|
|
void sim_protocol_reset(void);
|
|
int32_t sim_protocol_accept(uint32_t schema_version, uint32_t seq,
|
|
const char *kind, const char *operation_id,
|
|
uint32_t simulation_tick);
|
|
int32_t sim_protocol_pause(void);
|
|
int32_t sim_protocol_resume(void);
|
|
int32_t sim_protocol_state_value(void);
|
|
uint32_t sim_protocol_last_seq(void);
|
|
uint32_t sim_protocol_tick(void);
|
|
uint32_t sim_protocol_checkpoint_size(void);
|
|
int32_t sim_protocol_checkpoint_export(uint8_t *output, uint32_t capacity);
|
|
int32_t sim_protocol_checkpoint_restore(const uint8_t *input, uint32_t length);
|
|
int32_t sim_protocol_set_tick(uint32_t simulation_tick);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|