• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ osal_msg_receive函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中osal_msg_receive函数的典型用法代码示例。如果您正苦于以下问题:C++ osal_msg_receive函数的具体用法?C++ osal_msg_receive怎么用?C++ osal_msg_receive使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了osal_msg_receive函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Hal_ProcessEvent

/**************************************************************************************************
 * @fn      Hal_ProcessEvent
 *
 * @brief   Hal Process Event
 *
 * @param   task_id - Hal TaskId
 *          events - events
 *
 * @return  None
 **************************************************************************************************/
uint16 Hal_ProcessEvent( uint8 task_id, uint16 events )
{
  uint8 *msgPtr;

  (void)task_id;  // Intentionally unreferenced parameter
  
  //--------------------------------------------------------------------------//
  // processing the system message
  //--------------------------------------------------------------------------//
  if ( events & SYS_EVENT_MSG )
  {
    msgPtr = osal_msg_receive(Hal_TaskID);

    while (msgPtr)
    {
      /* Do something here - for now, just deallocate the msg and move on */

      /* De-allocate */
      osal_msg_deallocate( msgPtr );
      /* Next */
      msgPtr = osal_msg_receive( Hal_TaskID );
    }
    return events ^ SYS_EVENT_MSG;
  }
  
  return 0;
}
开发者ID:zhaoxuepeng,项目名称:ColomoBLE_WeChat-test,代码行数:37,代码来源:hal_drivers.c


示例2: Hal_ProcessEvent

/**************************************************************************************************
 * @fn      Hal_ProcessEvent
 *
 * @brief   Hal Process Event
 *
 * @param   task_id - Hal TaskId
 *          events - events
 *
 * @return  None
 **************************************************************************************************/
uint16 Hal_ProcessEvent( uint8 task_id, uint16 events )
{
  uint8 *msgPtr;
  
  (void)task_id;  // Intentionally unreferenced parameter

  if ( events & SYS_EVENT_MSG )
  {
    msgPtr = osal_msg_receive(Hal_TaskID);

    while (msgPtr)
    {
      /* Do something here - for now, just deallocate the msg and move on */

      /* De-allocate */
      osal_msg_deallocate( msgPtr );
      /* Next */
      msgPtr = osal_msg_receive( Hal_TaskID );
    }
    return events ^ SYS_EVENT_MSG;
  }

  if ( events & HAL_LED_BLINK_EVENT )
  {
#if (defined (BLINK_LEDS)) && (HAL_LED == TRUE)
    HalLedUpdate();
#endif /* BLINK_LEDS && HAL_LED */
    return events ^ HAL_LED_BLINK_EVENT;
  }

  if (events & HAL_KEY_EVENT)
  {

#if (defined HAL_KEY) && (HAL_KEY == TRUE)
    /* Check for keys */
    HalKeyPoll();

    /* if interrupt disabled, do next polling */
    if (!Hal_KeyIntEnable)
    {
      osal_start_timerEx( Hal_TaskID, HAL_KEY_EVENT, 100);
    }
#endif // HAL_KEY

    return events ^ HAL_KEY_EVENT;
  }

#ifdef POWER_SAVING
  if ( events & HAL_SLEEP_TIMER_EVENT )
  {
    halRestoreSleepLevel();
    return events ^ HAL_SLEEP_TIMER_EVENT;
  }
#endif

  /* Nothing interested, discard the message */
  return 0;

}
开发者ID:kobefaith,项目名称:zigbee,代码行数:69,代码来源:hal_drivers.c


示例3: DisplayTaskEventLoop

