Ejemplo n.º 1
0
//--------------------------------------------------------------------------------------------------
static void Testle_ecall_LoadMsd
(
    void
)
{
    le_ecall_CallRef_t   testECallRef = 0x00;

    LE_INFO("Start Testle_ecall_LoadMsd");

    LE_ASSERT((testECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(testECallRef, true, +48898064, +2218092, 0) == LE_OK);
    LE_ASSERT(le_ecall_SetMsdPassengersCount(testECallRef, 3) == LE_OK);

    // Check LE_DUPLICATE on le_ecall_SetMsdPosition and le_ecall_SetMsdPassengersCount
    LE_ASSERT(le_ecall_ImportMsd(testECallRef, ImportedMsd, sizeof(ImportedMsd)) == LE_OK);
    LE_ASSERT(le_ecall_SetMsdPosition(testECallRef, true, +48070380, -11310000, 45) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_SetMsdPassengersCount(testECallRef, 3) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_ResetMsdEraGlonassCrashSeverity(testECallRef) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_SetMsdEraGlonassCrashSeverity(testECallRef, 0) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_ResetMsdEraGlonassDiagnosticResult(testECallRef) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_SetMsdEraGlonassDiagnosticResult(testECallRef,
              LE_ECALL_DIAG_RESULT_PRESENT_MIC_CONNECTION_FAILURE)
              == LE_DUPLICATE);
    LE_ASSERT(le_ecall_ResetMsdEraGlonassCrashInfo(testECallRef) == LE_DUPLICATE);
    LE_ASSERT(le_ecall_SetMsdEraGlonassCrashInfo(testECallRef,
              LE_ECALL_CRASH_INFO_PRESENT_CRASH_FRONT_OR_SIDE
              | LE_ECALL_CRASH_INFO_CRASH_FRONT_OR_SIDE)
              == LE_DUPLICATE);

    le_ecall_Delete(testECallRef);
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------------------------------
static void Testle_ecall_StartTest
(
    void
)
{
    le_ecall_CallRef_t                 testECallRef = 0x00;
    le_ecall_State_t                   state = LE_ECALL_STATE_UNKNOWN;

    LE_ASSERT(le_ecall_SetPsapNumber("0102030405") == LE_OK);

    LE_ASSERT(le_ecall_SetMsdTxMode(LE_ECALL_TX_MODE_PUSH) == LE_OK);

    LE_ASSERT((testECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(testECallRef, true, +48898064, +2218092, 0) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdPassengersCount(testECallRef, 3) == LE_OK);

    LE_ASSERT(le_ecall_StartTest(testECallRef) == LE_OK);

    LE_ASSERT(le_ecall_StartManual(testECallRef) == LE_BUSY);
    LE_ASSERT(le_ecall_StartAutomatic(testECallRef) == LE_BUSY);

    state=le_ecall_GetState(testECallRef);
    LE_ASSERT(((state>=LE_ECALL_STATE_STARTED) && (state<=LE_ECALL_STATE_FAILED)));

    le_ecall_Delete(testECallRef);
}
Ejemplo n.º 3
0
//--------------------------------------------------------------------------------------------------
void Testle_ecall_StartTest
(
    void
)
{
    le_ecall_State_t                   state = LE_ECALL_STATE_UNKNOWN;

    LE_INFO("Start Testle_ecall_StartTest");

    LE_ASSERT(le_ecall_SetPsapNumber(PsapNumber) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdTxMode(LE_ECALL_TX_MODE_PUSH) == LE_OK);

    LE_ASSERT((LastTestECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(LastTestECallRef, true, +48898064, +2218092, 0) == LE_OK);
    LE_ASSERT(le_ecall_SetMsdPositionN1(LastTestECallRef, 11, -22) == LE_OK);
    LE_ASSERT(le_ecall_SetMsdPositionN2(LastTestECallRef, -33, 44) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdPassengersCount(LastTestECallRef, 3) == LE_OK);

    LE_ASSERT(le_ecall_StartTest(LastTestECallRef) == LE_OK);

    LE_ASSERT(le_ecall_StartManual(LastTestECallRef) == LE_BUSY);
    LE_ASSERT(le_ecall_StartAutomatic(LastTestECallRef) == LE_BUSY);

    LE_ASSERT(((state>=LE_ECALL_STATE_STARTED) && (state<=LE_ECALL_STATE_FAILED)));
}
Ejemplo n.º 4
0
//--------------------------------------------------------------------------------------------------
static void StartStressECall
(
    void
)
{
    LE_INFO("Start StartStressECall");

    LastECallState = LE_ECALL_STATE_DISCONNECTED;
    TestCount = 0;

    ThreadSemaphore = le_sem_Create("ThreadSem",0);

    LE_ASSERT(le_ecall_AddStateChangeHandler(MyECallEventHandler, NULL) != NULL);

    LE_ASSERT(le_ecall_SetPsapNumber(PsapNumber) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdTxMode(LE_ECALL_TX_MODE_PUSH) == LE_OK);

    LE_ASSERT((MytECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(MytECallRef, true, +48898064, +2218092, 0) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdPassengersCount(MytECallRef, 3) == LE_OK);

    le_thread_Start(le_thread_Create("ECallLoopThread", ECallLoopThread, NULL));
    // Start Test
    le_sem_Post(ThreadSemaphore);
}
Ejemplo n.º 5
0
//--------------------------------------------------------------------------------------------------
static void* ECallLoopThread
(
    void* ctxPtr
)
{
    le_ecall_ConnectService();

    while(1)
    {
        LE_INFO("Wait for semaphore...");
        le_sem_Wait(ThreadSemaphore);
        sleep(1);

        if (LastECallState == LE_ECALL_STATE_STARTED)
        {
            LE_INFO("Take the semaphore, End eCall...");
            LE_ASSERT(le_ecall_End(MytECallRef) == LE_OK);
            le_ecall_Delete(MytECallRef);
            MytECallRef = NULL;
        }
        else if (LastECallState == LE_ECALL_STATE_DISCONNECTED)
        {
            TestCount++;
            LE_INFO("Take the semaphore, Start new eCall...");

            LE_ASSERT((MytECallRef=le_ecall_Create()) != NULL);
            LE_ASSERT(le_ecall_SetMsdPosition(MytECallRef, true, +48898064, +2218092, 0) == LE_OK);
            LE_ASSERT(le_ecall_SetMsdPassengersCount(MytECallRef, 3) == LE_OK);
            LE_ASSERT(le_ecall_StartTest(MytECallRef) == LE_OK);
            LE_INFO("Start eCall #%d", TestCount);
        }
    }

    le_event_RunLoop();
}
Ejemplo n.º 6
0
//--------------------------------------------------------------------------------------------------
static void StartTestECall
(
    void
)
{
    le_ecall_State_t                   state = LE_ECALL_STATE_UNKNOWN;
    le_ecall_StateChangeHandlerRef_t   stateChangeHandlerRef = 0x00;

    LE_INFO("Start StartTestECall");

    LE_ASSERT((stateChangeHandlerRef = le_ecall_AddStateChangeHandler(MyECallEventHandler, NULL)) != NULL);

    LE_ASSERT(le_ecall_SetPsapNumber(PsapNumber) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdTxMode(LE_ECALL_TX_MODE_PUSH) == LE_OK);

    LE_ASSERT((LastTestECallRef=le_ecall_Create()) != NULL);

    LE_ASSERT(le_ecall_SetMsdPosition(LastTestECallRef, true, +48898064, +2218092, 0) == LE_OK);

    LE_ASSERT(le_ecall_SetMsdPassengersCount(LastTestECallRef, 3) == LE_OK);

    ConnectAudio();
    // Set a default gain for my test
    le_audio_SetGain(FeOutRef, 50);

    LE_ASSERT(le_ecall_StartTest(LastTestECallRef) == LE_OK);

    state=le_ecall_GetState(LastTestECallRef);
    LE_ASSERT(((state>=LE_ECALL_STATE_STARTED) && (state<=LE_ECALL_STATE_FAILED)));
}
Ejemplo n.º 7
0
//--------------------------------------------------------------------------------------------------
static void StartSession
(
    uint32_t paxCount,      ///< [IN] number of passengers
    int32_t  hMinAccuracy,  ///< [IN] minimum horizontal accuracy to trust the position (in meters)
    int32_t  dirMinAccuracy ///< [IN] minimum direction accuracy to trust the position (in degrees)
)
{
    bool                              isPosTrusted = false;
    int32_t                           latitude = 0x7FFFFFFF;
    int32_t                           longitude = 0x7FFFFFFF;
    int32_t                           hAccuracy = 0;
    int32_t                           direction = 0x7FFFFFFF;
    int32_t                           dirAccuracy = 0;

    LE_DEBUG("StartSession called");

    if (ECallRef)
    {
        LE_WARN("End and Delete previous eCall session.");
        le_ecall_End(ECallRef);
        le_ecall_Delete(ECallRef);
        ECallRef = NULL;
    }

    ECallRef=le_ecall_Create();
    LE_FATAL_IF((!ECallRef), "Unable to create an eCall object, exit the app!");
    LE_DEBUG("Create eCallRef.%p",  ECallRef);

    // Get the position data
    if ((le_pos_Get2DLocation(&latitude, &longitude, &hAccuracy) == LE_OK) &&
        (le_pos_GetDirection(&direction, &dirAccuracy) == LE_OK))
    {
        if ((hAccuracy < hMinAccuracy) && (dirAccuracy < dirMinAccuracy))
        {
            isPosTrusted = true;
            LE_INFO("Position can be trusted.");
        }
        else
        {
            LE_WARN("Position can't be trusted!");
        }
    }
    else
    {
        LE_WARN("Position can't be trusted!");
    }

    LE_ERROR_IF((le_ecall_SetMsdPosition(ECallRef,
                                         isPosTrusted,
                                         latitude,
                                         longitude,
                                         direction) != LE_OK),
                "Unable to set the position!");

    if (paxCount > 0)
    {
        LE_ERROR_IF((le_ecall_SetMsdPassengersCount(ECallRef, paxCount) != LE_OK),
                    "Unable to set the number of passengers!");
    }

    LE_ERROR_IF((le_ecall_StartTest(ECallRef) != LE_OK),
                "Unable to start an eCall, try again!");

    LE_INFO("Test eCall has been successfully triggered.");
}