Ejemplo n.º 1
0
static void MenuAppActionMsg(int item)
{
	tHostMsg* pOutgoingMsg;

	BPL_AllocMessageBuffer(&pOutgoingMsg);
	pOutgoingMsg->pPayload[0] = item;

	UTL_BuildHstMsg(pOutgoingMsg,GeneralPurposePhoneMsg,MENU_MSG_TYPE,
			pOutgoingMsg->pPayload,sizeof(char));

	RouteMsg(&pOutgoingMsg);
}
Ejemplo n.º 2
0
/*! A valid button event has occurred.  Now send a message
 *
 * \param unsigned char ButtonIndex
 * \param unsigned char ButtonPressType
 */
static void HandleButtonEvent(unsigned char ButtonIndex,
                              unsigned char ButtonPressType)
{
  tHostMsg* pButtonEventMsg;
  tButtonConfiguration* pLocalCfg = &(ButtonCfg[QueryDisplayMode()][ButtonIndex]);

  unsigned char DisplayMode = QueryDisplayMode();

  eMessageType Type = (eMessageType)pLocalCfg->CallbackMsgType[ButtonPressType];
  unsigned char Options = pLocalCfg->CallbackMsgOptions[ButtonPressType];

  if ( (pLocalCfg->MaskTable & (1 << ButtonPressType)) == 0 )
  {
    /* if the message type is non-zero then generate a message */
    if ( Type != 0 )
    {
        BPL_AllocMessageBuffer(&pButtonEventMsg);

        /* if this button press is going to the bluetooth then
         * format it properly.
         */
        if ( Type == ButtonEventMsg )
        {
          // Send the index of the button that changed state
          UTL_BuildHstMsg(pButtonEventMsg,
                          Type,
                          Options,
                          &ButtonIndex, sizeof(ButtonIndex));
        }
        else
        {
          /* a button can be configured to send any type of simple message
           * simple == limited payload
           */
          pButtonEventMsg->Type = Type;
          pButtonEventMsg->Options = Options;
        }

        RouteMsg(&pButtonEventMsg);

    }

  }

}
Ejemplo n.º 3
0
/*! Handle the messages routed to the background task */
static void BackgroundMessageHandler(tHostMsg* pMsg)
{
  tHostMsg* pOutgoingMsg;

  eMessageType Type = (eMessageType)pMsg->Type;

  switch(Type)
  {
  case GetDeviceType:
    BPL_AllocMessageBuffer(&pOutgoingMsg);

    pOutgoingMsg->pPayload[0] = 2; /* DIGITAL_BOARD_TYPE */

    UTL_BuildHstMsg(pOutgoingMsg, GetDeviceTypeResponse, NO_MSG_OPTIONS,
                    pOutgoingMsg->pPayload, sizeof(unsigned char));

    RouteMsg(&pOutgoingMsg);
    break;

  case SetVibrateMode:
    SetVibrateModeHandler(pMsg);
    break;

  case SetRealTimeClock:
    halRtcSet((tRtcHostMsgPayload*)pMsg->pPayload);

    BPL_AllocMessageBuffer(&pOutgoingMsg);
    pOutgoingMsg->Type = IdleUpdate;
    pOutgoingMsg->Options = NO_MSG_OPTIONS;
    RouteMsg(&pOutgoingMsg);

    break;

  default:
    PrintStringAndHex("<<Unhandled Message>> in Background Task: Type 0x", Type);
    break;
  }

}