Index: TestSupport.c =================================================================== diff -u -rbe8027c8521b547926489d1332c9119f285cd706 -re53564e90120fd06942205c23d95259ad66bf1d0 --- TestSupport.c (.../TestSupport.c) (revision be8027c8521b547926489d1332c9119f285cd706) +++ TestSupport.c (.../TestSupport.c) (revision e53564e90120fd06942205c23d95259ad66bf1d0) @@ -17,6 +17,7 @@ #include "Common.h" #include "SystemCommMessages.h" +#include "Timers.h" /** * @addtogroup TestSupport @@ -25,12 +26,14 @@ // ********** private definitions ********** -#define TEST_CONFIG_ENABLE_KEY 0xDABA36B2 ///< Release software configuration enable key. -#define TEST_CONFIG_DISABLE_KEY 0x00000000 ///< Release software configuration disable key. +#define TEST_CONFIG_ENABLE_KEY 0xDABA36B2 ///< Release software configuration enable key. +#define TEST_CONFIG_DISABLE_KEY 0x00000000 ///< Release software configuration disable key. +#define DIALIN_CHECK_IN_TIMEOUT_MS ( 5 * SEC_PER_MIN * MS_PER_SECOND ) ///< Dialin check in timeout in milliseconds. // ********** private data ********** -static U32 testConfig[ NUM_OF_TEST_CONFIGS ]; ///< Release software configuration. +static U32 testConfig[ NUM_OF_TEST_CONFIGS ]; ///< Release software configuration. +static U32 dialinCheckInTimeStamp; ///< Dialin checkin time stamp. // ********** private function prototypes ********** @@ -153,17 +156,13 @@ *************************************************************************/ void initTestConfigs( void ) { - TEST_CONFIG_T config; - - for ( config = TEST_CONFIG_ENABLE_MIXING_WITH_WATER; config < NUM_OF_TEST_CONFIGS; ++config ) - { - testConfig[ config ] = TEST_CONFIG_DISABLE_KEY; - } + resetAllTestConfigs(); } /*********************************************************************//** * @brief * The setTestConfig function sets the test configuration. + * Must be logged into HD/DG. * @details Inputs: none * @details Outputs: testConfig * @param config which is the configuration to set @@ -191,6 +190,7 @@ /*********************************************************************//** * @brief * The resetTestConfig function resets the test configuration. + * Must be logged into HD/DG. * @details Inputs: none * @details Outputs: testConfig * @param config which is the configuration to reset @@ -218,7 +218,7 @@ /*********************************************************************//** * @brief * The getTestConfigStatus function gets the status of the provided test - * configuration. + * configuration. Must be logged into HD/DG. * @details Inputs: testConfig * @details Outputs: none * @param config the test configuration @@ -228,12 +228,113 @@ { BOOL status = FALSE; - if ( TEST_CONFIG_ENABLE_KEY == testConfig[ config ] ) + if ( ( TRUE == isTestingActivated() ) && ( TEST_CONFIG_ENABLE_KEY == testConfig[ config ] ) ) { status = TRUE; } return status; } +/*********************************************************************//** + * @brief + * The sendTestConfigStatusToDialin function sends the test configuration + * status to dialin. + * @details Inputs: none + * @details Outputs: testConfig + * @return TRUE if the serialization is successful otherwise, FALSE + *************************************************************************/ +BOOL sendTestConfigStatusToDialin( void ) +{ + BOOL result; + MESSAGE_T msg; + TEST_CONFIG_T config; + U32 configStatus = 0; + U08 *payloadPtr = msg.payload; + + // Create a message record + blankMessage( &msg ); +#ifdef _DG_ + msg.hdr.msgID = MSG_ID_DG_SEND_TEST_CONFIGURATION; +#endif + msg.hdr.payloadLen = sizeof( testConfig ); + + for ( config = TEST_CONFIG_ENABLE_MIXING_WITH_WATER; config < NUM_OF_TEST_CONFIGS; ++config ) + { + configStatus = (U32)getTestConfigStatus( config ); + + memcpy( payloadPtr, &configStatus, sizeof( U32 ) ); + payloadPtr += sizeof( U32 ); + } + + // Serialize the message (w/ sync, CRC, and appropriate CAN padding) and add serialized message data to appropriate comm buffer + result = serializeMessage( msg, COMM_BUFFER_OUT_CAN_PC, ACK_NOT_REQUIRED ); + + return result; +} + +/*********************************************************************//** + * @brief + * The resetAllTestConfigs function resets all of the test configurations. + * Must be logged into HD/DG. + * @details Inputs: none + * @details Outputs: testConfig + * @return TRUE if the reset was successful otherwise, FALSE + *************************************************************************/ +BOOL resetAllTestConfigs( void ) +{ + BOOL status = FALSE; + + if ( TRUE == isTestingActivated() ) + { + TEST_CONFIG_T config; + + for ( config = TEST_CONFIG_ENABLE_MIXING_WITH_WATER; config < NUM_OF_TEST_CONFIGS; ++config ) + { + testConfig[ config ] = TEST_CONFIG_DISABLE_KEY; + } + + status = TRUE; + } + + return status; +} + +/*********************************************************************//** + * @brief + * The setDialinCheckInTimeStamp function set the dialin check in timestamp. + * @details Inputs: none + * @details Outputs: dialinCheckInTimeStamp + * @return none + *************************************************************************/ +void setDialinCheckInTimeStamp( void ) +{ + dialinCheckInTimeStamp = getMSTimerCount(); +} + +/*********************************************************************//** + * @brief + * The hasDialinCheckInBeenExpired function checks whether the check in from + * dialin has been expired or not. + * @details Inputs: none + * @details Outputs: dialinCheckInTimeStamp + * @return TRUE if the check in has been expired otherwise, FALSE + *************************************************************************/ +BOOL hasDialinCheckInBeenExpired( void ) +{ + BOOL status = FALSE; + + if ( ( TRUE == didTimeout( dialinCheckInTimeStamp, DIALIN_CHECK_IN_TIMEOUT_MS ) ) && ( TRUE == isTestingActivated() ) ) + { + // If the user has logged in and + status = TRUE; + } + + // TODO remove when the dialin portion has been implemented + status = FALSE; + // TODo remove when the dialin portion has been implemented + + return status; +} + /**@}*/ Index: TestSupport.h =================================================================== diff -u -rbe8027c8521b547926489d1332c9119f285cd706 -re53564e90120fd06942205c23d95259ad66bf1d0 --- TestSupport.h (.../TestSupport.h) (revision be8027c8521b547926489d1332c9119f285cd706) +++ TestSupport.h (.../TestSupport.h) (revision e53564e90120fd06942205c23d95259ad66bf1d0) @@ -39,9 +39,7 @@ TEST_CONFIG_FIRST = TEST_CONFIG_ENABLE_MIXING_WITH_WATER, ///< Test configuration first configuration. NUM_OF_TEST_CONFIGS ///< Number of test configuration. } TEST_CONFIG_T; -#endif - -#ifdef _HD_ +#else /// HD test software configurations typedef enum test_Config { @@ -57,8 +55,8 @@ /// Test configuration payload typedef struct { - TEST_CONFIG_T config; ///< Test configuration. BOOL reset; ///< Test configuration reset. + U32 config; ///< Test configuration. } TEST_CONFIG_PAYLOAD_T ; /// Test override payload type union. @@ -120,11 +118,18 @@ S32 getS32OverrideValue( OVERRIDE_S32_T *ovS32 ); F32 getF32OverrideValue( OVERRIDE_F32_T *ovF32 ); +// Test configuration functions + void initTestConfigs( void ); BOOL setTestConfig( TEST_CONFIG_T config ); BOOL resetTestConfig( TEST_CONFIG_T config ); BOOL getTestConfigStatus( TEST_CONFIG_T config ); +BOOL sendTestConfigStatusToDialin( void ); +BOOL resetAllTestConfigs( void ); +void setDialinCheckInTimeStamp( void ); +BOOL hasDialinCheckInBeenExpired( void ); + /**@}*/ #endif