ws server +proto

This commit is contained in:
2026-02-11 12:18:59 +03:00
parent 2ff6b1a454
commit aaa858b903
36 changed files with 1702 additions and 191 deletions

57
src/state.c Normal file
View File

@@ -0,0 +1,57 @@
#include <stdint.h>
#include "state.h"
uint8_t switchNewEmulState(const uint8_t currentState, const uint8_t controlOp)
{
switch (currentState)
{
case EMUL_STATE_STILL:
{
if(controlOp == EMUL_STATE_OP_START)
{
return EMUL_STATE_EXEC;
}
break;
}
case EMUL_STATE_EXEC:
{
if(controlOp == EMUL_STATE_OP_PAUSE)
{
return EMUL_STATE_PAUSE;
}
else if(controlOp == EMUL_STATE_OP_STOP)
{
return EMUL_STATE_STOP;
}
break;
}
case EMUL_STATE_PAUSE:
{
if(controlOp == EMUL_STATE_OP_RESUME)
{
return EMUL_STATE_EXEC;
}
else if (controlOp == EMUL_STATE_OP_RESET)
{
return EMUL_STATE_STILL;
}
break;
}
case EMUL_STATE_STOP:
{
if(controlOp == EMUL_STATE_OP_RESET)
{
return EMUL_STATE_STILL;
}
break;
}
default:
break;
}
return currentState;
}