Example #1
0
//--------------------------------------------------------------------------------------------------
void Testle_Temp_TestBadReturnCode
(
    void
)
{
    int32_t platformTemp=0;
    int32_t lowCriticalTemp=1, lowCriticalTempTmp=0;;
    int32_t lowWarningTemp=3, lowWarningTempTmp=0;
    int32_t hiWarningTemp=5, hiWarningTempTmp=0;
    int32_t hiCriticalTemp=7, hiCriticalTempTmp=0;
    int32_t radioTemp=0;

    pa_tempSimu_SetReturnCode(LE_FAULT);
    LE_ASSERT(le_temp_GetPlatformTemperature(&platformTemp) == LE_FAULT);
    LE_ASSERT(le_temp_GetPlatformThresholds(&lowCriticalTempTmp,
                                            &lowWarningTempTmp,
                                            &hiWarningTempTmp,
                                            &hiCriticalTempTmp) == LE_FAULT);
    LE_ASSERT(le_temp_GetRadioTemperature(&radioTemp) == LE_FAULT);
    LE_ASSERT(le_temp_GetRadioThresholds(&hiWarningTempTmp, &hiCriticalTempTmp) == LE_FAULT);
    LE_ASSERT(le_temp_SetPlatformThresholds(lowCriticalTemp,
                                            lowWarningTemp,
                                            hiWarningTemp,
                                            hiCriticalTemp) == LE_FAULT);
    LE_ASSERT(le_temp_SetRadioThresholds(hiWarningTemp, hiCriticalTemp) == LE_FAULT);
}
Example #2
0
//--------------------------------------------------------------------------------------------------
void Testle_Temp_TestCorrectUsage
(
    void
)
{
    int32_t platformTemp=0;
    int32_t lowCriticalTemp=1, lowCriticalTempTmp=0;;
    int32_t lowWarningTemp=3, lowWarningTempTmp=0;
    int32_t hiWarningTemp=5, hiWarningTempTmp=0;
    int32_t hiCriticalTemp=7, hiCriticalTempTmp=0;
    int32_t radioTemp=0;

    pa_tempSimu_SetReturnCode(LE_OK);

    LE_ASSERT(le_temp_GetPlatformTemperature(&platformTemp) == LE_OK);
    LE_ASSERT(platformTemp==PA_SIMU_TEMP_DEFAULT_PLATFORM_TEMP);

    LE_ASSERT(le_temp_GetPlatformThresholds(&lowCriticalTempTmp,
                                            &lowWarningTempTmp,
                                            &hiWarningTempTmp,
                                            &hiCriticalTempTmp) == LE_OK);
    LE_ASSERT(lowCriticalTempTmp == PA_SIMU_TEMP_DEFAULT_PLATFORM_LOW_CRIT);
    LE_ASSERT(lowWarningTempTmp == PA_SIMU_TEMP_DEFAULT_PLATFORM_LOW_WARN);
    LE_ASSERT(hiWarningTempTmp == PA_SIMU_TEMP_DEFAULT_PLATFORM_HIGH_WARN);
    LE_ASSERT(hiCriticalTempTmp == PA_SIMU_TEMP_DEFAULT_PLATFORM_HIGH_CRIT);

    LE_ASSERT(le_temp_GetRadioTemperature(&radioTemp) == LE_OK);
    LE_ASSERT(radioTemp == PA_SIMU_TEMP_DEFAULT_RADIO_TEMP);

    LE_ASSERT(le_temp_GetRadioThresholds(&hiWarningTempTmp, &hiCriticalTempTmp) == LE_OK);
    LE_ASSERT(hiWarningTempTmp == PA_SIMU_TEMP_DEFAULT_RADIO_HIGH_WARN);
    LE_ASSERT(hiCriticalTempTmp == PA_SIMU_TEMP_DEFAULT_RADIO_HIGH_CRIT);

    LE_ASSERT(le_temp_SetPlatformThresholds(lowCriticalTemp,
                                            lowWarningTemp,
                                            hiWarningTemp,
                                            hiCriticalTemp) == LE_OK);

    // Check if the values are correctly set in the PA
    lowCriticalTempTmp = lowWarningTempTmp = hiWarningTempTmp = hiCriticalTempTmp = 0;
    pa_temp_GetPlatformThresholds(&lowCriticalTempTmp,
                                  &lowWarningTempTmp,
                                  &hiWarningTempTmp,
                                  &hiCriticalTempTmp);
    LE_ASSERT(lowCriticalTemp == lowCriticalTempTmp);
    LE_ASSERT(lowWarningTemp == lowWarningTempTmp);
    LE_ASSERT(hiWarningTemp == hiWarningTempTmp);
    LE_ASSERT(hiCriticalTemp == hiCriticalTempTmp);

    LE_ASSERT(le_temp_SetRadioThresholds(hiWarningTemp, hiCriticalTemp) == LE_OK);
    hiWarningTempTmp = hiCriticalTempTmp = 0;
    pa_temp_GetRadioThresholds(&hiWarningTempTmp, &hiCriticalTempTmp);
    LE_ASSERT(hiWarningTemp == hiWarningTempTmp);
    LE_ASSERT(hiCriticalTemp == hiCriticalTempTmp);
}
Example #3
0
//--------------------------------------------------------------------------------------------------
static void Testle_temp_PlatformThresholdEventSetting
(
)
{
    int32_t warningTemperature = 0;
    int32_t criticalTemperature = 0;
    int32_t lowarningTemperature = 0;
    int32_t locriticalTemperature = 0;

    int32_t temperature = 0;
    le_result_t res = LE_FAULT;

    TimeCounter = 0;
    PoolTemp = 1;
    LE_INFO("Set PoolTemp %d", PoolTemp);

    le_thread_Ref_t thread = le_thread_Create("tempTest",DisplayTempThread,NULL);
    le_thread_Start(thread);

    LE_INFO("!!!!!!! YOU HAVE %d SECOND TO SET THE MODULE AT"
        " THE TEMP REFERENCE !!!!!!!", WAIT_TIME);
    TimeCounter = 0;

    PoolTemp = 2;
    LE_INFO("Set PoolTemp %d", PoolTemp);

    sleep(WAIT_TIME);

    // Get current Platform Tempeartaure
    res = le_temp_GetPlatformTemperature(&temperature);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetPlatformTemperature return %d degree Celcus", temperature);

    res = le_temp_GetPlatformThresholds(&locriticalTemperature, &lowarningTemperature,
                    &warningTemperature, &criticalTemperature);
    LE_ASSERT(res == LE_OK);

    // Set Warning Platform threshold Tempeartaure
    criticalTemperature = temperature + 20;
    warningTemperature = temperature + 10;
    lowarningTemperature = temperature - 10;
    locriticalTemperature = temperature - 20;

    //criticalTemperature = DEFAULT_PLATFORM_HICRITICAL_THRESHOLD; //temperature + 20;
    res = le_temp_SetPlatformThresholds(locriticalTemperature, lowarningTemperature,
                    warningTemperature, criticalTemperature);
    LE_ASSERT(res == LE_OK);

    PoolTemp = 0;
    LE_INFO("Set PoolTemp %d", PoolTemp);
    LE_INFO("!!!!!!! YOU MUST REBOOT THE MODULE !!!!!!!");
    sleep(2);
}
Example #4
0
//--------------------------------------------------------------------------------------------------
void Testle_Temp_TestBadParameters
(
    void
)
{
    pa_tempSimu_SetReturnCode(LE_OK);
    LE_ASSERT(le_temp_GetPlatformTemperature(NULL) == LE_FAULT);
    LE_ASSERT(le_temp_GetPlatformThresholds(NULL,NULL,NULL,NULL) == LE_FAULT);
    LE_ASSERT(le_temp_GetRadioTemperature(NULL) == LE_FAULT);
    LE_ASSERT(le_temp_GetRadioThresholds(NULL,NULL) == LE_FAULT);
    LE_ASSERT(le_temp_SetPlatformThresholds(2,2,3,5) == LE_BAD_PARAMETER);
    LE_ASSERT(le_temp_SetPlatformThresholds(1,0,3,5) == LE_BAD_PARAMETER);
    LE_ASSERT(le_temp_SetPlatformThresholds(1,2,0,5) == LE_BAD_PARAMETER);
    LE_ASSERT(le_temp_SetPlatformThresholds(1,2,3,4) == LE_BAD_PARAMETER);
    LE_ASSERT(le_temp_SetRadioThresholds(3,4) == LE_BAD_PARAMETER);
}
Example #5
0
//--------------------------------------------------------------------------------------------------
static void Testle_temp_SetGetPlatformThresholds
(
)
{
    le_result_t res = LE_FAULT;

    int32_t oldLoCriticalTemp = 0;
    int32_t oldLoWarningTemp = 0;
    int32_t oldHiWarningTemp = 0;
    int32_t oldHiCriticalTemp = 0;

    int32_t loCriticalTemp = 0;
    int32_t loWarningTemp = 0;
    int32_t hiWarningTemp = 0;
    int32_t hiCriticalTemp = 0;

    int32_t refLoCriticalTemp = 0;
    int32_t refLoWarningTemp = 0;
    int32_t refHiWarningTemp = 0;
    int32_t refHiCriticalTemp = 0;

    res = le_temp_GetPlatformThresholds(&oldLoCriticalTemp, &oldLoWarningTemp,
                    &oldHiWarningTemp, &oldHiCriticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetPlatformThresholds(%d, %d, %d, %d)", oldLoCriticalTemp, oldLoWarningTemp,
        oldHiWarningTemp, oldHiCriticalTemp);

    refLoCriticalTemp = oldLoCriticalTemp + 10;
    refLoWarningTemp = oldLoWarningTemp + 20;
    refHiWarningTemp = oldHiWarningTemp - 20;
    refHiCriticalTemp = oldHiCriticalTemp -10;

    LE_INFO("le_temp_SetPlatformThresholds(%d, %d, %d, %d)", refLoCriticalTemp, refLoWarningTemp,
           refHiWarningTemp, refHiCriticalTemp);
    res = le_temp_SetPlatformThresholds(refLoCriticalTemp, refLoWarningTemp,
                    refHiWarningTemp, refHiCriticalTemp);
    LE_ASSERT(res == LE_OK);


    res = le_temp_GetPlatformThresholds(&loCriticalTemp, &loWarningTemp,
                    &hiWarningTemp, &hiCriticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetPlatformThresholds(%d, %d, %d, %d)", loCriticalTemp, loWarningTemp,
        hiWarningTemp, hiCriticalTemp);
    LE_ASSERT(loCriticalTemp == refLoCriticalTemp);
    LE_ASSERT(loWarningTemp == refLoWarningTemp);
    LE_ASSERT(hiWarningTemp == refHiWarningTemp);
    LE_ASSERT(hiCriticalTemp == refHiCriticalTemp);

    // Test with critical threshold equal to the warning temperature.
    LE_INFO("le_temp_SetPlatformThresholds(%d, %d, %d, %d)", refLoCriticalTemp, refLoCriticalTemp,
        refHiWarningTemp, refHiCriticalTemp);
    res = le_temp_SetPlatformThresholds(refLoCriticalTemp, refLoCriticalTemp,
                    refHiWarningTemp, refHiCriticalTemp);
    LE_ASSERT(res == LE_BAD_PARAMETER);

    refLoCriticalTemp = oldLoCriticalTemp + 20  ;
    refLoWarningTemp = oldLoCriticalTemp + 10;
    refHiWarningTemp = oldHiWarningTemp;
    refHiCriticalTemp = oldHiCriticalTemp;

    LE_INFO("le_temp_SetPlatformThresholds(%d, %d, %d, %d)", refLoCriticalTemp, refLoCriticalTemp,
        refHiWarningTemp, refHiCriticalTemp);
    // Test with critical threshold temperature lesser than the warning temperature.
    res = le_temp_SetPlatformThresholds(refLoCriticalTemp, refLoCriticalTemp,
                    refHiWarningTemp, refHiCriticalTemp);
    LE_ASSERT(res == LE_BAD_PARAMETER);

    LE_INFO("Restore Initial thresold values (%d, %d, %d, %d)",
        oldLoCriticalTemp, oldLoWarningTemp,
        oldHiWarningTemp, oldHiCriticalTemp);
    res = le_temp_SetPlatformThresholds(oldLoCriticalTemp, oldLoWarningTemp,
                    oldHiWarningTemp, oldHiCriticalTemp);
    LE_ASSERT(res == LE_OK);

    res = le_temp_GetPlatformThresholds(&loCriticalTemp, &loWarningTemp,
                    &hiWarningTemp, &hiCriticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetPlatformThresholds(%d, %d, %d, %d)", loCriticalTemp, loWarningTemp,
        hiWarningTemp, hiCriticalTemp);

    LE_ASSERT(loCriticalTemp == oldLoCriticalTemp);
    LE_ASSERT(loWarningTemp == oldLoWarningTemp);
    LE_ASSERT(hiWarningTemp == oldHiWarningTemp);
    LE_ASSERT(hiCriticalTemp == oldHiCriticalTemp);
}