Index: firmware/App/Modes/OperationModes.c =================================================================== diff -u -r70f10c77f4f9a48d51030c00504d520fe25d0ba9 -r056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8 --- firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 70f10c77f4f9a48d51030c00504d520fe25d0ba9) +++ firmware/App/Modes/OperationModes.c (.../OperationModes.c) (revision 056bb7c3e42a6c56e10ff75f69aa1d7b9e5c8af8) @@ -28,6 +28,7 @@ #include "ModeUpdate.h" //#include "NVDataMgmt.h" #include "OperationModes.h" +#include "SystemCommTD.h" #include "TaskGeneral.h" #include "Timers.h" @@ -460,59 +461,59 @@ *************************************************************************/ CONFIRMATION_REQUEST_STATUS_T getConfirmationRequestStatus( GENERIC_CONFIRM_ID_T requestID ) { -// BOOL pending = FALSE; -// U32 pendingIndex = 0; + BOOL pending = FALSE; + U32 pendingIndex = 0; CONFIRMATION_REQUEST_STATUS_T status = CONFIRMATION_REQUEST_STATUS_PENDING; -// U32 i; + U32 i; -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( confirmRequests[ i ].requestID == requestID ) -// { -// status = confirmRequests[ i ].status; -// if ( status != CONFIRMATION_REQUEST_STATUS_PENDING ) -// { -// // Send UI clear -// if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) -// { -// sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); -// } -// else -// { -// sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, 0 ); -// } -// -// // Clear the confirmation request, it is done and consumed -// confirmRequests[ i ].requestID = GENERIC_CONFIRM_ID_NONE; -// confirmRequests[ i ].requestType = GENERIC_CONFIRM_CMD_REQUEST_OPEN; -// confirmRequests[ i ].timeStamp = 0; -// confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_UNUSED; -// } -// } -// else if ( CONFIRMATION_REQUEST_STATUS_PENDING == confirmRequests[ i ].status ) -// { -// if ( TRUE == pending ) -// { -// // Is this newer than other pending request? -// if ( confirmRequests[ i ].timeStamp > confirmRequests[ pendingIndex ].timeStamp ) -// { -// pendingIndex = i; -// } -// } -// else -// { -// pendingIndex = i; -// pending = TRUE; -// } -// } -// } -// -// if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) -// { -// // Last confirmation cleared, pending request must be resent to UI -// sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, confirmRequests[ pendingIndex ].requestType, 0 ); -// } + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( confirmRequests[ i ].requestID == requestID ) + { + status = confirmRequests[ i ].status; + if ( status != CONFIRMATION_REQUEST_STATUS_PENDING ) + { + // Send UI clear + if ( CONFIRMATION_REQUEST_STATUS_TIMEOUT == status ) + { + sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE, 0 ); + } + else + { + sendConfirmationRequest( confirmRequests[ i ].requestID, GENERIC_CONFIRM_CMD_ACCEPT_CLOSE, 0 ); + } + // Clear the confirmation request, it is done and consumed + confirmRequests[ i ].requestID = GENERIC_CONFIRM_ID_NONE; + confirmRequests[ i ].requestType = GENERIC_CONFIRM_CMD_REQUEST_OPEN; + confirmRequests[ i ].timeStamp = 0; + confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_UNUSED; + } + } + else if ( CONFIRMATION_REQUEST_STATUS_PENDING == confirmRequests[ i ].status ) + { + if ( TRUE == pending ) + { + // Is this newer than other pending request? + if ( confirmRequests[ i ].timeStamp > confirmRequests[ pendingIndex ].timeStamp ) + { + pendingIndex = i; + } + } + else + { + pendingIndex = i; + pending = TRUE; + } + } + } + + if ( ( CONFIRMATION_REQUEST_STATUS_PENDING != status ) && ( TRUE == pending ) ) + { + // Last confirmation cleared, pending request must be resent to UI + sendConfirmationRequest( confirmRequests[ pendingIndex ].requestID, confirmRequests[ pendingIndex ].requestType, 0 ); + } + return status; } @@ -551,40 +552,40 @@ *************************************************************************/ GENERIC_CONFIRM_ID_T addConfirmationRequest( GENERIC_CONFIRM_ID_T requestID, GENERIC_CONFIRM_COMMAND_T requestType, U32 rejectReason ) { -// U32 i; -// BOOL confirmAlreadyPending = FALSE; + U32 i; + BOOL confirmAlreadyPending = FALSE; GENERIC_CONFIRM_ID_T newID = GENERIC_CONFIRM_ID_NONE; -// // Check to make sure specified confirmation is not already pending -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( ( confirmRequests[ i ].requestID == requestID ) && -// ( confirmRequests[ i ].status != CONFIRMATION_REQUEST_STATUS_UNUSED ) ) -// { -// confirmAlreadyPending = TRUE; -// break; -// } -// } -// -// // If not already pending, add confirmation to list of pending confirmations and send to UI to be displayed -// if ( confirmAlreadyPending != TRUE ) -// { -// for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) -// { -// if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[ i ].status ) -// { -// // Save the confirmation request info -// confirmRequests[ i ].requestID = requestID; -// confirmRequests[ i ].requestType = requestType; -// confirmRequests[ i ].timeStamp = getMSTimerCount(); -// confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; -// newID = requestID; -// sendConfirmationRequest( requestID, requestType, rejectReason ); -// break; -// } -// } -// } + // Check to make sure specified confirmation is not already pending + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( ( confirmRequests[ i ].requestID == requestID ) && + ( confirmRequests[ i ].status != CONFIRMATION_REQUEST_STATUS_UNUSED ) ) + { + confirmAlreadyPending = TRUE; + break; + } + } + // If not already pending, add confirmation to list of pending confirmations and send to UI to be displayed + if ( confirmAlreadyPending != TRUE ) + { + for ( i = 0; i < MAX_PENDING_CONFIRM_REQUESTS; i++ ) + { + if ( CONFIRMATION_REQUEST_STATUS_UNUSED == confirmRequests[ i ].status ) + { + // Save the confirmation request info + confirmRequests[ i ].requestID = requestID; + confirmRequests[ i ].requestType = requestType; + confirmRequests[ i ].timeStamp = getMSTimerCount(); + confirmRequests[ i ].status = CONFIRMATION_REQUEST_STATUS_PENDING; + newID = requestID; + sendConfirmationRequest( requestID, requestType, rejectReason ); + break; + } + } + } + return newID; }