mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 11:03:05 +00:00
ESP Matter beta release
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
.cache
|
||||
.clang-format
|
||||
compile_commands.json
|
||||
*.swp
|
||||
build/
|
||||
sdkconfig
|
||||
sdkconfig.old
|
||||
@@ -0,0 +1,71 @@
|
||||
stages:
|
||||
- build
|
||||
|
||||
variables:
|
||||
IDF_PATH: "$CI_PROJECT_DIR/esp-idf"
|
||||
GIT_STRATEGY: fetch
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
GIT_DEPTH: "1"
|
||||
|
||||
.setup_idf: &setup_idf
|
||||
# - cd $REPOS_PATH # IDF_PATH is set to something else already?
|
||||
- git clone --recursive --branch release/v4.3 --depth 1 https://github.com/espressif/esp-idf.git
|
||||
- cd esp-idf
|
||||
- ./install.sh
|
||||
- . export.sh
|
||||
|
||||
.setup_matter: &setup_matter
|
||||
- cd $ESP_MATTER_PATH
|
||||
- source connectedhomeip/connectedhomeip/scripts/bootstrap.sh
|
||||
- . export.sh
|
||||
|
||||
.build_matter_examples: &build_matter_examples
|
||||
- export MATTER_EXAMPLES_PATH=$ESP_MATTER_PATH/connectedhomeip/connectedhomeip/examples
|
||||
- cd $MATTER_EXAMPLES_PATH/all-clusters-app/esp32
|
||||
- idf.py build
|
||||
- cd $MATTER_EXAMPLES_PATH/temperature-measurement-app/esp32
|
||||
- idf.py build
|
||||
- cd $MATTER_EXAMPLES_PATH/lock-app/esp32
|
||||
- idf.py build
|
||||
- cd $MATTER_EXAMPLES_PATH/pigweed-app/esp32
|
||||
- idf.py build
|
||||
- cd $MATTER_EXAMPLES_PATH/persistent-storage/esp32
|
||||
- idf.py build
|
||||
|
||||
.build_examples: &build_examples
|
||||
- cd $ESP_MATTER_PATH/examples/light
|
||||
- idf.py build
|
||||
- cd $REPOS_PATH
|
||||
- git clone --depth 1 --single-branch --recursive https://github.com/espressif/esp-rainmaker.git
|
||||
- export ESP_RMAKER_PATH=$PWD/esp-rainmaker
|
||||
- cd $ESP_MATTER_PATH/examples/rainmaker_light
|
||||
- idf.py build
|
||||
|
||||
build_esp_matter_examples:
|
||||
stage: build
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env:matter
|
||||
tags:
|
||||
- build
|
||||
|
||||
script:
|
||||
- export ESP_MATTER_PATH=$PWD
|
||||
- mkdir repos
|
||||
- export REPOS_PATH=$PWD/repos
|
||||
- *setup_idf
|
||||
- *setup_matter
|
||||
- *build_examples
|
||||
|
||||
build_all_examples:
|
||||
stage: build
|
||||
image: $CI_DOCKER_REGISTRY/esp32-ci-env:matter
|
||||
tags:
|
||||
- build
|
||||
when: manual
|
||||
script:
|
||||
- export ESP_MATTER_PATH=$PWD
|
||||
- mkdir repos
|
||||
- export REPOS_PATH=$PWD/repos
|
||||
- *setup_idf
|
||||
- *setup_matter
|
||||
- *build_matter_examples
|
||||
- *build_examples
|
||||
@@ -0,0 +1,3 @@
|
||||
[submodule "connectedhomeip"]
|
||||
path = connectedhomeip/connectedhomeip
|
||||
url = https://github.com/espressif/connectedhomeip.git
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,125 @@
|
||||
# ESP Matter
|
||||
|
||||
[Matter](https://buildwithmatter.com/) is the unified IP-based connectivity protocol built on proven technologies, helping connect and build reliable, secure IoT ecosystems. This new technology and royalty-free connectivity standard enables communications among a wide range of smart devices.
|
||||
|
||||
ESP Matter is the official Matter development framework for the Espressif's ESP32 series SoCs.
|
||||
|
||||
## Development Setup
|
||||
|
||||
This sections talks about setting up your development host, fetching the git repositories, and instructions to build and flash.
|
||||
|
||||
### Host Setup
|
||||
|
||||
You should install drivers and support packages for your development host. Windows, Linux and Mac OS-X, are supported development hosts. Please see [Get Started](https://docs.espressif.com/projects/esp-idf/en/v4.3/esp32/index.html) for the host setup instructions.
|
||||
|
||||
### Getting the Repositories
|
||||
|
||||
This only needs to be done once:
|
||||
```
|
||||
$ git clone --recursive https://github.com/espressif/esp-idf.git
|
||||
$ cd esp-idf
|
||||
$ git checkout v4.3
|
||||
$ git submodule update --init --recursive
|
||||
$ ./install.sh
|
||||
$ cd ..
|
||||
|
||||
$ git clone --recursive https://glab.espressif.cn/esp-matter-preview/esp-matter.git
|
||||
$ cd esp-matter/connectedhomeip/connectedhomeip
|
||||
$ source scripts/bootstrap.sh
|
||||
```
|
||||
|
||||
### Configuring the environment
|
||||
|
||||
This needs to be done everytime a new terminal is opened:
|
||||
```
|
||||
$ cd /path/to/esp-idf
|
||||
$ . export.sh
|
||||
$ cd /path/to/esp-matter/
|
||||
$ . export.sh
|
||||
$ cd examples/light/
|
||||
|
||||
$ export ESPPORT=/dev/cu.SLAB_USBtoUART (or /dev/ttyUSB0 or /dev/ttyUSB1 on Linux or COMxx on MinGW)
|
||||
```
|
||||
|
||||
### Building and Flashing the Firmware
|
||||
|
||||
Selecting board:
|
||||
```
|
||||
$ idf.py menuconfig
|
||||
```
|
||||
* menuconfig -> ESP Matter Board Selection -> Select the supported board
|
||||
* The boards here are dependent on the IDF_TARGET. If your board uses a different chip, set the correct target and try again.
|
||||
```
|
||||
idf.py set-target esp32c3 (or esp32 or other supported targets)
|
||||
```
|
||||
* The other peripheral components like led_driver, button_driver, etc are selected based on the board selected.
|
||||
* The configuration of the peripheral components can be found in `esp-matter/components/board/<board_name>/board.c`.
|
||||
* If the board that you have is of a different revision, and is not working as expected, the GPIO and other configuration can be changed in the `board.c` file.
|
||||
|
||||
Build and flash:
|
||||
```
|
||||
$ idf.py build
|
||||
$ idf.py flash monitor
|
||||
```
|
||||
|
||||
* Note: If you are getting build errors like:
|
||||
```
|
||||
ERROR: This script was called from a virtual environment, can not create a virtual environment again
|
||||
```
|
||||
Run:
|
||||
```
|
||||
pip install -r $IDF_PATH/requirements.txt
|
||||
```
|
||||
|
||||
## Test Setup (Python Controller Setup)
|
||||
|
||||
### Environment setup
|
||||
|
||||
```
|
||||
$ cd esp-matter/connectedhomeip/connectedhomeip
|
||||
$ ./scripts/build_python.sh -m platform
|
||||
$ source out/python_env/bin/activate
|
||||
|
||||
```
|
||||
|
||||
### Commissioning
|
||||
|
||||
Execute the controller and establish a secure session over BLE.
|
||||
```
|
||||
$ chip-device-ctrl
|
||||
chip-device-ctrl > ble-scan
|
||||
chip-device-ctrl > connect -ble 3840 20202021 12344321
|
||||
```
|
||||
|
||||
* Discriminator: 3840 (configurable through menuconfig)
|
||||
* Setup-pin-code: 20202021 (configurable through menuconfig)
|
||||
* Node ID: Optional. If not passed in this command, then it is auto-generated by the controller and displayed in the output of connect. The same value should be used in the next commands. We have chosen a random node ID which is 12344321.
|
||||
|
||||
Add credentials of the Wi-Fi network you want the device to connect to.
|
||||
```
|
||||
chip-device-ctrl > zcl NetworkCommissioning AddWiFiNetwork 12344321 0 0 ssid=str:TESTSSID credentials=str:$TESTPASSWD breadcrumb=0 timeoutMs=1000
|
||||
chip-device-ctrl > zcl NetworkCommissioning EnableNetwork 12344321 0 0 networkID=str:TESTSSID breadcrumb=0 timeoutMs=1000
|
||||
```
|
||||
|
||||
Close BLE connection.
|
||||
```
|
||||
chip-device-ctrl > close-ble
|
||||
```
|
||||
|
||||
Resolve DNS-SD name and update address of the node in the device controller.
|
||||
```
|
||||
chip-device-ctrl > resolve 0 12344321
|
||||
```
|
||||
|
||||
### Cluster Control
|
||||
|
||||
Use the cluster commands to control the attributes.
|
||||
```
|
||||
chip-device-ctrl > zcl OnOff On 12344321 1 0
|
||||
chip-device-ctrl > zcl LevelControl MoveToLevel 12344321 1 0 level=10 transitionTime=0 optionMask=0 optionOverride=0
|
||||
chip-device-ctrl > zcl LevelControl MoveToLevel 12344321 1 0 level=100 transitionTime=0 optionMask=0 optionOverride=0
|
||||
chip-device-ctrl > zcl ColorControl MoveToSaturation 12344321 1 0 saturation=200 transitionTime=0 optionsMask=0 optionsOverride=0
|
||||
chip-device-ctrl > zcl ColorControl MoveToHue 12344321 1 0 hue=150 direction=0 transitionTime=0 optionsMask=0 optionsOverride=0
|
||||
chip-device-ctrl > zcl OnOff Toggle 12344321 1 0
|
||||
chip-device-ctrl > quit
|
||||
```
|
||||
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRC_DIRS "${CONFIG_BOARD_NAME}"
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES button_driver led_driver)
|
||||
@@ -0,0 +1,50 @@
|
||||
menu "ESP Matter Board Selection"
|
||||
|
||||
choice BOARD_NAME
|
||||
prompt "Board Name"
|
||||
default BOARD_NAME_ESP32_DEVKIT_C if IDF_TARGET_ESP32
|
||||
default BOARD_NAME_ESP32C3_DEVKIT_M if IDF_TARGET_ESP32C3
|
||||
help
|
||||
Board name from esp-matter/components/board
|
||||
|
||||
config BOARD_NAME_ESP32_DEVKIT_C
|
||||
bool "ESP32-DevKitC"
|
||||
depends on IDF_TARGET_ESP32
|
||||
|
||||
config BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
bool "ESP32-C3-DevKitM"
|
||||
depends on IDF_TARGET_ESP32C3
|
||||
|
||||
config BOARD_NAME_M5STACK
|
||||
bool "M5Stack"
|
||||
depends on IDF_TARGET_ESP32
|
||||
|
||||
config BOARD_NAME_HOLLOW
|
||||
bool "Hollow"
|
||||
endchoice
|
||||
|
||||
config TFT_PREDEFINED_DISPLAY_TYPE
|
||||
int
|
||||
range 0 5
|
||||
default 0 if BOARD_NAME_ESP32_DEVKIT_C || BOARD_NAME_ESP32C3_DEVKIT_M || BOARD_NAME_HOLLOW
|
||||
default 3 if BOARD_NAME_M5STACK
|
||||
|
||||
config BOARD_NAME
|
||||
string
|
||||
default "esp32_devkit_c" if BOARD_NAME_ESP32_DEVKIT_C
|
||||
default "esp32c3_devkit_m" if BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
default "m5stack" if BOARD_NAME_M5STACK
|
||||
default "hollow" if BOARD_NAME_HOLLOW
|
||||
|
||||
config LED_DRIVER
|
||||
string
|
||||
default "gpio" if BOARD_NAME_ESP32_DEVKIT_C
|
||||
default "rmt" if BOARD_NAME_ESP32C3_DEVKIT_M
|
||||
default "vled" if BOARD_NAME_M5STACK
|
||||
default "hollow" if BOARD_NAME_HOLLOW
|
||||
|
||||
config BUTTON_DRIVER
|
||||
string
|
||||
default "hollow"
|
||||
|
||||
endmenu
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 12, /* GPIO_NUM_12 */
|
||||
.channel = 0, /* LEDC_CHANNEL_0 */
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 8, /* GPIO_NUM_8 */
|
||||
.channel = 0, /* RMT_CHANNEL_0 */
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = -1,
|
||||
.channel = -1,
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
{
|
||||
button_driver_config_t config = {
|
||||
.gpio = -1,
|
||||
};
|
||||
return button_driver_init(&config);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#pragma once
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
esp_err_t board_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "board";
|
||||
|
||||
static esp_err_t board_led_init()
|
||||
{
|
||||
led_driver_config_t config = {
|
||||
.gpio = 32, /* PIN_NUM_BCKL for M5Stack TFT */
|
||||
.channel = 7, /* LEDC_CHANNEL_7 */
|
||||
};
|
||||
return led_driver_init(&config);
|
||||
}
|
||||
|
||||
static esp_err_t board_button_init()
|
||||
{
|
||||
return button_driver_init(NULL);
|
||||
}
|
||||
|
||||
esp_err_t board_init()
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing board");
|
||||
board_led_init();
|
||||
board_button_init();
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
idf_component_register(SRCS ${CONFIG_BUTTON_DRIVER}/button_driver.c
|
||||
INCLUDE_DIRS include)
|
||||
@@ -0,0 +1,25 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "button_driver_hollow";
|
||||
|
||||
esp_err_t button_driver_init(button_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing button driver");
|
||||
/* Initialize the button driver here*/
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#pragma once
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int gpio;
|
||||
} button_driver_config_t;
|
||||
|
||||
esp_err_t button_driver_init(button_driver_config_t *config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <button_driver.h>
|
||||
|
||||
static const char *TAG = "button_driver_no_button";
|
||||
|
||||
esp_err_t button_driver_init(button_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing button driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
set(priv_requires_list )
|
||||
|
||||
# Chip specific components. Try and remove this later.
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND priv_requires_list tft spidriver)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND priv_requires_list led_strip)
|
||||
endif()
|
||||
|
||||
idf_component_register(SRCS ${CONFIG_LED_DRIVER}/led_driver.c color_format/color_format.c
|
||||
INCLUDE_DIRS include
|
||||
PRIV_REQUIRES ${priv_requires_list})
|
||||
@@ -0,0 +1,88 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <color_format.h>
|
||||
|
||||
void hsb_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB)
|
||||
{
|
||||
uint16_t sector = HS.hue / 60;
|
||||
uint16_t rgb_max = brightness;
|
||||
uint16_t rgb_min = rgb_max * (100 - HS.saturation) / 100;
|
||||
uint16_t offset = HS.hue % 60;
|
||||
uint16_t rgb_adj = (rgb_max - rgb_min) * offset / 60;
|
||||
|
||||
switch (sector) {
|
||||
case 0:
|
||||
RGB->red = rgb_max;
|
||||
RGB->green = rgb_min + rgb_adj;
|
||||
RGB->blue = rgb_min;
|
||||
break;
|
||||
case 1:
|
||||
RGB->red = rgb_max - rgb_adj;
|
||||
RGB->green = rgb_max;
|
||||
RGB->blue = rgb_min;
|
||||
break;
|
||||
case 2:
|
||||
RGB->red = rgb_min;
|
||||
RGB->green = rgb_max;
|
||||
RGB->blue = rgb_min + rgb_adj;
|
||||
break;
|
||||
case 3:
|
||||
RGB->red = rgb_min;
|
||||
RGB->green = rgb_max - rgb_adj;
|
||||
RGB->blue = rgb_max;
|
||||
break;
|
||||
case 4:
|
||||
RGB->red = rgb_min + rgb_adj;
|
||||
RGB->green = rgb_min;
|
||||
RGB->blue = rgb_max;
|
||||
break;
|
||||
default:
|
||||
RGB->red = rgb_max;
|
||||
RGB->green = rgb_min;
|
||||
RGB->blue = rgb_max - rgb_adj;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// A Table from color temperature to hue and saturation.
|
||||
// hue = temp_table[(temp - 600) / 100].hue
|
||||
// saturation= temp_table[(temp - 600) / 100].saturation
|
||||
// 600<= temp <= 10000
|
||||
const HS_color_t temp_table[] = {
|
||||
{4, 100}, {8, 100}, {11, 100}, {14, 100}, {16, 100}, {18, 100}, {20, 100}, {22, 100}, {24, 100}, {25, 100}, {27, 100},
|
||||
{28, 100},{30, 100}, {31, 100}, {31, 95}, {30, 89}, {30, 85}, {29, 80}, {29, 76}, {29, 73}, {29, 69}, {28, 66}, {28, 63},
|
||||
{28, 60}, {28, 57}, {28, 54}, {28, 52}, {27, 49}, {27, 47}, {27, 45}, {27, 43}, {27, 41}, {27, 39}, {27, 37}, {27, 35},
|
||||
{27, 33}, {27, 31}, {27, 30}, {27, 28}, {27, 26}, {27, 25}, {27, 23}, {27, 22}, {27, 21}, {27, 19}, {27, 18}, {27, 17},
|
||||
{27, 15}, {28, 14}, {28, 13}, {28, 12}, {29, 10}, {29, 9}, {30, 8}, {31, 7}, {32, 6}, {34, 5}, {36, 4}, {41, 3}, {49, 2},
|
||||
{0, 0}, {294, 2}, {265, 3}, {251, 4}, {242, 5}, {237, 6}, {233, 7}, {231, 8}, {229, 9}, {228, 10}, {227, 11}, {226, 11},
|
||||
{226, 12}, {225, 13}, {225, 13}, {224, 14}, {224, 14}, {224, 15}, {224, 15}, {223, 16}, {223, 16}, {223, 17}, {223, 17},
|
||||
{223, 17}, {222, 18}, {222, 18}, {222, 19}, {222, 19}, {222, 19}, {222, 19}, {222, 20}, {222, 20}, {222, 20}, {222, 21},
|
||||
{222, 21}
|
||||
};
|
||||
|
||||
void temp_to_hs(uint32_t temperature, HS_color_t *HS)
|
||||
{
|
||||
if (temperature < 600) {
|
||||
HS->hue = 0;
|
||||
HS->saturation = 100;
|
||||
return;
|
||||
}
|
||||
if (temperature > 10000) {
|
||||
HS->hue = 222;
|
||||
HS->saturation = 21 + (temperature -10000) * 41 / 990000;
|
||||
return;
|
||||
}
|
||||
HS->hue = temp_table[(temperature - 600) / 100].hue;
|
||||
HS->saturation = temp_table[(temperature - 600) / 100].saturation;
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <hal/ledc_types.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_gpio";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
ledc_timer_config_t ledc_timer = {
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE, // timer mode
|
||||
.duty_resolution = LEDC_TIMER_8_BIT, // resolution of PWM duty
|
||||
.timer_num = LEDC_TIMER_1, // timer index
|
||||
.freq_hz = 5000, // frequency of PWM signal
|
||||
.clk_cfg = LEDC_AUTO_CLK, // Auto select the source clock
|
||||
};
|
||||
err = ledc_timer_config(&ledc_timer);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "led_timerc_config failed");
|
||||
return err;
|
||||
}
|
||||
|
||||
ledc_channel_config_t ledc_channel = {
|
||||
.gpio_num = config->gpio,
|
||||
.speed_mode = LEDC_LOW_SPEED_MODE,
|
||||
.channel = config->channel,
|
||||
.intr_type = LEDC_INTR_DISABLE,
|
||||
.timer_sel = LEDC_TIMER_1,
|
||||
.duty = 0,
|
||||
.hpoint = 0,
|
||||
};
|
||||
err = ledc_channel_config(&ledc_channel);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "ledc_channel_config failed");
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
esp_err_t err;
|
||||
|
||||
if (brightness != 0) {
|
||||
current_brightness = brightness;
|
||||
}
|
||||
if (!current_power) {
|
||||
brightness = 0;
|
||||
}
|
||||
|
||||
err = ledc_set_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0, brightness);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "ledc_set_duty failed");
|
||||
}
|
||||
|
||||
err = ledc_update_duty(LEDC_LOW_SPEED_MODE, LEDC_CHANNEL_0);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "ledc_update_duty failed");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
return ESP_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <led_driver.h>
|
||||
#include <color_format.h>
|
||||
|
||||
static const char *TAG = "led_driver_hollow";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static HS_color_t current_HS = {0, 0};
|
||||
static uint32_t current_temperature = 6600;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
/* Initialize the driver here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting power to: %d", power);
|
||||
/* Set the power state here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting brightness to: %d", brightness);
|
||||
/* Set the brightness level here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting hue to: %d", hue);
|
||||
/* Set the color hue here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting saturation to: %d", saturation);
|
||||
/* Set the color saturation here */
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
ESP_LOGI(TAG, "Setting temperature to: %d", temperature);
|
||||
/* Set the color temp here*/
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return current_temperature;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint16_t hue;
|
||||
uint8_t saturation;
|
||||
} HS_color_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
} RGB_color_t;
|
||||
|
||||
void temp_to_hs(uint32_t temperature, HS_color_t *HS);
|
||||
|
||||
void hsb_to_rgb(HS_color_t HS,uint8_t brightness, RGB_color_t *RGB);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#pragma once
|
||||
#include <esp_err.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int gpio;
|
||||
int channel;
|
||||
} led_driver_config_t;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config);
|
||||
esp_err_t led_driver_set_power(bool power);
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness);
|
||||
esp_err_t led_driver_set_hue(uint16_t hue);
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation);
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature);
|
||||
|
||||
bool led_driver_get_power(void);
|
||||
uint8_t led_driver_get_brightness(void);
|
||||
uint16_t led_driver_get_hue(void);
|
||||
uint8_t led_driver_get_saturation(void);
|
||||
uint32_t led_driver_get_temperature(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_no_led";
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/rmt.h>
|
||||
#include <led_strip.h>
|
||||
#include <color_format.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
static const char *TAG = "led_driver_rmt";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static uint32_t current_temp = 6600;
|
||||
static HS_color_t current_HS = {0, 0};
|
||||
static RGB_color_t mRGB;
|
||||
static led_strip_t *strip = NULL;
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
|
||||
rmt_config_t rmt_cfg = RMT_DEFAULT_CONFIG_TX(config->gpio, config->channel);
|
||||
rmt_cfg.clk_div = 2;
|
||||
err = rmt_config(&rmt_cfg);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "rmt_cfg failed");
|
||||
}
|
||||
err = rmt_driver_install(rmt_cfg.channel, 0, 0);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "rmt_driver_install failed");
|
||||
}
|
||||
|
||||
led_strip_config_t strip_config = LED_STRIP_DEFAULT_CONFIG(1, (led_strip_dev_t)rmt_cfg.channel);
|
||||
strip = led_strip_new_rmt_ws2812(&strip_config);
|
||||
if (!strip) {
|
||||
ESP_LOGE(TAG, "W2812 driver install failed");
|
||||
err = ESP_FAIL;
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_RGB()
|
||||
{
|
||||
esp_err_t err = ESP_OK;
|
||||
if (!strip) {
|
||||
ESP_LOGE(TAG, "can't find w2812 led_strip handle");
|
||||
err = ESP_FAIL;
|
||||
} else {
|
||||
err = strip->set_pixel(strip, 0, mRGB.red, mRGB.green, mRGB.blue);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "strip_set_pixel failed");
|
||||
return err;
|
||||
}
|
||||
ESP_LOGI(TAG, "led set r:%d, g:%d, b:%d", mRGB.red, mRGB.green, mRGB.blue);
|
||||
err = strip->refresh(strip, 100);
|
||||
if (err != ESP_OK) {
|
||||
ESP_LOGE(TAG, "strip_refresh failed");
|
||||
}
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
if (brightness != 0) {
|
||||
current_brightness = brightness;
|
||||
}
|
||||
if (!current_power) {
|
||||
brightness = 0;
|
||||
}
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.hue = hue;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.saturation = saturation;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_temp = temperature;
|
||||
temp_to_hs(current_temp, ¤t_HS);
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return current_temp;
|
||||
}
|
||||
@@ -0,0 +1,212 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#include <string.h>
|
||||
#include <esp_system.h>
|
||||
#include <esp_log.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <tft.h>
|
||||
#include <tftspi.h>
|
||||
|
||||
#include <led_driver.h>
|
||||
#include <color_format.h>
|
||||
|
||||
#define TFT_SPI_CLOCK_INIT_HZ 8000000
|
||||
#define LEDC_PWM_HZ 1000
|
||||
#define BRIGHTNESS_MAX 255
|
||||
|
||||
static const char *TAG = "led_driver_vled";
|
||||
static bool current_power = false;
|
||||
static uint8_t current_brightness = 0;
|
||||
static HS_color_t current_HS = {0, 0};
|
||||
static uint32_t current_temperature = 6600;
|
||||
static RGB_color_t mRGB;
|
||||
static uint16_t DisplayHeight;
|
||||
static uint16_t DisplayWidth;
|
||||
static int led_driver_channel = -1;
|
||||
|
||||
static void SetupBrightnessControl(led_driver_config_t *config)
|
||||
{
|
||||
ledc_timer_config_t ledc_timer;
|
||||
memset(&ledc_timer, 0, sizeof(ledc_timer));
|
||||
led_driver_channel = config->channel;
|
||||
|
||||
ledc_timer.duty_resolution = LEDC_TIMER_8_BIT; // resolution of PWM duty
|
||||
ledc_timer.freq_hz = LEDC_PWM_HZ; // frequency of PWM signal
|
||||
ledc_timer.speed_mode = LEDC_HIGH_SPEED_MODE; // timer mode
|
||||
ledc_timer.timer_num = LEDC_TIMER_0; // timer index
|
||||
ledc_timer_config(&ledc_timer);
|
||||
ledc_timer_set(LEDC_HIGH_SPEED_MODE, LEDC_TIMER_0, LEDC_PWM_HZ, LEDC_TIMER_8_BIT, LEDC_REF_TICK);
|
||||
|
||||
ledc_channel_config_t ledc_channel;
|
||||
memset(&ledc_channel, 0, sizeof(ledc_channel));
|
||||
ledc_channel.channel = led_driver_channel;
|
||||
ledc_channel.duty = BRIGHTNESS_MAX;
|
||||
ledc_channel.gpio_num = config->gpio;
|
||||
ledc_channel.speed_mode = LEDC_HIGH_SPEED_MODE;
|
||||
ledc_channel.timer_sel = LEDC_TIMER_0;
|
||||
ledc_channel_config(&ledc_channel);
|
||||
}
|
||||
|
||||
static void SetDisplayBrightness(uint8_t brightness)
|
||||
{
|
||||
if (ledc_set_duty(LEDC_HIGH_SPEED_MODE, led_driver_channel, brightness) ||
|
||||
ledc_update_duty(LEDC_HIGH_SPEED_MODE, led_driver_channel)) {
|
||||
ESP_LOGE(TAG, "Failed to set display brightness...");
|
||||
}
|
||||
}
|
||||
|
||||
static esp_err_t InitDisplay()
|
||||
{
|
||||
esp_err_t err;
|
||||
spi_lobo_device_handle_t spi;
|
||||
spi_lobo_bus_config_t buscfg;
|
||||
memset((void *) &buscfg, 0, sizeof(buscfg));
|
||||
buscfg.miso_io_num = PIN_NUM_MISO; // set SPI MISO pin
|
||||
buscfg.mosi_io_num = PIN_NUM_MOSI; // set SPI MOSI pin
|
||||
buscfg.sclk_io_num = PIN_NUM_CLK; // set SPI CLK pin
|
||||
buscfg.quadwp_io_num = -1;
|
||||
buscfg.quadhd_io_num = -1;
|
||||
|
||||
spi_lobo_device_interface_config_t devcfg;
|
||||
memset((void *) &devcfg, 0, sizeof(devcfg));
|
||||
devcfg.clock_speed_hz = TFT_SPI_CLOCK_INIT_HZ;
|
||||
devcfg.mode = 0; // SPI mode 0
|
||||
devcfg.spics_io_num = -1; // we will use external CS pin
|
||||
devcfg.spics_ext_io_num = PIN_NUM_CS; // external CS pi
|
||||
devcfg.flags = LB_SPI_DEVICE_HALFDUPLEX; // ALWAYS SET to HALF DUPLEX MODE!! for display spi
|
||||
tft_max_rdclock = TFT_SPI_CLOCK_INIT_HZ;
|
||||
|
||||
// Initialize all pins used by display driver.
|
||||
TFT_PinsInit();
|
||||
// Initialize SPI bus and add a device for the display.
|
||||
err = spi_lobo_bus_add_device(TFT_HSPI_HOST, &buscfg, &devcfg, &spi);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
|
||||
// Configure the display to use the new SPI device.
|
||||
tft_disp_spi = spi;
|
||||
err = spi_lobo_device_select(spi, 1);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
err = spi_lobo_device_deselect(spi);
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
// Initialize the display driver.
|
||||
TFT_display_init();
|
||||
// Detect maximum read speed and set it.
|
||||
tft_max_rdclock = find_rd_speed();
|
||||
spi_lobo_set_speed(spi, DEFAULT_SPI_CLOCK);
|
||||
|
||||
TFT_setGammaCurve(0);
|
||||
TFT_setRotation(LANDSCAPE);
|
||||
TFT_resetclipwin();
|
||||
|
||||
DisplayWidth = (uint16_t)(1 + tft_dispWin.x2 - tft_dispWin.x1);
|
||||
DisplayHeight = (uint16_t)(1 + tft_dispWin.y2 - tft_dispWin.y1);
|
||||
ESP_LOGI(TAG, "Display initialized (height %u, width %u)", DisplayHeight, DisplayWidth);
|
||||
|
||||
TFT_invertDisplay(INVERT_OFF);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_init(led_driver_config_t *config)
|
||||
{
|
||||
ESP_LOGI(TAG, "Initializing led driver");
|
||||
esp_err_t err = ESP_OK;
|
||||
err = InitDisplay();
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
SetupBrightnessControl(config);
|
||||
SetDisplayBrightness(BRIGHTNESS_MAX);
|
||||
return err;
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_power(bool power)
|
||||
{
|
||||
current_power = power;
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_err_t led_driver_set_RGB()
|
||||
{
|
||||
TFT_fillWindow(TFT_BLACK);
|
||||
TFT_fillCircle(DisplayWidth / 2, DisplayHeight / 2, DisplayWidth / 4, (color_t) {mRGB.red, mRGB.green, mRGB.blue});
|
||||
TFT_drawCircle(DisplayWidth / 2, DisplayHeight / 2, DisplayWidth / 4, (color_t) {255, 255, 255});
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_err_t led_driver_set_brightness(uint8_t brightness)
|
||||
{
|
||||
if (brightness != 0) {
|
||||
current_brightness = brightness;
|
||||
}
|
||||
if (!current_power) {
|
||||
brightness = 0;
|
||||
}
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_hue(uint16_t hue)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.hue = hue;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_saturation(uint8_t saturation)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_HS.saturation = saturation;
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
esp_err_t led_driver_set_temperature(uint32_t temperature)
|
||||
{
|
||||
uint8_t brightness = current_power ? current_brightness : 0;
|
||||
current_temperature = temperature;
|
||||
temp_to_hs(current_temperature,¤t_HS);
|
||||
hsb_to_rgb(current_HS, brightness, &mRGB);
|
||||
return led_driver_set_RGB();
|
||||
}
|
||||
|
||||
bool led_driver_get_power()
|
||||
{
|
||||
return current_power;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_brightness()
|
||||
{
|
||||
return current_brightness;
|
||||
}
|
||||
|
||||
uint16_t led_driver_get_hue()
|
||||
{
|
||||
return current_HS.hue;
|
||||
}
|
||||
|
||||
uint8_t led_driver_get_saturation()
|
||||
{
|
||||
return current_HS.saturation;
|
||||
}
|
||||
|
||||
uint32_t led_driver_get_temperature()
|
||||
{
|
||||
return current_temperature;
|
||||
}
|
||||
Submodule
+1
Submodule connectedhomeip/connectedhomeip added at 903e149bd6
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRCS app_driver.c
|
||||
INCLUDE_DIRS .
|
||||
PRIV_REQUIRES board led_driver button_driver)
|
||||
@@ -0,0 +1,193 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <esp_log.h>
|
||||
|
||||
#include <app_driver.h>
|
||||
#include <board.h>
|
||||
#include <led_driver.h>
|
||||
|
||||
typedef struct driver_src {
|
||||
char name[SRC_MAX_NAMELEN];
|
||||
struct app_driver_param_callback callbacks;
|
||||
struct driver_src *next;
|
||||
} driver_src_t;
|
||||
|
||||
static const char *TAG = "app_driver";
|
||||
static driver_src_t *s_driver_src = NULL;
|
||||
|
||||
esp_err_t app_driver_init()
|
||||
{
|
||||
return board_init();
|
||||
}
|
||||
|
||||
esp_err_t app_driver_register_src(const char *name, app_driver_param_callback_t *callbacks)
|
||||
{
|
||||
driver_src_t *new_src = NULL;
|
||||
|
||||
if (name == NULL || callbacks == NULL) {
|
||||
ESP_LOGE(TAG, "Invalid arguments");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
new_src = (driver_src_t *)malloc(sizeof(driver_src_t));
|
||||
if (new_src == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to allocate memory for driver_src_t");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
memset(new_src, 0, sizeof(driver_src_t));
|
||||
strncpy(new_src->name, name, strnlen(name, SRC_MAX_NAMELEN));
|
||||
memcpy(&new_src->callbacks, callbacks, sizeof(app_driver_param_callback_t));
|
||||
|
||||
new_src->next = s_driver_src;
|
||||
s_driver_src = new_src;
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_update_and_report_power(bool power, const char *src)
|
||||
{
|
||||
esp_err_t ret;
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_power(power);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Report to other sources */
|
||||
ESP_LOGI(TAG, "Power (OnOff) set to: %d", power);
|
||||
while (cur_src) {
|
||||
if (strncmp(cur_src->name, src, strnlen(src, SRC_MAX_NAMELEN)) != 0 &&
|
||||
cur_src->callbacks.update_power != NULL) {
|
||||
cur_src->callbacks.update_power(power);
|
||||
}
|
||||
cur_src = cur_src->next;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_update_and_report_brightness(uint8_t brightness, const char *src)
|
||||
{
|
||||
esp_err_t ret;
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_brightness(brightness);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Report to other sources */
|
||||
ESP_LOGI(TAG, "Brightness set to: %d percent", brightness * 100 / 254);
|
||||
while (cur_src) {
|
||||
if (strncmp(cur_src->name, src, strnlen(src, SRC_MAX_NAMELEN)) != 0 &&
|
||||
cur_src->callbacks.update_brightness != NULL) {
|
||||
cur_src->callbacks.update_brightness(brightness);
|
||||
}
|
||||
cur_src = cur_src->next;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_update_and_report_hue(uint16_t hue, const char *src)
|
||||
{
|
||||
esp_err_t ret;
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_hue(hue);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Report to other sources */
|
||||
ESP_LOGI(TAG, "Hue set to: %d degree", hue);
|
||||
while (cur_src) {
|
||||
if (strncmp(cur_src->name, src, strnlen(src, SRC_MAX_NAMELEN)) != 0 &&
|
||||
cur_src->callbacks.update_hue != NULL) {
|
||||
cur_src->callbacks.update_hue(hue);
|
||||
}
|
||||
cur_src = cur_src->next;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_update_and_report_saturation(uint8_t saturation, const char *src)
|
||||
{
|
||||
esp_err_t ret;
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_saturation(saturation);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Report to other sources */
|
||||
ESP_LOGI(TAG, "Saturation set to: %d percent", saturation);
|
||||
while (cur_src) {
|
||||
if (strncmp(cur_src->name, src, strnlen(src, SRC_MAX_NAMELEN)) != 0 &&
|
||||
cur_src->callbacks.update_saturation != NULL) {
|
||||
cur_src->callbacks.update_saturation(saturation);
|
||||
}
|
||||
cur_src = cur_src->next;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
esp_err_t app_driver_update_and_report_temperature(uint32_t temperature, const char *src)
|
||||
{
|
||||
esp_err_t ret;
|
||||
driver_src_t *cur_src = s_driver_src;
|
||||
|
||||
/* Update */
|
||||
ret = led_driver_set_temperature(temperature);
|
||||
if (ret != ESP_OK) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Report to other sources */
|
||||
ESP_LOGI(TAG, "Color Temperature set to: %d kelvin", temperature);
|
||||
while (cur_src) {
|
||||
if (strncmp(cur_src->name, src, strnlen(src, SRC_MAX_NAMELEN)) != 0 &&
|
||||
cur_src->callbacks.update_temperature != NULL) {
|
||||
cur_src->callbacks.update_temperature(temperature);
|
||||
}
|
||||
cur_src = cur_src->next;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool app_driver_get_power()
|
||||
{
|
||||
return led_driver_get_power();
|
||||
}
|
||||
|
||||
uint8_t app_driver_get_brightness()
|
||||
{
|
||||
return led_driver_get_brightness();
|
||||
}
|
||||
|
||||
uint16_t app_driver_get_hue()
|
||||
{
|
||||
return led_driver_get_hue();
|
||||
}
|
||||
|
||||
uint8_t app_driver_get_saturation()
|
||||
{
|
||||
return led_driver_get_saturation();
|
||||
}
|
||||
|
||||
uint32_t app_driver_get_temperature()
|
||||
{
|
||||
return led_driver_get_temperature();
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <esp_err.h>
|
||||
|
||||
#define SRC_MAX_NAMELEN 20
|
||||
|
||||
/**
|
||||
* @brief The param update callbacks notify the registered sources that the param
|
||||
* was updated by other source.
|
||||
*
|
||||
*/
|
||||
typedef struct app_driver_param_callback {
|
||||
void (*update_power)(bool power); /* Update power (On/Off) */
|
||||
void (*update_brightness)(uint8_t brightness); /* Update brightness */
|
||||
void (*update_hue)(uint16_t hue); /* Update color hue */
|
||||
void (*update_saturation)(uint8_t saturation); /* Update color saturation */
|
||||
void (*update_temperature)(uint32_t temperature); /* Update color temperature */
|
||||
} app_driver_param_callback_t;
|
||||
|
||||
/**
|
||||
* @brief Initializes the application driver layer.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_init(void);
|
||||
|
||||
/**
|
||||
* @brief Register a control source.
|
||||
*
|
||||
* @param[in] name The source name.
|
||||
* @param[in] callbacks The param update callbacks.
|
||||
*
|
||||
* @note Each source can just register the param callbacks it cares about, and leave the others as NULL.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
* - ESP_ERR_INVALID_ARG if any of the param is invalid
|
||||
* - ESP_ERR_NO_MEM if register failed due to out of memory
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_register_src(const char *name, app_driver_param_callback_t *callbacks);
|
||||
|
||||
/**
|
||||
* @brief Update the power (On/Off) param and report to all other registered control sources.
|
||||
*
|
||||
* @param[in] power The new power value.
|
||||
* @param[in] src The source that the change comes from.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_update_and_report_power(bool power, const char *src);
|
||||
|
||||
/**
|
||||
* @brief Update the brightness param and report to all other registered control sources.
|
||||
*
|
||||
* @param[in] brightness The new brightness value.
|
||||
* @param[in] src The source that the change comes from.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_update_and_report_brightness(uint8_t brightness, const char *src);
|
||||
|
||||
/**
|
||||
* @brief Update the hue param and report to all other registered control sources.
|
||||
*
|
||||
* @param[in] hue The new hue value.
|
||||
* @param[in] src The source that the change comes from.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_update_and_report_hue(uint16_t hue, const char *src);
|
||||
|
||||
/**
|
||||
* @brief Update the saturation param and report to all other registered control sources.
|
||||
*
|
||||
* @param[in] saturation The new saturation value.
|
||||
* @param[in] src The source that the change comes from.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_update_and_report_saturation(uint8_t saturation, const char *src);
|
||||
|
||||
/**
|
||||
* @brief Update the color temperature param and report to all other registered control sources.
|
||||
*
|
||||
* @param[in] temperature The new temperature value.
|
||||
* @param[in] src The source that the change comes from.
|
||||
*
|
||||
* return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_driver_update_and_report_temperature(uint32_t temperature, const char *src);
|
||||
|
||||
/**
|
||||
* @brief Get the power (On/Off) value.
|
||||
*
|
||||
* @return The current power (On/Off) value.
|
||||
*
|
||||
*/
|
||||
bool app_driver_get_power(void);
|
||||
|
||||
/**
|
||||
* @brief Get the brightness value.
|
||||
*
|
||||
* @return The current brightness value.
|
||||
*
|
||||
*/
|
||||
uint8_t app_driver_get_brightness(void);
|
||||
|
||||
/**
|
||||
* @brief Get the hue value.
|
||||
*
|
||||
* @return The current hue value.
|
||||
*
|
||||
*/
|
||||
uint16_t app_driver_get_hue(void);
|
||||
|
||||
/**
|
||||
* @brief Get the saturation value.
|
||||
*
|
||||
* @return The current saturation value.
|
||||
*
|
||||
*/
|
||||
uint8_t app_driver_get_saturation(void);
|
||||
|
||||
/**
|
||||
* @brief Get the temperature value.
|
||||
*
|
||||
* @return The current temperature value.
|
||||
*
|
||||
*/
|
||||
uint32_t app_driver_get_temperature(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,33 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
message(FATAL_ERROR "Please set ESP_MATTER_PATH to the path of esp-matter repo")
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH})
|
||||
set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
|
||||
|
||||
# This should be done before using the IDF_TARGET variable.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"../common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components")
|
||||
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/tft"
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/spidriver"
|
||||
)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"$ENV{IDF_PATH}/examples/peripherals/rmt/led_strip/components"
|
||||
)
|
||||
endif()
|
||||
|
||||
project(light)
|
||||
|
||||
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
|
||||
idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
|
||||
@@ -0,0 +1,62 @@
|
||||
# Light Example
|
||||
|
||||
## Building and Flashing the Firmware
|
||||
|
||||
See the [README.md](../../README.md) file for more information about building and flashing the firmware.
|
||||
|
||||
|
||||
## What to expect in this example?
|
||||
|
||||
The example provides a minimal implementation to build a Matter light device on ESP32 series SoCs.
|
||||
|
||||
Supported features:
|
||||
- Matter Commissioning
|
||||
- On/Off, Brightness and Color (on ESP32-C3 for now) control
|
||||
- (Optional) Interactive shell
|
||||
|
||||
### Useful shell commands
|
||||
|
||||
- BLE commands
|
||||
|
||||
```
|
||||
> chip ble <start|stop|state>
|
||||
```
|
||||
|
||||
Set and get the BLE advertisement state.
|
||||
|
||||
- Wi-Fi commands
|
||||
|
||||
```
|
||||
> chip wifi mode [disable|ap|sta]
|
||||
```
|
||||
|
||||
Set and get the Wi-Fi mode.
|
||||
|
||||
```
|
||||
> chip wifi connect <ssid> <psk>
|
||||
```
|
||||
|
||||
Connect to Wi-Fi network.
|
||||
|
||||
- Device configuration
|
||||
|
||||
```
|
||||
> chip config
|
||||
```
|
||||
|
||||
Dump the device static configuration
|
||||
|
||||
|
||||
- Facotry reset
|
||||
|
||||
```
|
||||
> chip device factoryreset
|
||||
```
|
||||
|
||||
- On-boarding codes
|
||||
|
||||
```
|
||||
> chip onboardingcodes
|
||||
```
|
||||
|
||||
Dump the on-boarding pairing code payloads.
|
||||
@@ -0,0 +1,24 @@
|
||||
set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/gen"
|
||||
"${MATTER_SDK_PATH}/src/app/server"
|
||||
"${MATTER_SDK_PATH}/src/app/util"
|
||||
"${MATTER_SDK_PATH}/src/app/reporting"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/basic"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/general-commissioning-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/network-commissioning"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/on-off-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/operational-credentials-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/level-control"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/color-control-server")
|
||||
|
||||
set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}"
|
||||
"${MATTER_SDK_PATH}/src")
|
||||
|
||||
set(PRIV_REQUIRES_LIST chip bt esp32_mbedtls app_driver)
|
||||
|
||||
idf_component_register(SRC_DIRS ${SRC_DIRS_LIST}
|
||||
PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}
|
||||
PRIV_REQUIRES ${PRIV_REQUIRES_LIST})
|
||||
|
||||
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define APP_LOG_TAG "light"
|
||||
|
||||
#define DEFAULT_POWER false
|
||||
#define DEFAULT_BRIGHTNESS 100
|
||||
#define DEFAULT_HUE 0
|
||||
#define DEFAULT_SATURATION 0
|
||||
|
||||
#define HUE_MAX 359
|
||||
#define HUE_ATTRIBUTE_MAX 254
|
||||
#define SATURATION_MAX 100
|
||||
#define SATURATION_ATTRIBUTE_MAX 254
|
||||
|
||||
#define APP_DRIVER_SRC_LOCAL "local"
|
||||
#define APP_DRIVER_SRC_MATTER "matter"
|
||||
|
||||
#define REMAP_TO_RANGE(value, from, to) value * to / from
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "app_driver.h"
|
||||
#include "app_matter.h"
|
||||
#include "app_constants.h"
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "lib/shell/Engine.h"
|
||||
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
void ChipShellTask(void *args)
|
||||
{
|
||||
chip::Shell::Engine::Root().RunMainLoop();
|
||||
}
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
// Initialize the ESP NVS layer.
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize and set the default params */
|
||||
app_driver_init();
|
||||
|
||||
ESP_LOGI(APP_LOG_TAG, "==================================================");
|
||||
ESP_LOGI(APP_LOG_TAG, "esp-matter-light example starting");
|
||||
ESP_LOGI(APP_LOG_TAG, "==================================================");
|
||||
|
||||
/* Initialize chip */
|
||||
ESP_ERROR_CHECK(app_matter_init());
|
||||
|
||||
app_driver_update_and_report_power(DEFAULT_POWER, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_brightness(DEFAULT_BRIGHTNESS, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_hue(DEFAULT_HUE, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_saturation(DEFAULT_SATURATION, APP_DRIVER_SRC_LOCAL);
|
||||
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
xTaskCreate(&ChipShellTask, "chip_shell", 2048, NULL, 5, NULL);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "app_driver.h"
|
||||
#include "app_matter.h"
|
||||
#include "app_constants.h"
|
||||
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "app/common/gen/att-storage.h"
|
||||
#include "app/common/gen/attribute-id.h"
|
||||
#include "app/common/gen/attribute-type.h"
|
||||
#include "app/common/gen/cluster-id.h"
|
||||
#include "app/server/Mdns.h"
|
||||
#include "app/server/Server.h"
|
||||
#include "app/util/af.h"
|
||||
#include "app/util/basic-types.h"
|
||||
#include "platform/CHIPDeviceLayer.h"
|
||||
#include "core/CHIPError.h"
|
||||
#include "lib/shell/Engine.h"
|
||||
#include "lib/support/CHIPMem.h"
|
||||
#include <cstdint>
|
||||
|
||||
using chip::AttributeId;
|
||||
using chip::ClusterId;
|
||||
using chip::EndpointId;
|
||||
using chip::DeviceLayer::ChipDeviceEvent;
|
||||
using chip::DeviceLayer::ConnectivityMgr;
|
||||
using chip::DeviceLayer::DeviceEventType::PublicEventTypes;
|
||||
using chip::DeviceLayer::PlatformMgr;
|
||||
|
||||
static void on_on_off_attribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value, size_t size)
|
||||
{
|
||||
if (attribute == ZCL_ON_OFF_ATTRIBUTE_ID) {
|
||||
app_driver_update_and_report_power(*value, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in OnOff cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_level_control_atrribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value,
|
||||
size_t size)
|
||||
{
|
||||
if (attribute == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) {
|
||||
app_driver_update_and_report_brightness(*value, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in level control cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_color_control_attribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value,
|
||||
size_t size)
|
||||
{
|
||||
if (attribute == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) {
|
||||
// remap hue to [0, 359]
|
||||
uint16_t hue = REMAP_TO_RANGE(static_cast<uint16_t>(*value), HUE_ATTRIBUTE_MAX, HUE_MAX);
|
||||
app_driver_update_and_report_hue(hue, APP_DRIVER_SRC_MATTER);
|
||||
} else if (attribute == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) {
|
||||
// remap saturation to [0, 100]
|
||||
uint8_t saturation = REMAP_TO_RANGE(static_cast<uint16_t>(*value), SATURATION_ATTRIBUTE_MAX, SATURATION_MAX);
|
||||
app_driver_update_and_report_saturation(saturation, APP_DRIVER_SRC_MATTER);
|
||||
} else if (attribute == ZCL_COLOR_CONTROL_COLOR_TEMPERATURE_ATTRIBUTE_ID) {
|
||||
// color temperature (kelvins) = 10000000 / temperatureMireds
|
||||
uint16_t temp_mireds;
|
||||
emberAfReadServerAttribute(endpoint, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_COLOR_TEMPERATURE_ATTRIBUTE_ID,
|
||||
reinterpret_cast<uint8_t *>(&temp_mireds), sizeof(uint16_t));
|
||||
uint32_t color_temp = 1000000 / (temp_mireds == 0 ? 1 : temp_mireds);
|
||||
app_driver_update_and_report_temperature(color_temp, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in color control cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_device_event(const ChipDeviceEvent *event, intptr_t arg)
|
||||
{
|
||||
if (event->Type == PublicEventTypes::kInterfaceIpAddressChanged) {
|
||||
chip::app::Mdns::StartServer();
|
||||
}
|
||||
|
||||
ESP_LOGI(APP_LOG_TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static void update_matter_power(bool power)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
|
||||
(uint8_t *)&power, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_brightness(uint8_t brightness)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_LEVEL_CONTROL_CLUSTER_ID, ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
|
||||
&brightness, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_hue(uint16_t hue)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
uint8_t hue_attribute = REMAP_TO_RANGE(hue, HUE_MAX, HUE_ATTRIBUTE_MAX);
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID,
|
||||
CLUSTER_MASK_SERVER, &hue_attribute, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_saturation(uint8_t saturation)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
uint8_t saturation_attribute = REMAP_TO_RANGE(static_cast<uint16_t>(saturation), SATURATION_MAX, SATURATION_ATTRIBUTE_MAX);
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
|
||||
CLUSTER_MASK_SERVER, &saturation_attribute, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_temperature(uint32_t temperature)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
uint16_t temp_mireds;
|
||||
assert(temperature >= 18); // temperatureMireds limited in [0, 0xfeff]
|
||||
temp_mireds = 1000000 / temperature;
|
||||
status = emberAfWriteAttribute(1, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_COLOR_TEMPERATURE_ATTRIBUTE_ID,
|
||||
CLUSTER_MASK_SERVER, reinterpret_cast<uint8_t *>(&temp_mireds), ZCL_INT16U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId cluster, AttributeId attribute, uint8_t mask,
|
||||
uint16_t manufacturer, uint8_t type, uint16_t size, uint8_t *value)
|
||||
{
|
||||
ESP_LOGI(APP_LOG_TAG, "Handle cluster ID: %d", cluster);
|
||||
if (cluster == ZCL_ON_OFF_CLUSTER_ID) {
|
||||
on_on_off_attribute_changed(endpoint, attribute, value, size);
|
||||
} else if (cluster == ZCL_LEVEL_CONTROL_CLUSTER_ID) {
|
||||
on_level_control_atrribute_changed(endpoint, attribute, value, size);
|
||||
} else if (cluster == ZCL_COLOR_CONTROL_CLUSTER_ID) {
|
||||
on_color_control_attribute_changed(endpoint, attribute, value, size);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t app_matter_init()
|
||||
{
|
||||
app_driver_param_callback_t callbacks = {
|
||||
.update_power = update_matter_power,
|
||||
.update_brightness = update_matter_brightness,
|
||||
.update_hue = update_matter_hue,
|
||||
.update_saturation = update_matter_saturation,
|
||||
.update_temperature = update_matter_temperature,
|
||||
};
|
||||
|
||||
if (PlatformMgr().InitChipStack() != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to initialize CHIP stack");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ConnectivityMgr().SetBLEAdvertisingEnabled(true);
|
||||
if (chip::Platform::MemoryInit() != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to initialize CHIP memory pool");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
if (PlatformMgr().StartEventLoopTask() != CHIP_NO_ERROR) {
|
||||
chip::Platform::MemoryShutdown();
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to launch Matter main task");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
PlatformMgr().AddEventHandler(on_device_event, static_cast<intptr_t>(NULL));
|
||||
|
||||
InitServer();
|
||||
|
||||
app_driver_register_src(APP_DRIVER_SRC_MATTER, &callbacks);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Initializes the matter stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_matter_init(void);
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// List specific responses
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
#include "CHIPClusters.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "chip-zcl-zpro-codec-api.h"
|
||||
#include <gen/CHIPClientCallbacks.h>
|
||||
#include <lib/support/Span.h>
|
||||
|
||||
namespace chip {
|
||||
namespace Controller {
|
||||
|
||||
// TODO(#4502): onCompletion is not used by IM for now.
|
||||
// TODO(#4503): length should be passed to commands when byte string is in argument list.
|
||||
// TODO(#4503): Commands should take group id as an argument.
|
||||
|
||||
} // namespace Controller
|
||||
} // namespace chip
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2020 Silicon Labs
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// This file is generated by Simplicity Studio. Please do not edit manually.
|
||||
//
|
||||
//
|
||||
|
||||
// Enclosing macro to prevent multiple inclusion
|
||||
#ifndef __AF_GEN_EVENT__
|
||||
#define __AF_GEN_EVENT__
|
||||
|
||||
// Code used to configure the cluster event mechanism
|
||||
#define EMBER_AF_GENERATED_EVENT_CODE \
|
||||
EmberEventControl emberAfLevelControlClusterServerTickCallbackControl1; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerHueSatTransitionEventControl; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerTempTransitionEventControl; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerXyTransitionEventControl; \
|
||||
extern void emberAfPluginColorControlServerHueSatTransitionEventHandler(void); \
|
||||
extern void emberAfPluginColorControlServerTempTransitionEventHandler(void); \
|
||||
extern void emberAfPluginColorControlServerXyTransitionEventHandler(void); \
|
||||
static void clusterTickWrapper(EmberEventControl * control, EmberAfTickFunction callback, uint8_t endpoint) \
|
||||
{ \
|
||||
/* emberAfPushEndpointNetworkIndex(endpoint); */ \
|
||||
emberEventControlSetInactive(control); \
|
||||
(*callback)(endpoint); \
|
||||
/* emberAfPopNetworkIndex(); */ \
|
||||
} \
|
||||
\
|
||||
void emberAfLevelControlClusterServerTickCallbackWrapperFunction1(void) \
|
||||
{ \
|
||||
clusterTickWrapper(&emberAfLevelControlClusterServerTickCallbackControl1, emberAfLevelControlClusterServerTickCallback, \
|
||||
1); \
|
||||
}
|
||||
|
||||
// EmberEventData structs used to populate the EmberEventData table
|
||||
#define EMBER_AF_GENERATED_EVENTS \
|
||||
{ &emberAfLevelControlClusterServerTickCallbackControl1, emberAfLevelControlClusterServerTickCallbackWrapperFunction1 }, \
|
||||
{ &emberAfPluginColorControlServerHueSatTransitionEventControl, \
|
||||
emberAfPluginColorControlServerHueSatTransitionEventHandler }, \
|
||||
{ &emberAfPluginColorControlServerTempTransitionEventControl, emberAfPluginColorControlServerTempTransitionEventHandler }, \
|
||||
{ &emberAfPluginColorControlServerXyTransitionEventControl, emberAfPluginColorControlServerXyTransitionEventHandler },
|
||||
|
||||
#define EMBER_AF_GENERATED_EVENT_STRINGS \
|
||||
"Level Control Cluster Server EP 1", "Color Control Cluster Server Plugin HueSatTransition", \
|
||||
"Color Control Cluster Server Plugin TempTransition", "Color Control Cluster Server Plugin XyTransition",
|
||||
|
||||
// The length of the event context table used to track and retrieve cluster events
|
||||
#define EMBER_AF_EVENT_CONTEXT_LENGTH 1
|
||||
|
||||
// EmberAfEventContext structs used to populate the EmberAfEventContext table
|
||||
#define EMBER_AF_GENERATED_EVENT_CONTEXT \
|
||||
{ 0x1, 0x8, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfLevelControlClusterServerTickCallbackControl1 },
|
||||
|
||||
#endif // __AF_GEN_EVENT__
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
#include <app/common/gen/af-structs.h>
|
||||
#include <app/util/af.h>
|
||||
#include <app/util/attribute-list-byte-span.h>
|
||||
#include <app/util/basic-types.h>
|
||||
#include <support/SafeInt.h>
|
||||
#include <support/logging/CHIPLogging.h>
|
||||
|
||||
using namespace chip;
|
||||
using namespace chip::app::List;
|
||||
|
||||
// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid
|
||||
// and data is undefined.
|
||||
constexpr uint16_t kSizeLengthInBytes = 2u;
|
||||
|
||||
void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length)
|
||||
{
|
||||
if (write)
|
||||
{
|
||||
memmove(dest + *offset, src, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(dest, src + *offset, length);
|
||||
}
|
||||
|
||||
*offset = static_cast<uint16_t>(*offset + length);
|
||||
}
|
||||
|
||||
uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src,
|
||||
int32_t index)
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
memmove(dest, src, am->size);
|
||||
return am->size;
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
if (write)
|
||||
{
|
||||
// src is a pointer to native-endian uint16_t, dest is pointer to buffer that should hold little-endian value
|
||||
emberAfCopyInt16u(dest, 0, *reinterpret_cast<uint16_t *>(src));
|
||||
}
|
||||
else
|
||||
{
|
||||
// src is pointer to buffer holding little-endian value, dest is a pointer to native-endian uint16_t
|
||||
*reinterpret_cast<uint16_t *>(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes);
|
||||
}
|
||||
return kSizeLengthInBytes;
|
||||
}
|
||||
|
||||
if (!chip::CanCastTo<uint16_t>(index))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid. Should be between 1 and 65534", index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t entryLength = 0;
|
||||
switch (clusterId)
|
||||
{
|
||||
case 0x003E: // Operational Credentials Cluster
|
||||
{
|
||||
uint16_t entryOffset = kSizeLengthInBytes;
|
||||
switch (am->attributeId)
|
||||
{
|
||||
case 0x0001: // fabrics list
|
||||
{
|
||||
entryLength = 52;
|
||||
if (((index - 1) * entryLength) > (am->size - entryLength))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index);
|
||||
return 0;
|
||||
}
|
||||
entryOffset = static_cast<uint16_t>(entryOffset + ((index - 1) * entryLength));
|
||||
// Struct _FabricDescriptor
|
||||
_FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest);
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write,
|
||||
&entryOffset, sizeof(entry->FabricId)); // FABRIC_ID
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write,
|
||||
&entryOffset, sizeof(entry->VendorId)); // INT16U
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset,
|
||||
sizeof(entry->NodeId)); // NODE_ID
|
||||
chip::ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING
|
||||
if (CHIP_NO_ERROR !=
|
||||
(write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan)))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index);
|
||||
return 0;
|
||||
}
|
||||
entryOffset = static_cast<uint16_t>(entryOffset + 34);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entryLength;
|
||||
}
|
||||
|
||||
// A list is a collection of entries of the same data type. The data type may be any defined data type.
|
||||
uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer)
|
||||
{
|
||||
// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid
|
||||
// and data is undefined.
|
||||
uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes);
|
||||
if (entryCount == 0xFFFF)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t entryLength = 0;
|
||||
switch (clusterId)
|
||||
{
|
||||
case 0x003E: // Operational Credentials Cluster
|
||||
switch (attributeId)
|
||||
{
|
||||
case 0x0001: // fabrics list
|
||||
// Struct _FabricDescriptor
|
||||
entryLength = 52;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength);
|
||||
if (!chip::CanCastTo<uint16_t>(totalSize))
|
||||
{
|
||||
ChipLogError(Zcl, "Cluster %" PRIx32 ": Size of attribute %" PRIx32 " is too large.", clusterId, attributeId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return static_cast<uint16_t>(totalSize);
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
#include <app/common/gen/callback.h>
|
||||
#include <app/common/gen/cluster-id.h>
|
||||
#include <lib/support/Span.h>
|
||||
|
||||
using namespace chip;
|
||||
|
||||
// Cluster Init Functions
|
||||
void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
|
||||
{
|
||||
switch (clusterId)
|
||||
{
|
||||
case ZCL_BASIC_CLUSTER_ID:
|
||||
emberAfBasicClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_COLOR_CONTROL_CLUSTER_ID:
|
||||
emberAfColorControlClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
|
||||
emberAfGeneralCommissioningClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_LEVEL_CONTROL_CLUSTER_ID:
|
||||
emberAfLevelControlClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
|
||||
emberAfNetworkCommissioningClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_ON_OFF_CLUSTER_ID:
|
||||
emberAfOnOffClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID:
|
||||
emberAfOperationalCredentialsClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID:
|
||||
emberAfWiFiNetworkDiagnosticsClusterInitCallback(endpoint);
|
||||
break;
|
||||
default:
|
||||
// Unrecognized cluster ID
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfWiFiNetworkDiagnosticsClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
|
||||
//
|
||||
// Non-Cluster Related Callbacks
|
||||
//
|
||||
|
||||
/** @brief Add To Current App Tasks
|
||||
*
|
||||
* This function is only useful to sleepy end devices. This function will note
|
||||
* the passed item as part of a set of tasks the application has outstanding
|
||||
* (e.g. message sent requiring APS acknwoledgement). This will affect how the
|
||||
* application behaves with regard to sleeping and polling. Until the
|
||||
* outstanding task is completed, the device may poll more frequently and sleep
|
||||
* less often.
|
||||
*
|
||||
* @param tasks Ver.: always
|
||||
*/
|
||||
void __attribute__((weak)) emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
/** @brief Remove From Current App Tasks
|
||||
*
|
||||
* This function is only useful to sleepy end devices. This function will
|
||||
* remove the passed item from the set of tasks the application has outstanding
|
||||
* (e.g. message sent requiring APS acknwoledgement). This will affect how the
|
||||
* application behaves with regard to sleeping and polling. Removing the item
|
||||
* from the list of outstanding tasks may allow the device to sleep longer and
|
||||
* poll less frequently. If there are other outstanding tasks the system may
|
||||
* still have to stay away and poll more often.
|
||||
*
|
||||
* @param tasks Ver.: always
|
||||
*/
|
||||
void __attribute__((weak)) emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
/** @brief Allow Network Write Attribute
|
||||
*
|
||||
* This function is called by the application framework before it writes an
|
||||
* attribute in response to a write attribute request from an external device.
|
||||
* The value passed into this callback is the value to which the attribute is to
|
||||
* be set by the framework.
|
||||
Example: In mirroring simple metering data
|
||||
* on an Energy Services Interface (ESI) (formerly called Energy Service Portal
|
||||
* (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
|
||||
* attributes on its mirror. The-meter-mirror sample application, located in
|
||||
* app/framework/sample-apps, uses this callback to allow the mirrored device to
|
||||
* write simple metering attributes on the mirror regardless of the fact that
|
||||
* most simple metering attributes are defined as read-only by the ZigBee
|
||||
* specification.
|
||||
Note: The ZCL specification does not (as of this
|
||||
* writing) specify any permission-level security for writing writeable
|
||||
* attributes. As far as the ZCL specification is concerned, if an attribute is
|
||||
* writeable, any device that has a link key for the device should be able to
|
||||
* write that attribute. Furthermore if an attribute is read only, it should not
|
||||
* be written over the air. Thus, if you implement permissions for writing
|
||||
* attributes as a feature, you MAY be operating outside the specification. This
|
||||
* is unlikely to be a problem for writing read-only attributes, but it may be a
|
||||
* problem for attributes that are writeable according to the specification but
|
||||
* restricted by the application implementing this callback.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param value Ver.: always
|
||||
* @param type Ver.: always
|
||||
*/
|
||||
EmberAfAttributeWritePermission __attribute__((weak))
|
||||
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t * value, uint8_t type)
|
||||
{
|
||||
return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
|
||||
}
|
||||
|
||||
/** @brief Attribute Read Access
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to check
|
||||
* access permission for an attribute read.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode, AttributeId attributeId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @brief Attribute Write Access
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to check
|
||||
* access permission for an attribute write.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfAttributeWriteAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode, AttributeId attributeId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @brief Default Response
|
||||
*
|
||||
* This function is called by the application framework when a Default Response
|
||||
* command is received from an external device. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param commandId The command identifier to which this is a response. Ver.:
|
||||
* always
|
||||
* @param status Specifies either SUCCESS or the nature of the error that was
|
||||
* detected in the received command. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, CommandId commandId, EmberAfStatus status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Configure Reporting Response
|
||||
*
|
||||
* This function is called by the application framework when a Configure
|
||||
* Reporting Response command is received from an external device. The
|
||||
* application should return true if the message was processed or false if it
|
||||
* was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute status records. Ver.:
|
||||
* always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Read Reporting Configuration Response
|
||||
*
|
||||
* This function is called by the application framework when a Read Reporting
|
||||
* Configuration Response command is received from an external device. The
|
||||
* application should return true if the message was processed or false if it
|
||||
* was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute reporting configuration
|
||||
* records. Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Attributes Response
|
||||
*
|
||||
* This function is called by the application framework when a Discover
|
||||
* Attributes Response or Discover Attributes Extended Response command is
|
||||
* received from an external device. The Discover Attributes Response command
|
||||
* contains a bool indicating if discovery is complete and a list of zero or
|
||||
* more attribute identifier/type records. The final argument indicates whether
|
||||
* the response is in the extended format or not. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more attributes to be
|
||||
* discovered. true if there are no more attributes to be discovered. Ver.:
|
||||
* always
|
||||
* @param buffer Buffer containing the list of attribute identifier/type
|
||||
* records. Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
* @param extended Indicates whether the response is in the extended format or
|
||||
* not. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfDiscoverAttributesResponseCallback(ClusterId clusterId, bool discoveryComplete, uint8_t * buffer,
|
||||
uint16_t bufLen, bool extended)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Commands Generated Response
|
||||
*
|
||||
* This function is called by the framework when Discover Commands Generated
|
||||
* Response is received.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param manufacturerCode Manufacturer code Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more commands to be
|
||||
* discovered. Ver.: always
|
||||
* @param commandIds Buffer containing the list of command identifiers. Ver.:
|
||||
* always
|
||||
* @param commandIdCount The length of bytes of the list, whish is the same as
|
||||
* the number of identifiers. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfDiscoverCommandsGeneratedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
|
||||
CommandId * commandIds, uint16_t commandIdCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Commands Received Response
|
||||
*
|
||||
* This function is called by the framework when Discover Commands Received
|
||||
* Response is received.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param manufacturerCode Manufacturer code Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more commands to be
|
||||
* discovered. Ver.: always
|
||||
* @param commandIds Buffer containing the list of command identifiers. Ver.:
|
||||
* always
|
||||
* @param commandIdCount The length of bytes of the list, whish is the same as
|
||||
* the number of identifiers. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
|
||||
CommandId * commandIds, uint16_t commandIdCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Command Received
|
||||
*
|
||||
* This callback is the second in the Application Framework's message processing
|
||||
* chain. At this point in the processing of incoming over-the-air messages, the
|
||||
* application has determined that the incoming message is a ZCL command. It
|
||||
* parses enough of the message to populate an EmberAfClusterCommand struct. The
|
||||
* Application Framework defines this struct value in a local scope to the
|
||||
* command processing but also makes it available through a global pointer
|
||||
* called emberAfCurrentCommand, in app/framework/util/util.c. When command
|
||||
* processing is complete, this pointer is cleared.
|
||||
*
|
||||
* @param cmd Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Message Send
|
||||
*
|
||||
* This function is called by the framework when it is about to pass a message
|
||||
* to the stack primitives for sending. This message may or may not be ZCL,
|
||||
* ZDO, or some other protocol. This is called prior to
|
||||
any ZigBee
|
||||
* fragmentation that may be done. If the function returns true it is assumed
|
||||
* the callback has consumed and processed the message. The callback must also
|
||||
* set the EmberStatus status code to be passed back to the caller. The
|
||||
* framework will do no further processing on the message.
|
||||
If the
|
||||
* function returns false then it is assumed that the callback has not processed
|
||||
* the mesasge and the framework will continue to process accordingly.
|
||||
*
|
||||
* @param messageStruct The structure containing the parameters of the APS
|
||||
* message to be sent. Ver.: always
|
||||
* @param status A pointer to the status code value that will be returned to the
|
||||
* caller. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Message Sent
|
||||
*
|
||||
* This function is called by the application framework from the message sent
|
||||
* handler, when it is informed by the stack regarding the message sent status.
|
||||
* All of the values passed to the emberMessageSentHandler are passed on to this
|
||||
* callback. This provides an opportunity for the application to verify that its
|
||||
* message has been sent successfully and take the appropriate action. This
|
||||
* callback should return a bool value of true or false. A value of true
|
||||
* indicates that the message sent notification has been handled and should not
|
||||
* be handled by the application framework.
|
||||
*
|
||||
* @param type Ver.: always
|
||||
* @param destination Ver.: always
|
||||
* @param apsFrame Ver.: always
|
||||
* @param msgLen Ver.: always
|
||||
* @param message Ver.: always
|
||||
* @param status Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfMessageSentCallback(const MessageSendDestination & destination, EmberApsFrame * apsFrame,
|
||||
uint16_t msgLen, uint8_t * message, EmberStatus status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Attribute Change
|
||||
*
|
||||
* This function is called by the application framework before it changes an
|
||||
* attribute value. The value passed into this callback is the value to which
|
||||
* the attribute is to be set by the framework. The application should return
|
||||
* ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
|
||||
* to reject it.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param type Ver.: always
|
||||
* @param size Ver.: always
|
||||
* @param value Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfPreAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/** @brief Post Attribute Change
|
||||
*
|
||||
* This function is called by the application framework after it changes an
|
||||
* attribute value. The value passed into this callback is the value to which
|
||||
* the attribute was set by the framework.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param type Ver.: always
|
||||
* @param size Ver.: always
|
||||
* @param value Ver.: always
|
||||
*/
|
||||
void __attribute__((weak))
|
||||
emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
|
||||
{}
|
||||
|
||||
/** @brief External Attribute Read
|
||||
*
|
||||
* Like emberAfExternalAttributeWriteCallback above, this function is called
|
||||
* when the framework needs to read an attribute that is not stored within the
|
||||
* Application Framework's data structures.
|
||||
All of the important
|
||||
* information about the attribute itself is passed as a pointer to an
|
||||
* EmberAfAttributeMetadata struct, which is stored within the application and
|
||||
* used to manage the attribute. A complete description of the
|
||||
* EmberAfAttributeMetadata struct is provided in
|
||||
* app/framework/include/af-types.h
|
||||
This function assumes that the
|
||||
* application is able to read the attribute, write it into the passed buffer,
|
||||
* and return immediately. Any attributes that require a state machine for
|
||||
* reading and writing are not really candidates for externalization at the
|
||||
* present time. The Application Framework does not currently include a state
|
||||
* machine for reading or writing attributes that must take place across a
|
||||
* series of application ticks. Attributes that cannot be read in a timely
|
||||
* manner should be stored within the Application Framework and updated
|
||||
* occasionally by the application code from within the
|
||||
* emberAfMainTickCallback.
|
||||
If the application was successfully able to
|
||||
* read the attribute and write it into the passed buffer, it should return a
|
||||
* value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
|
||||
* managed attribute value is smaller than what the buffer can hold. In the case
|
||||
* of a buffer overflow throw an appropriate error such as
|
||||
* EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
|
||||
* application was not able to read the attribute.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeMetadata Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param buffer Ver.: always
|
||||
* @param maxReadLength Ver.: always
|
||||
* @param index Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, EmberAfAttributeMetadata * attributeMetadata,
|
||||
uint16_t manufacturerCode, uint8_t * buffer, uint16_t maxReadLength, int32_t index)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief Write Attributes Response
|
||||
*
|
||||
* This function is called by the application framework when a Write Attributes
|
||||
* Response command is received from an external device. The application should
|
||||
* return true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of write attribute status records.
|
||||
* Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfWriteAttributesResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief External Attribute Write
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to write an
|
||||
* attribute which is not stored within the data structures of the Application
|
||||
* Framework itself. One of the new features in Version 2 is the ability to
|
||||
* store attributes outside the Framework. This is particularly useful for
|
||||
* attributes that do not need to be stored because they can be read off the
|
||||
* hardware when they are needed, or are stored in some central location used by
|
||||
* many modules within the system. In this case, you can indicate that the
|
||||
* attribute is stored externally. When the framework needs to write an external
|
||||
* attribute, it makes a call to this callback.
|
||||
This callback is very
|
||||
* useful for host micros which need to store attributes in persistent memory.
|
||||
* Because each host micro (used with an Ember NCP) has its own type of
|
||||
* persistent memory storage, the Application Framework does not include the
|
||||
* ability to mark attributes as stored in flash the way that it does for Ember
|
||||
* SoCs like the EM35x. On a host micro, any attributes that need to be stored
|
||||
* in persistent memory should be marked as external and accessed through the
|
||||
* external read and write callbacks. Any host code associated with the
|
||||
* persistent storage should be implemented within this callback.
|
||||
All of
|
||||
* the important information about the attribute itself is passed as a pointer
|
||||
* to an EmberAfAttributeMetadata struct, which is stored within the application
|
||||
* and used to manage the attribute. A complete description of the
|
||||
* EmberAfAttributeMetadata struct is provided in
|
||||
* app/framework/include/af-types.h.
|
||||
This function assumes that the
|
||||
* application is able to write the attribute and return immediately. Any
|
||||
* attributes that require a state machine for reading and writing are not
|
||||
* candidates for externalization at the present time. The Application Framework
|
||||
* does not currently include a state machine for reading or writing attributes
|
||||
* that must take place across a series of application ticks. Attributes that
|
||||
* cannot be written immediately should be stored within the Application
|
||||
* Framework and updated occasionally by the application code from within the
|
||||
* emberAfMainTickCallback.
|
||||
If the application was successfully able to
|
||||
* write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
|
||||
* other return value indicates the application was not able to write the
|
||||
* attribute.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeMetadata Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param buffer Ver.: always
|
||||
* @param index Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, EmberAfAttributeMetadata * attributeMetadata,
|
||||
uint16_t manufacturerCode, uint8_t * buffer, int32_t index)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief Report Attributes
|
||||
*
|
||||
* This function is called by the application framework when a Report Attributes
|
||||
* command is received from an external device. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this command. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute report records. Ver.:
|
||||
* always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Get Current Time
|
||||
*
|
||||
* This callback is called when device attempts to get current time from the
|
||||
* hardware. If this device has means to retrieve exact time, then this method
|
||||
* should implement it. If the callback can't provide the exact time it should
|
||||
* return 0 to indicate failure. Default action is to return 0, which indicates
|
||||
* that device does not have access to real time.
|
||||
*
|
||||
*/
|
||||
uint32_t __attribute__((weak)) emberAfGetCurrentTimeCallback()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @brief Get Endpoint Info
|
||||
*
|
||||
* This function is a callback to an application implemented endpoint that
|
||||
* operates outside the normal application framework. When the framework wishes
|
||||
* to perform operations with that endpoint it uses this callback to retrieve
|
||||
* the endpoint's information. If the endpoint exists and the application can
|
||||
* provide data then true shall be returned. Otherwise the callback must return
|
||||
* false.
|
||||
*
|
||||
* @param endpoint The endpoint to retrieve data for. Ver.: always
|
||||
* @param returnNetworkIndex The index corresponding to the ZigBee network the
|
||||
* endpoint belongs to. If not using a multi-network device, 0 must be
|
||||
* returned. Otherwise on a multi-network device the stack will switch to this
|
||||
* network before sending the message. Ver.: always
|
||||
* @param returnEndpointInfo A pointer to a data struct that will be written
|
||||
* with information about the endpoint. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfGetEndpointInfoCallback(EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Registration Abort
|
||||
*
|
||||
* This callback is called when the device should abort the registration
|
||||
* process.
|
||||
*
|
||||
*/
|
||||
void __attribute__((weak)) emberAfRegistrationAbortCallback() {}
|
||||
|
||||
/** @brief Interpan Send Message
|
||||
*
|
||||
* This function will send a raw MAC message with interpan frame format using
|
||||
* the passed parameters.
|
||||
*
|
||||
* @param header Interpan header info Ver.: always
|
||||
* @param messageLength The length of the message received or to send Ver.:
|
||||
* always
|
||||
* @param message The message data received or to send. Ver.: always
|
||||
*/
|
||||
EmberStatus __attribute__((weak))
|
||||
emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message)
|
||||
{
|
||||
return EMBER_LIBRARY_NOT_PRESENT;
|
||||
}
|
||||
|
||||
/** @brief Start Move
|
||||
*
|
||||
* This function is called to initiate the process for a device to move (rejoin)
|
||||
* to a new parent.
|
||||
*
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfStartMoveCallback()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,607 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// Default values for the attributes longer than a pointer,
|
||||
// in a form of a binary blob
|
||||
// Separate block is generated for big-endian and little-endian cases.
|
||||
#if BIGENDIAN_CPU
|
||||
#define GENERATED_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server), big-endian */ \
|
||||
\
|
||||
/* 0 - VendorName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 32 - ProductName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 64 - UserLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 96 - HardwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 160 - SoftwareVersion, */ \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 164 - SoftwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 228 - ManufacturingDate, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 244 - PartNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 276 - ProductURL, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 532 - ProductLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 596 - SerialNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \
|
||||
\
|
||||
/* 628 - FabricId, */ \
|
||||
1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 636 - Breadcrumb, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), big-endian */ \
|
||||
\
|
||||
/* 644 - bssid, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server), big-endian */ \
|
||||
\
|
||||
/* 650 - fabrics list, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
}
|
||||
|
||||
#else // !BIGENDIAN_CPU
|
||||
#define GENERATED_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server), little-endian */ \
|
||||
\
|
||||
/* 0 - VendorName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 32 - ProductName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 64 - UserLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 96 - HardwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 160 - SoftwareVersion, */ \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 164 - SoftwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 228 - ManufacturingDate, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 244 - PartNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 276 - ProductURL, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 532 - ProductLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 596 - SerialNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \
|
||||
\
|
||||
/* 628 - FabricId, */ \
|
||||
1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 636 - Breadcrumb, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), little-endian */ \
|
||||
\
|
||||
/* 644 - bssid, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server), little-endian */ \
|
||||
\
|
||||
/* 650 - fabrics list, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
}
|
||||
|
||||
#endif // BIGENDIAN_CPU
|
||||
|
||||
#define GENERATED_DEFAULTS_COUNT (15)
|
||||
|
||||
#define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
|
||||
#define ZAP_LONG_DEFAULTS_INDEX(index) \
|
||||
{ \
|
||||
(uint8_t *) (&generatedDefaults[index]) \
|
||||
}
|
||||
#define ZAP_MIN_MAX_DEFAULTS_INDEX(index) \
|
||||
{ \
|
||||
(uint8_t *) (&minMaxDefault[index]) \
|
||||
}
|
||||
#define ZAP_EMPTY_DEFAULT() \
|
||||
{ \
|
||||
(uint16_t) 0 \
|
||||
}
|
||||
#define ZAP_SIMPLE_DEFAULT(x) \
|
||||
{ \
|
||||
(uint16_t) x \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfAttributeMinMaxValue structures.
|
||||
#define GENERATED_MIN_MAX_DEFAULT_COUNT 0
|
||||
#define GENERATED_MIN_MAX_DEFAULTS \
|
||||
{ \
|
||||
}
|
||||
|
||||
#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
|
||||
// This is an array of EmberAfAttributeMetadata structures.
|
||||
#define GENERATED_ATTRIBUTE_COUNT 64
|
||||
#define GENERATED_ATTRIBUTES \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* InteractionModelVersion */ \
|
||||
{ 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* VendorName */ \
|
||||
{ 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \
|
||||
{ 0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(32) }, /* ProductName */ \
|
||||
{ 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductID */ \
|
||||
{ 0x0005, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(64) }, /* UserLabel */ \
|
||||
{ 0x0006, ZAP_TYPE(CHAR_STRING), 2, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_EMPTY_DEFAULT() }, /* Location */ \
|
||||
{ 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(0x00) }, /* HardwareVersion */ \
|
||||
{ 0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(96) }, /* HardwareVersionString */ \
|
||||
{ 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(160) }, /* SoftwareVersion */ \
|
||||
{ 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(164) }, /* SoftwareVersionString */ \
|
||||
{ 0x000B, ZAP_TYPE(CHAR_STRING), 16, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(228) }, /* ManufacturingDate */ \
|
||||
{ 0x000C, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(244) }, /* PartNumber */ \
|
||||
{ 0x000D, ZAP_TYPE(CHAR_STRING), 256, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(276) }, /* ProductURL */ \
|
||||
{ 0x000E, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(532) }, /* ProductLabel */ \
|
||||
{ 0x000F, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(596) }, /* SerialNumber */ \
|
||||
{ 0x0010, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_SIMPLE_DEFAULT(0) }, /* LocalConfigDisabled */ \
|
||||
{ 0x0011, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* Reachable */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(628) }, /* FabricId */ \
|
||||
{ 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(636) }, /* Breadcrumb */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(OCTET_STRING), 6, 0, ZAP_LONG_DEFAULTS_INDEX(644) }, /* bssid */ \
|
||||
{ 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SecurityType */ \
|
||||
{ 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* WiFiVersion */ \
|
||||
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ChannelNumber */ \
|
||||
{ 0x0004, ZAP_TYPE(INT8S), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Rssi */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(650) }, /* fabrics list */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \
|
||||
{ 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* global scene control */ \
|
||||
{ 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* on time */ \
|
||||
{ 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* off wait time */ \
|
||||
{ 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* start up on off */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current level */ \
|
||||
{ 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \
|
||||
{ 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* options */ \
|
||||
{ 0x4000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* start up current level */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current hue */ \
|
||||
{ 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current saturation */ \
|
||||
{ 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \
|
||||
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* current x */ \
|
||||
{ 0x0004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* current y */ \
|
||||
{ 0x0007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* color temperature */ \
|
||||
{ 0x0008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* color mode */ \
|
||||
{ 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \
|
||||
{ 0x0010, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* number of primaries */ \
|
||||
{ 0x4000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* enhanced current hue */ \
|
||||
{ 0x4001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* enhanced color mode */ \
|
||||
{ 0x4002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop active */ \
|
||||
{ 0x4003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop direction */ \
|
||||
{ 0x4004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0019) }, /* color loop time */ \
|
||||
{ 0x4005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x2300) }, /* color loop start enhanced hue */ \
|
||||
{ 0x4006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color loop stored enhanced hue */ \
|
||||
{ 0x400A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color capabilities */ \
|
||||
{ 0x400B, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color temp physical min */ \
|
||||
{ 0x400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \
|
||||
{ 0x400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \
|
||||
{ 0x4010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_EMPTY_DEFAULT() }, /* start up color temperature mireds */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfCluster structures.
|
||||
#define ZAP_ATTRIBUTE_INDEX(index) ((EmberAfAttributeMetadata *) (&generatedAttributes[index]))
|
||||
|
||||
// Cluster function static arrays
|
||||
#define GENERATED_FUNCTION_ARRAYS \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayOnOffServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayColorControlServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfColorControlClusterServerInitCallback, \
|
||||
};
|
||||
|
||||
#define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
|
||||
#define GENERATED_CLUSTER_COUNT 8
|
||||
#define GENERATED_CLUSTERS \
|
||||
{ \
|
||||
{ 0x0028, \
|
||||
ZAP_ATTRIBUTE_INDEX(0), \
|
||||
19, \
|
||||
642, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ \
|
||||
0x0030, ZAP_ATTRIBUTE_INDEX(19), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ \
|
||||
0x0031, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ \
|
||||
0x0036, ZAP_ATTRIBUTE_INDEX(23), 6, 13, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \
|
||||
{ \
|
||||
0x003E, ZAP_ATTRIBUTE_INDEX(29), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x0006, \
|
||||
ZAP_ATTRIBUTE_INDEX(31), \
|
||||
6, \
|
||||
9, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0008, \
|
||||
ZAP_ATTRIBUTE_INDEX(37), \
|
||||
5, \
|
||||
7, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0300, \
|
||||
ZAP_ATTRIBUTE_INDEX(42), \
|
||||
22, \
|
||||
36, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
}
|
||||
|
||||
#define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
|
||||
|
||||
// This is an array of EmberAfEndpointType structures.
|
||||
#define GENERATED_ENDPOINT_TYPES \
|
||||
{ \
|
||||
{ ZAP_CLUSTER_INDEX(0), 5, 931 }, { ZAP_CLUSTER_INDEX(5), 3, 52 }, \
|
||||
}
|
||||
|
||||
// Largest attribute size is needed for various buffers
|
||||
#define ATTRIBUTE_LARGEST (257)
|
||||
|
||||
// Total size of singleton attributes
|
||||
#define ATTRIBUTE_SINGLETONS_SIZE (642)
|
||||
|
||||
// Total size of attribute storage
|
||||
#define ATTRIBUTE_MAX_SIZE (983)
|
||||
|
||||
// Number of fixed endpoints
|
||||
#define FIXED_ENDPOINT_COUNT (2)
|
||||
|
||||
// Array of endpoints that are supported, the data inside
|
||||
// the array is the endpoint number.
|
||||
#define FIXED_ENDPOINT_ARRAY \
|
||||
{ \
|
||||
0x0000, 0x0001 \
|
||||
}
|
||||
|
||||
// Array of profile ids
|
||||
#define FIXED_PROFILE_IDS \
|
||||
{ \
|
||||
0x0104, 0x0104 \
|
||||
}
|
||||
|
||||
// Array of device ids
|
||||
#define FIXED_DEVICE_IDS \
|
||||
{ \
|
||||
0, 0 \
|
||||
}
|
||||
|
||||
// Array of device versions
|
||||
#define FIXED_DEVICE_VERSIONS \
|
||||
{ \
|
||||
1, 1 \
|
||||
}
|
||||
|
||||
// Array of endpoint types supported on each endpoint
|
||||
#define FIXED_ENDPOINT_TYPES \
|
||||
{ \
|
||||
0, 1 \
|
||||
}
|
||||
|
||||
// Array of networks supported on each endpoint
|
||||
#define FIXED_NETWORKS \
|
||||
{ \
|
||||
0, 0 \
|
||||
}
|
||||
|
||||
// Array of EmberAfCommandMetadata structs.
|
||||
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
|
||||
#define EMBER_AF_GENERATED_COMMAND_COUNT (70)
|
||||
#define GENERATED_COMMANDS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* StartUp */ \
|
||||
{ 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ShutDown */ \
|
||||
{ 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Leave */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ArmFailSafe */ \
|
||||
{ 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ArmFailSafeResponse */ \
|
||||
{ 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetRegulatoryConfig */ \
|
||||
{ 0x0030, 0x03, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* SetRegulatoryConfigResponse */ \
|
||||
{ 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \
|
||||
{ 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \
|
||||
{ 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ScanNetworksResponse */ \
|
||||
{ 0x0031, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddWiFiNetwork */ \
|
||||
{ 0x0031, 0x03, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* AddWiFiNetworkResponse */ \
|
||||
{ 0x0031, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateWiFiNetwork */ \
|
||||
{ 0x0031, 0x05, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* UpdateWiFiNetworkResponse */ \
|
||||
{ 0x0031, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddThreadNetwork */ \
|
||||
{ 0x0031, 0x07, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* AddThreadNetworkResponse */ \
|
||||
{ 0x0031, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateThreadNetwork */ \
|
||||
{ 0x0031, 0x09, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* UpdateThreadNetworkResponse */ \
|
||||
{ 0x0031, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveNetwork */ \
|
||||
{ 0x0031, 0x0B, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* RemoveNetworkResponse */ \
|
||||
{ 0x0031, 0x0C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnableNetwork */ \
|
||||
{ 0x0031, 0x0D, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* EnableNetworkResponse */ \
|
||||
{ 0x0031, 0x0E, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* DisableNetwork */ \
|
||||
{ 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* DisableNetworkResponse */ \
|
||||
{ 0x0031, 0x10, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetLastNetworkCommissioningResult */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \
|
||||
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
|
||||
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
|
||||
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
|
||||
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
|
||||
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
|
||||
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
|
||||
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
|
||||
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
|
||||
{ 0x003E, 0xA1, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddTrustedRootCertificate */ \
|
||||
{ 0x003E, 0xA2, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveTrustedRootCertificate */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Off */ \
|
||||
{ 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On */ \
|
||||
{ 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Toggle */ \
|
||||
{ 0x0006, 0x40, 0 }, /* OffWithEffect */ \
|
||||
{ 0x0006, 0x41, 0 }, /* OnWithRecallGlobalScene */ \
|
||||
{ 0x0006, 0x42, 0 }, /* OnWithTimedOff */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0008, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevel */ \
|
||||
{ 0x0008, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Move */ \
|
||||
{ 0x0008, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Step */ \
|
||||
{ 0x0008, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Stop */ \
|
||||
{ 0x0008, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevelWithOnOff */ \
|
||||
{ 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveWithOnOff */ \
|
||||
{ 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepWithOnOff */ \
|
||||
{ 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopWithOnOff */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ 0x0300, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToHue */ \
|
||||
{ 0x0300, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveHue */ \
|
||||
{ 0x0300, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepHue */ \
|
||||
{ 0x0300, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToSaturation */ \
|
||||
{ 0x0300, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveSaturation */ \
|
||||
{ 0x0300, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepSaturation */ \
|
||||
{ 0x0300, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToHueAndSaturation */ \
|
||||
{ 0x0300, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToColor */ \
|
||||
{ 0x0300, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveColor */ \
|
||||
{ 0x0300, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepColor */ \
|
||||
{ 0x0300, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToColorTemperature */ \
|
||||
{ 0x0300, 0x40, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveToHue */ \
|
||||
{ 0x0300, 0x41, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveHue */ \
|
||||
{ 0x0300, 0x42, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedStepHue */ \
|
||||
{ 0x0300, 0x43, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveToHueAndSaturation */ \
|
||||
{ 0x0300, 0x44, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ColorLoopSet */ \
|
||||
{ 0x0300, 0x47, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopMoveStep */ \
|
||||
{ 0x0300, 0x4B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveColorTemperature */ \
|
||||
{ 0x0300, 0x4C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepColorTemperature */ \
|
||||
}
|
||||
|
||||
// Array of EmberAfManufacturerCodeEntry structures for commands.
|
||||
#define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_COMMAND_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfManufacturerCodeEntry structures for clusters.
|
||||
#define GENERATED_CLUSTER_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_CLUSTER_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfManufacturerCodeEntry structures for attributes.
|
||||
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// Array of EmberAfPluginReportingEntry structures.
|
||||
#define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_##x
|
||||
#define ZAP_REPORT_DIRECTION(x) ZRD(x)
|
||||
|
||||
// User options for plugin Reporting
|
||||
#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (5)
|
||||
#define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
|
||||
|
||||
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (5)
|
||||
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current hue */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0001, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current saturation */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0003, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current x */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0004, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current y */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0007, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* color temperature */ \
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// User options for plugin Binding Table Library
|
||||
#define EMBER_BINDING_TABLE_SIZE 10
|
||||
|
||||
/**** Network Section ****/
|
||||
#define EMBER_SUPPORTED_NETWORKS (1)
|
||||
|
||||
#define EMBER_APS_UNICAST_MESSAGE_COUNT 10
|
||||
|
||||
/**** Cluster endpoint counts ****/
|
||||
#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
|
||||
/**** Cluster Plugins ****/
|
||||
|
||||
// Use this macro to check if the server side of the Basic cluster is included
|
||||
#define ZCL_USING_BASIC_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_BASIC_SERVER
|
||||
#define EMBER_AF_PLUGIN_BASIC
|
||||
|
||||
// Use this macro to check if the server side of the Color Control cluster is included
|
||||
#define ZCL_USING_COLOR_CONTROL_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL
|
||||
// User options for server plugin Color Control
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV
|
||||
|
||||
// Use this macro to check if the server side of the General Commissioning cluster is included
|
||||
#define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_SERVER
|
||||
#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING
|
||||
|
||||
// Use this macro to check if the server side of the Level Control cluster is included
|
||||
#define ZCL_USING_LEVEL_CONTROL_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_SERVER
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL
|
||||
// User options for server plugin Level Control
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL 255
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0
|
||||
|
||||
// Use this macro to check if the server side of the Network Commissioning cluster is included
|
||||
#define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER
|
||||
#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING
|
||||
|
||||
// Use this macro to check if the server side of the On/off cluster is included
|
||||
#define ZCL_USING_ON_OFF_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_ON_OFF_SERVER
|
||||
#define EMBER_AF_PLUGIN_ON_OFF
|
||||
|
||||
// Use this macro to check if the server side of the Operational Credentials cluster is included
|
||||
#define ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS_SERVER
|
||||
#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS
|
||||
|
||||
// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included
|
||||
#define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER
|
||||
#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// This file contains the tokens for attributes stored in flash
|
||||
|
||||
// Identifier tags for tokens
|
||||
|
||||
// Types for the tokens
|
||||
#ifdef DEFINETYPES
|
||||
#endif // DEFINETYPES
|
||||
|
||||
// Actual token definitions
|
||||
#ifdef DEFINETOKENS
|
||||
#endif // DEFINETOKENS
|
||||
|
||||
// Macro snippet that loads all the attributes from tokens
|
||||
#define GENERATED_TOKEN_LOADER(endpoint) \
|
||||
do \
|
||||
{ \
|
||||
} while (false)
|
||||
|
||||
// Macro snippet that saves the attribute to token
|
||||
#define GENERATED_TOKEN_SAVER \
|
||||
do \
|
||||
{ \
|
||||
} while (false)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
|
||||
sec_cert, 0x3F, ,0xd000, 0x3000, , # Never mark this as an encrypted partition
|
||||
nvs, data, nvs, 0x10000, 0x6000,
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000,
|
||||
ota_0, app, ota_0, 0x20000, 0x1E0000,
|
||||
ota_1, app, ota_1, 0x200000, 0x1E0000,
|
||||
fctry, data, nvs, 0x3E0000, 0x6000
|
||||
|
@@ -0,0 +1,21 @@
|
||||
# Default to 921600 baud when flashing and monitoring device
|
||||
CONFIG_ESPTOOLPY_BAUD_921600B=y
|
||||
CONFIG_ESPTOOLPY_BAUD=921600
|
||||
CONFIG_ESPTOOLPY_COMPRESSED=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
#enable BT
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
|
||||
#enable lwip ipv6 autoconfig
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=y
|
||||
|
||||
# Use a custom partition table
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
@@ -0,0 +1,39 @@
|
||||
# The following lines of boilerplate have to be in your project's
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
if(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
message(FATAL_ERROR "Please set ESP_MATTER_PATH to the path of esp-matter repo")
|
||||
endif(NOT DEFINED ENV{ESP_MATTER_PATH})
|
||||
set(ESP_MATTER_PATH $ENV{ESP_MATTER_PATH})
|
||||
set(MATTER_SDK_PATH ${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip)
|
||||
|
||||
if(NOT DEFINED ENV{ESP_RMAKER_PATH})
|
||||
message(FATAL_ERROR "Please set ESP_RMAKER_PATH to the path of esp-rainmaker repo")
|
||||
endif(NOT DEFINED ENV{ESP_RMAKER_PATH})
|
||||
|
||||
# This should be done before using the IDF_TARGET variable.
|
||||
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
|
||||
|
||||
set(EXTRA_COMPONENT_DIRS
|
||||
"../common"
|
||||
"${MATTER_SDK_PATH}/config/esp32/components"
|
||||
"${ESP_MATTER_PATH}/components"
|
||||
"$ENV{ESP_RMAKER_PATH}/components"
|
||||
)
|
||||
|
||||
if(${IDF_TARGET} STREQUAL "esp32")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/tft"
|
||||
"${MATTER_SDK_PATH}/examples/common/m5stack-tft/repo/components/spidriver"
|
||||
)
|
||||
elseif(${IDF_TARGET} STREQUAL "esp32c3")
|
||||
list(APPEND EXTRA_COMPONENT_DIRS
|
||||
"$ENV{IDF_PATH}/examples/peripherals/rmt/led_strip/components"
|
||||
)
|
||||
endif()
|
||||
|
||||
project(rainmaker_light)
|
||||
|
||||
idf_build_set_property(CXX_COMPILE_OPTIONS "-std=gnu++14;-Os;-DLWIP_IPV6_SCOPES=0;-DCHIP_HAVE_CONFIG_H" APPEND)
|
||||
idf_build_set_property(C_COMPILE_OPTIONS "-Os;-DLWIP_IPV6_SCOPES=0" APPEND)
|
||||
@@ -0,0 +1,60 @@
|
||||
# RainMaker Light Example
|
||||
|
||||
## Building and Flashing the Firmware
|
||||
|
||||
See the [README.md](../../README.md) file for more information about building and flashing the firmware.
|
||||
|
||||
## What to expect in this example?
|
||||
|
||||
This example showcases integration of ESP RainMaker with a Matter light device. ESP RainMaker is an end-to-end solution offered by Espressif to enable remote control and monitoring for ESP32 based products without any configuration required in the Cloud. Please refer the ESP RainMaker documentation [here](https://rainmaker.espressif.com/docs/get-started.html) for more details.
|
||||
|
||||
Supported features:
|
||||
- Matter Commissioning
|
||||
- RainMaker Claiming and User-Node Association
|
||||
- On/Off, Brightness and Color (on ESP32-C3 for now) control over RainMaker app as well as Matter Controller
|
||||
- Updates through RainMaker reflected over Matter and vice versa
|
||||
|
||||
Make sure to follow these additional steps along with the steps in the top level README.
|
||||
|
||||
### Getting the Repositories
|
||||
|
||||
This only needs to be done once:
|
||||
```
|
||||
$ git clone --recursive https://github.com/espressif/esp-rainmaker.git
|
||||
```
|
||||
Setup the RainMaker CLI from here: https://rainmaker.espressif.com/docs/cli-setup.html
|
||||
|
||||
### Configuring the environment
|
||||
|
||||
This needs to be done everytime a new terminal is opened:
|
||||
```
|
||||
cd esp-matter/examples/rainmaker_light/
|
||||
|
||||
export ESP_RMAKER_PATH=/path/to/esp-rainmaker
|
||||
```
|
||||
|
||||
### RainMaker Claiming
|
||||
|
||||
This need to be done before flashing the firmware. Note the mac address of the device.
|
||||
|
||||
RainMaker CLI:
|
||||
```
|
||||
$ cd $ESP_RMAKER_PATH/cli
|
||||
$ rainmaker.py claim --addr 0x3E0000 $ESPPORT
|
||||
```
|
||||
|
||||
### RainMaker User-Node Association
|
||||
|
||||
This need to be done after commissioning.
|
||||
|
||||
RainMaker CLI:
|
||||
```
|
||||
$ rainmaker.py test --addnode <node-id>
|
||||
```
|
||||
|
||||
This will print the console command to be run on the device:
|
||||
```
|
||||
add-user <user-id> <secret-key>
|
||||
```
|
||||
|
||||
Copy-paste this command on the device console.
|
||||
@@ -0,0 +1,24 @@
|
||||
set(SRC_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}"
|
||||
"${CMAKE_CURRENT_LIST_DIR}/gen"
|
||||
"${MATTER_SDK_PATH}/src/app/server"
|
||||
"${MATTER_SDK_PATH}/src/app/util"
|
||||
"${MATTER_SDK_PATH}/src/app/reporting"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/basic"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/general-commissioning-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/network-commissioning"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/on-off-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/operational-credentials-server"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/level-control"
|
||||
"${MATTER_SDK_PATH}/src/app/clusters/color-control-server")
|
||||
|
||||
set(PRIV_INCLUDE_DIRS_LIST "${CMAKE_CURRENT_LIST_DIR}"
|
||||
"${MATTER_SDK_PATH}/src")
|
||||
|
||||
set(PRIV_REQUIRES_LIST chip bt esp32_mbedtls app_driver esp_rainmaker console)
|
||||
|
||||
idf_component_register(SRC_DIRS ${SRC_DIRS_LIST}
|
||||
PRIV_INCLUDE_DIRS ${PRIV_INCLUDE_DIRS_LIST}
|
||||
PRIV_REQUIRES ${PRIV_REQUIRES_LIST})
|
||||
|
||||
set_property(TARGET ${COMPONENT_LIB} PROPERTY CXX_STANDARD 14)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE "-DLWIP_IPV6_SCOPES=0" "-DCHIP_HAVE_CONFIG_H")
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define APP_LOG_TAG "rainmaker_light"
|
||||
|
||||
#define DEFAULT_POWER false
|
||||
#define DEFAULT_BRIGHTNESS 100
|
||||
#define DEFAULT_HUE 0
|
||||
#define DEFAULT_SATURATION 0
|
||||
|
||||
#define HUE_MAX 359
|
||||
#define HUE_ATTRIBUTE_MAX 254
|
||||
#define SATURATION_MAX 100
|
||||
#define SATURATION_ATTRIBUTE_MAX 254
|
||||
#define BRIGHTNESS_MAX 100
|
||||
#define BRIGHTNESS_ATTRIBUTE_MAX 254
|
||||
|
||||
#define APP_DRIVER_SRC_LOCAL "local"
|
||||
#define APP_DRIVER_SRC_MATTER "matter"
|
||||
#define APP_DRIVER_SRC_RAINMAKER "rainmaker"
|
||||
|
||||
#define REMAP_TO_RANGE(value, from, to) value * to / from
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "app_driver.h"
|
||||
#include "app_matter.h"
|
||||
#include "app_constants.h"
|
||||
#include "app_rainmaker.h"
|
||||
|
||||
#include "esp_console.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_log.h"
|
||||
#include "nvs_flash.h"
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
#include "lib/shell/Engine.h"
|
||||
|
||||
typedef enum param_type {
|
||||
PARAM_TYPE_POWER = 0,
|
||||
PARAM_TYPE_BRIGHTNESS,
|
||||
PARAM_TYPE_MAX,
|
||||
} param_type_t;
|
||||
|
||||
static int cli_handler(int argc, char *argv[])
|
||||
{
|
||||
if (argc != 3) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Incorrect arguments");
|
||||
return 0;
|
||||
}
|
||||
param_type_t param_type = (param_type_t)atoi(argv[1]);
|
||||
int value = atoi(argv[2]);
|
||||
|
||||
if (param_type == PARAM_TYPE_POWER) {
|
||||
app_driver_update_and_report_power(value, APP_DRIVER_SRC_LOCAL);
|
||||
} else if (param_type == PARAM_TYPE_BRIGHTNESS) {
|
||||
app_driver_update_and_report_brightness(value, APP_DRIVER_SRC_LOCAL);
|
||||
} else {
|
||||
ESP_LOGE(APP_LOG_TAG, "Param type not handled: %d", param_type);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static esp_console_cmd_t driver_cmds[] = {
|
||||
{
|
||||
.command = "driver",
|
||||
.help = "This can be used to simulate on-device control. Usage: driver <param_type> <value>",
|
||||
.hint = NULL,
|
||||
.func = cli_handler,
|
||||
.argtable = NULL
|
||||
},
|
||||
};
|
||||
|
||||
static esp_err_t cli_init()
|
||||
{
|
||||
int cmds_num = sizeof(driver_cmds) / sizeof(esp_console_cmd_t);
|
||||
int i;
|
||||
for (i = 0; i < cmds_num; i++) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Registering command: %s", driver_cmds[i].command);
|
||||
esp_console_cmd_register(&driver_cmds[i]);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
void ChipShellTask(void *args)
|
||||
{
|
||||
chip::Shell::Engine::Root().RunMainLoop();
|
||||
}
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
|
||||
extern "C" void app_main()
|
||||
{
|
||||
// Initialize the ESP NVS layer.
|
||||
ESP_ERROR_CHECK(nvs_flash_init());
|
||||
|
||||
/* Initialize and set the default params */
|
||||
app_driver_init();
|
||||
|
||||
ESP_LOGI(APP_LOG_TAG, "==================================================");
|
||||
ESP_LOGI(APP_LOG_TAG, "esp-matter-rainmaker-light example starting");
|
||||
ESP_LOGI(APP_LOG_TAG, "==================================================");
|
||||
|
||||
/* Initialize chip */
|
||||
ESP_ERROR_CHECK(app_matter_init());
|
||||
|
||||
/* Initialize rainmaker */
|
||||
app_rmaker_init();
|
||||
|
||||
app_driver_update_and_report_power(DEFAULT_POWER, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_brightness(DEFAULT_BRIGHTNESS, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_hue(DEFAULT_HUE, APP_DRIVER_SRC_LOCAL);
|
||||
app_driver_update_and_report_saturation(DEFAULT_SATURATION, APP_DRIVER_SRC_LOCAL);
|
||||
|
||||
/* Register CLI commands with esp_console (indirectly, rainmaker's console). */
|
||||
cli_init();
|
||||
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
/* Rainmaker console is enabled. So disabling this. */
|
||||
// xTaskCreate(&ChipShellTask, "chip_shell", 2048, NULL, 5, NULL);
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "app_driver.h"
|
||||
#include "app_matter.h"
|
||||
#include "app_constants.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#include "app/common/gen/att-storage.h"
|
||||
#include "app/common/gen/attribute-id.h"
|
||||
#include "app/common/gen/attribute-type.h"
|
||||
#include "app/common/gen/cluster-id.h"
|
||||
#include "app/server/Mdns.h"
|
||||
#include "app/server/Server.h"
|
||||
#include "app/util/af.h"
|
||||
#include "app/util/basic-types.h"
|
||||
#include "platform/CHIPDeviceLayer.h"
|
||||
#include "core/CHIPError.h"
|
||||
#include "lib/shell/Engine.h"
|
||||
#include "lib/support/CHIPMem.h"
|
||||
|
||||
using chip::AttributeId;
|
||||
using chip::ClusterId;
|
||||
using chip::EndpointId;
|
||||
using chip::DeviceLayer::ChipDeviceEvent;
|
||||
using chip::DeviceLayer::ConnectivityMgr;
|
||||
using chip::DeviceLayer::DeviceEventType::PublicEventTypes;
|
||||
using chip::DeviceLayer::PlatformMgr;
|
||||
|
||||
static void on_on_off_attribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value, size_t size)
|
||||
{
|
||||
if (attribute == ZCL_ON_OFF_ATTRIBUTE_ID) {
|
||||
app_driver_update_and_report_power(*value, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in On/Off cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_level_control_atrribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value,
|
||||
size_t size)
|
||||
{
|
||||
if (attribute == ZCL_CURRENT_LEVEL_ATTRIBUTE_ID) {
|
||||
app_driver_update_and_report_brightness(*value, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in level control cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_color_control_attribute_changed(chip::EndpointId endpoint, chip::AttributeId attribute, uint8_t *value,
|
||||
size_t size)
|
||||
{
|
||||
if (attribute == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) {
|
||||
// remap hue to [0, 359]
|
||||
uint16_t hue = REMAP_TO_RANGE(static_cast<uint16_t>(*value), HUE_ATTRIBUTE_MAX, HUE_MAX);
|
||||
app_driver_update_and_report_hue(hue, APP_DRIVER_SRC_MATTER);
|
||||
} else if (attribute == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID) {
|
||||
// remap saturation to [0, 100]
|
||||
uint8_t saturation = REMAP_TO_RANGE(static_cast<uint16_t>(*value), SATURATION_ATTRIBUTE_MAX, SATURATION_MAX);
|
||||
app_driver_update_and_report_saturation(saturation, APP_DRIVER_SRC_MATTER);
|
||||
} else {
|
||||
ESP_LOGW(APP_LOG_TAG, "Unknown attribute in level control cluster: %d", attribute);
|
||||
}
|
||||
}
|
||||
|
||||
static void on_device_event(const ChipDeviceEvent *event, intptr_t arg)
|
||||
{
|
||||
if (event->Type == PublicEventTypes::kInterfaceIpAddressChanged) {
|
||||
chip::app::Mdns::StartServer();
|
||||
}
|
||||
|
||||
ESP_LOGI(APP_LOG_TAG, "Current free heap: %zu", heap_caps_get_free_size(MALLOC_CAP_8BIT));
|
||||
}
|
||||
|
||||
static void update_matter_power(bool power)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_ON_OFF_CLUSTER_ID, ZCL_ON_OFF_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
|
||||
(uint8_t *)&power, ZCL_BOOLEAN_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_brightness(uint8_t brightness)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_LEVEL_CONTROL_CLUSTER_ID, ZCL_CURRENT_LEVEL_ATTRIBUTE_ID, CLUSTER_MASK_SERVER,
|
||||
&brightness, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_hue(uint16_t hue)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
uint8_t hue_attribute = REMAP_TO_RANGE(hue, HUE_MAX, HUE_ATTRIBUTE_MAX);
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID,
|
||||
CLUSTER_MASK_SERVER, &hue_attribute, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
static void update_matter_saturation(uint8_t saturation)
|
||||
{
|
||||
EmberAfStatus status;
|
||||
uint8_t saturation_attribute = REMAP_TO_RANGE(static_cast<uint16_t>(saturation), SATURATION_MAX, SATURATION_ATTRIBUTE_MAX);
|
||||
|
||||
status = emberAfWriteAttribute(1, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
|
||||
CLUSTER_MASK_SERVER, &saturation_attribute, ZCL_INT8U_ATTRIBUTE_TYPE);
|
||||
assert(status == EMBER_ZCL_STATUS_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
void emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId cluster, AttributeId attribute, uint8_t mask,
|
||||
uint16_t manufacturer, uint8_t type, uint16_t size, uint8_t *value)
|
||||
{
|
||||
ESP_LOGI(APP_LOG_TAG, "Handle cluster ID: %d", cluster);
|
||||
if (cluster == ZCL_ON_OFF_CLUSTER_ID) {
|
||||
on_on_off_attribute_changed(endpoint, attribute, value, size);
|
||||
} else if (cluster == ZCL_LEVEL_CONTROL_CLUSTER_ID) {
|
||||
on_level_control_atrribute_changed(endpoint, attribute, value, size);
|
||||
} else if (cluster == ZCL_COLOR_CONTROL_CLUSTER_ID) {
|
||||
on_color_control_attribute_changed(endpoint, attribute, value, size);
|
||||
}
|
||||
}
|
||||
|
||||
esp_err_t app_matter_init()
|
||||
{
|
||||
app_driver_param_callback_t callbacks = {
|
||||
.update_power = update_matter_power,
|
||||
.update_brightness = update_matter_brightness,
|
||||
.update_hue = update_matter_hue,
|
||||
.update_saturation = update_matter_saturation,
|
||||
.update_temperature = NULL,
|
||||
};
|
||||
|
||||
if (PlatformMgr().InitChipStack() != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to initialize CHIP stack");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
ConnectivityMgr().SetBLEAdvertisingEnabled(true);
|
||||
if (chip::Platform::MemoryInit() != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to initialize CHIP memory pool");
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
if (PlatformMgr().StartEventLoopTask() != CHIP_NO_ERROR) {
|
||||
chip::Platform::MemoryShutdown();
|
||||
ESP_LOGE(APP_LOG_TAG, "Failed to launch Matter main task");
|
||||
return ESP_FAIL;
|
||||
}
|
||||
PlatformMgr().AddEventHandler(on_device_event, static_cast<intptr_t>(NULL));
|
||||
|
||||
InitServer();
|
||||
|
||||
app_driver_register_src(APP_DRIVER_SRC_MATTER, &callbacks);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
/**
|
||||
* @brief Initializes the matter stack.
|
||||
*
|
||||
* @return
|
||||
* - ESP_OK on success
|
||||
*
|
||||
*/
|
||||
esp_err_t app_matter_init(void);
|
||||
@@ -0,0 +1,163 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/task.h>
|
||||
#include <esp_log.h>
|
||||
#include <nvs_flash.h>
|
||||
|
||||
#include <esp_rmaker_core.h>
|
||||
#include <esp_rmaker_standard_params.h>
|
||||
#include <esp_rmaker_standard_devices.h>
|
||||
#include <esp_rmaker_standard_types.h>
|
||||
#include <esp_rmaker_ota.h>
|
||||
#include <esp_rmaker_schedule.h>
|
||||
#include <esp_rmaker_console.h>
|
||||
|
||||
#include <app_rainmaker.h>
|
||||
#include <app_driver.h>
|
||||
#include "app_constants.h"
|
||||
|
||||
esp_rmaker_device_t *light_device;
|
||||
|
||||
static void update_rmaker_power(bool power)
|
||||
{
|
||||
esp_rmaker_param_t *param = esp_rmaker_device_get_param_by_type(light_device, ESP_RMAKER_PARAM_POWER);
|
||||
if (!param) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Param type not found");
|
||||
return;
|
||||
}
|
||||
esp_rmaker_param_update_and_report(param, esp_rmaker_bool(power));
|
||||
}
|
||||
|
||||
static void update_rmaker_brightness(uint8_t brightness)
|
||||
{
|
||||
uint8_t brightness_rainmaker = REMAP_TO_RANGE(brightness, BRIGHTNESS_ATTRIBUTE_MAX, BRIGHTNESS_MAX);
|
||||
esp_rmaker_param_t *param = esp_rmaker_device_get_param_by_type(light_device, ESP_RMAKER_PARAM_BRIGHTNESS);
|
||||
if (!param) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Param type not found");
|
||||
return;
|
||||
}
|
||||
esp_rmaker_param_update_and_report(param, esp_rmaker_int(brightness_rainmaker));
|
||||
}
|
||||
|
||||
static void update_rmaker_hue(uint16_t hue)
|
||||
{
|
||||
esp_rmaker_param_t *param = esp_rmaker_device_get_param_by_type(light_device, ESP_RMAKER_PARAM_HUE);
|
||||
if (!param) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Param type not found");
|
||||
return;
|
||||
}
|
||||
esp_rmaker_param_update_and_report(param, esp_rmaker_int(hue));
|
||||
}
|
||||
|
||||
static void update_rmaker_saturation(uint8_t saturation)
|
||||
{
|
||||
esp_rmaker_param_t *param = esp_rmaker_device_get_param_by_type(light_device, ESP_RMAKER_PARAM_SATURATION);
|
||||
if (!param) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Param type not found");
|
||||
return;
|
||||
}
|
||||
esp_rmaker_param_update_and_report(param, esp_rmaker_int(saturation));
|
||||
}
|
||||
|
||||
/* Callback to handle commands received from the RainMaker cloud */
|
||||
static esp_err_t write_cb(const esp_rmaker_device_t *device, const esp_rmaker_param_t *param,
|
||||
const esp_rmaker_param_val_t val, void *priv_data, esp_rmaker_write_ctx_t *ctx)
|
||||
{
|
||||
if (ctx) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Received write request via : %s", esp_rmaker_device_cb_src_to_str(ctx->src));
|
||||
}
|
||||
const char *device_name = esp_rmaker_device_get_name(device);
|
||||
const char *param_name = esp_rmaker_param_get_name(param);
|
||||
if (strcmp(param_name, ESP_RMAKER_DEF_POWER_NAME) == 0) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Received value = %s for %s - %s",
|
||||
val.val.b ? "true" : "false", device_name, param_name);
|
||||
app_driver_update_and_report_power(val.val.b, APP_DRIVER_SRC_RAINMAKER);
|
||||
} else if (strcmp(param_name, ESP_RMAKER_DEF_BRIGHTNESS_NAME) == 0) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Received value = %d for %s - %s",
|
||||
val.val.i, device_name, param_name);
|
||||
uint8_t brightness = REMAP_TO_RANGE(val.val.i, BRIGHTNESS_MAX, BRIGHTNESS_ATTRIBUTE_MAX);
|
||||
app_driver_update_and_report_brightness(brightness, APP_DRIVER_SRC_RAINMAKER);
|
||||
} else if (strcmp(param_name, ESP_RMAKER_DEF_HUE_NAME) == 0) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Received value = %d for %s - %s",
|
||||
val.val.i, device_name, param_name);
|
||||
app_driver_update_and_report_hue(val.val.i, APP_DRIVER_SRC_RAINMAKER);
|
||||
} else if (strcmp(param_name, ESP_RMAKER_DEF_SATURATION_NAME) == 0) {
|
||||
ESP_LOGI(APP_LOG_TAG, "Received value = %d for %s - %s",
|
||||
val.val.i, device_name, param_name);
|
||||
app_driver_update_and_report_saturation(val.val.i, APP_DRIVER_SRC_RAINMAKER);
|
||||
} else {
|
||||
/* Silently ignoring invalid params */
|
||||
return ESP_OK;
|
||||
}
|
||||
esp_rmaker_param_update_and_report(param, val);
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void app_rmaker_init()
|
||||
{
|
||||
app_driver_param_callback_t callbacks = {
|
||||
.update_power = update_rmaker_power,
|
||||
.update_brightness = update_rmaker_brightness,
|
||||
.update_hue = update_rmaker_hue,
|
||||
.update_saturation = update_rmaker_saturation,
|
||||
.update_temperature = NULL,
|
||||
};
|
||||
|
||||
/* Initialize the ESP RainMaker Agent.
|
||||
* Note that this should be called after app_wifi_init() but before app_wifi_start()
|
||||
* */
|
||||
esp_rmaker_console_init();
|
||||
|
||||
esp_rmaker_config_t rainmaker_cfg = {
|
||||
.enable_time_sync = false,
|
||||
};
|
||||
esp_rmaker_node_t *node = esp_rmaker_node_init(&rainmaker_cfg, "ESP RainMaker Device", "Lightbulb");
|
||||
if (!node) {
|
||||
ESP_LOGE(APP_LOG_TAG, "Could not initialise node. Aborting!!!");
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
abort();
|
||||
}
|
||||
|
||||
/* Create a device and add the relevant parameters to it */
|
||||
light_device = esp_rmaker_lightbulb_device_create("Light", NULL, app_driver_get_power());
|
||||
esp_rmaker_device_add_cb(light_device, write_cb, NULL);
|
||||
|
||||
esp_rmaker_device_add_param(light_device,
|
||||
esp_rmaker_brightness_param_create(ESP_RMAKER_DEF_BRIGHTNESS_NAME, app_driver_get_brightness()));
|
||||
|
||||
esp_rmaker_device_add_param(light_device, esp_rmaker_hue_param_create(ESP_RMAKER_DEF_HUE_NAME, app_driver_get_hue()));
|
||||
|
||||
esp_rmaker_device_add_param(light_device,
|
||||
esp_rmaker_saturation_param_create(ESP_RMAKER_DEF_SATURATION_NAME, app_driver_get_saturation()));
|
||||
|
||||
esp_rmaker_node_add_device(node, light_device);
|
||||
|
||||
/* Enable OTA */
|
||||
esp_rmaker_ota_config_t ota_config = {
|
||||
.server_cert = ESP_RMAKER_OTA_DEFAULT_SERVER_CERT,
|
||||
};
|
||||
esp_rmaker_ota_enable(&ota_config, OTA_USING_PARAMS);
|
||||
|
||||
/* Enable timezone service which will be require for setting appropriate timezone
|
||||
* from the phone apps for scheduling to work correctly.
|
||||
* For more information on the various ways of setting timezone, please check
|
||||
* https://rainmaker.espressif.com/docs/time-service.html.
|
||||
*/
|
||||
esp_rmaker_timezone_service_enable();
|
||||
|
||||
/* Enable scheduling. */
|
||||
esp_rmaker_schedule_enable();
|
||||
|
||||
/* Start the ESP RainMaker Agent */
|
||||
esp_rmaker_start();
|
||||
|
||||
app_driver_register_src(APP_DRIVER_SRC_RAINMAKER, &callbacks);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
This example code is in the Public Domain (or CC0 licensed, at your option.)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, this
|
||||
software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
void app_rmaker_init();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// List specific responses
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
#include "CHIPClusters.h"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include "chip-zcl-zpro-codec-api.h"
|
||||
#include <gen/CHIPClientCallbacks.h>
|
||||
#include <lib/support/Span.h>
|
||||
|
||||
namespace chip {
|
||||
namespace Controller {
|
||||
|
||||
// TODO(#4502): onCompletion is not used by IM for now.
|
||||
// TODO(#4503): length should be passed to commands when byte string is in argument list.
|
||||
// TODO(#4503): Commands should take group id as an argument.
|
||||
|
||||
} // namespace Controller
|
||||
} // namespace chip
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,84 @@
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2020 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* Copyright (c) 2020 Silicon Labs
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// This file is generated by Simplicity Studio. Please do not edit manually.
|
||||
//
|
||||
//
|
||||
|
||||
// Enclosing macro to prevent multiple inclusion
|
||||
#ifndef __AF_GEN_EVENT__
|
||||
#define __AF_GEN_EVENT__
|
||||
|
||||
// Code used to configure the cluster event mechanism
|
||||
#define EMBER_AF_GENERATED_EVENT_CODE \
|
||||
EmberEventControl emberAfLevelControlClusterServerTickCallbackControl1; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerHueSatTransitionEventControl; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerTempTransitionEventControl; \
|
||||
extern EmberEventControl emberAfPluginColorControlServerXyTransitionEventControl; \
|
||||
extern void emberAfPluginColorControlServerHueSatTransitionEventHandler(void); \
|
||||
extern void emberAfPluginColorControlServerTempTransitionEventHandler(void); \
|
||||
extern void emberAfPluginColorControlServerXyTransitionEventHandler(void); \
|
||||
static void clusterTickWrapper(EmberEventControl * control, EmberAfTickFunction callback, uint8_t endpoint) \
|
||||
{ \
|
||||
/* emberAfPushEndpointNetworkIndex(endpoint); */ \
|
||||
emberEventControlSetInactive(control); \
|
||||
(*callback)(endpoint); \
|
||||
/* emberAfPopNetworkIndex(); */ \
|
||||
} \
|
||||
\
|
||||
void emberAfLevelControlClusterServerTickCallbackWrapperFunction1(void) \
|
||||
{ \
|
||||
clusterTickWrapper(&emberAfLevelControlClusterServerTickCallbackControl1, emberAfLevelControlClusterServerTickCallback, \
|
||||
1); \
|
||||
}
|
||||
|
||||
// EmberEventData structs used to populate the EmberEventData table
|
||||
#define EMBER_AF_GENERATED_EVENTS \
|
||||
{ &emberAfLevelControlClusterServerTickCallbackControl1, emberAfLevelControlClusterServerTickCallbackWrapperFunction1 }, \
|
||||
{ &emberAfPluginColorControlServerHueSatTransitionEventControl, \
|
||||
emberAfPluginColorControlServerHueSatTransitionEventHandler }, \
|
||||
{ &emberAfPluginColorControlServerTempTransitionEventControl, emberAfPluginColorControlServerTempTransitionEventHandler }, \
|
||||
{ &emberAfPluginColorControlServerXyTransitionEventControl, emberAfPluginColorControlServerXyTransitionEventHandler },
|
||||
|
||||
#define EMBER_AF_GENERATED_EVENT_STRINGS \
|
||||
"Level Control Cluster Server EP 1", "Color Control Cluster Server Plugin HueSatTransition", \
|
||||
"Color Control Cluster Server Plugin TempTransition", "Color Control Cluster Server Plugin XyTransition",
|
||||
|
||||
// The length of the event context table used to track and retrieve cluster events
|
||||
#define EMBER_AF_EVENT_CONTEXT_LENGTH 1
|
||||
|
||||
// EmberAfEventContext structs used to populate the EmberAfEventContext table
|
||||
#define EMBER_AF_GENERATED_EVENT_CONTEXT \
|
||||
{ 0x1, 0x8, false, EMBER_AF_LONG_POLL, EMBER_AF_OK_TO_SLEEP, &emberAfLevelControlClusterServerTickCallbackControl1 },
|
||||
|
||||
#endif // __AF_GEN_EVENT__
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
#include <app/common/gen/af-structs.h>
|
||||
#include <app/util/af.h>
|
||||
#include <app/util/attribute-list-byte-span.h>
|
||||
#include <app/util/basic-types.h>
|
||||
#include <support/SafeInt.h>
|
||||
#include <support/logging/CHIPLogging.h>
|
||||
|
||||
using namespace chip;
|
||||
using namespace chip::app::List;
|
||||
|
||||
// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid
|
||||
// and data is undefined.
|
||||
constexpr uint16_t kSizeLengthInBytes = 2u;
|
||||
|
||||
void copyListMember(uint8_t * dest, uint8_t * src, bool write, uint16_t * offset, uint16_t length)
|
||||
{
|
||||
if (write)
|
||||
{
|
||||
memmove(dest + *offset, src, length);
|
||||
}
|
||||
else
|
||||
{
|
||||
memmove(dest, src + *offset, length);
|
||||
}
|
||||
|
||||
*offset = static_cast<uint16_t>(*offset + length);
|
||||
}
|
||||
|
||||
uint16_t emberAfCopyList(ClusterId clusterId, EmberAfAttributeMetadata * am, bool write, uint8_t * dest, uint8_t * src,
|
||||
int32_t index)
|
||||
{
|
||||
if (index == -1)
|
||||
{
|
||||
memmove(dest, src, am->size);
|
||||
return am->size;
|
||||
}
|
||||
|
||||
if (index == 0)
|
||||
{
|
||||
if (write)
|
||||
{
|
||||
// src is a pointer to native-endian uint16_t, dest is pointer to buffer that should hold little-endian value
|
||||
emberAfCopyInt16u(dest, 0, *reinterpret_cast<uint16_t *>(src));
|
||||
}
|
||||
else
|
||||
{
|
||||
// src is pointer to buffer holding little-endian value, dest is a pointer to native-endian uint16_t
|
||||
*reinterpret_cast<uint16_t *>(dest) = emberAfGetInt16u(src, 0, kSizeLengthInBytes);
|
||||
}
|
||||
return kSizeLengthInBytes;
|
||||
}
|
||||
|
||||
if (!chip::CanCastTo<uint16_t>(index))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid. Should be between 1 and 65534", index);
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t entryLength = 0;
|
||||
switch (clusterId)
|
||||
{
|
||||
case 0x003E: // Operational Credentials Cluster
|
||||
{
|
||||
uint16_t entryOffset = kSizeLengthInBytes;
|
||||
switch (am->attributeId)
|
||||
{
|
||||
case 0x0001: // fabrics list
|
||||
{
|
||||
entryLength = 52;
|
||||
if (((index - 1) * entryLength) > (am->size - entryLength))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid.", index);
|
||||
return 0;
|
||||
}
|
||||
entryOffset = static_cast<uint16_t>(entryOffset + ((index - 1) * entryLength));
|
||||
// Struct _FabricDescriptor
|
||||
_FabricDescriptor * entry = reinterpret_cast<_FabricDescriptor *>(write ? src : dest);
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->FabricId, write ? (uint8_t *) &entry->FabricId : src, write,
|
||||
&entryOffset, sizeof(entry->FabricId)); // FABRIC_ID
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->VendorId, write ? (uint8_t *) &entry->VendorId : src, write,
|
||||
&entryOffset, sizeof(entry->VendorId)); // INT16U
|
||||
copyListMember(write ? dest : (uint8_t *) &entry->NodeId, write ? (uint8_t *) &entry->NodeId : src, write, &entryOffset,
|
||||
sizeof(entry->NodeId)); // NODE_ID
|
||||
chip::ByteSpan * LabelSpan = &entry->Label; // OCTET_STRING
|
||||
if (CHIP_NO_ERROR !=
|
||||
(write ? WriteByteSpan(dest + entryOffset, 34, LabelSpan) : ReadByteSpan(src + entryOffset, 34, LabelSpan)))
|
||||
{
|
||||
ChipLogError(Zcl, "Index %" PRId32 " is invalid. Not enough remaining space", index);
|
||||
return 0;
|
||||
}
|
||||
entryOffset = static_cast<uint16_t>(entryOffset + 34);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return entryLength;
|
||||
}
|
||||
|
||||
// A list is a collection of entries of the same data type. The data type may be any defined data type.
|
||||
uint16_t emberAfAttributeValueListSize(ClusterId clusterId, AttributeId attributeId, const uint8_t * buffer)
|
||||
{
|
||||
// The first 2 bytes specify the number of entries. A value of 0xFFFF means the list in invalid
|
||||
// and data is undefined.
|
||||
uint16_t entryCount = emberAfGetInt16u(buffer, 0, kSizeLengthInBytes);
|
||||
if (entryCount == 0xFFFF)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint16_t entryLength = 0;
|
||||
switch (clusterId)
|
||||
{
|
||||
case 0x003E: // Operational Credentials Cluster
|
||||
switch (attributeId)
|
||||
{
|
||||
case 0x0001: // fabrics list
|
||||
// Struct _FabricDescriptor
|
||||
entryLength = 52;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t totalSize = kSizeLengthInBytes + (entryCount * entryLength);
|
||||
if (!chip::CanCastTo<uint16_t>(totalSize))
|
||||
{
|
||||
ChipLogError(Zcl, "Cluster %" PRIx32 ": Size of attribute %" PRIx32 " is too large.", clusterId, attributeId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return static_cast<uint16_t>(totalSize);
|
||||
}
|
||||
@@ -0,0 +1,634 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
#include <app/common/gen/callback.h>
|
||||
#include <app/common/gen/cluster-id.h>
|
||||
#include <lib/support/Span.h>
|
||||
|
||||
using namespace chip;
|
||||
|
||||
// Cluster Init Functions
|
||||
void emberAfClusterInitCallback(EndpointId endpoint, ClusterId clusterId)
|
||||
{
|
||||
switch (clusterId)
|
||||
{
|
||||
case ZCL_BASIC_CLUSTER_ID:
|
||||
emberAfBasicClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_COLOR_CONTROL_CLUSTER_ID:
|
||||
emberAfColorControlClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_GENERAL_COMMISSIONING_CLUSTER_ID:
|
||||
emberAfGeneralCommissioningClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_LEVEL_CONTROL_CLUSTER_ID:
|
||||
emberAfLevelControlClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_NETWORK_COMMISSIONING_CLUSTER_ID:
|
||||
emberAfNetworkCommissioningClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_ON_OFF_CLUSTER_ID:
|
||||
emberAfOnOffClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_OPERATIONAL_CREDENTIALS_CLUSTER_ID:
|
||||
emberAfOperationalCredentialsClusterInitCallback(endpoint);
|
||||
break;
|
||||
case ZCL_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_ID:
|
||||
emberAfWiFiNetworkDiagnosticsClusterInitCallback(endpoint);
|
||||
break;
|
||||
default:
|
||||
// Unrecognized cluster ID
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void __attribute__((weak)) emberAfBasicClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfColorControlClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfGeneralCommissioningClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfLevelControlClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfNetworkCommissioningClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfOnOffClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfOperationalCredentialsClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
void __attribute__((weak)) emberAfWiFiNetworkDiagnosticsClusterInitCallback(EndpointId endpoint)
|
||||
{
|
||||
// To prevent warning
|
||||
(void) endpoint;
|
||||
}
|
||||
|
||||
//
|
||||
// Non-Cluster Related Callbacks
|
||||
//
|
||||
|
||||
/** @brief Add To Current App Tasks
|
||||
*
|
||||
* This function is only useful to sleepy end devices. This function will note
|
||||
* the passed item as part of a set of tasks the application has outstanding
|
||||
* (e.g. message sent requiring APS acknwoledgement). This will affect how the
|
||||
* application behaves with regard to sleeping and polling. Until the
|
||||
* outstanding task is completed, the device may poll more frequently and sleep
|
||||
* less often.
|
||||
*
|
||||
* @param tasks Ver.: always
|
||||
*/
|
||||
void __attribute__((weak)) emberAfAddToCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
/** @brief Remove From Current App Tasks
|
||||
*
|
||||
* This function is only useful to sleepy end devices. This function will
|
||||
* remove the passed item from the set of tasks the application has outstanding
|
||||
* (e.g. message sent requiring APS acknwoledgement). This will affect how the
|
||||
* application behaves with regard to sleeping and polling. Removing the item
|
||||
* from the list of outstanding tasks may allow the device to sleep longer and
|
||||
* poll less frequently. If there are other outstanding tasks the system may
|
||||
* still have to stay away and poll more often.
|
||||
*
|
||||
* @param tasks Ver.: always
|
||||
*/
|
||||
void __attribute__((weak)) emberAfRemoveFromCurrentAppTasksCallback(EmberAfApplicationTask tasks) {}
|
||||
|
||||
/** @brief Allow Network Write Attribute
|
||||
*
|
||||
* This function is called by the application framework before it writes an
|
||||
* attribute in response to a write attribute request from an external device.
|
||||
* The value passed into this callback is the value to which the attribute is to
|
||||
* be set by the framework.
|
||||
Example: In mirroring simple metering data
|
||||
* on an Energy Services Interface (ESI) (formerly called Energy Service Portal
|
||||
* (ESP) in SE 1.0).), a mirrored simple meter needs to write read-only
|
||||
* attributes on its mirror. The-meter-mirror sample application, located in
|
||||
* app/framework/sample-apps, uses this callback to allow the mirrored device to
|
||||
* write simple metering attributes on the mirror regardless of the fact that
|
||||
* most simple metering attributes are defined as read-only by the ZigBee
|
||||
* specification.
|
||||
Note: The ZCL specification does not (as of this
|
||||
* writing) specify any permission-level security for writing writeable
|
||||
* attributes. As far as the ZCL specification is concerned, if an attribute is
|
||||
* writeable, any device that has a link key for the device should be able to
|
||||
* write that attribute. Furthermore if an attribute is read only, it should not
|
||||
* be written over the air. Thus, if you implement permissions for writing
|
||||
* attributes as a feature, you MAY be operating outside the specification. This
|
||||
* is unlikely to be a problem for writing read-only attributes, but it may be a
|
||||
* problem for attributes that are writeable according to the specification but
|
||||
* restricted by the application implementing this callback.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param value Ver.: always
|
||||
* @param type Ver.: always
|
||||
*/
|
||||
EmberAfAttributeWritePermission __attribute__((weak))
|
||||
emberAfAllowNetworkWriteAttributeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t * value, uint8_t type)
|
||||
{
|
||||
return EMBER_ZCL_ATTRIBUTE_WRITE_PERMISSION_ALLOW_WRITE_NORMAL; // Default
|
||||
}
|
||||
|
||||
/** @brief Attribute Read Access
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to check
|
||||
* access permission for an attribute read.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfAttributeReadAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode, AttributeId attributeId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @brief Attribute Write Access
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to check
|
||||
* access permission for an attribute write.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfAttributeWriteAccessCallback(EndpointId endpoint, ClusterId clusterId, uint16_t manufacturerCode, AttributeId attributeId)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @brief Default Response
|
||||
*
|
||||
* This function is called by the application framework when a Default Response
|
||||
* command is received from an external device. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param commandId The command identifier to which this is a response. Ver.:
|
||||
* always
|
||||
* @param status Specifies either SUCCESS or the nature of the error that was
|
||||
* detected in the received command. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfDefaultResponseCallback(ClusterId clusterId, CommandId commandId, EmberAfStatus status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Configure Reporting Response
|
||||
*
|
||||
* This function is called by the application framework when a Configure
|
||||
* Reporting Response command is received from an external device. The
|
||||
* application should return true if the message was processed or false if it
|
||||
* was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute status records. Ver.:
|
||||
* always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfConfigureReportingResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Read Reporting Configuration Response
|
||||
*
|
||||
* This function is called by the application framework when a Read Reporting
|
||||
* Configuration Response command is received from an external device. The
|
||||
* application should return true if the message was processed or false if it
|
||||
* was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute reporting configuration
|
||||
* records. Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfReadReportingConfigurationResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Attributes Response
|
||||
*
|
||||
* This function is called by the application framework when a Discover
|
||||
* Attributes Response or Discover Attributes Extended Response command is
|
||||
* received from an external device. The Discover Attributes Response command
|
||||
* contains a bool indicating if discovery is complete and a list of zero or
|
||||
* more attribute identifier/type records. The final argument indicates whether
|
||||
* the response is in the extended format or not. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more attributes to be
|
||||
* discovered. true if there are no more attributes to be discovered. Ver.:
|
||||
* always
|
||||
* @param buffer Buffer containing the list of attribute identifier/type
|
||||
* records. Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
* @param extended Indicates whether the response is in the extended format or
|
||||
* not. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfDiscoverAttributesResponseCallback(ClusterId clusterId, bool discoveryComplete, uint8_t * buffer,
|
||||
uint16_t bufLen, bool extended)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Commands Generated Response
|
||||
*
|
||||
* This function is called by the framework when Discover Commands Generated
|
||||
* Response is received.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param manufacturerCode Manufacturer code Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more commands to be
|
||||
* discovered. Ver.: always
|
||||
* @param commandIds Buffer containing the list of command identifiers. Ver.:
|
||||
* always
|
||||
* @param commandIdCount The length of bytes of the list, whish is the same as
|
||||
* the number of identifiers. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfDiscoverCommandsGeneratedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
|
||||
CommandId * commandIds, uint16_t commandIdCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Discover Commands Received Response
|
||||
*
|
||||
* This function is called by the framework when Discover Commands Received
|
||||
* Response is received.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param manufacturerCode Manufacturer code Ver.: always
|
||||
* @param discoveryComplete Indicates whether there are more commands to be
|
||||
* discovered. Ver.: always
|
||||
* @param commandIds Buffer containing the list of command identifiers. Ver.:
|
||||
* always
|
||||
* @param commandIdCount The length of bytes of the list, whish is the same as
|
||||
* the number of identifiers. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfDiscoverCommandsReceivedResponseCallback(ClusterId clusterId, uint16_t manufacturerCode, bool discoveryComplete,
|
||||
CommandId * commandIds, uint16_t commandIdCount)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Command Received
|
||||
*
|
||||
* This callback is the second in the Application Framework's message processing
|
||||
* chain. At this point in the processing of incoming over-the-air messages, the
|
||||
* application has determined that the incoming message is a ZCL command. It
|
||||
* parses enough of the message to populate an EmberAfClusterCommand struct. The
|
||||
* Application Framework defines this struct value in a local scope to the
|
||||
* command processing but also makes it available through a global pointer
|
||||
* called emberAfCurrentCommand, in app/framework/util/util.c. When command
|
||||
* processing is complete, this pointer is cleared.
|
||||
*
|
||||
* @param cmd Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfPreCommandReceivedCallback(EmberAfClusterCommand * cmd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Message Send
|
||||
*
|
||||
* This function is called by the framework when it is about to pass a message
|
||||
* to the stack primitives for sending. This message may or may not be ZCL,
|
||||
* ZDO, or some other protocol. This is called prior to
|
||||
any ZigBee
|
||||
* fragmentation that may be done. If the function returns true it is assumed
|
||||
* the callback has consumed and processed the message. The callback must also
|
||||
* set the EmberStatus status code to be passed back to the caller. The
|
||||
* framework will do no further processing on the message.
|
||||
If the
|
||||
* function returns false then it is assumed that the callback has not processed
|
||||
* the mesasge and the framework will continue to process accordingly.
|
||||
*
|
||||
* @param messageStruct The structure containing the parameters of the APS
|
||||
* message to be sent. Ver.: always
|
||||
* @param status A pointer to the status code value that will be returned to the
|
||||
* caller. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfPreMessageSendCallback(EmberAfMessageStruct * messageStruct, EmberStatus * status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Message Sent
|
||||
*
|
||||
* This function is called by the application framework from the message sent
|
||||
* handler, when it is informed by the stack regarding the message sent status.
|
||||
* All of the values passed to the emberMessageSentHandler are passed on to this
|
||||
* callback. This provides an opportunity for the application to verify that its
|
||||
* message has been sent successfully and take the appropriate action. This
|
||||
* callback should return a bool value of true or false. A value of true
|
||||
* indicates that the message sent notification has been handled and should not
|
||||
* be handled by the application framework.
|
||||
*
|
||||
* @param type Ver.: always
|
||||
* @param destination Ver.: always
|
||||
* @param apsFrame Ver.: always
|
||||
* @param msgLen Ver.: always
|
||||
* @param message Ver.: always
|
||||
* @param status Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfMessageSentCallback(const MessageSendDestination & destination, EmberApsFrame * apsFrame,
|
||||
uint16_t msgLen, uint8_t * message, EmberStatus status)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Pre Attribute Change
|
||||
*
|
||||
* This function is called by the application framework before it changes an
|
||||
* attribute value. The value passed into this callback is the value to which
|
||||
* the attribute is to be set by the framework. The application should return
|
||||
* ::EMBER_ZCL_STATUS_SUCCESS to permit the change or any other ::EmberAfStatus
|
||||
* to reject it.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param type Ver.: always
|
||||
* @param size Ver.: always
|
||||
* @param value Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfPreAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
/** @brief Post Attribute Change
|
||||
*
|
||||
* This function is called by the application framework after it changes an
|
||||
* attribute value. The value passed into this callback is the value to which
|
||||
* the attribute was set by the framework.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeId Ver.: always
|
||||
* @param mask Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param type Ver.: always
|
||||
* @param size Ver.: always
|
||||
* @param value Ver.: always
|
||||
*/
|
||||
void __attribute__((weak))
|
||||
emberAfPostAttributeChangeCallback(EndpointId endpoint, ClusterId clusterId, AttributeId attributeId, uint8_t mask,
|
||||
uint16_t manufacturerCode, uint8_t type, uint16_t size, uint8_t * value)
|
||||
{}
|
||||
|
||||
/** @brief External Attribute Read
|
||||
*
|
||||
* Like emberAfExternalAttributeWriteCallback above, this function is called
|
||||
* when the framework needs to read an attribute that is not stored within the
|
||||
* Application Framework's data structures.
|
||||
All of the important
|
||||
* information about the attribute itself is passed as a pointer to an
|
||||
* EmberAfAttributeMetadata struct, which is stored within the application and
|
||||
* used to manage the attribute. A complete description of the
|
||||
* EmberAfAttributeMetadata struct is provided in
|
||||
* app/framework/include/af-types.h
|
||||
This function assumes that the
|
||||
* application is able to read the attribute, write it into the passed buffer,
|
||||
* and return immediately. Any attributes that require a state machine for
|
||||
* reading and writing are not really candidates for externalization at the
|
||||
* present time. The Application Framework does not currently include a state
|
||||
* machine for reading or writing attributes that must take place across a
|
||||
* series of application ticks. Attributes that cannot be read in a timely
|
||||
* manner should be stored within the Application Framework and updated
|
||||
* occasionally by the application code from within the
|
||||
* emberAfMainTickCallback.
|
||||
If the application was successfully able to
|
||||
* read the attribute and write it into the passed buffer, it should return a
|
||||
* value of EMBER_ZCL_STATUS_SUCCESS. Ensure that the size of the externally
|
||||
* managed attribute value is smaller than what the buffer can hold. In the case
|
||||
* of a buffer overflow throw an appropriate error such as
|
||||
* EMBER_ZCL_STATUS_INSUFFICIENT_SPACE. Any other return value indicates the
|
||||
* application was not able to read the attribute.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeMetadata Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param buffer Ver.: always
|
||||
* @param maxReadLength Ver.: always
|
||||
* @param index Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfExternalAttributeReadCallback(EndpointId endpoint, ClusterId clusterId, EmberAfAttributeMetadata * attributeMetadata,
|
||||
uint16_t manufacturerCode, uint8_t * buffer, uint16_t maxReadLength, int32_t index)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief Write Attributes Response
|
||||
*
|
||||
* This function is called by the application framework when a Write Attributes
|
||||
* Response command is received from an external device. The application should
|
||||
* return true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this response. Ver.: always
|
||||
* @param buffer Buffer containing the list of write attribute status records.
|
||||
* Ver.: always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfWriteAttributesResponseCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief External Attribute Write
|
||||
*
|
||||
* This function is called whenever the Application Framework needs to write an
|
||||
* attribute which is not stored within the data structures of the Application
|
||||
* Framework itself. One of the new features in Version 2 is the ability to
|
||||
* store attributes outside the Framework. This is particularly useful for
|
||||
* attributes that do not need to be stored because they can be read off the
|
||||
* hardware when they are needed, or are stored in some central location used by
|
||||
* many modules within the system. In this case, you can indicate that the
|
||||
* attribute is stored externally. When the framework needs to write an external
|
||||
* attribute, it makes a call to this callback.
|
||||
This callback is very
|
||||
* useful for host micros which need to store attributes in persistent memory.
|
||||
* Because each host micro (used with an Ember NCP) has its own type of
|
||||
* persistent memory storage, the Application Framework does not include the
|
||||
* ability to mark attributes as stored in flash the way that it does for Ember
|
||||
* SoCs like the EM35x. On a host micro, any attributes that need to be stored
|
||||
* in persistent memory should be marked as external and accessed through the
|
||||
* external read and write callbacks. Any host code associated with the
|
||||
* persistent storage should be implemented within this callback.
|
||||
All of
|
||||
* the important information about the attribute itself is passed as a pointer
|
||||
* to an EmberAfAttributeMetadata struct, which is stored within the application
|
||||
* and used to manage the attribute. A complete description of the
|
||||
* EmberAfAttributeMetadata struct is provided in
|
||||
* app/framework/include/af-types.h.
|
||||
This function assumes that the
|
||||
* application is able to write the attribute and return immediately. Any
|
||||
* attributes that require a state machine for reading and writing are not
|
||||
* candidates for externalization at the present time. The Application Framework
|
||||
* does not currently include a state machine for reading or writing attributes
|
||||
* that must take place across a series of application ticks. Attributes that
|
||||
* cannot be written immediately should be stored within the Application
|
||||
* Framework and updated occasionally by the application code from within the
|
||||
* emberAfMainTickCallback.
|
||||
If the application was successfully able to
|
||||
* write the attribute, it returns a value of EMBER_ZCL_STATUS_SUCCESS. Any
|
||||
* other return value indicates the application was not able to write the
|
||||
* attribute.
|
||||
*
|
||||
* @param endpoint Ver.: always
|
||||
* @param clusterId Ver.: always
|
||||
* @param attributeMetadata Ver.: always
|
||||
* @param manufacturerCode Ver.: always
|
||||
* @param buffer Ver.: always
|
||||
* @param index Ver.: always
|
||||
*/
|
||||
EmberAfStatus __attribute__((weak))
|
||||
emberAfExternalAttributeWriteCallback(EndpointId endpoint, ClusterId clusterId, EmberAfAttributeMetadata * attributeMetadata,
|
||||
uint16_t manufacturerCode, uint8_t * buffer, int32_t index)
|
||||
{
|
||||
return EMBER_ZCL_STATUS_FAILURE;
|
||||
}
|
||||
|
||||
/** @brief Report Attributes
|
||||
*
|
||||
* This function is called by the application framework when a Report Attributes
|
||||
* command is received from an external device. The application should return
|
||||
* true if the message was processed or false if it was not.
|
||||
*
|
||||
* @param clusterId The cluster identifier of this command. Ver.: always
|
||||
* @param buffer Buffer containing the list of attribute report records. Ver.:
|
||||
* always
|
||||
* @param bufLen The length in bytes of the list. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfReportAttributesCallback(ClusterId clusterId, uint8_t * buffer, uint16_t bufLen)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Get Current Time
|
||||
*
|
||||
* This callback is called when device attempts to get current time from the
|
||||
* hardware. If this device has means to retrieve exact time, then this method
|
||||
* should implement it. If the callback can't provide the exact time it should
|
||||
* return 0 to indicate failure. Default action is to return 0, which indicates
|
||||
* that device does not have access to real time.
|
||||
*
|
||||
*/
|
||||
uint32_t __attribute__((weak)) emberAfGetCurrentTimeCallback()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** @brief Get Endpoint Info
|
||||
*
|
||||
* This function is a callback to an application implemented endpoint that
|
||||
* operates outside the normal application framework. When the framework wishes
|
||||
* to perform operations with that endpoint it uses this callback to retrieve
|
||||
* the endpoint's information. If the endpoint exists and the application can
|
||||
* provide data then true shall be returned. Otherwise the callback must return
|
||||
* false.
|
||||
*
|
||||
* @param endpoint The endpoint to retrieve data for. Ver.: always
|
||||
* @param returnNetworkIndex The index corresponding to the ZigBee network the
|
||||
* endpoint belongs to. If not using a multi-network device, 0 must be
|
||||
* returned. Otherwise on a multi-network device the stack will switch to this
|
||||
* network before sending the message. Ver.: always
|
||||
* @param returnEndpointInfo A pointer to a data struct that will be written
|
||||
* with information about the endpoint. Ver.: always
|
||||
*/
|
||||
bool __attribute__((weak))
|
||||
emberAfGetEndpointInfoCallback(EndpointId endpoint, uint8_t * returnNetworkIndex, EmberAfEndpointInfoStruct * returnEndpointInfo)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @brief Registration Abort
|
||||
*
|
||||
* This callback is called when the device should abort the registration
|
||||
* process.
|
||||
*
|
||||
*/
|
||||
void __attribute__((weak)) emberAfRegistrationAbortCallback() {}
|
||||
|
||||
/** @brief Interpan Send Message
|
||||
*
|
||||
* This function will send a raw MAC message with interpan frame format using
|
||||
* the passed parameters.
|
||||
*
|
||||
* @param header Interpan header info Ver.: always
|
||||
* @param messageLength The length of the message received or to send Ver.:
|
||||
* always
|
||||
* @param message The message data received or to send. Ver.: always
|
||||
*/
|
||||
EmberStatus __attribute__((weak))
|
||||
emberAfInterpanSendMessageCallback(EmberAfInterpanHeader * header, uint16_t messageLength, uint8_t * message)
|
||||
{
|
||||
return EMBER_LIBRARY_NOT_PRESENT;
|
||||
}
|
||||
|
||||
/** @brief Start Move
|
||||
*
|
||||
* This function is called to initiate the process for a device to move (rejoin)
|
||||
* to a new parent.
|
||||
*
|
||||
*/
|
||||
bool __attribute__((weak)) emberAfStartMoveCallback()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
@@ -0,0 +1,607 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// Default values for the attributes longer than a pointer,
|
||||
// in a form of a binary blob
|
||||
// Separate block is generated for big-endian and little-endian cases.
|
||||
#if BIGENDIAN_CPU
|
||||
#define GENERATED_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server), big-endian */ \
|
||||
\
|
||||
/* 0 - VendorName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 32 - ProductName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 64 - UserLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 96 - HardwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 160 - SoftwareVersion, */ \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 164 - SoftwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 228 - ManufacturingDate, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 244 - PartNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 276 - ProductURL, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 532 - ProductLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 596 - SerialNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server), big-endian */ \
|
||||
\
|
||||
/* 628 - FabricId, */ \
|
||||
1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 636 - Breadcrumb, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), big-endian */ \
|
||||
\
|
||||
/* 644 - bssid, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server), big-endian */ \
|
||||
\
|
||||
/* 650 - fabrics list, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
}
|
||||
|
||||
#else // !BIGENDIAN_CPU
|
||||
#define GENERATED_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server), little-endian */ \
|
||||
\
|
||||
/* 0 - VendorName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 32 - ProductName, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 64 - UserLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 96 - HardwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 160 - SoftwareVersion, */ \
|
||||
0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 164 - SoftwareVersionString, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 228 - ManufacturingDate, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 244 - PartNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 276 - ProductURL, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 532 - ProductLabel, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 596 - SerialNumber, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server), little-endian */ \
|
||||
\
|
||||
/* 628 - FabricId, */ \
|
||||
1, 'o', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* 636 - Breadcrumb, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server), little-endian */ \
|
||||
\
|
||||
/* 644 - bssid, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server), little-endian */ \
|
||||
\
|
||||
/* 650 - fabrics list, */ \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
|
||||
}
|
||||
|
||||
#endif // BIGENDIAN_CPU
|
||||
|
||||
#define GENERATED_DEFAULTS_COUNT (15)
|
||||
|
||||
#define ZAP_TYPE(type) ZCL_##type##_ATTRIBUTE_TYPE
|
||||
#define ZAP_LONG_DEFAULTS_INDEX(index) \
|
||||
{ \
|
||||
(uint8_t *) (&generatedDefaults[index]) \
|
||||
}
|
||||
#define ZAP_MIN_MAX_DEFAULTS_INDEX(index) \
|
||||
{ \
|
||||
(uint8_t *) (&minMaxDefault[index]) \
|
||||
}
|
||||
#define ZAP_EMPTY_DEFAULT() \
|
||||
{ \
|
||||
(uint16_t) 0 \
|
||||
}
|
||||
#define ZAP_SIMPLE_DEFAULT(x) \
|
||||
{ \
|
||||
(uint16_t) x \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfAttributeMinMaxValue structures.
|
||||
#define GENERATED_MIN_MAX_DEFAULT_COUNT 0
|
||||
#define GENERATED_MIN_MAX_DEFAULTS \
|
||||
{ \
|
||||
}
|
||||
|
||||
#define ZAP_ATTRIBUTE_MASK(mask) ATTRIBUTE_MASK_##mask
|
||||
// This is an array of EmberAfAttributeMetadata structures.
|
||||
#define GENERATED_ATTRIBUTE_COUNT 64
|
||||
#define GENERATED_ATTRIBUTES \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* InteractionModelVersion */ \
|
||||
{ 0x0001, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(0) }, /* VendorName */ \
|
||||
{ 0x0002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* VendorID */ \
|
||||
{ 0x0003, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(32) }, /* ProductName */ \
|
||||
{ 0x0004, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_EMPTY_DEFAULT() }, /* ProductID */ \
|
||||
{ 0x0005, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(64) }, /* UserLabel */ \
|
||||
{ 0x0006, ZAP_TYPE(CHAR_STRING), 2, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_EMPTY_DEFAULT() }, /* Location */ \
|
||||
{ 0x0007, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(0x00) }, /* HardwareVersion */ \
|
||||
{ 0x0008, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(96) }, /* HardwareVersionString */ \
|
||||
{ 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(160) }, /* SoftwareVersion */ \
|
||||
{ 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(164) }, /* SoftwareVersionString */ \
|
||||
{ 0x000B, ZAP_TYPE(CHAR_STRING), 16, ZAP_ATTRIBUTE_MASK(SINGLETON), \
|
||||
ZAP_LONG_DEFAULTS_INDEX(228) }, /* ManufacturingDate */ \
|
||||
{ 0x000C, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(244) }, /* PartNumber */ \
|
||||
{ 0x000D, ZAP_TYPE(CHAR_STRING), 256, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(276) }, /* ProductURL */ \
|
||||
{ 0x000E, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(532) }, /* ProductLabel */ \
|
||||
{ 0x000F, ZAP_TYPE(CHAR_STRING), 32, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_LONG_DEFAULTS_INDEX(596) }, /* SerialNumber */ \
|
||||
{ 0x0010, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON) | ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_SIMPLE_DEFAULT(0) }, /* LocalConfigDisabled */ \
|
||||
{ 0x0011, ZAP_TYPE(BOOLEAN), 1, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(1) }, /* Reachable */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(628) }, /* FabricId */ \
|
||||
{ 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_LONG_DEFAULTS_INDEX(636) }, /* Breadcrumb */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(OCTET_STRING), 6, 0, ZAP_LONG_DEFAULTS_INDEX(644) }, /* bssid */ \
|
||||
{ 0x0001, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* SecurityType */ \
|
||||
{ 0x0002, ZAP_TYPE(ENUM8), 1, 0, ZAP_EMPTY_DEFAULT() }, /* WiFiVersion */ \
|
||||
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* ChannelNumber */ \
|
||||
{ 0x0004, ZAP_TYPE(INT8S), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* Rssi */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(650) }, /* fabrics list */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* on/off */ \
|
||||
{ 0x4000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* global scene control */ \
|
||||
{ 0x4001, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* on time */ \
|
||||
{ 0x4002, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x0000) }, /* off wait time */ \
|
||||
{ 0x4003, ZAP_TYPE(ENUM8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* start up on off */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current level */ \
|
||||
{ 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \
|
||||
{ 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* options */ \
|
||||
{ 0x4000, ZAP_TYPE(INT8U), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_EMPTY_DEFAULT() }, /* start up current level */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ 0x0000, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current hue */ \
|
||||
{ 0x0001, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* current saturation */ \
|
||||
{ 0x0002, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* remaining time */ \
|
||||
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x616B) }, /* current x */ \
|
||||
{ 0x0004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x607D) }, /* current y */ \
|
||||
{ 0x0007, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x00FA) }, /* color temperature */ \
|
||||
{ 0x0008, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* color mode */ \
|
||||
{ 0x000F, ZAP_TYPE(BITMAP8), 1, ZAP_ATTRIBUTE_MASK(WRITABLE), ZAP_SIMPLE_DEFAULT(0x00) }, /* color control options */ \
|
||||
{ 0x0010, ZAP_TYPE(INT8U), 1, 0, ZAP_EMPTY_DEFAULT() }, /* number of primaries */ \
|
||||
{ 0x4000, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* enhanced current hue */ \
|
||||
{ 0x4001, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* enhanced color mode */ \
|
||||
{ 0x4002, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop active */ \
|
||||
{ 0x4003, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* color loop direction */ \
|
||||
{ 0x4004, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0019) }, /* color loop time */ \
|
||||
{ 0x4005, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x2300) }, /* color loop start enhanced hue */ \
|
||||
{ 0x4006, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color loop stored enhanced hue */ \
|
||||
{ 0x400A, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color capabilities */ \
|
||||
{ 0x400B, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* color temp physical min */ \
|
||||
{ 0x400C, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0xFEFF) }, /* color temp physical max */ \
|
||||
{ 0x400D, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* couple color temp to level min-mireds */ \
|
||||
{ 0x4010, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(WRITABLE), \
|
||||
ZAP_EMPTY_DEFAULT() }, /* start up color temperature mireds */ \
|
||||
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* cluster revision */ \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfCluster structures.
|
||||
#define ZAP_ATTRIBUTE_INDEX(index) ((EmberAfAttributeMetadata *) (&generatedAttributes[index]))
|
||||
|
||||
// Cluster function static arrays
|
||||
#define GENERATED_FUNCTION_ARRAYS \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayBasicServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfBasicClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayOnOffServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfOnOffClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayLevelControlServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfLevelControlClusterServerInitCallback, \
|
||||
}; \
|
||||
const EmberAfGenericClusterFunction chipFuncArrayColorControlServer[] = { \
|
||||
(EmberAfGenericClusterFunction) emberAfColorControlClusterServerInitCallback, \
|
||||
};
|
||||
|
||||
#define ZAP_CLUSTER_MASK(mask) CLUSTER_MASK_##mask
|
||||
#define GENERATED_CLUSTER_COUNT 8
|
||||
#define GENERATED_CLUSTERS \
|
||||
{ \
|
||||
{ 0x0028, \
|
||||
ZAP_ATTRIBUTE_INDEX(0), \
|
||||
19, \
|
||||
642, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayBasicServer }, /* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ \
|
||||
0x0030, ZAP_ATTRIBUTE_INDEX(19), 3, 18, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ \
|
||||
0x0031, ZAP_ATTRIBUTE_INDEX(22), 1, 2, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ \
|
||||
0x0036, ZAP_ATTRIBUTE_INDEX(23), 6, 13, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: WiFi Network Diagnostics (server) */ \
|
||||
{ \
|
||||
0x003E, ZAP_ATTRIBUTE_INDEX(29), 2, 256, ZAP_CLUSTER_MASK(SERVER), NULL \
|
||||
}, /* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x0006, \
|
||||
ZAP_ATTRIBUTE_INDEX(31), \
|
||||
6, \
|
||||
9, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayOnOffServer }, /* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0008, \
|
||||
ZAP_ATTRIBUTE_INDEX(37), \
|
||||
5, \
|
||||
7, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayLevelControlServer }, /* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0300, \
|
||||
ZAP_ATTRIBUTE_INDEX(42), \
|
||||
22, \
|
||||
36, \
|
||||
ZAP_CLUSTER_MASK(SERVER) | ZAP_CLUSTER_MASK(INIT_FUNCTION), \
|
||||
chipFuncArrayColorControlServer }, /* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
}
|
||||
|
||||
#define ZAP_CLUSTER_INDEX(index) ((EmberAfCluster *) (&generatedClusters[index]))
|
||||
|
||||
// This is an array of EmberAfEndpointType structures.
|
||||
#define GENERATED_ENDPOINT_TYPES \
|
||||
{ \
|
||||
{ ZAP_CLUSTER_INDEX(0), 5, 931 }, { ZAP_CLUSTER_INDEX(5), 3, 52 }, \
|
||||
}
|
||||
|
||||
// Largest attribute size is needed for various buffers
|
||||
#define ATTRIBUTE_LARGEST (257)
|
||||
|
||||
// Total size of singleton attributes
|
||||
#define ATTRIBUTE_SINGLETONS_SIZE (642)
|
||||
|
||||
// Total size of attribute storage
|
||||
#define ATTRIBUTE_MAX_SIZE (983)
|
||||
|
||||
// Number of fixed endpoints
|
||||
#define FIXED_ENDPOINT_COUNT (2)
|
||||
|
||||
// Array of endpoints that are supported, the data inside
|
||||
// the array is the endpoint number.
|
||||
#define FIXED_ENDPOINT_ARRAY \
|
||||
{ \
|
||||
0x0000, 0x0001 \
|
||||
}
|
||||
|
||||
// Array of profile ids
|
||||
#define FIXED_PROFILE_IDS \
|
||||
{ \
|
||||
0x0104, 0x0104 \
|
||||
}
|
||||
|
||||
// Array of device ids
|
||||
#define FIXED_DEVICE_IDS \
|
||||
{ \
|
||||
0, 0 \
|
||||
}
|
||||
|
||||
// Array of device versions
|
||||
#define FIXED_DEVICE_VERSIONS \
|
||||
{ \
|
||||
1, 1 \
|
||||
}
|
||||
|
||||
// Array of endpoint types supported on each endpoint
|
||||
#define FIXED_ENDPOINT_TYPES \
|
||||
{ \
|
||||
0, 1 \
|
||||
}
|
||||
|
||||
// Array of networks supported on each endpoint
|
||||
#define FIXED_NETWORKS \
|
||||
{ \
|
||||
0, 0 \
|
||||
}
|
||||
|
||||
// Array of EmberAfCommandMetadata structs.
|
||||
#define ZAP_COMMAND_MASK(mask) COMMAND_MASK_##mask
|
||||
#define EMBER_AF_GENERATED_COMMAND_COUNT (70)
|
||||
#define GENERATED_COMMANDS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Basic (server) */ \
|
||||
{ 0x0028, 0x00, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* StartUp */ \
|
||||
{ 0x0028, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ShutDown */ \
|
||||
{ 0x0028, 0x02, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* Leave */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: General Commissioning (server) */ \
|
||||
{ 0x0030, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ArmFailSafe */ \
|
||||
{ 0x0030, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ArmFailSafeResponse */ \
|
||||
{ 0x0030, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetRegulatoryConfig */ \
|
||||
{ 0x0030, 0x03, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* SetRegulatoryConfigResponse */ \
|
||||
{ 0x0030, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* CommissioningComplete */ \
|
||||
{ 0x0030, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* CommissioningCompleteResponse */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Network Commissioning (server) */ \
|
||||
{ 0x0031, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ScanNetworks */ \
|
||||
{ 0x0031, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* ScanNetworksResponse */ \
|
||||
{ 0x0031, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddWiFiNetwork */ \
|
||||
{ 0x0031, 0x03, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* AddWiFiNetworkResponse */ \
|
||||
{ 0x0031, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateWiFiNetwork */ \
|
||||
{ 0x0031, 0x05, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* UpdateWiFiNetworkResponse */ \
|
||||
{ 0x0031, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddThreadNetwork */ \
|
||||
{ 0x0031, 0x07, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* AddThreadNetworkResponse */ \
|
||||
{ 0x0031, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateThreadNetwork */ \
|
||||
{ 0x0031, 0x09, ZAP_COMMAND_MASK(OUTGOING_SERVER) }, /* UpdateThreadNetworkResponse */ \
|
||||
{ 0x0031, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveNetwork */ \
|
||||
{ 0x0031, 0x0B, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* RemoveNetworkResponse */ \
|
||||
{ 0x0031, 0x0C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnableNetwork */ \
|
||||
{ 0x0031, 0x0D, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* EnableNetworkResponse */ \
|
||||
{ 0x0031, 0x0E, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* DisableNetwork */ \
|
||||
{ 0x0031, 0x0F, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* DisableNetworkResponse */ \
|
||||
{ 0x0031, 0x10, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* GetLastNetworkCommissioningResult */ \
|
||||
\
|
||||
/* Endpoint: 0, Cluster: Operational Credentials (server) */ \
|
||||
{ 0x003E, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* SetFabric */ \
|
||||
{ 0x003E, 0x01, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* SetFabricResponse */ \
|
||||
{ 0x003E, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* OpCSRRequest */ \
|
||||
{ 0x003E, 0x05, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCSRResponse */ \
|
||||
{ 0x003E, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddOpCert */ \
|
||||
{ 0x003E, 0x08, ZAP_COMMAND_MASK(INCOMING_CLIENT) }, /* OpCertResponse */ \
|
||||
{ 0x003E, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* UpdateFabricLabel */ \
|
||||
{ 0x003E, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveFabric */ \
|
||||
{ 0x003E, 0x0B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveAllFabrics */ \
|
||||
{ 0x003E, 0xA1, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* AddTrustedRootCertificate */ \
|
||||
{ 0x003E, 0xA2, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* RemoveTrustedRootCertificate */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: On/off (server) */ \
|
||||
{ 0x0006, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Off */ \
|
||||
{ 0x0006, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* On */ \
|
||||
{ 0x0006, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Toggle */ \
|
||||
{ 0x0006, 0x40, 0 }, /* OffWithEffect */ \
|
||||
{ 0x0006, 0x41, 0 }, /* OnWithRecallGlobalScene */ \
|
||||
{ 0x0006, 0x42, 0 }, /* OnWithTimedOff */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Level Control (server) */ \
|
||||
{ 0x0008, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevel */ \
|
||||
{ 0x0008, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Move */ \
|
||||
{ 0x0008, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Step */ \
|
||||
{ 0x0008, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* Stop */ \
|
||||
{ 0x0008, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToLevelWithOnOff */ \
|
||||
{ 0x0008, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveWithOnOff */ \
|
||||
{ 0x0008, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepWithOnOff */ \
|
||||
{ 0x0008, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopWithOnOff */ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ 0x0300, 0x00, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToHue */ \
|
||||
{ 0x0300, 0x01, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveHue */ \
|
||||
{ 0x0300, 0x02, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepHue */ \
|
||||
{ 0x0300, 0x03, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToSaturation */ \
|
||||
{ 0x0300, 0x04, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveSaturation */ \
|
||||
{ 0x0300, 0x05, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepSaturation */ \
|
||||
{ 0x0300, 0x06, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToHueAndSaturation */ \
|
||||
{ 0x0300, 0x07, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToColor */ \
|
||||
{ 0x0300, 0x08, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveColor */ \
|
||||
{ 0x0300, 0x09, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepColor */ \
|
||||
{ 0x0300, 0x0A, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveToColorTemperature */ \
|
||||
{ 0x0300, 0x40, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveToHue */ \
|
||||
{ 0x0300, 0x41, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveHue */ \
|
||||
{ 0x0300, 0x42, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedStepHue */ \
|
||||
{ 0x0300, 0x43, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* EnhancedMoveToHueAndSaturation */ \
|
||||
{ 0x0300, 0x44, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* ColorLoopSet */ \
|
||||
{ 0x0300, 0x47, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StopMoveStep */ \
|
||||
{ 0x0300, 0x4B, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* MoveColorTemperature */ \
|
||||
{ 0x0300, 0x4C, ZAP_COMMAND_MASK(INCOMING_SERVER) }, /* StepColorTemperature */ \
|
||||
}
|
||||
|
||||
// Array of EmberAfManufacturerCodeEntry structures for commands.
|
||||
#define GENERATED_COMMAND_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_COMMAND_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfManufacturerCodeEntry structures for clusters.
|
||||
#define GENERATED_CLUSTER_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_CLUSTER_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// This is an array of EmberAfManufacturerCodeEntry structures for attributes.
|
||||
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODE_COUNT (0)
|
||||
#define GENERATED_ATTRIBUTE_MANUFACTURER_CODES \
|
||||
{ \
|
||||
{ \
|
||||
0x00, 0x00 \
|
||||
} \
|
||||
}
|
||||
|
||||
// Array of EmberAfPluginReportingEntry structures.
|
||||
#define ZRD(x) EMBER_ZCL_REPORTING_DIRECTION_##x
|
||||
#define ZAP_REPORT_DIRECTION(x) ZRD(x)
|
||||
|
||||
// User options for plugin Reporting
|
||||
#define EMBER_AF_PLUGIN_REPORTING_TABLE_SIZE (5)
|
||||
#define EMBER_AF_PLUGIN_REPORTING_ENABLE_GROUP_BOUND_REPORTS
|
||||
|
||||
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS_TABLE_SIZE (5)
|
||||
#define EMBER_AF_GENERATED_REPORTING_CONFIG_DEFAULTS \
|
||||
{ \
|
||||
\
|
||||
/* Endpoint: 1, Cluster: Color Control (server) */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0000, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current hue */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0001, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current saturation */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0003, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current x */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0004, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* current y */ \
|
||||
{ \
|
||||
ZAP_REPORT_DIRECTION(REPORTED), 0x0001, 0x0300, 0x0007, ZAP_CLUSTER_MASK(SERVER), 0x0000, { { 0, 65344, 0 } } \
|
||||
}, /* color temperature */ \
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// User options for plugin Binding Table Library
|
||||
#define EMBER_BINDING_TABLE_SIZE 10
|
||||
|
||||
/**** Network Section ****/
|
||||
#define EMBER_SUPPORTED_NETWORKS (1)
|
||||
|
||||
#define EMBER_APS_UNICAST_MESSAGE_COUNT 10
|
||||
|
||||
/**** Cluster endpoint counts ****/
|
||||
#define EMBER_AF_BASIC_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_COLOR_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_GENERAL_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_LEVEL_CONTROL_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_NETWORK_COMMISSIONING_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_ON_OFF_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
#define EMBER_AF_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER_ENDPOINT_COUNT (1)
|
||||
|
||||
/**** Cluster Plugins ****/
|
||||
|
||||
// Use this macro to check if the server side of the Basic cluster is included
|
||||
#define ZCL_USING_BASIC_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_BASIC_SERVER
|
||||
#define EMBER_AF_PLUGIN_BASIC
|
||||
|
||||
// Use this macro to check if the server side of the Color Control cluster is included
|
||||
#define ZCL_USING_COLOR_CONTROL_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL
|
||||
// User options for server plugin Color Control
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_XY
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_TEMP
|
||||
#define EMBER_AF_PLUGIN_COLOR_CONTROL_SERVER_HSV
|
||||
|
||||
// Use this macro to check if the server side of the General Commissioning cluster is included
|
||||
#define ZCL_USING_GENERAL_COMMISSIONING_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING_SERVER
|
||||
#define EMBER_AF_PLUGIN_GENERAL_COMMISSIONING
|
||||
|
||||
// Use this macro to check if the server side of the Level Control cluster is included
|
||||
#define ZCL_USING_LEVEL_CONTROL_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_SERVER
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL
|
||||
// User options for server plugin Level Control
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MAXIMUM_LEVEL 255
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_MINIMUM_LEVEL 0
|
||||
#define EMBER_AF_PLUGIN_LEVEL_CONTROL_RATE 0
|
||||
|
||||
// Use this macro to check if the server side of the Network Commissioning cluster is included
|
||||
#define ZCL_USING_NETWORK_COMMISSIONING_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING_SERVER
|
||||
#define EMBER_AF_PLUGIN_NETWORK_COMMISSIONING
|
||||
|
||||
// Use this macro to check if the server side of the On/off cluster is included
|
||||
#define ZCL_USING_ON_OFF_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_ON_OFF_SERVER
|
||||
#define EMBER_AF_PLUGIN_ON_OFF
|
||||
|
||||
// Use this macro to check if the server side of the Operational Credentials cluster is included
|
||||
#define ZCL_USING_OPERATIONAL_CREDENTIALS_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS_SERVER
|
||||
#define EMBER_AF_PLUGIN_OPERATIONAL_CREDENTIALS
|
||||
|
||||
// Use this macro to check if the server side of the WiFi Network Diagnostics cluster is included
|
||||
#define ZCL_USING_WIFI_NETWORK_DIAGNOSTICS_CLUSTER_SERVER
|
||||
#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS_SERVER
|
||||
#define EMBER_AF_PLUGIN_WI_FI_NETWORK_DIAGNOSTICS
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2021 Project CHIP Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
|
||||
// Prevent multiple inclusion
|
||||
#pragma once
|
||||
|
||||
// This file contains the tokens for attributes stored in flash
|
||||
|
||||
// Identifier tags for tokens
|
||||
|
||||
// Types for the tokens
|
||||
#ifdef DEFINETYPES
|
||||
#endif // DEFINETYPES
|
||||
|
||||
// Actual token definitions
|
||||
#ifdef DEFINETOKENS
|
||||
#endif // DEFINETOKENS
|
||||
|
||||
// Macro snippet that loads all the attributes from tokens
|
||||
#define GENERATED_TOKEN_LOADER(endpoint) \
|
||||
do \
|
||||
{ \
|
||||
} while (false)
|
||||
|
||||
// Macro snippet that saves the attribute to token
|
||||
#define GENERATED_TOKEN_SAVER \
|
||||
do \
|
||||
{ \
|
||||
} while (false)
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,9 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
# Note: Firmware partition offset needs to be 64K aligned, initial 36K (9 sectors) are reserved for bootloader and partition table
|
||||
sec_cert, 0x3F, ,0xd000, 0x3000, , # Never mark this as an encrypted partition
|
||||
nvs, data, nvs, 0x10000, 0x6000,
|
||||
otadata, data, ota, , 0x2000
|
||||
phy_init, data, phy, , 0x1000,
|
||||
ota_0, app, ota_0, 0x20000, 0x1E0000,
|
||||
ota_1, app, ota_1, 0x200000, 0x1E0000,
|
||||
fctry, data, nvs, 0x3E0000, 0x6000
|
||||
|
@@ -0,0 +1,31 @@
|
||||
# Default to 921600 baud when flashing and monitoring device
|
||||
CONFIG_ESPTOOLPY_BAUD_921600B=y
|
||||
CONFIG_ESPTOOLPY_BAUD=921600
|
||||
CONFIG_ESPTOOLPY_COMPRESSED=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
|
||||
CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
|
||||
CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
|
||||
|
||||
#enable BT
|
||||
CONFIG_BT_ENABLED=y
|
||||
CONFIG_BT_NIMBLE_ENABLED=y
|
||||
|
||||
#enable lwip ipv6 autoconfig
|
||||
CONFIG_LWIP_IPV6_AUTOCONFIG=y
|
||||
|
||||
# Use a custom partition table
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x8000
|
||||
CONFIG_PARTITION_TABLE_MD5=y
|
||||
|
||||
# Enable chip shell
|
||||
CONFIG_ENABLE_CHIP_SHELL=y
|
||||
|
||||
# mbedtls
|
||||
CONFIG_MBEDTLS_DYNAMIC_BUFFER=y
|
||||
CONFIG_MBEDTLS_DYNAMIC_FREE_PEER_CERT=y
|
||||
CONFIG_MBEDTLS_DYNAMIC_FREE_CONFIG_DATA=y
|
||||
|
||||
# Temporary Fix for Timer Overflows
|
||||
CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=3120
|
||||
@@ -0,0 +1,54 @@
|
||||
# This script should be sourced, not executed.
|
||||
|
||||
realpath_int() {
|
||||
wdir="$PWD"; [ "$PWD" = "/" ] && wdir=""
|
||||
arg=$1
|
||||
case "$arg" in
|
||||
/*) scriptdir="${arg}";;
|
||||
*) scriptdir="$wdir/${arg#./}";;
|
||||
esac
|
||||
scriptdir="${scriptdir%/*}"
|
||||
echo "$scriptdir"
|
||||
}
|
||||
|
||||
|
||||
esp_matter_export_main() {
|
||||
if [ -z "${ESP_MATTER_PATH}" ]
|
||||
then
|
||||
# ESP_MATTER_PATH not set in the environment.
|
||||
# If using bash or zsh, try to guess ESP_MATTER_PATH from script location.
|
||||
self_path=""
|
||||
|
||||
# shellcheck disable=SC2128 # ignore array expansion warning
|
||||
if [ -n "${BASH_SOURCE-}" ]
|
||||
then
|
||||
self_path="${BASH_SOURCE}"
|
||||
elif [ -n "${ZSH_VERSION-}" ]
|
||||
then
|
||||
self_path="${(%):-%x}"
|
||||
else
|
||||
echo "Could not detect ESP_MATTER_PATH. Please set it before sourcing this script:"
|
||||
echo " export ESP_MATTER_PATH=(add path here)"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# shellcheck disable=SC2169,SC2169,SC2039 # unreachable with 'dash'
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
# convert possibly relative path to absolute
|
||||
script_dir="$(realpath_int "${self_path}")"
|
||||
# resolve any ../ references to make the path shorter
|
||||
script_dir="$(cd "${script_dir}" || exit 1; pwd)"
|
||||
else
|
||||
# convert to full path and get the directory name of that
|
||||
script_name="$(readlink -f "${self_path}")"
|
||||
script_dir="$(dirname "${script_name}")"
|
||||
fi
|
||||
export ESP_MATTER_PATH="${script_dir}"
|
||||
echo "Setting ESP_MATTER_PATH to '${ESP_MATTER_PATH}'"
|
||||
fi
|
||||
|
||||
# PATH for gn
|
||||
export PATH=${PATH}:${ESP_MATTER_PATH}/connectedhomeip/connectedhomeip/.environment/cipd/pigweed/
|
||||
}
|
||||
|
||||
esp_matter_export_main
|
||||
Reference in New Issue
Block a user