This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

ICall_fetchServiceMsg函数在什么情况下能取到消息

Other Parts Discussed in Thread: CC2650

if(ICall_fetchServiceMsg(&stackid, &dest, (void **)&pMsg)== ICALL_ERRNO_SUCCESS)

CC2650作为节点收到数据后,应用层是不是通过ICall_fetchServiceMsg取回的消息?

还有哪些情况ICall_fetchServiceMsg会有消息取回,现在到这边后一直没反应

  • static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1)
    {
    // 初始化
    SimpleBLEPeripheral_init();

    // 应用主循环
    for (;;)
    {
    // 等待信号量
    // 一个消息message入队到消息接收队列或者ICall_signal被调用
    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)
    {
    uint8 safeToDealloc = TRUE;

    if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity))
    {
    ICall_Event *pEvt = (ICall_Event *)pMsg;

    // 查看是否是BLE Stack 事件
    if (pEvt->signature == 0xffff)
    {
    if (pEvt->event_flag & SBP_CONN_EVT_END_EVT)
    {
    // 重新发送ATT响应
    SimpleBLEPeripheral_sendAttRsp();
    }
    }
    else
    {
    // 处理 inter-task 消息
    safeToDealloc = SimpleBLEPeripheral_processStackMsg((ICall_Hdr *)pMsg);
    }
    }
    //销毁
    if (pMsg && safeToDealloc)
    {
    ICall_freeMsg(pMsg);
    }
    }

    // 如果RTOS队列不是空的(有任务),处理APP消息
    while (!Queue_empty(appMsgQueue))
    {
    sbpEvt_t *pMsg = (sbpEvt_t *)Util_dequeueMsg(appMsgQueue);
    if (pMsg)
    {
    // 处理消息
    SimpleBLEPeripheral_processAppMsg(pMsg);

    // 销毁 消息
    ICall_free(pMsg);
    }
    }
    }

    if (events & SBP_PERIODIC_EVT)
    {
    events &= ~SBP_PERIODIC_EVT;

    Util_startClock(&periodicClock);

    // 运行 periodic 应用任务
    SimpleBLEPeripheral_performPeriodicTask();
    }

    ... ...

    }
    }