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.

Custom message between stack task and application task

Other Parts Discussed in Thread: BLE-STACK

Hi,

where can I find an example of a generic message sent from BLE stack task to application task using ICall?

I want to send an inter-task message as described in section 4.3.2.2 of BLE SDG for BLE-Stack 2.1.0, but I don't understand how to define a new custom message in stack task and send it.

Thanks for your help.

Luca

  • Hello Luca,

    Can you provide an example on how you would want to define/send a custom message from the Stack task? It's generally advisable not to modify the stack task but instead create your own task to pass messages.

    Best wishes
  • Hello JXS,

    I am using HostTest on my custom USB dongle project.

    I would like that the stack task could send a message/event to application task when, for example, it receives UTIL_ForceBoot message or before sending GAP_EstablishLink event message, like it does when it receives GAP_TerminateLinkRequest.

    In such case I am able to receive the message in the application task loop:

    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)
          {
            bool dealloc = true;
    
            if ((src == ICALL_SERVICE_CLASS_BLE) && (dest == selfEntity))
            {
              // Process incoming messages
              switch (pMsg->hdr.event)
              {
                case HCI_GAP_EVENT_EVENT:
                  HostTestApp_processGapEvent(pMsg);
                  break;
                default:
                  break;
              }
            }
    
            if (dealloc == true)
            {
              ICall_freeMsg(pMsg);
            }
          }
        }

    I would like a custom message/event to the application task with osal_msg_send, like I see in OnBoard_SendKeys:

        // Send the address to the task
        msgPtr = (keyChange_t *)osal_msg_allocate( sizeof(keyChange_t) );
        if ( msgPtr )
        {
          msgPtr->hdr.event = KEY_CHANGE;
          msgPtr->state = state;
          msgPtr->keys = keys;
    
          osal_msg_send( registeredKeysTaskID, (uint8 *)msgPtr );

    What is the TaskID of the application task to use in osal_msg_send? How can I get it?


    Thanks for your help.

    Luca

     

     

  • Hi Luca,

    I want to do the same thing. Have you resolved the problem?

    Best regards,

    Yang