fixed erronius behaviour with "response to response" in communication
protocol, additional handler needed
This commit is contained in:
parent
9d743f3044
commit
b140b22354
|
|
@ -41,6 +41,7 @@ typedef enum
|
|||
{
|
||||
SYS_OK_DATA = 0,
|
||||
SYS_OK,
|
||||
SYS_GOT_RESPONSE_MESSAGE,
|
||||
|
||||
SYS_ERROR_WRONG_JSON_FORMAT = 200,
|
||||
SYS_ERROR_PARSE_DATA,
|
||||
|
|
|
|||
|
|
@ -248,8 +248,10 @@ static sys_error_code DataHeaderParser(data_message_t *MSG)
|
|||
if (result.elements == 1)
|
||||
{
|
||||
MSG->parsedData.msgType = atoi((char*) result.pValue);
|
||||
if (MSG->parsedData.msgType > 2 || MSG->parsedData.msgType < 1)
|
||||
if (MSG->parsedData.msgType > DATA_MESSAGE_TYPE_RESPONSE || MSG->parsedData.msgType < DATA_MESSAGE_TYPE_COMMAND)
|
||||
return SYS_ERROR_PARSE_MSGTYPE;
|
||||
if (MSG->parsedData.msgType == DATA_MESSAGE_TYPE_RESPONSE)
|
||||
return SYS_GOT_RESPONSE_MESSAGE;
|
||||
}
|
||||
else
|
||||
return SYS_ERROR_PARSE_MSGTYPE;
|
||||
|
|
@ -298,6 +300,17 @@ esp_err_t ServiceDataHandler(data_message_t *MSG)
|
|||
else
|
||||
MSG->err_code = (int) DataHeaderParser(MSG);
|
||||
|
||||
if (MSG->err_code == SYS_GOT_RESPONSE_MESSAGE)
|
||||
{
|
||||
//ToDo Here handler of received data
|
||||
#if REAST_API_DEBUG_MODE
|
||||
ESP_LOGI(TAG, "Got response message with msgid=%d", MSG->parsedData.msgID);
|
||||
#endif
|
||||
MSG->outputDataBuffer[0] = 0x00;
|
||||
MSG->outputDataLength = 0;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
if (MSG->err_code)
|
||||
{
|
||||
struct jWriteControl jwc;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user