esp_zb_light.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. * Copyright (c) 2021 Espressif Systems (Shanghai) CO LTD
  3. * All rights reserved.
  4. *
  5. *
  6. * Redistribution and use in source and binary forms, with or without modification,
  7. * are permitted provided that the following conditions are met:
  8. *
  9. * 1. Redistributions of source code must retain the above copyright notice,
  10. * this list of conditions and the following disclaimer.
  11. *
  12. * 2. Redistributions in binary form, except as embedded into a Espressif Systems
  13. * integrated circuit in a product or a software update for such product,
  14. * must reproduce the above copyright notice, this list of conditions and
  15. * the following disclaimer in the documentation and/or other materials
  16. * provided with the distribution.
  17. *
  18. * 3. Neither the name of the copyright holder nor the names of its contributors
  19. * may be used to endorse or promote products derived from this software without
  20. * specific prior written permission.
  21. *
  22. * 4. Any software provided in binary form under this license must not be reverse
  23. * engineered, decompiled, modified and/or disassembled.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  28. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
  29. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  30. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  31. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  32. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  33. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  34. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  35. * POSSIBILITY OF SUCH DAMAGE.
  36. */
  37. #include "zboss_api.h"
  38. #include "light_driver.h"
  39. /* Zigbee configuration */
  40. #define IEEE_CHANNEL_MASK (1l << 13) /* Zigbee default setting is channel 13 for light example usage */
  41. #define ERASE_PERSISTENT_CONFIG ZB_TRUE /* erase network devices before running example */
  42. /* groups cluster attributes */
  43. typedef struct {
  44. zb_uint8_t name_support;
  45. } zb_zcl_groups_attrs_t;
  46. /* scene cluster attributes */
  47. typedef struct {
  48. zb_uint8_t scene_count;
  49. zb_uint8_t current_scene;
  50. zb_uint8_t scene_valid;
  51. zb_uint8_t name_support;
  52. zb_uint16_t current_group;
  53. } zb_zcl_scenes_attrs_t;
  54. /* light bulb device cluster attributes */
  55. typedef struct {
  56. zb_zcl_basic_attrs_t basic_attr;
  57. zb_zcl_identify_attrs_t identify_attr;
  58. zb_zcl_groups_attrs_t groups_attr;
  59. zb_zcl_scenes_attrs_t scenes_attr;
  60. zb_zcl_on_off_attrs_t on_off_attr;
  61. } bulb_device_ctx_t;
  62. #define HA_ESP_LIGHT_ENDPOINT 10 /* esp light bulb device endpoint, used to process light controlling commands */
  63. #define ZB_ESP_DEFAULT_RADIO_CONFIG() \
  64. { \
  65. .radio_mode = RADIO_MODE_NATIVE, \
  66. }
  67. #define ZB_ESP_DEFAULT_HOST_CONFIG() \
  68. { \
  69. .host_connection_mode = HOST_CONNECTION_MODE_NONE, \
  70. }