123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247 |
- /**************************************************************************************************
- Filename: zcl_samplesw_data.c
- Revised: $Date: 2008-03-11 11:01:35 -0700 (Tue, 11 Mar 2008) $
- Revision: $Revision: 16570 $
- Description: Zigbee Cluster Library - sample device application.
- Copyright 2006-2007 Texas Instruments Incorporated. All rights reserved.
- IMPORTANT: Your use of this Software is limited to those specific rights
- granted under the terms of a software license agreement between the user
- who downloaded the software, his/her employer (which must be your employer)
- and Texas Instruments Incorporated (the "License"). You may not use this
- Software unless 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 “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
- INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
- NON-INFRINGEMENT 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 SIMILAR COSTS.
- Should you have any questions regarding your right to use this Software,
- contact Texas Instruments Incorporated at www.TI.com.
- **************************************************************************************************/
- /*********************************************************************
- * INCLUDES
- */
- #include "ZComDef.h"
- #include "OSAL.h"
- #include "AF.h"
- #include "ZDConfig.h"
- #include "zcl.h"
- #include "zcl_general.h"
- #include "zcl_ha.h"
- #include "zcl_samplesw.h"
- /*********************************************************************
- * CONSTANTS
- */
- #define SAMPLESW_DEVICE_VERSION 0
- #define SAMPLESW_FLAGS 0
- #define SAMPLESW_HWVERSION 0
- #define SAMPLESW_ZCLVERSION 0
- /*********************************************************************
- * TYPEDEFS
- */
- /*********************************************************************
- * MACROS
- */
- /*********************************************************************
- * GLOBAL VARIABLES
- */
- // Basic Cluster
- const uint8 zclSampleSw_HWRevision = SAMPLESW_HWVERSION;
- const uint8 zclSampleSw_ZCLVersion = SAMPLESW_ZCLVERSION;
- const uint8 zclSampleSw_ManufacturerName[] = { 16, 'T','e','x','a','s','I','n','s','t','r','u','m','e','n','t','s' };
- const uint8 zclSampleSw_ModelId[] = { 16, 'T','I','0','0','0','1',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
- const uint8 zclSampleSw_DateCode[] = { 16, '2','0','0','6','0','8','3','1',' ',' ',' ',' ',' ',' ',' ',' ' };
- const uint8 zclSampleSw_PowerSource = POWER_SOURCE_MAINS_1_PHASE;
- uint8 zclSampleSw_LocationDescription[17] = { 16, ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' };
- uint8 zclSampleSw_PhysicalEnvironment = 0;
- uint8 zclSampleSw_DeviceEnable = DEVICE_ENABLED;
- // Identify Cluster
- uint16 zclSampleSw_IdentifyTime = 0;
- // On/Off Cluster
- uint8 zclSampleSw_OnOff = LIGHT_OFF;
- /*********************************************************************
- * ATTRIBUTE DEFINITIONS - Uses REAL cluster IDs
- */
- CONST zclAttrRec_t zclSampleSw_Attrs[SAMPLESW_MAX_ATTRIBUTES] =
- {
- // *** General Basic Cluster Attributes ***
- {
- ZCL_CLUSTER_ID_GEN_BASIC, // Cluster IDs - defined in the foundation (ie. zcl.h)
- { // Attribute record
- ATTRID_BASIC_HW_VERSION, // Attribute ID - Found in Cluster Library header (ie. zcl_general.h)
- ZCL_DATATYPE_UINT8, // Data Type - found in zcl.h
- ACCESS_CONTROL_READ, // Variable access control - found in zcl.h
- (void *)&zclSampleSw_HWRevision // Pointer to attribute variable
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_ZCL_VERSION,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleSw_ZCLVersion
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_MANUFACTURER_NAME,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleSw_ManufacturerName
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_MODEL_ID,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleSw_ModelId
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_DATE_CODE,
- ZCL_DATATYPE_CHAR_STR,
- ACCESS_CONTROL_READ,
- (void *)zclSampleSw_DateCode
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_POWER_SOURCE,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleSw_PowerSource
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_LOCATION_DESC,
- ZCL_DATATYPE_CHAR_STR,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)zclSampleSw_LocationDescription
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_PHYSICAL_ENV,
- ZCL_DATATYPE_UINT8,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleSw_PhysicalEnvironment
- }
- },
- {
- ZCL_CLUSTER_ID_GEN_BASIC,
- { // Attribute record
- ATTRID_BASIC_DEVICE_ENABLED,
- ZCL_DATATYPE_UINT8,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleSw_DeviceEnable
- }
- },
-
- // *** Identify Cluster Attribute ***
- {
- ZCL_CLUSTER_ID_GEN_IDENTIFY,
- { // Attribute record
- ATTRID_IDENTIFY_TIME,
- ZCL_DATATYPE_UINT16,
- (ACCESS_CONTROL_READ | ACCESS_CONTROL_WRITE),
- (void *)&zclSampleSw_IdentifyTime
- }
- },
-
- // *** On / Off Cluster Attributes ***
- {
- ZCL_CLUSTER_ID_GEN_ON_OFF,
- { // Attribute record
- ATTRID_ON_OFF,
- ZCL_DATATYPE_UINT8,
- ACCESS_CONTROL_READ,
- (void *)&zclSampleSw_OnOff
- }
- },
- };
- /*********************************************************************
- * SIMPLE DESCRIPTOR
- */
- // This is the Cluster ID List and should be filled with Application
- // specific cluster IDs.
- #define ZCLSAMPLESW_MAX_INCLUSTERS 1
- const cId_t zclSampleSw_InClusterList[ZCLSAMPLESW_MAX_INCLUSTERS] =
- {
- ZCL_CLUSTER_ID_GEN_BASIC
- };
- #define ZCLSAMPLESW_MAX_OUTCLUSTERS 1
- const cId_t zclSampleSw_OutClusterList[ZCLSAMPLESW_MAX_OUTCLUSTERS] =
- {
- ZCL_CLUSTER_ID_GEN_ON_OFF
- };
- SimpleDescriptionFormat_t zclSampleSw_SimpleDesc =
- {
- SAMPLESW_ENDPOINT, // int Endpoint;
- ZCL_HA_PROFILE_ID, // uint16 AppProfId[2];
- ZCL_HA_DEVICEID_ON_OFF_SWITCH, // uint16 AppDeviceId[2];
- SAMPLESW_DEVICE_VERSION, // int AppDevVer:4;
- SAMPLESW_FLAGS, // int AppFlags:4;
- ZCLSAMPLESW_MAX_INCLUSTERS, // byte AppNumInClusters;
- (cId_t *)zclSampleSw_InClusterList, // byte *pAppInClusterList;
- ZCLSAMPLESW_MAX_OUTCLUSTERS, // byte AppNumInClusters;
- (cId_t *)zclSampleSw_OutClusterList // byte *pAppInClusterList;
- };
- /*********************************************************************
- * GLOBAL FUNCTIONS
- */
- /*********************************************************************
- * LOCAL FUNCTIONS
- */
- /****************************************************************************
- ****************************************************************************/
|