uint16 DisplayTaskEventLoop(uint8 task_id, uint16 events)
{
	   Dis_Msg_t *msg = NULL;
	
	   if(events & SYS_EVENT_MSG)
		 {
			  msg = (Dis_Msg_t *)osal_msg_receive(task_id);
			 
			  while(msg)
				{
					 switch(msg->hdr.event)
					 {
                case DIS_UPDATE:
									if(false == IS_Flag_Valid(DISPLAY_UPDATE_LOCK)){
										dispaly_update_handler(gSystem_t, cur_menu->id, msg->value);
									}
									break;
								
								case DIS_JUMP:
									dispaly_update_handler(gSystem_t, (menu_id_t)msg->value, 0);
									break;
								
								default:
									break;
					 }
					 
					 osal_msg_deallocate((uint8 *) msg);
					 
					 msg = (Dis_Msg_t *)osal_msg_receive(task_id);
				}
				
				return (events ^ SYS_EVENT_MSG);
		 }
		 
		 if(events & VOL_DIS_BACK_MSG){
			 vol_dis_timeout_handler();
			 return (events ^ VOL_DIS_BACK_MSG);
		 }
		 
		 if(events & SRC_MENU_TIMEOUT_MSG){
			 src_dis_timeout_handler();
			 return (events ^ SRC_MENU_TIMEOUT_MSG);
		 }
		 
		 if(events & SRC_MENU_TO_FILE_LIST_TIMEOUT_MSG){
			 
			 src_menu_to_file_list_handler();
			 
			 return(events ^ SRC_MENU_TO_FILE_LIST_TIMEOUT_MSG);
		 }
		 
		 return 0;
 }
开发者ID:saiyn,项目名称:OSAL,代码行数:53,代码来源:Display_Task.c


示例4: SampleApp_ProcessEvent

/*********************************************************************
 * @fn      SampleApp_ProcessEvent
 * @brief   Generic Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 * @return  none
 */
uint16 SampleApp_ProcessEvent( uint8 task_id, uint16 events )
{
  afIncomingMSGPacket_t *MSGpkt;
  (void)task_id;  // Intentionally unreferenced parameter

  if ( events & SYS_EVENT_MSG )
  {
    MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( SampleApp_TaskID );
    //Databuf = osal_mem_alloc(MSGpkt->cmd.DataLength);
    while ( MSGpkt )
    {
        switch ( MSGpkt->hdr.event )
        {        
          // Received when a messages is received (OTA) for this endpoint
          case AF_INCOMING_MSG_CMD:
            SampleApp_MessageMSGCB( MSGpkt );
            break;  
          default:
            break;
        }    
        
      // Release the memory
      osal_msg_deallocate((uint8 *)MSGpkt );
     
      // Next - if one is available
      MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive( SampleApp_TaskID );
    }
  
    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  // Send a message out - This event is generated by a timer
  //  (setup in SampleApp_Init()).
  if ( events & SAMPLEAPP_SEND_PERIODIC_MSG_EVT )
  {
     
     SampleApp_SendPeriodicMessage();  //发送数据函数
     
    // Setup to send message again in normal period (+ a little jitter)
   
    osal_start_timerEx( SampleApp_TaskID, SAMPLEAPP_SEND_PERIODIC_MSG_EVT,
        (SAMPLEAPP_SEND_PERIODIC_MSG_TIMEOUT + (osal_rand() & 0x00FF)) );

    // return unprocessed events
    return (events ^ SAMPLEAPP_SEND_PERIODIC_MSG_EVT);
  }

  // Discard unknown events
  return 0;
}
开发者ID:ProjectCosin,项目名称:CCU.Android.System.Coordinator,代码行数:61,代码来源:SampleApp.c


示例5: FanProcessEvent

uint16 FanProcessEvent(uint8 taskId, uint16 events)
{
	if (events & SYS_EVENT_MSG)
	{
		uint8* message = NULL;

		if ((message = osal_msg_receive(fanTaskId)) != NULL)
		{
			FanProcessOSALMessage((osal_event_hdr_t*)message);
			osal_msg_deallocate(message);
		}

		return (events ^ SYS_EVENT_MSG);
	}

	if (events & FAN_START_DEVICE_EVT)
	{
		GAPRole_StartDevice(&fanPeripheralCallBacks);
		GAPBondMgr_Register(&fanBondManagerCallBacks);
	
		return (events ^ FAN_START_DEVICE_EVT);
	}

	if (events & FAN_UPDATE_STATUS_EVT)
	{
		FanUpdateStatus();
	
		return (events ^ FAN_UPDATE_STATUS_EVT);
	}

	return 0;
};
开发者ID:drme,项目名称:ble-remote,代码行数:32,代码来源:fan.c


示例6: SimpleBLEBroadcaster_ProcessEvent

/*********************************************************************
 * @fn      SimpleBLEBroadcaster_ProcessEvent
 *
 * @brief   Simple BLE Broadcaster Application Task event processor. This
 *          function is called to process all events for the task. Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 SimpleBLEBroadcaster_ProcessEvent( uint8 task_id, uint16 events )
{
  
  VOID task_id; // OSAL required parameter that isn't used in this function
  
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( simpleBLEBroadcaster_TaskID )) != NULL )
    {
      simpleBLEBroadcaster_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & SBP_START_DEVICE_EVT )
  {
    // Start the Device
    VOID GAPRole_StartDevice( &simpleBLEBroadcaster_BroadcasterCBs );
    
    return ( events ^ SBP_START_DEVICE_EVT );
  }
  
  // Discard unknown events
  return 0;
}
开发者ID:billy-wang,项目名称:IOT,代码行数:45,代码来源:simpleBLEBroadcaster.c


示例7: CyclingService_ProcessEvent

/*********************************************************************
 * @fn      CyclingService_ProcessEvent
 *
 * @brief   process incoming event.
 *
 * @param   task_id - OSAL task id.
 *
 * @param   events - event bit(s) set for the task(s)
 *
 * @return  none
 */
uint16 CyclingService_ProcessEvent( uint8 task_id, uint16 events )
{
  VOID task_id;

  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( cyclingService_TaskID )) != NULL )
    {
      cycling_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & CSC_CMD_IND_SEND_EVT )
  {
    GATT_Indication( connectionHandle, &cscCmdInd, FALSE, cyclingService_TaskID );

    // Set Control Point Cfg done
    scOpInProgress = FALSE;

    return ( events ^ CSC_CMD_IND_SEND_EVT );
  }

  return 0;
}
开发者ID:AubrCool,项目名称:BLE,代码行数:43,代码来源:cyclingservice.c


