Seperate retransmission maximum in two parameters
one for data requests and another for search requests - add new handle member for max search retransmission - set default maximum for search retransmission to one - rename define for retransmission option
This commit is contained in:
parent
7ca329ee40
commit
31016929bc
@ -1430,7 +1430,8 @@ mbus_context_serial(const char *device)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->max_retry = 3;
|
handle->max_data_retry = 3;
|
||||||
|
handle->max_search_retry = 1;
|
||||||
handle->is_serial = 1;
|
handle->is_serial = 1;
|
||||||
handle->purge_first_frame = MBUS_FRAME_PURGE_M2S;
|
handle->purge_first_frame = MBUS_FRAME_PURGE_M2S;
|
||||||
handle->auxdata = serial_data;
|
handle->auxdata = serial_data;
|
||||||
@ -1477,7 +1478,8 @@ mbus_context_tcp(const char *host, uint16_t port)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
handle->max_retry = 3;
|
handle->max_data_retry = 3;
|
||||||
|
handle->max_search_retry = 1;
|
||||||
handle->is_serial = 0;
|
handle->is_serial = 0;
|
||||||
handle->purge_first_frame = MBUS_FRAME_PURGE_M2S;
|
handle->purge_first_frame = MBUS_FRAME_PURGE_M2S;
|
||||||
handle->auxdata = tcp_data;
|
handle->auxdata = tcp_data;
|
||||||
@ -1549,10 +1551,17 @@ mbus_context_set_option(mbus_handle * handle, mbus_context_option option, long v
|
|||||||
|
|
||||||
switch (option)
|
switch (option)
|
||||||
{
|
{
|
||||||
case MBUS_OPTION_MAX_RETRY:
|
case MBUS_OPTION_MAX_DATA_RETRY:
|
||||||
if ((value >= 0) && (value <= 9))
|
if ((value >= 0) && (value <= 9))
|
||||||
{
|
{
|
||||||
handle->max_retry = value;
|
handle->max_data_retry = value;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case MBUS_OPTION_MAX_SEARCH_RETRY:
|
||||||
|
if ((value >= 0) && (value <= 9))
|
||||||
|
{
|
||||||
|
handle->max_search_retry = value;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1934,7 +1943,7 @@ mbus_sendrecv_request(mbus_handle *handle, int address, mbus_frame *reply, int m
|
|||||||
|
|
||||||
while (more_frames)
|
while (more_frames)
|
||||||
{
|
{
|
||||||
if (retry > handle->max_retry)
|
if (retry > handle->max_data_retry)
|
||||||
{
|
{
|
||||||
// Give up
|
// Give up
|
||||||
retval = 1;
|
retval = 1;
|
||||||
|
@ -85,7 +85,8 @@ extern "C" {
|
|||||||
*/
|
*/
|
||||||
typedef struct _mbus_handle {
|
typedef struct _mbus_handle {
|
||||||
int fd;
|
int fd;
|
||||||
int max_retry;
|
int max_data_retry;
|
||||||
|
int max_search_retry;
|
||||||
char purge_first_frame;
|
char purge_first_frame;
|
||||||
char is_serial; /**< _handle type (non zero for serial) */
|
char is_serial; /**< _handle type (non zero for serial) */
|
||||||
int (*open) (struct _mbus_handle *handle);
|
int (*open) (struct _mbus_handle *handle);
|
||||||
@ -148,7 +149,8 @@ typedef struct _mbus_record {
|
|||||||
* MBus handle option enumeration
|
* MBus handle option enumeration
|
||||||
*/
|
*/
|
||||||
typedef enum _mbus_context_option {
|
typedef enum _mbus_context_option {
|
||||||
MBUS_OPTION_MAX_RETRY, /**< option defines the maximum attempts of data retransmission */
|
MBUS_OPTION_MAX_DATA_RETRY, /**< option defines the maximum attempts of data request retransmission */
|
||||||
|
MBUS_OPTION_MAX_SEARCH_RETRY, /**< option defines the maximum attempts of search request retransmission */
|
||||||
MBUS_OPTION_PURGE_FIRST_FRAME /**< option controls the echo cancelation for mbus_recv_frame */
|
MBUS_OPTION_PURGE_FIRST_FRAME /**< option controls the echo cancelation for mbus_recv_frame */
|
||||||
} mbus_context_option;
|
} mbus_context_option;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user