diff options
Diffstat (limited to 'stm32f091/server.h')
-rw-r--r-- | stm32f091/server.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/stm32f091/server.h b/stm32f091/server.h index 6041ef6..c5698c0 100644 --- a/stm32f091/server.h +++ b/stm32f091/server.h @@ -2,6 +2,27 @@ #include <stdlib.h> #include <stdint.h> +#include <stdbool.h> + +typedef enum { + WS_SERVER_LM_CMD_ECHO, /** @brief listen for echo of sent command */ + WS_SERVER_LM_STATUS_CODE, /** @brief listen for busy, ERROR or OK */ + WS_SERVER_LM_IDLE, /** @brief listen for incoming +IPD commands */ + WS_SERVER_LM_IPD_LISTENING, /** @brief +IPD received, now reading data */ +} ws_e_server_listen_mode; + +typedef enum { + WS_SERVER_RC_NONE = -1, + WS_SERVER_RC_BUSY, + WS_SERVER_RC_ERR, + WS_SERVER_RC_OK, +} ws_e_server_response_code; + +typedef struct { + int counter; + ws_e_server_listen_mode mode; + ws_e_server_response_code last_response; +} ws_s_server_parser; /** * @brief +IPD incoming request handler @@ -15,3 +36,9 @@ */ void ws_server_req_incoming(uint8_t* data, size_t size); +/** @brief send response to incoming request on specific channel */ +void ws_server_req_respond(unsigned int channel, uint8_t* data, size_t size); + +/** @brief send data to esp, waiting until server returns to idle mode */ +void ws_server_send(uint8_t* data, size_t size); + |