示例8: MT_ProcessEvent

/***************************************************************************************************
 * @fn      MT_ProcessEvent
 *
 * @brief MonitorTest Task Event Processor.  This task is put into the task table.
 *
 * @param   byte task_id - task ID of the MT Task
 * @param   UINT16 events - event(s) for the MT Task
 *
 * @return  void
 ***************************************************************************************************/
UINT16 MT_ProcessEvent(uint8 task_id, uint16 events)
{
  uint8 *msg_ptr;
  
  (void)task_id;  // Intentionally unreferenced parameter

  /* Could be multiple events, so switch won't work */
  if ( events & SYS_EVENT_MSG )
  {
    while ( (msg_ptr = osal_msg_receive( MT_TaskID )) )
    {
      MT_ProcessIncomingCommand((mtOSALSerialData_t *)msg_ptr);
    }

    /* Return unproccessed events */
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & MT_ZTOOL_SERIAL_RCV_BUFFER_FULL )
  {
    /* Return unproccessed events */
    return (events ^ MT_ZTOOL_SERIAL_RCV_BUFFER_FULL);
  }

  /* Handle MT_SYS_OSAL_START_TIMER callbacks */
#if defined MT_SYS_FUNC
  if ( events & (MT_SYS_OSAL_EVENT_MASK))
  {
    if (events & MT_SYS_OSAL_EVENT_0)
    {
      MT_SysOsalTimerExpired(0x00);
      events ^= MT_SYS_OSAL_EVENT_0;
    }

    if (events & MT_SYS_OSAL_EVENT_1)
    {
      MT_SysOsalTimerExpired(0x01);
      events ^= MT_SYS_OSAL_EVENT_1;
    }

    if (events & MT_SYS_OSAL_EVENT_2)
    {
      MT_SysOsalTimerExpired(0x02);
      events ^= MT_SYS_OSAL_EVENT_2;
    }

    if (events & MT_SYS_OSAL_EVENT_3)
    {
      MT_SysOsalTimerExpired(0x03);
      events ^= MT_SYS_OSAL_EVENT_3;
    }

    return events;
  }
#endif

  /* Discard or make more handlers */
  return 0;

} /* MT_ProcessEvent() */
开发者ID:tuteng,项目名称:zigbee,代码行数:70,代码来源:MT_TASK.c


