?? wsn_coordinator.c
字號(hào):
*
****************************************************************************/
void JZA_vAppEventHandler(void)
{
uint8 u8Msg;
uint8 u8TimerId;
if (!bAppTimerStarted)
{
if (bNwkStarted)
{
bAppTimerStarted = TRUE;
(void)bBosCreateTimer(vToggleLed, &u8Msg, 0, (APP_TICK_PERIOD_ms / 10), &u8TimerId);
}
}
}
/****************************************************************************
*
* NAME: JZA_vPeripheralEvent
*
* DESCRIPTION:
* Called when a hardware event causes an interrupt. This function is called
* from within the interrupt context so should be brief. In this case, the
* information is placed on a simple FIFO queue to be processed later.
*
* PARAMETERS: Name RW Usage
* u32Device R Peripheral generating interrupt
* u32ItemBitmap R Bitmap of interrupt sources within peripheral
*
****************************************************************************/
PUBLIC void JZA_vPeripheralEvent(uint32 u32Device, uint32 u32ItemBitmap)
{
}
/****************************************************************************
*
* NAME: JZA_vAppDefineTasks
*
* DESCRIPTION:
* Called by Zigbee stack during initialisation to allow the application to
* initialise any tasks that it requires. This application requires none.
*
* RETURNS:
* void
*
****************************************************************************/
PUBLIC void JZA_vAppDefineTasks(void)
{
}
/****************************************************************************
*
* NAME: JZA_boAppStart
*
* DESCRIPTION:
* Called by Zigbee stack during initialisation. Sets up the profile
* information and starts the networking activity
*
* RETURNS:
* TRUE
*
****************************************************************************/
PUBLIC bool_t JZA_boAppStart(void)
{
JZS_vStartStack();
return TRUE;
}
/****************************************************************************
*
* NAME: JZA_eAfKvpObject
*
* DESCRIPTION:
* Called when a KVP transaction has been received with a matching endpoint.
*
* PARAMETERS: Name RW Usage
* afSrcAddr R Address of sender device
* u8DstEndpoint R Endpoint at receiver
* pu8ClusterId R Pointer to cluster ID
* eCommandTypeId R KVP command type
* u16AttributeId R KVP attribute ID
* pu8AfduLength R Pointer to length of data
* pu8Afdu R Data array
*
* RETURNS:
* AF_ERROR_CODE
*
****************************************************************************/
PUBLIC bool_t JZA_bAfKvpObject(APS_Addrmode_e eAddrMode,
uint16 u16AddrSrc,
uint8 u8SrcEP,
uint8 u8LQI,
uint8 u8DstEP,
uint8 u8ClusterId,
uint8 *pu8ClusterIDRsp,
AF_Transaction_s *puTransactionInd,
AF_Transaction_s *puTransactionRsp)
{
return KVP_SUCCESS;
}
/****************************************************************************
*
* NAME: JZA_vAfKvpResponse
*
* DESCRIPTION:
* Called after a KVP transaction with acknowledgement request, when the
* acknowledgement arrives. In this application no action is taken as no
* KVP transaction acknowledgements are expected.
*
* PARAMETERS: Name RW Usage
* srcAddressMod R Address of sender device
* transactionSequenceNum R KVP transaction number
* commandTypeIdentifier R KVP command type
* dstEndPoint R Endpoint at receiver
* clusterID R Cluster ID
* attributeIdentifier R KVP attribute ID
* errorCode R Result code
* afduLength R Length of payload data
* pAfdu R Payload data array
*
****************************************************************************/
PUBLIC void JZA_vAfKvpResponse(APS_Addrmode_e eAddrMode,
uint16 u16AddrSrc,
uint8 u8SrcEP,
uint8 u8LQI,
uint8 u8DstEP,
uint8 u8ClusterID,
AF_Transaction_s *puTransactionInd)
{
}
/****************************************************************************
*
* NAME: JZA_pu8AfMsgObject
*
* DESCRIPTION:
* Called when a MSG transaction has been received with a matching endpoint.
*
* PARAMETERS: Name RW Usage
* afSrcAddr R Address of sender device
* dstEndPoint R Endpoint at receiver
* clusterID R Pointer to cluster ID
* afduLength R Pointer to length of data
* pAfdu R Data array
*
* RETURNS:
* NULL
*
****************************************************************************/
PUBLIC bool_t JZA_bAfMsgObject(APS_Addrmode_e eAddrMode,
uint16 u16AddrSrc,
uint8 u8SrcEP,
uint8 u8LQI,
uint8 u8DstEP,
uint8 u8ClusterID,
uint8 *pu8ClusterIDRsp,
AF_Transaction_s *puTransactionInd,
AF_Transaction_s *puTransactionRsp)
{
uint16 u16Humidity;
uint16 u16BattVoltage;
uint16 u16Temperature;
if ((eAddrMode == APS_ADDRMODE_SHORT) && (u8DstEP == WSN_DATA_SINK_ENDPOINT))
{
if(u8ClusterID == WSN_CID_SENSOR_READINGS)
{
u16BattVoltage = puTransactionInd->uFrame.sMsg.au8TransactionData[1];
u16BattVoltage = u16BattVoltage << 8;
u16BattVoltage |= puTransactionInd->uFrame.sMsg.au8TransactionData[0];
u16Temperature = puTransactionInd->uFrame.sMsg.au8TransactionData[3];
u16Temperature = u16Temperature << 8;
u16Temperature |= puTransactionInd->uFrame.sMsg.au8TransactionData[2];
u16Humidity = puTransactionInd->uFrame.sMsg.au8TransactionData[5];
u16Humidity = u16Humidity << 8;
u16Humidity |= puTransactionInd->uFrame.sMsg.au8TransactionData[4];
vTxSerialDataFrame(u16AddrSrc, u16Humidity, u16Temperature, u16BattVoltage);
}
}
return 0;
}
/****************************************************************************
*
* NAME: JZA_vZdpResponse
*
* DESCRIPTION:
* Called when a ZDP response frame has been received. In this application no
* action is taken as no ZDP responses are anticipated.
*
* PARAMETERS: Name RW Usage
* u8Type R ZDP response type
* pu8Payload R Payload buffer
* u8PayloadLen R Length of payload
*
****************************************************************************/
PUBLIC void JZA_vZdpResponse(uint8 u8Type,
uint8 u8LQI,
uint8 *pu8Payload,
uint8 u8PayloadLen)
{
}
/****************************************************************************
*
* NAME: JZA_vStackEvent
*
* DESCRIPTION:
* Called by Zigbee stack to pass an event up to the application.
*
* RETURNS:
* TRUE
*
****************************************************************************/
PUBLIC void JZA_vStackEvent(teJZS_EventIdentifier eEventId,
tuJZS_StackEvent *puStackEvent)
{
if (eEventId == JZS_EVENT_NWK_STARTED)
{
// load the simple descriptor now that the network has started
uint8 u8InputClusterCnt = 1;
uint8 au8InputClusterList[] = {WSN_CID_SENSOR_READINGS};
uint8 u8OutputClusterCnt = 0;
uint8 au8OutputClusterList[] = {};
(void)afmeAddSimpleDesc(WSN_DATA_SINK_ENDPOINT,
WSN_PROFILE_ID,
0x0000,
0x00,
0x00,
u8InputClusterCnt,
au8InputClusterList,
u8OutputClusterCnt,
au8OutputClusterList);
bNwkStarted = TRUE;
}
}
/****************************************************************************/
/*** END OF FILE ***/
/****************************************************************************/
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -