Implement GET_STATUS implementation result (#312)
* Implement GET_STATUS implementation result
Signed-off-by: Pablo Garrido <pablogs9@gmail.com>
* Apply suggestions from code review
Co-authored-by: Antonio Cuadros <49162117+Acuadros95@users.noreply.github.com>
* Revert "Apply suggestions from code review"
This reverts commit e63497987f
.
Co-authored-by: Antonio Cuadros <49162117+Acuadros95@users.noreply.github.com>
This commit is contained in:
parent
243b16b659
commit
160fc8529c
|
@ -162,6 +162,11 @@ typedef struct uxrContinuousArgs
|
|||
size_t data_size;
|
||||
} uxrContinuousArgs;
|
||||
|
||||
typedef uint8_t pong_status_t;
|
||||
#define NO_PONG_STATUS 0x00
|
||||
#define PONG_IN_SESSION_STATUS 0x01
|
||||
#define PONG_NO_SESSION_STATUS 0x02
|
||||
|
||||
/**
|
||||
* @nosubgrouping
|
||||
*/
|
||||
|
@ -193,7 +198,7 @@ typedef struct uxrSession
|
|||
void* on_reply_args;
|
||||
|
||||
bool on_data_flag;
|
||||
bool on_pong_flag;
|
||||
pong_status_t on_pong_flag;
|
||||
uxrContinuousArgs continuous_args;
|
||||
|
||||
#ifdef UCLIENT_PROFILE_MULTITHREAD
|
||||
|
|
|
@ -125,7 +125,7 @@ static bool run_session_until_sync(
|
|||
uxrSession* session,
|
||||
int timeout);
|
||||
|
||||
bool uxr_acknack_pong(
|
||||
pong_status_t uxr_acknack_pong(
|
||||
ucdrBuffer* buffer);
|
||||
|
||||
//==================================================================
|
||||
|
@ -626,14 +626,14 @@ void uxr_flash_output_streams(
|
|||
//==================================================================
|
||||
// PRIVATE
|
||||
//==================================================================
|
||||
bool uxr_acknack_pong(
|
||||
pong_status_t uxr_acknack_pong(
|
||||
ucdrBuffer* buffer)
|
||||
{
|
||||
bool success = false;
|
||||
bool ret = false;
|
||||
bool must_be_read = ucdr_buffer_remaining(buffer) > SUBHEADER_SIZE;
|
||||
bool active_session = false;
|
||||
|
||||
if (must_be_read)
|
||||
if (ucdr_buffer_remaining(buffer) > SUBHEADER_SIZE)
|
||||
{
|
||||
uint8_t id = 0;
|
||||
uint8_t flags = 0;
|
||||
|
@ -646,6 +646,8 @@ bool uxr_acknack_pong(
|
|||
INFO_Payload info_payload;
|
||||
|
||||
success &= uxr_deserialize_BaseObjectReply(buffer, &info_payload.base);
|
||||
active_session = info_payload.base.result.implementation_status;
|
||||
|
||||
success &= ucdr_deserialize_bool(buffer, &info_payload.object_info.optional_config);
|
||||
|
||||
if (info_payload.object_info.optional_config)
|
||||
|
@ -667,7 +669,7 @@ bool uxr_acknack_pong(
|
|||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
return ret ? (active_session ? PONG_IN_SESSION_STATUS : PONG_NO_SESSION_STATUS) : NO_PONG_STATUS;
|
||||
}
|
||||
|
||||
bool uxr_run_session_until_pong(
|
||||
|
@ -679,11 +681,11 @@ bool uxr_run_session_until_pong(
|
|||
|
||||
uxr_flash_output_streams(session);
|
||||
|
||||
session->on_pong_flag = false;
|
||||
session->on_pong_flag = NO_PONG_STATUS;
|
||||
do
|
||||
{
|
||||
listen_message_reliably(session, remaining_time);
|
||||
if (session->on_pong_flag)
|
||||
if (NO_PONG_STATUS != session->on_pong_flag)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
@ -691,7 +693,7 @@ bool uxr_run_session_until_pong(
|
|||
}
|
||||
while (remaining_time > 0);
|
||||
|
||||
bool ret = session->on_pong_flag;
|
||||
bool ret = PONG_IN_SESSION_STATUS == session->on_pong_flag;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -875,9 +877,9 @@ void read_message(
|
|||
uxrStreamId id = uxr_stream_id_from_raw(stream_id_raw, UXR_INPUT_STREAM);
|
||||
read_stream(session, ub, id, seq_num);
|
||||
}
|
||||
else if (uxr_acknack_pong(ub))
|
||||
else
|
||||
{
|
||||
session->on_pong_flag = true;
|
||||
session->on_pong_flag = uxr_acknack_pong(ub);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
bool serialize_get_info_message(
|
||||
ucdrBuffer* ub);
|
||||
|
||||
bool uxr_acknack_pong(
|
||||
pong_status_t uxr_acknack_pong(
|
||||
ucdrBuffer* buffer);
|
||||
|
||||
bool listen_info_message(
|
||||
|
@ -153,7 +153,7 @@ bool listen_info_message(
|
|||
uint8_t stream_id_raw;
|
||||
uxrSeqNum seq_num;
|
||||
uxr_read_session_header(&session_info_fake, &ub, &stream_id_raw, &seq_num);
|
||||
success &= uxr_acknack_pong(&ub);
|
||||
success &= NO_PONG_STATUS != uxr_acknack_pong(&ub);
|
||||
}
|
||||
|
||||
return success;
|
||||
|
|
Loading…
Reference in New Issue