示例9: MHMSSysEvtMsg

/**************************************************************************************************
 * @fn          MHMSSysEvtMsg
 *
 * @brief       This function is called by MHMSAppEvt() to process all of the pending OSAL messages.
 *
 * input parameters
 *
 * None.
 *
 * output parameters
 *
 * None.
 *
 * @return      None.
 **************************************************************************************************
 */
static void MHMSSysEvtMsg(void)
{
    uint8 *msg;

    while ((msg = osal_msg_receive(MHMSTaskId)))
    {
        switch (*msg)
        {
#if TVSA_DATA_CNF  //MHMS Question what is this for?
        case AF_DATA_CONFIRM_CMD:
            if (ZSuccess != ((afDataConfirm_t *)msg)->hdr.status)
            {
                if (0 == ++MHMSCnfErrCnt)
                {
                    MHMSCnfErrCnt = 255;
                }
            }
            break;
#endif

        case AF_INCOMING_MSG_CMD:  //MHMS this a router processing the incomming command from the coordinator
            MHMSAfMsgRx((afIncomingMSGPacket_t *)msg);
            break;

        case ZDO_STATE_CHANGE:
            MHMSZdoStateChange();
            break;

        default:
            break;
        }

        (void)osal_msg_deallocate(msg);  // Receiving task is responsible for releasing the memory.
    }
}
开发者ID:krismontpetit,项目名称:MHMS,代码行数:51,代码来源:tvsa.c


示例10: GAPCentralRole_ProcessEvent

/**
 * @brief   Central Profile Task event processing function.
 *
 * @param   taskId - Task ID
 * @param   events - Events.
 *
 * @return  events not processed
 */
uint16 GAPCentralRole_ProcessEvent( uint8 taskId, uint16 events )
{
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( gapCentralRoleTaskId )) != NULL )
    {
      gapCentralRole_ProcessOSALMsg( (osal_event_hdr_t *) pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & GAP_EVENT_SIGN_COUNTER_CHANGED )
  {
    // Sign counter changed, save it to NV
    VOID osal_snv_write( BLE_NVID_SIGNCOUNTER, sizeof( uint32 ), &gapCentralRoleSignCounter );

    return ( events ^ GAP_EVENT_SIGN_COUNTER_CHANGED );
  }

  // Discard unknown events
  return 0;
}
开发者ID:AubrCool,项目名称:BLE,代码行数:37,代码来源:central.c


示例11: HidEmuKbd_ProcessEvent

