【正文】
ss you agree to abide by the terms of the License. The License limits your use, and you acknowledge, that the Software may not be modified, copied or distributed unless embedded on a Texas Instruments microcontroller or used solely and exclusively in conjunction with a Texas Instruments radio frequency transceiver, which is integrated into your product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any purpose. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED 揂 S IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NONINFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER 11 級(jí)計(jì)算機(jī)科學(xué)與技術(shù) 36 SIMILAR COSTS. Should you have any questions regarding your right to use this Software, contact Texas Instruments Incorporated at . **************************************************************************************************/ /********************************************************************* This application isn39。t intended to do anything useful, it is intended to be a simple example of an application39。s structure. This application sends it39。s messages either as broadcast or broadcast filtered group messages. The other (more normal) message addressing is unicast. Most of the other sample applications are written to support the unicast message model. Key control: SW1: Sends a flash mand to all devices in Group 1. SW2: Adds/Removes (toggles) this device in and out of Group 1. This will enable and disable the reception of the flash mand. *********************************************************************/ /********************************************************************* * INCLUDES */ include include include include include include include include /* HAL */ include include include include include include include include include include include /********************************************************************* * MACROS 11 級(jí)計(jì)算機(jī)科學(xué)與技術(shù) 37 */ /********************************************************************* * CONSTANTS */ /********************************************************************* * TYPEDEFS */ /********************************************************************* * GLOBAL VARIABLES */ // This list should be filled with Application specific Cluster IDs. const cId_t SampleApp_ClusterList[SAMPLEAPP_MAX_CLUSTERS] = { SAMPLEAPP_PERIODIC_CLUSTERID, SAMPLEAPP_FLASH_CLUSTERID }。 const SimpleDescriptionFormat_t SampleApp_SimpleDesc = { SAMPLEAPP_ENDPOINT, // int Endpoint。 SAMPLEAPP_PROFID, // uint16 AppProfId[2]。 SAMPLEAPP_DEVICEID, // uint16 AppDeviceId[2]。 SAMPLEAPP_DEVICE_VERSION, // int AppDevVer:4。 SAMPLEAPP_FLAGS, // int AppFlags:4。 SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters。 (cId_t *)SampleApp_ClusterList, // uint8 *pAppInClusterList。 SAMPLEAPP_MAX_CLUSTERS, // uint8 AppNumInClusters。 (cId_t *)SampleApp_ClusterList // uint8 *pAppInClusterList。 }。 // This is the Endpoint/Interface description. It is defined here, but // filledin in SampleApp_Init(). Another way to go would be to fill // in the structure here and make it a const (in code space). The // way it39。s defined in this sample app it is define in RAM. endPointDesc_t SampleApp_epDesc。 /********************************************************************* * EXTERNAL VARIABLES */ /********************************************************************* * EXTERNAL FUNCTIONS */ /********************************************************************* * LOCAL VARIABLES 11 級(jí)計(jì)算機(jī)科學(xué)與技術(shù) 38 */ uint8 SampleApp_TaskID。 // Task ID for internal task/event processing // This variable will be received when // SampleApp_Init() is called. devStates_t SampleApp_NwkState。 uint8 SampleApp_TransID。 // This is the unique message ID (counter) afAddrType_t SampleApp_Periodic_DstAddr。 //廣播 afAddrType_t SampleApp_Flash_DstAddr。 //組播 afAddrType_t SampleApp_P2P_DstAddr。 //點(diǎn)播 aps_Group_t SampleApp_Group。 uint8 SampleAppPeriodicCounter = 0。 uint8 SampleAppFlashCounter = 0。 define MY_DEFINI_UART_PORT 0 //自定義串口; ifndef RX_MAX_LENGTH //最大緩沖區(qū)字節(jié)數(shù); define RX_MAX_LENGTH 20 endif uint8 RX_BUFFER[RX_MAX_LENGTH]。 //緩沖區(qū); uint8 RX_Length。 //接收到字符串的長(zhǎng)度; void APP_CallBackFunction(uint8 port , uint8 event)。 //回調(diào)函數(shù); //static unsigned char endpoint_id = 1。 //ID 為 1 的終端節(jié)點(diǎn)?。。。。。。。。。。。。。。。。。。。? static unsigned char endpoint_id = 2。 //ID 為 2 的終端節(jié)點(diǎn)!?。。。。。。。。。。。。。。。。。。? //static unsigned char endpoint_id = 3。 //ID 為 3 的終端節(jié)點(diǎn)?。。。。。。。。。。。。。。。。。。。? static unsigned char first_start_flag = 1。 /********************************************************************* * LOCAL FUNCTIONS */ void SampleApp_HandleKeys( ui