Added TSM timeout callback function.

This commit is contained in:
skarg
2013-10-16 17:41:10 +00:00
parent c9daf98061
commit ec1ffa8598
2 changed files with 21 additions and 0 deletions
+8
View File
@@ -80,10 +80,18 @@ typedef struct BACnet_TSM_Data {
unsigned apdu_len;
} BACNET_TSM_DATA;
typedef void (
*tsm_timeout_function) (
uint8_t invoke_id);
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void tsm_set_timeout_handler(
tsm_timeout_function pFunction);
bool tsm_transaction_available(
void);
uint8_t tsm_transaction_idle_count(
+13
View File
@@ -64,6 +64,14 @@ static BACNET_TSM_DATA TSM_List[MAX_TSM_TRANSACTIONS];
/* invoke ID for incrementing between subsequent calls. */
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 */
static uint8_t tsm_find_invokeID_index(
uint8_t invokeID)
@@ -276,6 +284,11 @@ void tsm_timer_milliseconds(
and this indicates a failed message:
IDLE and a valid invoke id */
TSM_List[i].state = TSM_STATE_IDLE;
if(TSM_List[i].InvokeID != 0) {
if(!Timeout_Function) {
Timeout_Function(TSM_List[i].InvokeID);
}
}
}
}
}