/*********************************************************************
 * @fn      HidEmuKbd_ProcessEvent
 *
 * @brief   HidEmuKbd Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 HidEmuKbd_ProcessEvent( uint8 task_id, uint16 events )
{

  VOID task_id; // OSAL required parameter that isn't used in this function

  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( hidEmuKbdTaskId )) != NULL )
    {
      hidEmuKbd_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & START_DEVICE_EVT )
  {
    return ( events ^ START_DEVICE_EVT );
  }

   return 0;
}
开发者ID:bluewish,项目名称:ble_dev,代码行数:41,代码来源:hidemukbd.c


示例12: TimeApp_ProcessEvent

/*********************************************************************
 * @fn      TimeApp_ProcessEvent
 *
 * @brief   Time App Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 TimeApp_ProcessEvent( uint8 task_id, uint16 events )
{
  
  VOID task_id; // OSAL required parameter that isn't used in this function
  
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( timeAppTaskId )) != NULL )
    {
      timeApp_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return ( events ^ SYS_EVENT_MSG );
  }

  if ( events & START_DEVICE_EVT )
  {
    // Start the Device
    VOID GAPRole_StartDevice( &timeAppPeripheralCB );

    // Register with bond manager after starting device
    GAPBondMgr_Register( (gapBondCBs_t *) &timeAppBondCB );

    return ( events ^ START_DEVICE_EVT );
  }

  if ( events & START_DISCOVERY_EVT )
  {
    if ( timeAppPairingStarted )
    {
      // Postpone discovery until pairing completes
      timeAppDiscPostponed = TRUE;
    }
    else
    {
      timeAppDiscState = timeAppDiscStart();
    }  
    return ( events ^ START_DISCOVERY_EVT );
  }

  if ( events & CLOCK_UPDATE_EVT )
  {
    timeAppClockDisplay();

    // Restart clock tick timer
    osal_start_timerEx( timeAppTaskId, CLOCK_UPDATE_EVT, DEFAULT_CLOCK_UPDATE_PERIOD );

    return ( events ^ CLOCK_UPDATE_EVT );
  }
     
  // Discard unknown events
  return 0;
}
开发者ID:Mecabot,项目名称:BLE-CC254x-1.4.0,代码行数:72,代码来源:timeapp.c


示例13: SimpleBLEPeripheral_ProcessEvent

/*********************************************************************
 * @fn      SimpleBLEPeripheral_ProcessEvent
 *
 * @brief   Simple BLE Peripheral Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 SimpleBLEPeripheral_ProcessEvent( uint8 task_id, uint16 events )
{
  //tasksArr[] ÊÇ11¸öTaskµÄ×îºóÒ»¸ö£¬ÓÉOSAL ϵͳ½øÐе÷¶È¡£ÓÐʱ¼äÀ´ÁË£¬Óø÷½·¨´¦Àí¡£³õʼ»¯OSAL_SimpleBLEperipheal

  VOID task_id; // OSAL required parameter that isn't used in this function

  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( simpleBLEPeripheral_TaskID )) != NULL )
    {
      simpleBLEPeripheral_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & SBP_START_DEVICE_EVT )
  {
    // Start the Device   Õâ¸öÊÇÉ豸ÓÐ״̬±ä»¯²Å»áµ÷ÓõĻص÷º¯Êý
    VOID GAPRole_StartDevice( &simpleBLEPeripheral_PeripheralCBs );

    // Start Bond Manager
    VOID GAPBondMgr_Register( &simpleBLEPeripheral_BondMgrCBs );
    
    // Set timer for first periodic event
    //init LED
    PWM_init();
    init_QI_Switch(1);
    //dataChange(1,0);
    
    //osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
    //LedChange();
    return ( events ^ SBP_START_DEVICE_EVT );
  }
  
 if ( events & SBP_PERIODIC_EVT )
  {
    //osal_start_timerEx( simpleBLEPeripheral_TaskID, SBP_PERIODIC_EVT, SBP_PERIODIC_EVT_PERIOD );
    //Ö´ÐеƹâchangeµÄº¯Êý
    
    if(P1_1 == 1){
        //HalLcdWriteString("HEIGH",HAL_LCD_LINE_4);
    }else{
        //HalLcdWriteString("LOW",HAL_LCD_LINE_4);
    }

    LedChange();
    return (events ^ SBP_PERIODIC_EVT);
  }

  // Discard unknown events
  return 0;
}
开发者ID:uestczhuyan,项目名称:ankiBLE,代码行数:72,代码来源:simpleBLEPeripheral.c


示例14: LoacationApp_ProcessEvent

/* @fn      LoacationApp_ProcessEvent
 * @brief   Generic Application Task event processor.
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - Bit map of events to process.
 * @return  none*/
