Added a way for TSM to indicated a transaction that failed to confirm, and added that into the confirmed handling demos.

This commit is contained in:
skarg
2006-08-15 21:35:35 +00:00
parent 4fe0decdf7
commit f4f9241298
9 changed files with 81 additions and 8 deletions
+8 -1
View File
@@ -259,12 +259,19 @@ int main(int argc, char *argv[])
Communication_Password);
} else if (tsm_invoke_id_free(invoke_id))
break;
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
printf("\rError: APDU Timeout!");
printf("\rError: APDU Timeout!\r\n");
break;
}
}
+7 -1
View File
@@ -121,7 +121,13 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
case PROP_UNITS:
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
break;
/* test case for signed encoding and decoding negative value correctly */
case 9997:
apdu_len = encode_tagged_real(&apdu[0], 90.510);
break;
case 9998:
apdu_len = encode_tagged_unsigned(&apdu[0], 90);
break;
/* test case for signed encoding-decoding negative value correctly */
case 9999:
apdu_len = encode_tagged_signed(&apdu[0], -200);
break;
+8 -1
View File
@@ -286,12 +286,19 @@ int main(int argc, char *argv[])
requestedOctetCount);
Current_Invoke_ID = invoke_id;
}
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
printf("\rError: APDU Timeout!");
fprintf(stderr, "\rError: APDU Timeout!\r\n");
break;
}
}
+8 -1
View File
@@ -226,12 +226,19 @@ int main(int argc, char *argv[])
Target_Object_Index);
} else if (tsm_invoke_id_free(invoke_id))
break;
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
printf("\rError: APDU Timeout!");
printf("\rError: APDU Timeout!\r\n");
break;
}
}
+10
View File
@@ -245,11 +245,21 @@ int main(int argc, char *argv[])
Reinitialize_Password);
} else if (tsm_invoke_id_free(invoke_id))
break;
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
fprintf(stderr, "\rError: APDU Timeout!\r\n");
break;
}
}
/* keep track of time for next check */
last_seconds = current_seconds;
+8 -1
View File
@@ -264,12 +264,19 @@ int main(int argc, char *argv[])
&fileData);
Current_Invoke_ID = invoke_id;
}
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
printf("\rError: APDU Timeout!");
fprintf(stderr, "\rError: APDU Timeout!\r\n");
break;
}
}
+8 -1
View File
@@ -323,12 +323,19 @@ int main(int argc, char *argv[])
Target_Object_Property_Index);
} else if (tsm_invoke_id_free(invoke_id))
break;
else if (tsm_invoke_id_failed(invoke_id))
{
fprintf(stderr, "\rError: TSM Timeout!\r\n");
tsm_free_invoke_id(invoke_id);
/* try again or abort? */
break;
}
} else {
/* increment timer - exit if timed out */
elapsed_seconds += (current_seconds - last_seconds);
if (elapsed_seconds > timeout_seconds)
{
printf("\rError: APDU Timeout!");
printf("\rError: APDU Timeout!\r\n");
break;
}
}