本文整理汇总了C++中osal_set_event函数的典型用法代码示例。如果您正苦于以下问题:C++ osal_set_event函数的具体用法?C++ osal_set_event怎么用?C++ osal_set_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osal_set_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: zb_HandleOsalEvent
/******************************************************************************
* @fn zb_HandleOsalEvent
*
* @brief The zb_HandleOsalEvent function is called by the operating
* system when a task event is set
*
* @param event - Bitmask containing the events that have been set
*
* @return none
*/
void zb_HandleOsalEvent( uint16 event )
{
if(event & SYS_EVENT_MSG)
{
}
if ( event & MY_START_EVT )
{
zb_StartRequest();
}
if ( event & MY_REPORT_EVT )
{
if (appState == APP_BINDED)
{
}
else
{
osal_set_event( sapi_TaskID, MY_FIND_COLLECTOR_EVT);
}
}
if ( event & MY_FIND_COLLECTOR_EVT )
{
// Find and bind to a gateway device (if this node is not gateway)
zb_BindDevice( TRUE, DUMMY_REPORT_CMD_ID, (uint8 *)NULL );
}
}
示例2: oadManagerSvcDiscoveryMsg
/*********************************************************************
* @fn oadManagerSvcDiscoveryMsg
*
* @brief Process GATT Primary Service discovery message
*
* @return none
*/
static void oadManagerSvcDiscoveryMsg(gattMsgEvent_t *pMsg)
{
if ( pMsg->hdr.status == SUCCESS ) // Characteristic found, the store handle.
{
attFindByTypeValueRsp_t *pRsp = &(pMsg->msg.findByTypeValueRsp);
if ( pRsp->numInfo > 0 )
{
oadSvcStartHdl = pRsp->handlesInfo[0].handle;
oadSvcEndHdl = pRsp->handlesInfo[0].grpEndHandle;
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
LCD_WRITE_STRING("OAD Svc Found!", HAL_LCD_LINE_1);
#endif
// OAD service found
(void)osal_set_event(oadManagerTaskId, CCC_DISCOVERY_EVT);
}
}
else if ( pMsg->hdr.status == bleProcedureComplete )
{
if ( oadSvcStartHdl == 0 )
{
#if (defined HAL_LCD) && (HAL_LCD == TRUE)
LCD_WRITE_STRING("OAD SvcNotFound", HAL_LCD_LINE_3);
#endif
}
}
}
示例3: zb_SendDataConfirm
/******************************************************************************
* @fn zb_SendDataConfirm
*
* @brief The zb_SendDataConfirm callback function is called by the
* ZigBee after a send data operation completes
*
* @param handle - The handle identifying the data transmission.
* status - The status of the operation.
*
* @return none
*/
void zb_SendDataConfirm( uint8 handle, uint8 status )
{
if(status != ZB_SUCCESS)
{
if ( ++reportFailureNr >= REPORT_FAILURE_LIMIT )
{
// Stop reporting
osal_stop_timerEx( sapi_TaskID, MY_REPORT_EVT );
// After failure reporting start automatically when the device
// is binded to a new gateway
reportState=TRUE;
// Try binding to a new gateway
osal_set_event( sapi_TaskID, MY_FIND_COLLECTOR_EVT );
reportFailureNr=0;
}
}
// status == SUCCESS
else
{
// Reset failure counter
reportFailureNr=0;
}
}
示例4: OADManager_Init
/*********************************************************************
* @fn OADManager_Init
*
* @brief Initialization function for the OAD Manager App Task.
* This is called during initialization and should contain
* any application specific initialization (ie. hardware
* initialization/setup, table initialization, power up
* notification).
*
* @param task_id - the ID assigned by OSAL. This ID should be
* used to send messages and set timers.
*
* @return none
*/
void OADManager_Init( uint8 task_id )
{
oadManagerTaskId = task_id;
// Setup Central Profile
{
uint8 scanRes = DEFAULT_MAX_SCAN_RES;
GAPCentralRole_SetParameter ( GAPCENTRALROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
}
// Setup GAP
GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
GAP_SetParamValue( TGAP_REJECT_CONN_PARAMS, DEFAULT_OAD_REJECT_CONN_PARAMS );
GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (uint8 *) oadManagerDeviceName );
// Initialize GATT Client
VOID GATT_InitClient();
// Register to receive incoming ATT Indications/Notifications
GATT_RegisterForInd( task_id );
#if (defined HAL_KEY) && (HAL_KEY == TRUE)
// Register for all key events - This app will handle all key events
RegisterForKeys( task_id );
#endif
#if (defined HAL_LED) && (HAL_LED == TRUE)
HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
#endif
// Setup a delayed profile startup
osal_set_event( task_id, START_DEVICE_EVT );
}
示例5: bedChangeCB
/*********************************************************************
* @fn bedChangeCB
*
* @brief Callback from BedProfile indicating a value change
*
* @param paramID - parameter ID of the value that was changed.
*
* @return none
*/
static void bedChangeCB( uint8 paramID )
{
/*
if (paramID == BED_CONF)
{
uint8 newValue;
Gyro_GetParameter( BED_CONF, &newValue );
if (newValue == 0)
{
// Put sensor to sleep
if (bedEnabled)
{
bedEnabled = FALSE;
osal_set_event( sensorTag_TaskID, ST_BED_SENSOR_EVT);
}
}
else
{
*/
bedEnabled = TRUE;
osal_set_event( sensorTag_TaskID, ST_BED_SENSOR_EVT);
//}
//} // should not get here
}
示例6: zapZdoProcessIncoming
/**************************************************************************************************
* @fn zapZdoProcessIncoming
*
* @brief This function processes the ZDO sub-system response from the ZNP.
*
* input parameters
*
* @param port - Port Id corresponding to the ZNP that sent the message.
* @param pBuf - A pointer to the RPC response.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
void zapZdoProcessIncoming(uint8 port, uint8 *pBuf)
{
uint8 len = pBuf[MT_RPC_POS_LEN];
uint8 cmd1 = pBuf[MT_RPC_POS_CMD1];
pBuf += MT_RPC_FRAME_HDR_SZ;
switch (cmd1)
{
case MT_ZDO_STATUS_ERROR_RSP: // TODO: fill-in when/if needed.
break;
case MT_ZDO_STATE_CHANGE_IND:
// Especially for UART transport, allow time for multiple got syncs before acting on it.
if (ZSuccess != osal_start_timerEx(zapTaskId, ZAP_APP_ZDO_STATE_CHANGE_EVT,
ZAP_APP_ZDO_STATE_CHANGE_DLY))
{
(void)osal_set_event(zapTaskId, ZAP_APP_ZDO_STATE_CHANGE_EVT);
}
break;
case MT_ZDO_MATCH_DESC_RSP_SENT: // TODO: fill-in when/if needed.
break;
case MT_ZDO_SRC_RTG_IND: // TODO: fill-in when/if needed.
break;
case MT_ZDO_JOIN_CNF: // TODO: fill-in when/if needed.
break;
case MT_ZDO_CONCENTRATOR_IND_CB:
zapZDO_ConcentratorIndicationCB(pBuf);
break;
case MT_ZDO_MSG_CB_INCOMING:
{
zdoIncomingMsg_t inMsg;
// Assuming exclusive use of network short addresses.
inMsg.srcAddr.addrMode = Addr16Bit;
inMsg.srcAddr.addr.shortAddr = BUILD_UINT16(pBuf[0], pBuf[1]);
pBuf += 2;
inMsg.wasBroadcast = *pBuf++;
inMsg.clusterID = BUILD_UINT16(pBuf[0], pBuf[1]);
pBuf += 2;
inMsg.SecurityUse = *pBuf++;
inMsg.TransSeq = *pBuf++;
inMsg.asduLen = len-9;
inMsg.macDestAddr = BUILD_UINT16(pBuf[0], pBuf[1]);
pBuf += 2;
inMsg.asdu = pBuf;
ZDO_SendMsgCBs(&inMsg);
}
break;
default:
break;
}
}
示例7: HAL_ISR_FUNCTION
HAL_ISR_FUNCTION(port2Isr, P2INT_VECTOR)
{
unsigned char status;
unsigned char i;
HAL_ENTER_ISR();
status = P2IFG;
status &= P2IEN;
if (status)
{
P2IFG = ~status;
P2IF = 0;
for (i = 0; i < OS_MAX_INTERRUPT; i++)
{
if (PIN_MAJOR(blueBasic_interrupts[i].pin) == 2 && (status & (1 << PIN_MINOR(blueBasic_interrupts[i].pin))))
{
osal_set_event(blueBasic_TaskID, BLUEBASIC_EVENT_INTERRUPT << i);
}
}
}
HAL_EXIT_ISR();
}
示例8: timeAppPairStateCB
/*********************************************************************
* @fn pairStateCB
*
* @brief Pairing state callback.
*
* @return none
*/
static void timeAppPairStateCB( uint16 connHandle, uint8 state, uint8 status )
{
if ( state == GAPBOND_PAIRING_STATE_STARTED )
{
timeAppPairingStarted = TRUE;
}
else if ( state == GAPBOND_PAIRING_STATE_COMPLETE )
{
timeAppPairingStarted = FALSE;
if ( status == SUCCESS )
{
linkDBItem_t *pItem;
if ( (pItem = linkDB_Find( gapConnHandle )) != NULL )
{
// Store bonding state of pairing
timeAppBonded = ( (pItem->stateFlags & LINK_BOUND) == LINK_BOUND );
if ( timeAppBonded )
{
osal_memcpy( timeAppBondedAddr, pItem->addr, B_ADDR_LEN );
}
}
// If discovery was postponed start discovery
if ( timeAppDiscPostponed && timeAppDiscoveryCmpl == FALSE )
{
timeAppDiscPostponed = FALSE;
osal_set_event( bloodPressureTaskId, BP_START_DISCOVERY_EVT );
}
}
}
}
示例9: oadManagerCharDiscovery
/*********************************************************************
* @fn oadManagerCharDiscovery
*
* @brief OAD Characteristics service discovery.
*
* @return none
*/
static void oadManagerCharDiscovery(void)
{
attReadByTypeReq_t req;
req.startHandle = oadSvcStartHdl;
req.endHandle = oadSvcEndHdl;
req.type.len = ATT_UUID_SIZE;
if ( oadManagerDiscIdx == 0 )
{
uint8 oadCharUUID[ATT_UUID_SIZE] = { TI_BASE_UUID_128( OAD_IMG_IDENTIFY_UUID ) };
(void)osal_memcpy(req.type.uuid, oadCharUUID, ATT_UUID_SIZE);
}
else
{
uint8 oadCharUUID[ATT_UUID_SIZE] = { TI_BASE_UUID_128( OAD_IMG_BLOCK_UUID ) };
(void)osal_memcpy(req.type.uuid, oadCharUUID, ATT_UUID_SIZE);
}
if (GATT_DiscCharsByUUID(oadManagerConnHandle, &req, oadManagerTaskId) != SUCCESS)
{
(void)osal_set_event(oadManagerTaskId, CHAR_DISCOVERY_EVT);
}
}
示例10: pulseNodeCheckIn
static void pulseNodeCheckIn(void)
{
static bool Flag;
afAddrType_t addr; //AF address stucture defined for info on the destination Endpoint object that data will be sent to
osal_stop_timerEx(pulseTaskId, PULSE_EVT_REQ); //Stop pulseDataReq() task since no pulse data is being measured
PulseEvtReq_sync = FALSE;
Flag = FALSE;
addr.addr.shortAddr = pulseAddr; //loading short address (16-bit) with pulse address
addr.addrMode = afAddr16Bit; //Set to directly sent to a node
addr.endPoint = PULSE_ENDPOINT; //Sets the endpoint of the final destination (coordinator?)
pulseDat[PULSE_CHECK_IN] = CHECK_IN_ACTIVE; //Flag is set and will notify coordinator that node is currently sending check in data
HalLcdWriteString("BPMsensor Inacti",HAL_LCD_LINE_5);
if (afStatus_SUCCESS != AF_DataRequest(&addr, (endPointDesc_t *)&PULSE_epDesc, PULSE_CLUSTER_ID,
PULSE_DAT_LEN, pulseDat, &pulseTSN, AF_DISCV_ROUTE,AF_DEFAULT_RADIUS))
{ //if data transfer is unsuccessful place event immediately back into queue to attempt to send again
osal_set_event(pulseTaskId, PULSE_EVT_CHECKIN);
}
else
{
pulseCnt++;
}
if((QS == FALSE) && (Flag == FALSE)){
osal_start_timerEx(pulseTaskId, PULSE_EVT_CHECKIN, PULSE_DLY_CHECKIN); //send check in dummy packet every 10 seconds
Flag = TRUE; //to prevent restarting of timer if existing already running
}
}
示例11: barometerChangeCB
/*********************************************************************
* @fn barometerChangeCB
*
* @brief Callback from Barometer Service indicating a value change
*
* @param paramID - parameter ID of the value that was changed.
*
* @return none
*/
static void barometerChangeCB( uint8 paramID )
{
uint8 newValue;
switch( paramID )
{
case SENSOR_CONF:
Barometer_GetParameter( SENSOR_CONF, &newValue );
switch ( newValue)
{
case ST_CFG_SENSOR_DISABLE:
if (barEnabled)
{
barEnabled = FALSE;
osal_set_event( sensorTag_TaskID, ST_BAROMETER_SENSOR_EVT);
}
break;
case ST_CFG_SENSOR_ENABLE:
if(!barEnabled)
{
barEnabled = TRUE;
osal_set_event( sensorTag_TaskID, ST_BAROMETER_SENSOR_EVT);
}
break;
case ST_CFG_CALIBRATE:
readBarCalibration();
break;
default:
break;
}
break;
case SENSOR_PERI:
Barometer_GetParameter( SENSOR_PERI, &newValue );
sensorBarPeriod = newValue*SENSOR_PERIOD_RESOLUTION;
break;
default:
// should not get here!
break;
}
}
示例12: HalLedBlink
/***************************************************************************************************
* @fn HalLedBlink
*
* @brief Blink the leds
*
* @param leds - bit mask value of leds to be blinked
* numBlinks - number of blinks
* percent - the percentage in each period where the led
* will be on
* period - length of each cycle in milliseconds
*
* @return None
***************************************************************************************************/
void HalLedBlink (uint8 leds, uint8 numBlinks, uint8 percent, uint16 period)
{
#if (defined (BLINK_LEDS)) && (HAL_LED == TRUE)
uint8 led;
HalLedControl_t *sts;
if (leds && percent && period)
{
if (percent < 100)
{
led = HAL_LED_1;
leds &= HAL_LED_ALL;
sts = HalLedStatusControl.HalLedControlTable;
while (leds)
{
if (leds & led)
{
/* Store the current state of the led before going to blinking if not already blinking */
if(sts->mode < HAL_LED_MODE_BLINK )
preBlinkState |= (led & HalLedState);
sts->mode = HAL_LED_MODE_OFF; /* Stop previous blink */
sts->time = period; /* Time for one on/off cycle */
sts->onPct = percent; /* % of cycle LED is on */
sts->left = numBlinks; /* Number of blink cycles */
if (!numBlinks) sts->mode |= HAL_LED_MODE_FLASH; /* Continuous */
sts->next = osal_GetSystemClock(); /* Start now */
sts->mode |= HAL_LED_MODE_BLINK; /* Enable blinking */
leds ^= led;
}
led <<= 1;
sts++;
}
// Cancel any overlapping timer for blink events
osal_stop_timerEx(Hal_TaskID, HAL_LED_BLINK_EVENT);
osal_set_event (Hal_TaskID, HAL_LED_BLINK_EVENT);
}
else
{
HalLedSet (leds, HAL_LED_MODE_ON); /* >= 100%, turn on */
}
}
else
{
HalLedSet (leds, HAL_LED_MODE_OFF); /* No on time, turn off */
}
#elif (HAL_LED == TRUE)
percent = (leds & HalLedState) ? HAL_LED_MODE_OFF : HAL_LED_MODE_ON;
HalLedOnOff (leds, percent); /* Toggle */
#else
// HAL LED is disabled, suppress unused argument warnings
(void) leds;
(void) numBlinks;
(void) percent;
(void) period;
#endif /* BLINK_LEDS && HAL_LED */
}
示例13: SimpleBLECentral_Init
/*********************************************************************
* @fn SimpleBLECentral_Init
*
* @brief Initialization function for the Simple BLE Central App Task.
* This is called during initialization and should contain
* any application specific initialization (ie. hardware
* initialization/setup, table initialization, power up
* notification).
*
* @param task_id - the ID assigned by OSAL. This ID should be
* used to send messages and set timers.
*
* @return none
*/
void SimpleBLECentral_Init( uint8 task_id )
{
simpleBLETaskId = task_id;
// 串口初始化
NPI_InitTransport(uart_NpiSerialCallback);
//NPI_WriteTransport("SimpleBLECentral_Init\r\n", 23);
Get_IMEI();
//halSleep(100);
//Get_Test();
// Setup Central Profile
{
uint8 scanRes = DEFAULT_MAX_SCAN_RES;
GAPCentralRole_SetParameter ( GAPCENTRALROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
}
// Setup GAP
GAP_SetParamValue( TGAP_GEN_DISC_SCAN, DEFAULT_SCAN_DURATION );
GAP_SetParamValue( TGAP_LIM_DISC_SCAN, DEFAULT_SCAN_DURATION );
GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, (uint8 *) simpleBLEDeviceName );
// Setup the GAP Bond Manager
{
uint32 passkey = DEFAULT_PASSCODE;
uint8 pairMode = DEFAULT_PAIRING_MODE;
uint8 mitm = DEFAULT_MITM_MODE;
uint8 ioCap = DEFAULT_IO_CAPABILITIES;
uint8 bonding = DEFAULT_BONDING_MODE;
GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof( uint32 ), &passkey );
GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof( uint8 ), &pairMode );
GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof( uint8 ), &mitm );
GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof( uint8 ), &ioCap );
GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof( uint8 ), &bonding );
}
// Initialize GATT Client
VOID GATT_InitClient();
// Register to receive incoming ATT Indications/Notifications
GATT_RegisterForInd( simpleBLETaskId );
// Initialize GATT attributes
GGS_AddService( GATT_ALL_SERVICES ); // GAP
GATTServApp_AddService( GATT_ALL_SERVICES ); // GATT attributes
// Register for all key events - This app will handle all key events
RegisterForKeys( simpleBLETaskId );
// makes sure LEDs are off
HalLedSet( (HAL_LED_1 | HAL_LED_2), HAL_LED_MODE_OFF );
// Setup a delayed profile startup
osal_set_event( simpleBLETaskId, START_DEVICE_EVT );
}
示例14: rxCB
/***************************************************************************************************
* LOCAL FUNCTIONS
***************************************************************************************************/
static void rxCB( uint8 port, uint8 event )
{
extern uint8 SampleApp_TaskID;
rxlen=Hal_UART_RxBufLen(SERIAL_APP_PORT); //接收缓冲区数据长度,字节为单位
readbuf(); //读取buf的数值,并判断时候用ID功能
if(rxlen==0)
osal_mem_free( rbuf ); //释放内存
else
osal_set_event(SampleApp_TaskID,UART_RX_CB_EVT);
}
示例15: readAccData
/*********************************************************************
* @fn readAccData
*
* @brief Read accelerometer data
*
* @param none
*
* @return none
*/
static void readAccData(void)
{
// uint8 aData[ACCELEROMETER_DATA_LEN];
// if (HalAccRead(aData))
// {
// Accel_SetParameter( ACCELEROMETER_DATA, ACCELEROMETER_DATA_LEN, aData);
// }
// readGyroData();
osal_set_event( sensorTag_TaskID, ST_GYROSCOPE_SENSOR_EVT );
}