Align pause resume and abort lifecycle

This commit is contained in:
2026-09-01 21:12:52 +08:00
parent 3dcd2d681f
commit 1342cff3f0
5 changed files with 56 additions and 28 deletions

View File

@@ -47,6 +47,8 @@ static int state_accepts_kind(uint32_t current, const char *kind) {
if (current == SIM_PROTOCOL_READY) return 1;
if (current == SIM_PROTOCOL_PAUSED) {
return is_kind(kind, "PROGRAM_RESUME") || is_kind(kind, "RESUME") ||
is_kind(kind, "PROGRAM_ABORT") || is_kind(kind, "ESTOP") ||
is_kind(kind, "POWER") || is_kind(kind, "SET_OVERRIDE") ||
is_kind(kind, "PING") || is_kind(kind, "SNAPSHOT_REQUEST") ||
is_kind(kind, "DESTROY");
}
@@ -76,6 +78,7 @@ int32_t sim_protocol_accept(uint32_t schema_version, uint32_t seq,
else if (is_kind(kind, "SESSION_READY")) state.state = SIM_PROTOCOL_READY;
else if (is_kind(kind, "PROGRAM_PAUSE")) state.state = SIM_PROTOCOL_PAUSED;
else if (is_kind(kind, "PROGRAM_RESUME") || is_kind(kind, "RESUME")) state.state = SIM_PROTOCOL_READY;
else if (is_kind(kind, "PROGRAM_ABORT") || is_kind(kind, "ESTOP") || is_kind(kind, "POWER")) state.state = SIM_PROTOCOL_READY;
else if (is_kind(kind, "DESTROY")) state.state = SIM_PROTOCOL_DESTROYED;
else if (is_kind(kind, "RESET")) {
/* RESET is a machine/task reset once attached. Keep the transport