uint16 LoacationApp_ProcessEvent( uint8 task_id, uint16 events ) {
  if ( events & SYS_EVENT_MSG ) {
    afIncomingMSGPacket_t *MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive(
                                                             LoacationApp_TaskID );
    while ( MSGpkt != NULL ) {
      switch ( MSGpkt->hdr.event ) {
      case KEY_CHANGE:
        handleKeys( ((keyChange_t *)MSGpkt)->state, ((keyChange_t *)MSGpkt)->keys );
        break;
      case AF_DATA_CONFIRM_CMD:
#if !defined( RTR_NWK )
        {
        // This message is received as a confirmation of a data packet sent.
        // The status is of ZStatus_t type [defined in ZComDef.h]
        afDataConfirm_t *afDataConfirm = (afDataConfirm_t *)MSGpkt;
        /* No ACK from the MAC layer implies that mobile device is out of
         * range of most recent parent. Therefore, begin an orphan scan
         * to try to find a former parent.
         * NOTE: To get the fastest action in the process of finding a new
         * parent, set the MAX_JOIN_ATTEMPTS in ZDApp.c to 1.*/
        if(afDataConfirm->hdr.status == ZMacNoACK) LoacationApp_NoACK();
        else{}// Some other error -- Do something.
        }
#endif
        break;
      case AF_INCOMING_MSG_CMD:
        processMSGCmd( MSGpkt );
        break;
      case ZDO_STATE_CHANGE:
#if defined( POWER_SAVING )
        if(rejoinPending) {
          rejoinPending = FALSE;
          LoacationApp_Sleep(TRUE); //Ok to resume power saving ops.
        }
#endif
        break;
      default:
        break;
      }
      osal_msg_deallocate( (uint8 *)MSGpkt );
      MSGpkt = (afIncomingMSGPacket_t *)osal_msg_receive(LoacationApp_TaskID);
    }
    return (events ^ SYS_EVENT_MSG);  // Return unprocessed events.
  }
  return 0;  // Discard unknown events
}
开发者ID:abyssxsy,项目名称:ZigBeeLocalizer,代码行数:51,代码来源:LocationApp.c


示例15: GAPCentralRole_ProcessEvent

/**
 * @brief   Central Profile Task event processing function.
 *
 * @param   taskId - Task ID
 * @param   events - Events.
 *
 * @return  events not processed
 */
uint16 GAPCentralRole_ProcessEvent( uint8 taskId, uint16 events )
{
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( gapCentralRoleTaskId )) != NULL )
    {
      gapCentralRole_ProcessOSALMsg( (osal_event_hdr_t *) pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & GAP_EVENT_SIGN_COUNTER_CHANGED )
  {
    // Sign counter changed, save it to NV
    VOID osal_snv_write( BLE_NVID_SIGNCOUNTER, sizeof( uint32 ), &gapCentralRoleSignCounter );

    return ( events ^ GAP_EVENT_SIGN_COUNTER_CHANGED );
  }

  if ( events & START_ADVERTISING_EVT )
  {
    if ( gapRole_AdvEnabled )
    {
      gapAdvertisingParams_t params;

      // Setup advertisement parameters
      params.eventType = gapRole_AdvEventType;
      params.initiatorAddrType = gapRole_AdvDirectType;
      VOID osal_memcpy( params.initiatorAddr, gapRole_AdvDirectAddr, B_ADDR_LEN );
      params.channelMap = gapRole_AdvChanMap;
      params.filterPolicy = gapRole_AdvFilterPolicy;

      if ( GAP_MakeDiscoverable( gapRole_TaskID, &params ) != SUCCESS )
      {
        gapRole_state = GAPROLE_ERROR;
        // Notify the application
        if ( pGapCentralRoleCB && pGapCentralRoleCB->broadcastCB )
        {
          pGapCentralRoleCB->broadcastCB( gapRole_state );
        }
      }
    }

    return ( events ^ START_ADVERTISING_EVT );
  }  
  
  
  
  // Discard unknown events
  return 0;
}
开发者ID:karthikdash,项目名称:BLE,代码行数:66,代码来源:centralBroadcasterProfile.c


示例16: zapSBL_SysEvtMsg

