//-------------------------------------------------------------------------------------------------- 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(); }
//-------------------------------------------------------------------------------------------------- static void* Test_thread(void* context) { le_ecall_StateChangeHandlerRef_t stateChangeHandlerRef = 0x00; le_ecall_ConnectService(); LE_INFO("Add State Change Handler"); LE_ASSERT((stateChangeHandlerRef = le_ecall_AddStateChangeHandler(MyECallEventHandler, NULL)) != NULL); LE_INFO("No event loop"); le_event_RunLoop(); }