本文整理汇总了C++中AF_DataRequest函数的典型用法代码示例。如果您正苦于以下问题:C++ AF_DataRequest函数的具体用法?C++ AF_DataRequest怎么用?C++ AF_DataRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了AF_DataRequest函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AT_AF_Cmd_HA_CIDDISC_req
/********************************************************
process request funtin of the CLUSDISC command
*************************************************************/
void AT_AF_Cmd_HA_CIDDISC_req(afIncomingMSGPacket_t *pkt ){
AT_AF_hdr *req = (AT_AF_hdr *)pkt->cmd.Data;
AT_AF_Cmd_HA_CIDDISC_rsp_t *rsp;
uint8 status=0;
uint16 rspLen=0;
if(AT_is_CMD_EPs(req->ep)){
SimpleDescriptionFormat_t *pDesc;
if(SUCCESS == (status=afFindSimpleDesc(&pDesc, req->ep))){
rspLen = (pDesc->AppNumInClusters+pDesc->AppNumInClusters)*2 +sizeof(AT_AF_Cmd_HA_CIDDISC_rsp_t);
rsp = osal_mem_alloc(rspLen);
if(rsp) {
rsp->status = SUCCESS;
rsp->serverNum = pDesc->AppNumInClusters;
rsp->clientNum = pDesc->AppNumOutClusters;
rsp->hdr.ep = req->ep;
rsp->hdr.cmd = AT_AF_Cmd_rsp;
osal_memcpy(rsp->list,pDesc->pAppInClusterList,rsp->serverNum*2);
osal_memcpy(rsp->list+rsp->serverNum,pDesc->pAppOutClusterList,rsp->clientNum*2);
//sent the found data
AF_DataRequest( & (pkt->srcAddr), & AT_AF_epDesc,
AT_AF_Cmd_HA_CIDDISC_CLUSTERID,
rspLen,
(uint8*)rsp,
&AT_AF_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS );
osal_mem_free(rsp);
return; //important
}else{
status = AT_AF_MEM_ERROR;
}
}else {
//status = status; //have been done
}
}else{
status = AT_AF_NOTFOUND_ERROR;
}
AT_AF_Cmd_HA_CIDDISC_rsp_t dftRsp;
dftRsp.hdr.cmd = AT_AF_Cmd_rsp;
dftRsp.hdr.ep = req->ep;
dftRsp.status = status;
rsp = &dftRsp;
AF_DataRequest( & (pkt->srcAddr), & AT_AF_epDesc,
AT_AF_Cmd_HA_CIDDISC_CLUSTERID,
sizeof(AT_AF_Cmd_HA_CIDDISC_rsp_t),
(uint8*)rsp,
&AT_AF_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS );
}
示例2: MHMSDataReq
/**************************************************************************************************
* @fn MHMSDataReq
*
* @brief This function is called by MHMSAppEvt() to send a MHMS data report. When it is detected that
* a pulse is found (QS flag is set) this function will start to transfer BPM, IBI, and raw Signal
* data over the air to the coordinator at 20ms intervals. When there is no BPM detected
* this function will stop sending information over the air to the coordinator.
*
* input parameters
*
* None.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
static void MHMSDataReq(void)
{
static bool MHMSDataReqFlag;
MHMSDataReqFlag = FALSE;
afAddrType_t addr; //AF address stucture defined for info on the destination Endpoint object that data will be sent to
osal_stop_timerEx(MHMSTaskId, MHMS_EVT_CHECKIN); //Node is collecting data and sending it to coordinator so turn off check in event
MHMSEvtCheckin_sync = FALSE;
MHMSDat[MHMS_CHECK_IN] = CHECK_IN_INACTIVE; //Flag is off and will notify coordinator that node is not sending check in data
addr.addr.shortAddr = MHMSAddr; //loading short address (16-bit) with pulse address
addr.addrMode = afAddr16Bit; //Set to directly sent to a node
addr.endPoint = MHMS_ENDPOINT; //Sets the endpoint of the final destination (coordinator?)
if (afStatus_SUCCESS != AF_DataRequest(&addr, (endPointDesc_t *)&MHMS_epDesc, MHMS_CLUSTER_ID,
MHMS_DAT_LEN, MHMSDat, &MHMSTSN,
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(MHMSTaskId, MHMS_EVT_REQ);
}
if((QS == TRUE) && (MHMSDataReqFlag == FALSE)){
osal_start_timerEx(MHMSTaskId, MHMS_EVT_REQ, MHMS_DLY_DATAREQ); //send next Pulse data report in 500ms
MHMSDataReqFlag = TRUE; //to prevent restarting of timer if existing already running
}
}
示例3: AF_DataRequestSrcRtg
afStatus_t AF_DataRequestSrcRtg( afAddrType_t *dstAddr, endPointDesc_t *srcEP,
uint16 cID, uint16 len, uint8 *buf, uint8 *transID,
uint8 options, uint8 radius, uint8 relayCnt, uint16* pRelayList )
{
uint8 status;
/* Add the source route to the source routing table */
status = RTG_AddSrcRtgEntry_Guaranteed( dstAddr->addr.shortAddr, relayCnt,
pRelayList );
if( status == RTG_SUCCESS)
{
/* Call AF_DataRequest to send the data */
status = AF_DataRequest( dstAddr, srcEP, cID, len, buf, transID, options, radius );
}
else if( status == RTG_INVALID_PATH )
{
/* The source route relay count is exceeding the network limit */
status = afStatus_INVALID_PARAMETER;
}
else
{
/* The guaranteed adding entry fails due to memory failure */
status = afStatus_MEM_FAIL;
}
return status;
}
示例4: SerialApp_SendData
static void SerialApp_SendData( uint8 *buf, uint8 len )
{
afStatus_t stat;
// Pre-pend sequence number to the start of the Rx buffer.
*buf = ++SerialApp_SeqTx;
otaBuf = buf;
otaLen = len+1;
if (buf[1]==0xff)
{
reset();
}
stat = AF_DataRequest( &SerialApp_DstAddr,
(endPointDesc_t *)&SerialApp_epDesc,
SERIALAPP_CLUSTERID_CMD,
otaLen, otaBuf,
&SerialApp_MsgID, 0, AF_DEFAULT_RADIUS );
HalLedSet(HAL_LED_2,HAL_LED_MODE_OFF);
FREE_OTABUF();
}
示例5: AT_AF_Cmd_REPPRINT_req
void AT_AF_Cmd_REPPRINT_req(afIncomingMSGPacket_t *pkt ){
const uint8 AT_CMD_EP_ARRAY[] = AT_CMD_EPs;
uint8 epNum = afNumEndPoints()-1;
byte* epBuf = (byte*) osal_mem_alloc(epNum);
if(epBuf==NULL) return;
afEndPoints( epBuf, true);
AT_sort_arr(epBuf,epNum);
//the epStatus store the search result
uint8 pbuf_temp[sizeof(AT_CMD_EP_ARRAY)+sizeof(AT_AF_hdr)];
AT_AF_Cmd_REPPRINT_rsp_t* pbuf = (AT_AF_Cmd_REPPRINT_rsp_t*)pbuf_temp;
pbuf->hdr.cmd=AT_AF_Cmd_rsp;
pbuf->hdr.numItem=AT_CMD_EPs_Num;
int i,j;
for(i=0,j=0;j<AT_CMD_EPs_Num;j++){
if(epBuf[i]==AT_CMD_EP_ARRAY[j]){
pbuf->status[j] = AT_AF_enable;
i++;
}
else pbuf->status[j] = AT_AF_disable;
}
osal_mem_free(epBuf);
AF_DataRequest( & (pkt->srcAddr), & AT_AF_epDesc,
AT_AF_Cmd_REPPRINT_CLUSTERID,
sizeof(AT_CMD_EP_ARRAY)+sizeof(AT_AF_hdr),
(uint8*)pbuf,
&AT_AF_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS );
}
示例6: MHMSAnnce
/**************************************************************************************************
* @fn MHMSAnnce
*
* @brief This function is called by MHMSAppEvt() to send an announce command to start or stop
* the device that is acting as a health monitor from collecting sensor data.
*
* input parameters
*
* None.
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
static void MHMSAnnce(void)
{
uint8 msg[3];
afAddrType_t addr;
addr.addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVALL;
addr.addrMode = afAddrBroadcast;
addr.endPoint = MHMS_ENDPOINT;
if (INVALID_NODE_ADDR != MHMSAddr)
{
msg[MHMS_CMD_IDX] = MHMS_CMD_BEG;
if (ZSuccess != osal_start_timerEx(MHMSTaskId, MHMS_EVT_ANN, MHMS_DLY_ANN))
{
(void)osal_set_event(MHMSTaskId, MHMS_EVT_ANN);
}
}
else
{
msg[MHMS_CMD_IDX] = MHMS_CMD_END;
}
msg[MHMS_ADR_LSB] = LO_UINT16(MHMSAddr);
msg[MHMS_ADR_MSB] = HI_UINT16(MHMSAddr);
if (afStatus_SUCCESS != AF_DataRequest(&addr, (endPointDesc_t *)&MHMS_epDesc, MHMS_CLUSTER_ID,
3, msg, &MHMSTSN, AF_TX_OPTIONS_NONE, AF_DEFAULT_RADIUS))
{
osal_set_event(MHMSTaskId, MHMS_EVT_ANN);
}
else
{
MHMSCnt++;
}
}
示例7: ParkWay_SendTheMessage
//This function send the status of own park to the coordinator
static void ParkWay_SendTheMessage( void )
{
uint8 pData[6];
pData[0] = 'E';
pData[1] = 'D';
pData[2] = DEVICE_PW_1;
pData[3] = DEVICE_PW_2;
pData[4] = '-';
pData[5] = vaga;
//Send data to the coordinator ADDRESS(0000)
if ( AF_DataRequest( &ParkWay_DstAddr, &ParkWay_epDesc,
ParkWay_CLUSTERID,
(byte)osal_strlen( pData ) + 1,
(byte *)&pData,
&ParkWay_TransID,
AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
// Successfully requested to be sent.
}
else
{
osal_stop_timerEx( ParkWay_TaskID,
ParkWay_SEND_MSG_EVT);
osal_start_timerEx( ParkWay_TaskID,
POLLING_OF_DEV_EVT,
200);
}
}
示例8: handleKeys
/* @fn handleKeys
* @brief Handles all key events for this device.
* @param shift - true if in shift/alt.
* @param keys - bit field for key events. Valid entries:
* @return none*/
static void handleKeys( uint8 shift, uint8 keys ) {
/* POWER_SAVING key press interrupt uses shift key to awaken from deep sleep,
* so it is not available.*/
#if !defined( POWER_SAVING )
/* Give the LocationProfile access to 4 keys by sending any Shif-Key
* sequence to the profile as a normal Key.*/
if ( shift ) LocationHandleKeys( keys );
else
#endif
{
if(keys & HAL_KEY_SW_1) {}
if(keys & HAL_KEY_SW_2) {}
if(keys & HAL_KEY_SW_3) {}
if(keys & HAL_KEY_SW_4) {}
}
#if defined ( LOCATION_BLINDNODE )
{
static uint8 transId;
uint8 actionId = LOCATION_APP_TOGGLE;
afAddrType_t dstAddr;
dstAddr.addrMode = afAddrBroadcast;
dstAddr.addr.shortAddr = NWK_BROADCAST_SHORTADDR_DEVALL;
dstAddr.endPoint = LOCATION_APP_ENDPOINT;
// Control all lights within 1-hop radio range.
AF_DataRequest( &dstAddr, (endPointDesc_t *)&LoacationApp_epDesc,
LOCATION_APP_ON_OFF_ID, 1, &actionId, &transId, AF_SKIP_ROUTING, 1);
}
#endif
}
示例9: TestPayloadTx
/**************************************************************************************************
* @fn TestPayloadTx
*
* @brief This function is called by the MHMSAppEvt() function. This function is used to test
* network loading by sending test payloads that have a packet size and Tx frequency that
* are user defined. This is operated on a timer and is initiated by SW1.
* input parameters
*
*
* output parameters
*
* None.
*
* @return None.
**************************************************************************************************
*/
static void TestPayloadTx(void){
static uint8 SeqNum = 0; //MHMS Note that there is actually a separate Seq number appended to the over the air msg by the ZNP (ex. msg.nwkSeqNum)
static bool flag = FALSE;
afAddrType_t addr; //AF address stucture defined for info on the destination Endpoint object that data will be sent to
// Turn off collecting data and regular Pulse report generation for Payload testing
osal_stop_timerEx(MHMSTaskId, MHMS_EVT_CHECKIN);
osal_stop_timerEx(MHMSTaskId, MHMS_EVT_DAT);
osal_stop_timerEx(MHMSTaskId, MHMS_EVT_REQ);
TestDatTx[11] = SeqNum;
TestDatTx[MHMS_CMD_IDX] = MHMS_CMD_DAT_TEST;
if( flag == FALSE){
SeqNum++;
}
flag = FALSE;
addr.addr.shortAddr = MHMSAddr; //loading short address (16-bit) with pulse address
addr.addrMode = afAddr16Bit; //Set to directly sent to a node
addr.endPoint = MHMS_ENDPOINT; //Sets the endpoint of the final destination (coordinator?)
HalLcdWriteString("TestPayload TX",HAL_LCD_LINE_5);
if (afStatus_SUCCESS != AF_DataRequest(&addr, (endPointDesc_t *)&MHMS_epDesc, MHMS_CLUSTER_ID,
MHMS_TEST_PAYLOAD_LEN, TestDatTx, &MHMSTSN, 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(MHMSTaskId, TEST_EVT_PAYLOAD_TX);
flag = TRUE;
}
osal_start_timerEx(MHMSTaskId, TEST_EVT_PAYLOAD_TX, TEST_DLY_PAYLOAD_TX); //send check in dummy packet every 10 seconds
}
示例10: GenericApp_SendTheMessage
/*********************************************************************
* @fn GenericApp_SendTheMessage
*
* @brief Send "the" message.
*
* @param none
*
* @return none
*/
static void GenericApp_SendTheMessage( void )
{
byte temp[4];
DHT11();
temp[0] = wendu_shi;
temp[1] = wendu_ge;
temp[2] = shidu_shi;
temp[3] = shidu_ge;
if ( AF_DataRequest( &GenericApp_DstAddr, &GenericApp_epDesc,
TEMP_HUMI_INFO_CLUSTERID,
4,
temp,
&GenericApp_TransID,
AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
// Successfully requested to be sent.
}
else
{
// Error occurred in request to send.
}
}
示例11: AT_AF_Cmd_HA_DISC_req
/***************************************************************************
deal with the HA discover request
*****************************************************************************/
void AT_AF_Cmd_HA_DISC_req(afIncomingMSGPacket_t *pkt ){
AT_AF_Cmd_HA_DISC_req_t *req = (AT_AF_Cmd_HA_DISC_req_t *)pkt->cmd.Data;
AT_AF_Cmd_HA_DISC_rsp_t *rsp;
uint8 zcl_epCount =0;
uint8 AT_CMD_EP_ARRAY[]=AT_CMD_EPs;
uint8 i;
uint8 buf_temp[sizeof(AT_AF_Cmd_HA_DISC_rsp_t)+sizeof(AT_CMD_EP_ARRAY)*sizeof(AT_AF_Cmd_HA_DISC_item_t)];
rsp = (AT_AF_Cmd_HA_DISC_rsp_t *) buf_temp;
for(i=0;i<sizeof(AT_CMD_EP_ARRAY);i++){
epList_t* epList = AT_af_get_ep(AT_CMD_EP_ARRAY[i]);
SimpleDescriptionFormat_t* simDesc=epList->epDesc->simpleDesc;
//find the CID
bool found=false;
uint8 j;
for(j=0;j<simDesc->AppNumOutClusters;j++){
if(simDesc->pAppOutClusterList[j]==req->CID) {
if(req->option==0){
if(afFindEndPointDesc(AT_CMD_EP_ARRAY[i])) found=true;
}else{
found=true;
}
break;
}
}
if(!found){
for(j=0;j<simDesc->AppNumInClusters;j++){
if(simDesc->pAppInClusterList[j]==req->CID) {
if(req->option==0){
if(afFindEndPointDesc(AT_CMD_EP_ARRAY[i])) found=true;
}else{
found=true;
}
break;
}
}
}
//if found the CID
if(found){
rsp->item[zcl_epCount].ep = AT_CMD_EP_ARRAY[i];
rsp->item[zcl_epCount].status = afFindEndPointDesc(AT_CMD_EP_ARRAY[i]) ? AT_AF_enable : AT_AF_disable;
zcl_epCount++;
}
}
if(zcl_epCount!=0){
rsp->hdr.numItem=zcl_epCount;
rsp->hdr.cmd=AT_AF_Cmd_rsp;
AF_DataRequest( & (pkt->srcAddr), & AT_AF_epDesc,
AT_AF_Cmd_HA_DISC_CLUSTERID,
sizeof(AT_AF_Cmd_HA_DISC_rsp_t)+zcl_epCount*sizeof(AT_AF_Cmd_HA_DISC_item_t),
(uint8*)rsp,
&AT_AF_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS );
}
}
示例12: MT_AfDataStore
/**************************************************************************************************
* @fn MT_AfDataStore
*
* @brief Process AF Data Store command to incrementally store the data buffer for very large
* outgoing AF message.
*
* input parameters
*
* @param pBuf - pointer to the received buffer
*
* output parameters
*
* @param rtrn - AF-Status of the operation.
*
* @return None.
**************************************************************************************************
*/
void MT_AfDataStore(uint8 *pBuf)
{
uint16 idx;
uint8 len, rtrn = afStatus_FAILED;
pBuf += MT_RPC_FRAME_HDR_SZ;
idx = BUILD_UINT16(pBuf[0], pBuf[1]);
len = pBuf[2];
pBuf += 3;
if (pMtAfDataReq == NULL)
{
rtrn = afStatus_MEM_FAIL;
}
else if (len == 0) // Indication to send the message.
{
rtrn = AF_DataRequest(&(pMtAfDataReq->dstAddr), pMtAfDataReq->epDesc, pMtAfDataReq->cId,
pMtAfDataReq->dataLen, pMtAfDataReq->data,
&(pMtAfDataReq->transId), pMtAfDataReq->txOpts, pMtAfDataReq->radius);
(void)osal_mem_free(pMtAfDataReq);
pMtAfDataReq = NULL;
}
else
{
(void)osal_memcpy(pMtAfDataReq->data+idx, pBuf, len);
rtrn = afStatus_SUCCESS;
}
MT_BuildAndSendZToolResponse(((uint8)MT_RPC_CMD_SRSP | (uint8)MT_RPC_SYS_AF),
MT_AF_DATA_STORE, 1, &rtrn);
}
示例13: LCD_SendRetry
/***********************************************************
LCD send retry
***********************************************************/
static void LCD_SendRetry(){
// first get the short address
uint16 srcAddr = NLME_GetShortAddr();
// new the frame
byte frame[7] = {0};
// fill the header
frame[0] = 0xFE;
// fill the length
frame[1] = 0;
// fill the command
frame[2] = LO_UINT16(LCD_RETRY_CMD);
frame[3] = HI_UINT16(LCD_RETRY_CMD);
// fill Addr
frame[4] = LO_UINT16(srcAddr);
frame[5] = HI_UINT16(srcAddr);
// fill the fcs
frame[6] = LCD_CalcFCS((byte*)&frame[1], 5);
// Send the data to Coordinator
AF_DataRequest( &LCD_DstAddr,
&LCD_epDesc,
ZIGBEE_COMMON_CLUSTER,
7,
(byte *)frame,
&LCD_TransID,
AF_DISCV_ROUTE, AF_DEFAULT_RADIUS );
}
示例14: LCD_SendACK
/**************************************************************
send the ack command to the monitor
**************************************************************/
static void LCD_SendACK(byte flag){
// new the frame
byte frame[8] = {0};
// fill the header
frame[0] = 0xFE;
// fill the length
frame[1] = 1;
// fill the command
frame[2] = LO_UINT16(LCD_ACK_CMD);
frame[3] = HI_UINT16(LCD_ACK_CMD);
// fill Addr
frame[4] = LO_UINT16(0);
frame[5] = HI_UINT16(0);
// fill the flag
frame[6] = flag;
// fill the fcs
frame[7] = LCD_CalcFCS((byte*)&frame[1], 6);
// Send the data to Coordinator
AF_DataRequest( &LCD_DstAddr,
&LCD_epDesc,
ZIGBEE_COMMON_CLUSTER,
8,
(byte *)frame,
&LCD_TransID,
AF_DISCV_ROUTE, AF_DEFAULT_RADIUS );
}
示例15: SampleApp_SendPointMessage
void SampleApp_SendPointMessage(void)
{
HalUARTWrite(0, "PointMsg\n", sizeof("PointMsg\n")-1);
uint8 T[5];
Temp_test();
if (temp > 27)
LED1 = !LED1;
T[0] = temp / 10 + 48;
T[1] = temp % 10 + 48;
T[2] = ' ';
T[3] = 'C';
T[4] = '\0';
HalUARTWrite(0, "temp=", 5);
HalUARTWrite(0, T, 2);
HalUARTWrite(0, "\n", 1);
if ( AF_DataRequest( &SampleApp_Point_DstAddr, &SampleApp_epDesc,
SAMPLEAPP_POINT_CLUSTERID,
5,
T,
&SampleApp_TransID,
AF_DISCV_ROUTE,
AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
HalUARTWrite(0, "PointMsg Success\n", sizeof("PointMsg Success\n")-1);
}
else
{
// Error occurred in request to send.
HalUARTWrite(0, "PointMsg Failed\n", sizeof("PointMsg Failed\n")-1);
}
}