/**************************************************************************************************
 * @fn          zapSBL_SysEvtMsg
 *
 * @brief       This function is called by zapSBL_Evt() to process all pending OSAL messages.
 *
 * input parameters
 *
 * None.
 *
 * output parameters
 *
 * None.
 *
 * @return      None.
 **************************************************************************************************
 */
static void zapSBL_SysEvtMsg(void)
{
  uint8 *msg;

  while ((msg = osal_msg_receive(zapSBL_TaskId)))
  {
    (void)osal_msg_deallocate(msg);  // Receiving task is responsible for releasing the memory.
  }
}
开发者ID:Daan1992,项目名称:WSN-Lab,代码行数:25,代码来源:zap_sbl.c


示例17: SoftCmd_ProcessEvent

/*********************************************************************
 * @fn      SoftCmd_ProcessEvent
 *
 * @brief   Soft Command Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 SoftCmd_ProcessEvent( uint8 task_id, uint16 events )
{
  
  VOID task_id; // OSAL required parameter that isn't used in this function
  
  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( softCmdTaskId )) != NULL )
    {
      softCmd_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & START_DEVICE_EVT )
  {
    // Start the Device
    VOID GAPRole_StartDevice( &softCmdPeripheralCBs );

    // Register with bond manager after starting device
    GAPBondMgr_Register( (gapBondCBs_t *) &softCmdBondCB );
    
    return ( events ^ START_DEVICE_EVT );
  }

  if ( events & START_DISCOVERY_EVT )
  {
    if ( softCmdPairingStarted )
    {
      // Postpone discovery until pairing completes
      softCmdDiscPostponed = TRUE;
    }
    else
    {
      softCmdDiscState = softCmdDiscStart();
    }  
    return ( events ^ START_DISCOVERY_EVT );
  }

  if ( events & BATT_PERIODIC_EVT )
  {
    // Perform periodic battery task
    softCmdBattPeriodicTask();
    
    return (events ^ BATT_PERIODIC_EVT);
  }  
  
  // Discard unknown events
  return 0;
}
开发者ID:JensenSung,项目名称:shred444,代码行数:70,代码来源:softcmd.c


示例18: SimpleBLEPeripheral_ProcessEvent

/*********************************************************************
 * @fn      SimpleBLEPeripheral_ProcessEvent
 *
 * @brief   Simple BLE Peripheral Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 SimpleBLEPeripheral_ProcessEvent( uint8 task_id, uint16 events )
{

  VOID task_id; // OSAL required parameter that isn't used in this function

  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( simpleBLEPeripheral_TaskID )) != NULL )
    {
      simpleBLEPeripheral_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & SBP_START_DEVICE_EVT )
  {
    P0_7 = 0;  //防止继电器跳变,初始化为高
    P0DIR |= BV(7); //设置为输出
    P0SEL &=~BV(7); //设置该脚为普通GPIO
    //HCI_EXT_SetTxPowerCmd (HCI_EXT_TX_POWER_MINUS_23_DBM);
    // Start the Device
    VOID GAPRole_StartDevice( &simpleBLEPeripheral_PeripheralCBs );

    // Start Bond Manager
    VOID GAPBondMgr_Register( &simpleBLEPeripheral_BondMgrCBs );

    return ( events ^ SBP_START_DEVICE_EVT );
  }

  if ( events & SBP_PERIODIC_EVT )
  {
    //成功写入后,重启从机
    HAL_SYSTEM_RESET();
    return (events ^ SBP_PERIODIC_EVT);
  }

#if defined ( PLUS_BROADCASTER )
  if ( events & SBP_ADV_IN_CONNECTION_EVT )
  {
    uint8 turnOnAdv = TRUE;
    // Turn on advertising while in a connection
    GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &turnOnAdv );

    return (events ^ SBP_ADV_IN_CONNECTION_EVT);
  }
#endif // PLUS_BROADCASTER

  // Discard unknown events
  return 0;
}
开发者ID:HoobeeTechnology,项目名称:Hoobee,代码行数:70,代码来源:simpleBLEPeripheral.c


示例19: PIRSensor_ProcessEvent

/*********************************************************************
 * @fn      PIRSensor_ProcessEvent
 *
 * @brief   Simple BLE Peripheral Application Task event processor.  This function
 *          is called to process all events for the task.  Events
 *          include timers, messages and any other user defined events.
 *
 * @param   task_id  - The OSAL assigned task ID.
 * @param   events - events to process.  This is a bit map and can
 *                   contain more than one event.
 *
 * @return  events not processed
 */
