Added TSM timeout callback function.
This commit is contained in:
@@ -80,10 +80,18 @@ typedef struct BACnet_TSM_Data {
|
|||||||
unsigned apdu_len;
|
unsigned apdu_len;
|
||||||
} BACNET_TSM_DATA;
|
} BACNET_TSM_DATA;
|
||||||
|
|
||||||
|
typedef void (
|
||||||
|
*tsm_timeout_function) (
|
||||||
|
uint8_t invoke_id);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
|
void tsm_set_timeout_handler(
|
||||||
|
tsm_timeout_function pFunction);
|
||||||
|
|
||||||
bool tsm_transaction_available(
|
bool tsm_transaction_available(
|
||||||
void);
|
void);
|
||||||
uint8_t tsm_transaction_idle_count(
|
uint8_t tsm_transaction_idle_count(
|
||||||
|
|||||||
@@ -64,6 +64,14 @@ static BACNET_TSM_DATA TSM_List[MAX_TSM_TRANSACTIONS];
|
|||||||
/* invoke ID for incrementing between subsequent calls. */
|
/* invoke ID for incrementing between subsequent calls. */
|
||||||
static uint8_t Current_Invoke_ID = 1;
|
static uint8_t Current_Invoke_ID = 1;
|
||||||
|
|
||||||
|
static tsm_timeout_function Timeout_Function;
|
||||||
|
|
||||||
|
void tsm_set_timeout_handler(
|
||||||
|
tsm_timeout_function pFunction)
|
||||||
|
{
|
||||||
|
Timeout_Function = pFunction;
|
||||||
|
}
|
||||||
|
|
||||||
/* returns MAX_TSM_TRANSACTIONS if not found */
|
/* returns MAX_TSM_TRANSACTIONS if not found */
|
||||||
static uint8_t tsm_find_invokeID_index(
|
static uint8_t tsm_find_invokeID_index(
|
||||||
uint8_t invokeID)
|
uint8_t invokeID)
|
||||||
@@ -276,6 +284,11 @@ void tsm_timer_milliseconds(
|
|||||||
and this indicates a failed message:
|
and this indicates a failed message:
|
||||||
IDLE and a valid invoke id */
|
IDLE and a valid invoke id */
|
||||||
TSM_List[i].state = TSM_STATE_IDLE;
|
TSM_List[i].state = TSM_STATE_IDLE;
|
||||||
|
if(TSM_List[i].InvokeID != 0) {
|
||||||
|
if(!Timeout_Function) {
|
||||||
|
Timeout_Function(TSM_List[i].InvokeID);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user