loadcontrol.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /**************************************************************************************************
  2. Filename: loadcontrol.h
  3. Revised: $Date: 2012-04-02 17:02:19 -0700 (Mon, 02 Apr 2012) $
  4. Revision: $Revision: 29996 $
  5. Description: Header file for the Load Control Device functionality
  6. Copyright 2009-2010 Texas Instruments Incorporated. All rights reserved.
  7. IMPORTANT: Your use of this Software is limited to those specific rights
  8. granted under the terms of a software license agreement between the user
  9. who downloaded the software, his/her employer (which must be your employer)
  10. and Texas Instruments Incorporated (the "License"). You may not use this
  11. Software unless you agree to abide by the terms of the License. The License
  12. limits your use, and you acknowledge, that the Software may not be modified,
  13. copied or distributed unless embedded on a Texas Instruments microcontroller
  14. or used solely and exclusively in conjunction with a Texas Instruments radio
  15. frequency transceiver, which is integrated into your product. Other than for
  16. the foregoing purpose, you may not use, reproduce, copy, prepare derivative
  17. works of, modify, distribute, perform, display or sell this Software and/or
  18. its documentation for any purpose.
  19. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE
  20. PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED,
  21. INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE,
  22. NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL
  23. TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT,
  24. NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER
  25. LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES
  26. INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE
  27. OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT
  28. OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES
  29. (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.
  30. Should you have any questions regarding your right to use this Software,
  31. contact Texas Instruments Incorporated at www.TI.com.
  32. **************************************************************************************************/
  33. #ifndef LOADCONTROL_H
  34. #define LOADCONTROL_H
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. /*********************************************************************
  40. * INCLUDES
  41. */
  42. #include "zcl.h"
  43. /*********************************************************************
  44. * CONSTANTS
  45. */
  46. #define LOADCONTROL_ENDPOINT 0x09
  47. #define LOADCONTROL_MAX_ATTRIBUTES 16
  48. #define LOADCONTROL_MAX_OPTIONS 2
  49. #define LOADCONTROL_UPDATE_TIME_PERIOD 1000 // Update time event in seconds
  50. #define LOADCONTROL_LOAD_CTRL_PERIOD 60000 // Load control event is 1 min long, this number is in millisecs
  51. #define LOADCONTROL_EVENT_ID 0x12345678 // Event ID for the load control event
  52. #define START_TIME_NOW 0x00000000 // Start time of NOW
  53. #define HVAC_DEVICE_CLASS 0x000001 // HVAC compressor or furnace - bit 0 is set
  54. #define ONOFF_LOAD_DEVICE_CLASS 0x000080 // simple misc residential on/off loads - bit 7 is set
  55. // Application Events
  56. #define LOADCONTROL_IDENTIFY_TIMEOUT_EVT 0x0001
  57. #define LOADCONTROL_UPDATE_TIME_EVT 0x0002
  58. #define LOADCONTROL_KEY_ESTABLISHMENT_REQUEST_EVT 0x0004
  59. #define LOADCONTROL_LOAD_CTRL_EVT 0x0008
  60. /*********************************************************************
  61. * MACROS
  62. */
  63. /*********************************************************************
  64. * TYPEDEFS
  65. */
  66. /*********************************************************************
  67. * VARIABLES
  68. */
  69. extern SimpleDescriptionFormat_t loadControlSimpleDesc;
  70. extern CONST zclAttrRec_t loadControlAttrs[];
  71. extern zclOptionRec_t loadControlOptions[];
  72. extern uint8 loadControlDeviceEnabled;
  73. extern uint16 loadControlTransitionTime;
  74. extern uint16 loadControlIdentifyTime;
  75. extern uint32 loadControlTime;
  76. extern uint8 loadControlSignature[];
  77. /*********************************************************************
  78. * FUNCTIONS
  79. */
  80. /*
  81. * Initialization for the task
  82. */
  83. extern void loadcontrol_Init( uint8 task_id );
  84. /*
  85. * Event Process for the task
  86. */
  87. extern uint16 loadcontrol_event_loop( uint8 task_id, uint16 events );
  88. /*********************************************************************
  89. *********************************************************************/
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. #endif /* LOADCONTROL_H */