uint16 PIRSensor_ProcessEvent( uint8 task_id, uint16 events )
{

  VOID task_id; // OSAL required parameter that isn't used in this function

  if ( events & SYS_EVENT_MSG )
  {
    uint8 *pMsg;

    if ( (pMsg = osal_msg_receive( PIRSensor_TaskID )) != NULL )
    {
      PIRSensor_ProcessOSALMsg( (osal_event_hdr_t *)pMsg );

      // Release the OSAL message
      VOID osal_msg_deallocate( pMsg );
    }

    // return unprocessed events
    return (events ^ SYS_EVENT_MSG);
  }

  if ( events & SBP_START_DEVICE_EVT )
  {
    // Start the Device
    VOID GAPRole_StartDevice( &PIRSensor_PeripheralCBs );

    // Start Bond Manager
    VOID GAPBondMgr_Register( &PIRSensor_BondMgrCBs );

    return ( events ^ SBP_START_DEVICE_EVT );
  }

  //////////////////////////
  //         AIN          //
  //////////////////////////
  if ( events & SBP_READ_AIN_EVT )
  {
    if(ainEnabled)
    {
      uint16 ainData;
      ainData = readAdcData(HAL_ADC_CHANNEL_6);
      Ain_SetParameter(SENSOR_DATA, AIN_DATA_LEN, &ainData);
      
      osal_start_timerEx( PIRSensor_TaskID, SBP_READ_AIN_EVT, sensorAinPeriod );
    }
    else
    {
      resetCharacteristicValue( AIN_SERV_UUID, SENSOR_DATA, 0, AIN_DATA_LEN);
      resetCharacteristicValue( AIN_SERV_UUID, SENSOR_CONF, ST_CFG_SENSOR_DISABLE, sizeof ( uint8 ));
    }

    return (events ^ SBP_READ_AIN_EVT);
  }

  // Discard unknown events
  return 0;
}
开发者ID:jackchased,项目名称:ble-firmware,代码行数:70,代码来源:PIRSensor.c


示例20: MdcEventLoop

uint16 MdcEventLoop(uint8 task_id, uint16 events)
{
	Mdc_Task_Msg_t *msg = NULL;
	
	if(events & SYS_EVENT_MSG)
	{
		msg = (Mdc_Task_Msg_t *)osal_msg_receive(task_id);
			 
		while(msg)
		{
			switch(msg->hdr.event)
			{
				
				case MDC_VOLUME_MSG:
					mdc_volume_event_handler(gSystem_t);
					break;
				
				default:
				break;
			}
					 
			osal_msg_deallocate((uint8 *) msg);
					 
		  msg = (Mdc_Task_Msg_t *)osal_msg_receive(task_id);
	  }
				
			return (events ^ SYS_EVENT_MSG);
 }
	
	
	if(events & MDC_POLL_MSG){
		mdc_poll_handler(gSystem_t);
		return (events ^ MDC_POLL_MSG);
	}
	
	if(events & HDMI_V2_VOLUME_PUSH_MSG){
		
		Send_MdcTask_Msg(MDC_VOLUME_MSG, 0);
		
		return (events ^ HDMI_V2_VOLUME_PUSH_MSG);
	}
	
	return 0;
}
开发者ID:saiyn,项目名称:OSAL,代码行数:44,代码来源:MDC_Task.c



注:本文中的osal_msg_receive函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ osal_set_event函数代码示例发布时间:2022-05-30
下一篇:
C++ osal_msg_deallocate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap