Пример #1
0
static void* DisplayTempThread(void* context)
{
    int32_t radioTemp = 0;
    int32_t platformTemp = 0;

    le_temp_ConnectService();

    LE_INFO("Thread Start");

    do
    {
        if (PoolTemp == 2)
        {
            le_temp_GetRadioTemperature(&radioTemp);
            le_temp_GetPlatformTemperature(&platformTemp);
            LE_INFO("(%d) Get Radio Temp (%d), Platform Temp %d",
                TimeCounter++, radioTemp, platformTemp);
            TimeCounter++;
        }
        sleep(1);
    }
    while (PoolTemp > 0);

    // Run the event loop
    le_event_RunLoop();
    return NULL;
}
Пример #2
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);
}
Пример #3
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);
}
Пример #4
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);
}
Пример #5
0
//--------------------------------------------------------------------------------------------------
static void Testle_temp_GetTemperatures
(
)
{
    int32_t temperature = 0;
    le_result_t res = LE_FAULT;

    res = le_temp_GetRadioTemperature(&temperature);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetRadioTemperature return %d degree Celcus", temperature);

    res = le_temp_GetPlatformTemperature(&temperature);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetPlatformTemperature return %d degree Celcus", temperature);

}
Пример #6
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);
}