I have created a state machine which processes in the task function to process the various states generated by the callback functions. I thought the SimpleBLECentral_taskfxn runs in an infinite loop. But it doesn't runs after the first iteration
static void SimpleBLECentral_taskFxn(UArg a0, UArg a1) { // Initialize application SimpleBLECentral_init(); // Application main loop for (;;) { // Waits for a signal to the semaphore associated with the calling thread. // Note that the semaphore associated with a thread is signaled when a // message is queued to the message receive queue of the thread or when // ICall_signal() function is called onto the semaphore. ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER); if (errno == ICALL_ERRNO_SUCCESS) { ICall_EntityID dest; ICall_ServiceEnum src; ICall_HciExtEvt *pMsg = NULL; if (ICall_fetchServiceMsg(&src, &dest, (void **)&pMsg) == ICALL_ERRNO_SUCCESS) { if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity)) { // Process inter-task message SimpleBLECentral_processStackMsg((ICall_Hdr *)pMsg); } if (pMsg) { ICall_freeMsg(pMsg); } } } // If RTOS queue is not empty, process app message while (!Queue_empty(appMsgQueue)) { sbcEvt_t *pMsg = (sbcEvt_t *)Util_dequeueMsg(appMsgQueue); if (pMsg) { // Process message SimpleBLECentral_processAppMsg(pMsg); // Free the space from the message ICall_free(pMsg); } } //state machine defined switch(taskState) { case TASK_CONNECT: function1(); break; case TASK_DISCOVER: function2(); break; case TASK_DISCONNECT: function3(); break; case TASK_SPI: function4(); break; case TASK_READ: } if (events & SBC_START_DISCOVERY_EVT) { events &= ~SBC_START_DISCOVERY_EVT; SimpleBLECentral_startDiscovery(); } } }