請問各位,我想create new task專門負責處理send data to PHONE,
但程式卡在ICall_registerApp()就shutdown了,反覆看了sample code也沒發現有什麼可疑的。
我參考SDK的Sensor Tag create task,以下是我加的內容:
<define / flag>
ICALL_MAX_NUM_TASKS=4 ===> 5 //原本是4個task
#define SPP_TASK_STACK_SIZE 160
<main.c>
int main()
{
....
TBD_createTask();
App_process_createTask();
DataSend_createTask(); <=== new task
}
<DataSendProcess.c>
void SppSendData_init(void)
{
ICall_registerApp(&SppselfEntity, &sem); <================= 當在這
sppMsgQueue = Util_constructQueue(&appMsg);
Util_constructClock(&spp_periodicClock, SppDataSend_clockHandler,
SPP_PERIODIC_EVT_PERIOD, 0, false, SPP_PERIODIC_EVT);
}
void SppDataSend_createTask(void)
{
Task_Params taskParams;
// Configure task.
Task_Params_init(&taskParams);
taskParams.stack = sppTaskStack;
taskParams.stackSize = SPP_TASK_STACK_SIZE;
taskParams.priority = SPP_TASK_PRIORITY;
Task_construct(&sppSendTask, SppSendData_taskFxn, &taskParams, NULL);
}
void SppSendData_taskFxn(UArg a0, UArg a1)
{
SppSendData_init();
for (;;)
{
ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER);
if (events & SPP_PERIODIC_EVT)
{
Util_startClock(&spp_periodicClock);
sppSendEvt_t *pMsg = (sppSendEvt_t *)Util_dequeueMsg(sppMsgQueue);
if (pMsg->len != 0)
{
SPP_DATA_SEND(pMsg->len, pMsg->data); //SimpleProfile_SetParameter()
ICall_free(pMsg);
}
else
{
events &= ~SPP_PERIODIC_EVT;
}
}
while (!Queue_empty(sppMsgQueue))
{
sppSendEvt_t *pMsg = (sppSendEvt_t *)Util_dequeueMsg(sppMsgQueue);
if (pMsg->len != 0)
{
SPP_DATA_SEND(pMsg->len, pMsg->data);
ICall_free(pMsg);
}
}
}
}