Changed SubscribeCOV demo application to wait for APDU Timeout * Retries until the target device is found. After the target device is found, the demo application can wait the duration of the longest COV lifetime, if there is one. Thanks for the suggestion, Duane King!
This commit is contained in:
@@ -307,11 +307,6 @@ int main(
|
|||||||
/* configure the timeout values */
|
/* configure the timeout values */
|
||||||
last_seconds = time(NULL);
|
last_seconds = time(NULL);
|
||||||
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
timeout_seconds = (apdu_timeout() / 1000) * apdu_retries();
|
||||||
if (!COV_Subscribe_Data->cancellationRequest &&
|
|
||||||
(timeout_seconds < COV_Subscribe_Data->lifetime)) {
|
|
||||||
/* only use the first subscribe value */
|
|
||||||
timeout_seconds = COV_Subscribe_Data->lifetime;
|
|
||||||
}
|
|
||||||
/* try to bind with the device */
|
/* try to bind with the device */
|
||||||
found =
|
found =
|
||||||
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
address_bind_request(Target_Device_Object_Instance, &max_apdu,
|
||||||
@@ -350,6 +345,11 @@ int main(
|
|||||||
Request_Invoke_ID = Send_COV_Subscribe(
|
Request_Invoke_ID = Send_COV_Subscribe(
|
||||||
Target_Device_Object_Instance,
|
Target_Device_Object_Instance,
|
||||||
cov_data);
|
cov_data);
|
||||||
|
if (!cov_data->cancellationRequest &&
|
||||||
|
(timeout_seconds < cov_data->lifetime)) {
|
||||||
|
/* increase the timeout to the longest lifetime */
|
||||||
|
timeout_seconds = cov_data->lifetime;
|
||||||
|
}
|
||||||
printf("Sent SubscribeCOV request. Waiting %u seconds.\r\n",
|
printf("Sent SubscribeCOV request. Waiting %u seconds.\r\n",
|
||||||
(unsigned)(timeout_seconds - elapsed_seconds));
|
(unsigned)(timeout_seconds - elapsed_seconds));
|
||||||
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
} else if (tsm_invoke_id_free(Request_Invoke_ID)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user