esp_matter_client: Adding APIs to support connect and then sending commands from a client

zap_common: Adding all the client commands.
switch: Removing binding handler from the example since it is already handled in esp_matter.
switch/app_driver: Add support for sending commands.
This commit is contained in:
Chirag Atal
2022-02-03 10:42:35 +05:30
parent c186f30a2b
commit b55cbf6661
12 changed files with 8801 additions and 319 deletions
+1
View File
@@ -22,6 +22,7 @@ application.
#include <esp_matter_attribute.h>
#include <esp_matter_cluster.h>
#include <esp_matter_command.h>
#include <esp_matter_client.h>
#include <esp_matter_core.h>
#include <esp_matter_endpoint.h>
#include <esp_matter_event.h>
@@ -631,10 +631,13 @@ esp_err_t esp_matter_attribute_update(int endpoint_id, int cluster_id, int attri
esp_matter_attribute_get_type_and_val(&val, &attribute_type, &attribute_size, &value);
/* Update matter */
EmberAfStatus status = emberAfWriteServerAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_type);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
ESP_LOGE(TAG, "Error updating attribute to matter");
return ESP_FAIL;
EmberAfStatus status = EMBER_ZCL_STATUS_SUCCESS;
if (emberAfContainsServer(endpoint_id, cluster_id)) {
status = emberAfWriteServerAttribute(endpoint_id, cluster_id, attribute_id, value, attribute_type);
if (status != EMBER_ZCL_STATUS_SUCCESS) {
ESP_LOGE(TAG, "Error updating attribute to matter");
return ESP_FAIL;
}
}
return ESP_OK;
}
+401
View File
@@ -0,0 +1,401 @@
// Copyright 2022 Espressif Systems (Shanghai) PTE 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 <esp_matter.h>
#include <esp_matter_core.h>
#include <app/clusters/bindings/BindingManager.h>
#include <zap-generated/CHIPClusters.h>
using chip::Callback::Callback;
using chip::DeviceProxy;
using chip::FabricInfo;
using chip::kInvalidEndpointId;
using chip::OperationalDeviceProxy;
using chip::PeerId;
static const char *TAG = "esp_matter_client";
static esp_matter_client_command_callback_t client_command_callback = NULL;
static void *client_command_callback_priv_data = NULL;
esp_err_t esp_matter_set_client_command_callback(esp_matter_client_command_callback_t callback, void *priv_data)
{
client_command_callback = callback;
client_command_callback_priv_data = priv_data;
return ESP_OK;
}
/** TODO: Change g_remote_endpoint_id to something better. */
int g_remote_endpoint_id = kInvalidEndpointId;
void esp_matter_new_connection_success_callback(void *context, OperationalDeviceProxy *peer_device)
{
ESP_LOGI(TAG, "New connection success");
if (client_command_callback) {
client_command_callback(peer_device, g_remote_endpoint_id, client_command_callback_priv_data);
}
}
void esp_matter_new_connection_failure_callback(void *context, PeerId peerId, CHIP_ERROR error)
{
ESP_LOGI(TAG, "New connection failure");
}
esp_err_t esp_matter_connect(int fabric_index, int node_id, int remote_endpoint_id)
{
/* Get info */
FabricInfo *fabric_info = chip::Server::GetInstance().GetFabricTable().FindFabricWithIndex(fabric_index);
PeerId peer_id = fabric_info->GetPeerIdForNode(node_id);
/* Find existing */
DeviceProxy *peer_device = chip::Server::GetInstance().GetCASESessionManager()->FindExistingSession(peer_id);
if (peer_device) {
/* Callback if found */
if (client_command_callback) {
client_command_callback(peer_device, remote_endpoint_id, client_command_callback_priv_data);
}
return ESP_OK;
}
/* Create new connection */
g_remote_endpoint_id = remote_endpoint_id;
static Callback<chip::OnDeviceConnected> success_callback(esp_matter_new_connection_success_callback, NULL);
static Callback<chip::OnDeviceConnectionFailure> failure_callback(esp_matter_new_connection_failure_callback, NULL);
chip::Server::GetInstance().GetCASESessionManager()->FindOrEstablishSession(peer_id, &success_callback,
&failure_callback);
return ESP_OK;
}
static void esp_matter_command_client_binding_callback(const EmberBindingTableEntry *binding, DeviceProxy *peer_device,
void *context)
{
if (client_command_callback) {
client_command_callback(peer_device, binding->remote, client_command_callback_priv_data);
}
}
esp_err_t esp_matter_client_cluster_update(int endpoint_id, int cluster_id)
{
chip::BindingManager::GetInstance().NotifyBoundClusterChanged(endpoint_id, cluster_id, NULL);
return ESP_OK;
}
void esp_matter_binding_manager_init()
{
static bool init_done = false;
if (init_done) {
return;
}
chip::BindingManager::GetInstance().SetAppServer(&chip::Server::GetInstance());
chip::BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(esp_matter_command_client_binding_callback);
init_done = true;
}
static void esp_matter_send_command_success_callback(void *context, const chip::app::DataModel::NullObjectType &data)
{
ESP_LOGI(TAG, "Send command success");
}
static void esp_matter_send_command_failure_callback(void *context, CHIP_ERROR error)
{
ESP_LOGI(TAG, "FSend command failure");
}
esp_err_t esp_matter_on_off_send_command_on(esp_matter_peer_device_t *remote_device, int remote_endpoint_id)
{
chip::Controller::OnOffCluster cluster;
chip::app::Clusters::OnOff::Commands::On::Type command_data;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_on_off_send_command_off(esp_matter_peer_device_t *remote_device, int remote_endpoint_id)
{
chip::Controller::OnOffCluster cluster;
chip::app::Clusters::OnOff::Commands::Off::Type command_data;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_on_off_send_command_toggle(esp_matter_peer_device_t *remote_device, int remote_endpoint_id)
{
chip::Controller::OnOffCluster cluster;
chip::app::Clusters::OnOff::Commands::Toggle::Type command_data;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_move(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t move_mode, uint8_t rate, uint8_t option_mask,
uint8_t option_override)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::Move::Type command_data;
command_data.moveMode = (chip::app::Clusters::LevelControl::MoveMode)move_mode;
command_data.rate = rate;
command_data.optionMask = option_mask;
command_data.optionOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_move_to_level(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t level,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::MoveToLevel::Type command_data;
command_data.level = level;
command_data.transitionTime = transition_time;
command_data.optionMask = option_mask;
command_data.optionOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_move_to_level_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t level,
uint16_t transition_time)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::MoveToLevelWithOnOff::Type command_data;
command_data.level = level;
command_data.transitionTime = transition_time;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_move_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode,
uint8_t rate)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::MoveWithOnOff::Type command_data;
command_data.moveMode = (chip::app::Clusters::LevelControl::MoveMode)move_mode;
command_data.rate = rate;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_step(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t step_mode, uint8_t step_size, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::Step::Type command_data;
command_data.stepMode = (chip::app::Clusters::LevelControl::StepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
command_data.optionMask = option_mask;
command_data.optionOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_step_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::StepWithOnOff::Type command_data;
command_data.stepMode = (chip::app::Clusters::LevelControl::StepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_stop(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::Stop::Type command_data;
command_data.optionMask = option_mask;
command_data.optionOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_level_control_send_command_stop_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id)
{
chip::Controller::LevelControlCluster cluster;
chip::app::Clusters::LevelControl::Commands::Stop::Type command_data;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_move_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::MoveHue::Type command_data;
command_data.moveMode = (chip::app::Clusters::ColorControl::HueMoveMode)move_mode;
command_data.rate = rate;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_move_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::MoveSaturation::Type command_data;
command_data.moveMode = (chip::app::Clusters::ColorControl::SaturationMoveMode)move_mode;
command_data.rate = rate;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_move_to_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t hue, uint8_t direction,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::MoveToHue::Type command_data;
command_data.hue = hue;
command_data.direction = (chip::app::Clusters::ColorControl::HueDirection)direction;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_move_to_hue_and_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t hue,
uint8_t saturation, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::MoveToHueAndSaturation::Type command_data;
command_data.hue = hue;
command_data.saturation = saturation;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_move_to_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t saturation,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::MoveToSaturation::Type command_data;
command_data.saturation = saturation;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_step_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::StepHue::Type command_data;
command_data.stepMode = (chip::app::Clusters::ColorControl::HueStepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
esp_err_t esp_matter_color_control_send_command_step_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override)
{
chip::Controller::ColorControlCluster cluster;
chip::app::Clusters::ColorControl::Commands::StepSaturation::Type command_data;
command_data.stepMode = (chip::app::Clusters::ColorControl::SaturationStepMode)step_mode;
command_data.stepSize = step_size;
command_data.transitionTime = transition_time;
command_data.optionsMask = option_mask;
command_data.optionsOverride = option_override;
cluster.Associate(remote_device, remote_endpoint_id);
cluster.InvokeCommand(command_data, NULL, esp_matter_send_command_success_callback,
esp_matter_send_command_failure_callback);
return ESP_OK;
}
+76
View File
@@ -0,0 +1,76 @@
// Copyright 2022 Espressif Systems (Shanghai) PTE 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>
#include <esp_matter_core.h>
/* cluster: on_off */
esp_err_t esp_matter_on_off_send_command_off(esp_matter_peer_device_t *remote_device, int remote_endpoint_id);
esp_err_t esp_matter_on_off_send_command_on(esp_matter_peer_device_t *remote_device, int remote_endpoint_id);
esp_err_t esp_matter_on_off_send_command_toggle(esp_matter_peer_device_t *remote_device, int remote_endpoint_id);
/* cluster: level_control */
esp_err_t esp_matter_level_control_send_command_move(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t move_mode, uint8_t rate, uint8_t option_mask,
uint8_t option_override);
esp_err_t esp_matter_level_control_send_command_move_to_level(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t level,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t esp_matter_level_control_send_command_move_to_level_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t level,
uint16_t transition_time);
esp_err_t esp_matter_level_control_send_command_move_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode,
uint8_t rate);
esp_err_t esp_matter_level_control_send_command_step(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t step_mode, uint8_t step_size, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override);
esp_err_t esp_matter_level_control_send_command_step_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time);
esp_err_t esp_matter_level_control_send_command_stop(esp_matter_peer_device_t *remote_device, int remote_endpoint_id,
uint8_t option_mask, uint8_t option_override);
esp_err_t esp_matter_level_control_send_command_stop_with_on_off(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id);
/* cluster: color_control */
esp_err_t esp_matter_color_control_send_command_move_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_move_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t move_mode, uint8_t rate,
uint8_t option_mask, uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_move_to_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t hue, uint8_t direction,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_move_to_hue_and_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t hue,
uint8_t saturation, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_move_to_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t saturation,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_step_hue(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode, uint8_t step_size,
uint16_t transition_time, uint8_t option_mask,
uint8_t option_override);
esp_err_t esp_matter_color_control_send_command_step_saturation(esp_matter_peer_device_t *remote_device,
int remote_endpoint_id, uint8_t step_mode,
uint8_t step_size, uint16_t transition_time,
uint8_t option_mask, uint8_t option_override);
@@ -269,6 +269,8 @@ esp_matter_cluster_t *esp_matter_cluster_create_binding(esp_matter_endpoint_t *e
if (flags & CLUSTER_MASK_CLIENT) {
esp_matter_cluster_set_plugin_client_init_callback(cluster, MatterBasicPluginClientInitCallback);
}
/* Extra initialization */
esp_matter_binding_manager_init();
esp_matter_attribute_create(cluster, ZCL_CLUSTER_REVISION_SERVER_ATTRIBUTE_ID, ATTRIBUTE_MASK_NONE,
esp_matter_uint16(config->cluster_revision));
+9
View File
@@ -17,6 +17,7 @@
#include <esp_err.h>
#include <esp_matter_attribute.h>
#include <app/InteractionModelEngine.h>
#include <app/DeviceProxy.h>
#include <app/util/af-types.h>
using chip::DeviceLayer::ChipDeviceEvent;
@@ -57,6 +58,8 @@ typedef esp_err_t (*esp_matter_command_custom_callback_t)(int endpoint_id, int c
typedef void (*esp_matter_command_callback_t)(void *command_obj, const ConcreteCommandPath &command_path,
TLVReader &tlv_data);
typedef chip::DeviceProxy esp_matter_peer_device_t;
typedef void (*esp_matter_client_command_callback_t)(esp_matter_peer_device_t *peer_device, int remote_endpoint_id, void *priv_data);
/** Initializing APIs */
esp_err_t esp_matter_attribute_callback_set(esp_matter_attribute_callback_t callback, void *priv_data);
@@ -121,3 +124,9 @@ int esp_matter_command_get_id(esp_matter_command_t *command);
esp_matter_command_callback_t esp_matter_command_get_callback(esp_matter_command_t *command);
int esp_matter_command_get_flags(esp_matter_command_t *command);
esp_err_t esp_matter_command_set_custom_callback(esp_matter_command_custom_callback_t callback, void *priv_data);
/* Client APIs */
void esp_matter_binding_manager_init();
esp_err_t esp_matter_connect(int fabric_index, int node_id, int remote_endpoint_id);
esp_err_t esp_matter_set_client_command_callback(esp_matter_client_command_callback_t callback, void *priv_data);
esp_err_t esp_matter_client_cluster_update(int endpoint_id, int cluster_id);
File diff suppressed because it is too large Load Diff
@@ -1,6 +1,6 @@
/*
*
* Copyright (c) 2021 Project CHIP Authors
* Copyright (c) 2022 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.
@@ -30,28 +30,376 @@
namespace chip {
namespace Controller {
class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase {
class DLL_EXPORT AccessControlCluster : public ClusterBase
{
public:
OtaSoftwareUpdateProviderCluster()
: ClusterBase(app::Clusters::OtaSoftwareUpdateProvider::Id) {}
~OtaSoftwareUpdateProviderCluster() {}
AccessControlCluster() : ClusterBase(app::Clusters::AccessControl::Id) {}
~AccessControlCluster() {}
};
// Cluster Commands
CHIP_ERROR ApplyUpdateRequest(Callback::Cancelable *onSuccessCallback,
Callback::Cancelable *onFailureCallback,
chip::ByteSpan updateToken,
uint32_t newVersion);
CHIP_ERROR NotifyUpdateApplied(Callback::Cancelable *onSuccessCallback,
Callback::Cancelable *onFailureCallback,
chip::ByteSpan updateToken,
uint32_t softwareVersion);
CHIP_ERROR QueryImage(Callback::Cancelable *onSuccessCallback,
Callback::Cancelable *onFailureCallback,
chip::VendorId vendorId, uint16_t productId,
uint32_t softwareVersion, uint8_t protocolsSupported,
uint16_t hardwareVersion, chip::CharSpan location,
bool requestorCanConsent,
chip::ByteSpan metadataForProvider);
class DLL_EXPORT AccountLoginCluster : public ClusterBase
{
public:
AccountLoginCluster() : ClusterBase(app::Clusters::AccountLogin::Id) {}
~AccountLoginCluster() {}
// Cluster Commands
CHIP_ERROR GetSetupPINRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan tempAccountIdentifier);
CHIP_ERROR LoginRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan tempAccountIdentifier, chip::CharSpan setupPIN);
CHIP_ERROR LogoutRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT AdministratorCommissioningCluster : public ClusterBase
{
public:
AdministratorCommissioningCluster() : ClusterBase(app::Clusters::AdministratorCommissioning::Id) {}
~AdministratorCommissioningCluster() {}
// Cluster Commands
CHIP_ERROR OpenBasicCommissioningWindow(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t commissioningTimeout);
CHIP_ERROR OpenCommissioningWindow(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t commissioningTimeout, chip::ByteSpan PAKEVerifier, uint16_t discriminator,
uint32_t iterations, chip::ByteSpan salt, uint16_t passcodeID);
CHIP_ERROR RevokeCommissioning(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT ApplicationBasicCluster : public ClusterBase
{
public:
ApplicationBasicCluster() : ClusterBase(app::Clusters::ApplicationBasic::Id) {}
~ApplicationBasicCluster() {}
};
class DLL_EXPORT ApplicationLauncherCluster : public ClusterBase
{
public:
ApplicationLauncherCluster() : ClusterBase(app::Clusters::ApplicationLauncher::Id) {}
~ApplicationLauncherCluster() {}
// Cluster Commands
CHIP_ERROR HideAppRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t catalogVendorId, chip::CharSpan applicationId);
CHIP_ERROR LaunchAppRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan data, uint16_t catalogVendorId, chip::CharSpan applicationId);
CHIP_ERROR StopAppRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t catalogVendorId, chip::CharSpan applicationId);
};
class DLL_EXPORT AudioOutputCluster : public ClusterBase
{
public:
AudioOutputCluster() : ClusterBase(app::Clusters::AudioOutput::Id) {}
~AudioOutputCluster() {}
// Cluster Commands
CHIP_ERROR RenameOutputRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t index, chip::CharSpan name);
CHIP_ERROR SelectOutputRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t index);
};
class DLL_EXPORT BarrierControlCluster : public ClusterBase
{
public:
BarrierControlCluster() : ClusterBase(app::Clusters::BarrierControl::Id) {}
~BarrierControlCluster() {}
// Cluster Commands
CHIP_ERROR BarrierControlGoToPercent(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t percentOpen);
CHIP_ERROR BarrierControlStop(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT BasicCluster : public ClusterBase
{
public:
BasicCluster() : ClusterBase(app::Clusters::Basic::Id) {}
~BasicCluster() {}
// Cluster Commands
CHIP_ERROR MfgSpecificPing(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT BinaryInputBasicCluster : public ClusterBase
{
public:
BinaryInputBasicCluster() : ClusterBase(app::Clusters::BinaryInputBasic::Id) {}
~BinaryInputBasicCluster() {}
};
class DLL_EXPORT BindingCluster : public ClusterBase
{
public:
BindingCluster() : ClusterBase(app::Clusters::Binding::Id) {}
~BindingCluster() {}
// Cluster Commands
CHIP_ERROR Bind(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::NodeId nodeId,
chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId);
CHIP_ERROR Unbind(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::NodeId nodeId,
chip::GroupId groupId, chip::EndpointId endpointId, chip::ClusterId clusterId);
};
class DLL_EXPORT BooleanStateCluster : public ClusterBase
{
public:
BooleanStateCluster() : ClusterBase(app::Clusters::BooleanState::Id) {}
~BooleanStateCluster() {}
};
class DLL_EXPORT BridgedActionsCluster : public ClusterBase
{
public:
BridgedActionsCluster() : ClusterBase(app::Clusters::BridgedActions::Id) {}
~BridgedActionsCluster() {}
// Cluster Commands
CHIP_ERROR DisableAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR DisableActionWithDuration(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t actionID, uint32_t invokeID, uint32_t duration);
CHIP_ERROR EnableAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR EnableActionWithDuration(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t actionID, uint32_t invokeID, uint32_t duration);
CHIP_ERROR InstantAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR InstantActionWithTransition(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t actionID, uint32_t invokeID, uint16_t transitionTime);
CHIP_ERROR PauseAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR PauseActionWithDuration(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t actionID, uint32_t invokeID, uint32_t duration);
CHIP_ERROR ResumeAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR StartAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
CHIP_ERROR StartActionWithDuration(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t actionID, uint32_t invokeID, uint32_t duration);
CHIP_ERROR StopAction(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t actionID,
uint32_t invokeID);
};
class DLL_EXPORT BridgedDeviceBasicCluster : public ClusterBase
{
public:
BridgedDeviceBasicCluster() : ClusterBase(app::Clusters::BridgedDeviceBasic::Id) {}
~BridgedDeviceBasicCluster() {}
};
class DLL_EXPORT ChannelCluster : public ClusterBase
{
public:
ChannelCluster() : ClusterBase(app::Clusters::Channel::Id) {}
~ChannelCluster() {}
// Cluster Commands
CHIP_ERROR ChangeChannelByNumberRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t majorNumber, uint16_t minorNumber);
CHIP_ERROR ChangeChannelRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan match);
CHIP_ERROR SkipChannelRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t count);
};
class DLL_EXPORT ColorControlCluster : public ClusterBase
{
public:
ColorControlCluster() : ClusterBase(app::Clusters::ColorControl::Id) {}
~ColorControlCluster() {}
// Cluster Commands
CHIP_ERROR ColorLoopSet(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t updateFlags,
uint8_t action, uint8_t direction, uint16_t time, uint16_t startHue, uint8_t optionsMask,
uint8_t optionsOverride);
CHIP_ERROR EnhancedMoveHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t moveMode,
uint16_t rate, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR EnhancedMoveToHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t enhancedHue, uint8_t direction, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride);
CHIP_ERROR EnhancedMoveToHueAndSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t enhancedHue, uint8_t saturation, uint16_t transitionTime,
uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR EnhancedStepHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode,
uint16_t stepSize, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveColor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, int16_t rateX,
int16_t rateY, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveColorTemperature(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t moveMode, uint16_t rate, uint16_t colorTemperatureMinimum,
uint16_t colorTemperatureMaximum, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t moveMode,
uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t moveMode,
uint8_t rate, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveToColor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t colorX,
uint16_t colorY, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveToColorTemperature(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t colorTemperature, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride);
CHIP_ERROR MoveToHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t hue,
uint8_t direction, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR MoveToHueAndSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t hue, uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask,
uint8_t optionsOverride);
CHIP_ERROR MoveToSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t saturation, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR StepColor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, int16_t stepX,
int16_t stepY, uint16_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR StepColorTemperature(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t stepMode, uint16_t stepSize, uint16_t transitionTime, uint16_t colorTemperatureMinimum,
uint16_t colorTemperatureMaximum, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR StepHue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode,
uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR StepSaturation(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode,
uint8_t stepSize, uint8_t transitionTime, uint8_t optionsMask, uint8_t optionsOverride);
CHIP_ERROR StopMoveStep(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t optionsMask,
uint8_t optionsOverride);
};
class DLL_EXPORT ContentLauncherCluster : public ClusterBase
{
public:
ContentLauncherCluster() : ClusterBase(app::Clusters::ContentLauncher::Id) {}
~ContentLauncherCluster() {}
// Cluster Commands
CHIP_ERROR LaunchContentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
bool autoPlay, chip::CharSpan data);
CHIP_ERROR LaunchURLRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan contentURL, chip::CharSpan displayString, chip::CharSpan providerName);
};
class DLL_EXPORT DescriptorCluster : public ClusterBase
{
public:
DescriptorCluster() : ClusterBase(app::Clusters::Descriptor::Id) {}
~DescriptorCluster() {}
};
class DLL_EXPORT DiagnosticLogsCluster : public ClusterBase
{
public:
DiagnosticLogsCluster() : ClusterBase(app::Clusters::DiagnosticLogs::Id) {}
~DiagnosticLogsCluster() {}
// Cluster Commands
CHIP_ERROR RetrieveLogsRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t intent, uint8_t requestedProtocol, chip::ByteSpan transferFileDesignator);
};
class DLL_EXPORT DoorLockCluster : public ClusterBase
{
public:
DoorLockCluster() : ClusterBase(app::Clusters::DoorLock::Id) {}
~DoorLockCluster() {}
// Cluster Commands
CHIP_ERROR ClearCredential(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t credentialType, uint16_t credentialIndex);
CHIP_ERROR ClearUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userIndex);
CHIP_ERROR GetCredentialStatus(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t credentialType, uint16_t credentialIndex);
CHIP_ERROR GetUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t userIndex);
CHIP_ERROR LockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan pinCode);
CHIP_ERROR SetCredential(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t operationType, uint8_t credentialType, uint16_t credentialIndex, chip::ByteSpan credentialData,
uint16_t userIndex, uint8_t userStatus);
CHIP_ERROR SetUser(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t operationType,
uint16_t userIndex, chip::CharSpan userName, uint32_t userUniqueId, uint8_t userStatus, uint8_t userType,
uint8_t credentialRule);
CHIP_ERROR UnlockDoor(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan pinCode);
};
class DLL_EXPORT ElectricalMeasurementCluster : public ClusterBase
{
public:
ElectricalMeasurementCluster() : ClusterBase(app::Clusters::ElectricalMeasurement::Id) {}
~ElectricalMeasurementCluster() {}
};
class DLL_EXPORT EthernetNetworkDiagnosticsCluster : public ClusterBase
{
public:
EthernetNetworkDiagnosticsCluster() : ClusterBase(app::Clusters::EthernetNetworkDiagnostics::Id) {}
~EthernetNetworkDiagnosticsCluster() {}
// Cluster Commands
CHIP_ERROR ResetCounts(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT FixedLabelCluster : public ClusterBase
{
public:
FixedLabelCluster() : ClusterBase(app::Clusters::FixedLabel::Id) {}
~FixedLabelCluster() {}
};
class DLL_EXPORT FlowMeasurementCluster : public ClusterBase
{
public:
FlowMeasurementCluster() : ClusterBase(app::Clusters::FlowMeasurement::Id) {}
~FlowMeasurementCluster() {}
};
class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase
{
public:
GeneralCommissioningCluster() : ClusterBase(app::Clusters::GeneralCommissioning::Id) {}
~GeneralCommissioningCluster() {}
// Cluster Commands
CHIP_ERROR ArmFailSafe(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t expiryLengthSeconds, uint64_t breadcrumb, uint32_t timeoutMs);
CHIP_ERROR CommissioningComplete(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR SetRegulatoryConfig(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t location, chip::CharSpan countryCode, uint64_t breadcrumb, uint32_t timeoutMs);
};
class DLL_EXPORT GeneralDiagnosticsCluster : public ClusterBase
{
public:
GeneralDiagnosticsCluster() : ClusterBase(app::Clusters::GeneralDiagnostics::Id) {}
~GeneralDiagnosticsCluster() {}
};
class DLL_EXPORT GroupKeyManagementCluster : public ClusterBase
{
public:
GroupKeyManagementCluster() : ClusterBase(app::Clusters::GroupKeyManagement::Id) {}
~GroupKeyManagementCluster() {}
// Cluster Commands
CHIP_ERROR KeySetRead(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupKeySetID);
CHIP_ERROR KeySetReadAllIndices(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupKeySetIDs);
CHIP_ERROR KeySetRemove(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupKeySetID);
CHIP_ERROR KeySetWrite(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupKeySetID, uint8_t securityPolicy, chip::ByteSpan epochKey0, uint64_t epochStartTime0,
chip::ByteSpan epochKey1, uint64_t epochStartTime1, chip::ByteSpan epochKey2, uint64_t epochStartTime2);
};
class DLL_EXPORT GroupsCluster : public ClusterBase
{
public:
GroupsCluster() : ClusterBase(app::Clusters::Groups::Id) {}
~GroupsCluster() {}
// Cluster Commands
CHIP_ERROR AddGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
chip::CharSpan groupName);
CHIP_ERROR AddGroupIfIdentifying(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupId, chip::CharSpan groupName);
CHIP_ERROR GetGroupMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupList);
CHIP_ERROR RemoveAllGroups(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR RemoveGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId);
CHIP_ERROR ViewGroup(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId);
};
class DLL_EXPORT IdentifyCluster : public ClusterBase
@@ -63,6 +411,446 @@ public:
// Cluster Commands
CHIP_ERROR Identify(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t identifyTime);
CHIP_ERROR IdentifyQuery(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR TriggerEffect(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t effectIdentifier, uint8_t effectVariant);
};
class DLL_EXPORT IlluminanceMeasurementCluster : public ClusterBase
{
public:
IlluminanceMeasurementCluster() : ClusterBase(app::Clusters::IlluminanceMeasurement::Id) {}
~IlluminanceMeasurementCluster() {}
};
class DLL_EXPORT KeypadInputCluster : public ClusterBase
{
public:
KeypadInputCluster() : ClusterBase(app::Clusters::KeypadInput::Id) {}
~KeypadInputCluster() {}
// Cluster Commands
CHIP_ERROR SendKeyRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t keyCode);
};
class DLL_EXPORT LevelControlCluster : public ClusterBase
{
public:
LevelControlCluster() : ClusterBase(app::Clusters::LevelControl::Id) {}
~LevelControlCluster() {}
// Cluster Commands
CHIP_ERROR Move(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t moveMode,
uint8_t rate, uint8_t optionMask, uint8_t optionOverride);
CHIP_ERROR MoveToLevel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t level,
uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride);
CHIP_ERROR MoveToLevelWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t level, uint16_t transitionTime);
CHIP_ERROR MoveWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t moveMode,
uint8_t rate);
CHIP_ERROR Step(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode,
uint8_t stepSize, uint16_t transitionTime, uint8_t optionMask, uint8_t optionOverride);
CHIP_ERROR StepWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t stepMode,
uint8_t stepSize, uint16_t transitionTime);
CHIP_ERROR Stop(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t optionMask,
uint8_t optionOverride);
CHIP_ERROR StopWithOnOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT LocalizationConfigurationCluster : public ClusterBase
{
public:
LocalizationConfigurationCluster() : ClusterBase(app::Clusters::LocalizationConfiguration::Id) {}
~LocalizationConfigurationCluster() {}
};
class DLL_EXPORT LowPowerCluster : public ClusterBase
{
public:
LowPowerCluster() : ClusterBase(app::Clusters::LowPower::Id) {}
~LowPowerCluster() {}
// Cluster Commands
CHIP_ERROR Sleep(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT MediaInputCluster : public ClusterBase
{
public:
MediaInputCluster() : ClusterBase(app::Clusters::MediaInput::Id) {}
~MediaInputCluster() {}
// Cluster Commands
CHIP_ERROR HideInputStatusRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR RenameInputRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t index,
chip::CharSpan name);
CHIP_ERROR SelectInputRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t index);
CHIP_ERROR ShowInputStatusRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT MediaPlaybackCluster : public ClusterBase
{
public:
MediaPlaybackCluster() : ClusterBase(app::Clusters::MediaPlayback::Id) {}
~MediaPlaybackCluster() {}
// Cluster Commands
CHIP_ERROR FastForwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR NextRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR PauseRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR PlayRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR PreviousRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR RewindRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR SeekRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint64_t position);
CHIP_ERROR SkipBackwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint64_t deltaPositionMilliseconds);
CHIP_ERROR SkipForwardRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint64_t deltaPositionMilliseconds);
CHIP_ERROR StartOverRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR StopRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT ModeSelectCluster : public ClusterBase
{
public:
ModeSelectCluster() : ClusterBase(app::Clusters::ModeSelect::Id) {}
~ModeSelectCluster() {}
// Cluster Commands
CHIP_ERROR ChangeToMode(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t newMode);
};
class DLL_EXPORT NetworkCommissioningCluster : public ClusterBase
{
public:
NetworkCommissioningCluster() : ClusterBase(app::Clusters::NetworkCommissioning::Id) {}
~NetworkCommissioningCluster() {}
// Cluster Commands
CHIP_ERROR AddOrUpdateThreadNetwork(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan operationalDataset, uint64_t breadcrumb);
CHIP_ERROR AddOrUpdateWiFiNetwork(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan ssid, chip::ByteSpan credentials, uint64_t breadcrumb);
CHIP_ERROR ConnectNetwork(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan networkID, uint64_t breadcrumb);
CHIP_ERROR RemoveNetwork(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan networkID, uint64_t breadcrumb);
CHIP_ERROR ReorderNetwork(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan networkID, uint8_t networkIndex, uint64_t breadcrumb);
CHIP_ERROR ScanNetworks(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan ssid,
uint64_t breadcrumb);
};
class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase
{
public:
OtaSoftwareUpdateProviderCluster() : ClusterBase(app::Clusters::OtaSoftwareUpdateProvider::Id) {}
~OtaSoftwareUpdateProviderCluster() {}
// Cluster Commands
CHIP_ERROR ApplyUpdateRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan updateToken, uint32_t newVersion);
CHIP_ERROR NotifyUpdateApplied(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan updateToken, uint32_t softwareVersion);
CHIP_ERROR QueryImage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::VendorId vendorId, uint16_t productId, uint32_t softwareVersion, uint8_t protocolsSupported,
uint16_t hardwareVersion, chip::CharSpan location, bool requestorCanConsent,
chip::ByteSpan metadataForProvider);
};
class DLL_EXPORT OtaSoftwareUpdateRequestorCluster : public ClusterBase
{
public:
OtaSoftwareUpdateRequestorCluster() : ClusterBase(app::Clusters::OtaSoftwareUpdateRequestor::Id) {}
~OtaSoftwareUpdateRequestorCluster() {}
// Cluster Commands
CHIP_ERROR AnnounceOtaProvider(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::NodeId providerNodeId, chip::VendorId vendorId, uint8_t announcementReason,
chip::ByteSpan metadataForNode, chip::EndpointId endpoint);
};
class DLL_EXPORT OccupancySensingCluster : public ClusterBase
{
public:
OccupancySensingCluster() : ClusterBase(app::Clusters::OccupancySensing::Id) {}
~OccupancySensingCluster() {}
};
class DLL_EXPORT OnOffCluster : public ClusterBase
{
public:
OnOffCluster() : ClusterBase(app::Clusters::OnOff::Id) {}
~OnOffCluster() {}
// Cluster Commands
CHIP_ERROR Off(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR OffWithEffect(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t effectId,
uint8_t effectVariant);
CHIP_ERROR On(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR OnWithRecallGlobalScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR OnWithTimedOff(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t onOffControl, uint16_t onTime, uint16_t offWaitTime);
CHIP_ERROR Toggle(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT OnOffSwitchConfigurationCluster : public ClusterBase
{
public:
OnOffSwitchConfigurationCluster() : ClusterBase(app::Clusters::OnOffSwitchConfiguration::Id) {}
~OnOffSwitchConfigurationCluster() {}
};
class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase
{
public:
OperationalCredentialsCluster() : ClusterBase(app::Clusters::OperationalCredentials::Id) {}
~OperationalCredentialsCluster() {}
// Cluster Commands
CHIP_ERROR AddNOC(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, chip::ByteSpan NOCValue,
chip::ByteSpan ICACValue, chip::ByteSpan IPKValue, chip::NodeId caseAdminNode, uint16_t adminVendorId);
CHIP_ERROR AddTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan rootCertificate);
CHIP_ERROR AttestationRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan attestationNonce);
CHIP_ERROR CertificateChainRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t certificateType);
CHIP_ERROR OpCSRRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan CSRNonce);
CHIP_ERROR RemoveFabric(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t fabricIndex);
CHIP_ERROR RemoveTrustedRootCertificate(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan trustedRootIdentifier);
CHIP_ERROR UpdateFabricLabel(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::CharSpan label);
CHIP_ERROR UpdateNOC(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::ByteSpan NOCValue, chip::ByteSpan ICACValue);
};
class DLL_EXPORT PowerSourceCluster : public ClusterBase
{
public:
PowerSourceCluster() : ClusterBase(app::Clusters::PowerSource::Id) {}
~PowerSourceCluster() {}
};
class DLL_EXPORT PowerSourceConfigurationCluster : public ClusterBase
{
public:
PowerSourceConfigurationCluster() : ClusterBase(app::Clusters::PowerSourceConfiguration::Id) {}
~PowerSourceConfigurationCluster() {}
};
class DLL_EXPORT PressureMeasurementCluster : public ClusterBase
{
public:
PressureMeasurementCluster() : ClusterBase(app::Clusters::PressureMeasurement::Id) {}
~PressureMeasurementCluster() {}
};
class DLL_EXPORT PumpConfigurationAndControlCluster : public ClusterBase
{
public:
PumpConfigurationAndControlCluster() : ClusterBase(app::Clusters::PumpConfigurationAndControl::Id) {}
~PumpConfigurationAndControlCluster() {}
};
class DLL_EXPORT RelativeHumidityMeasurementCluster : public ClusterBase
{
public:
RelativeHumidityMeasurementCluster() : ClusterBase(app::Clusters::RelativeHumidityMeasurement::Id) {}
~RelativeHumidityMeasurementCluster() {}
};
class DLL_EXPORT ScenesCluster : public ClusterBase
{
public:
ScenesCluster() : ClusterBase(app::Clusters::Scenes::Id) {}
~ScenesCluster() {}
// Cluster Commands
CHIP_ERROR AddScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
uint8_t sceneId, uint16_t transitionTime, chip::CharSpan sceneName, chip::ClusterId clusterId,
uint8_t length, uint8_t value);
CHIP_ERROR GetSceneMembership(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupId);
CHIP_ERROR RecallScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
uint8_t sceneId, uint16_t transitionTime);
CHIP_ERROR RemoveAllScenes(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t groupId);
CHIP_ERROR RemoveScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
uint8_t sceneId);
CHIP_ERROR StoreScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
uint8_t sceneId);
CHIP_ERROR ViewScene(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint16_t groupId,
uint8_t sceneId);
};
class DLL_EXPORT SoftwareDiagnosticsCluster : public ClusterBase
{
public:
SoftwareDiagnosticsCluster() : ClusterBase(app::Clusters::SoftwareDiagnostics::Id) {}
~SoftwareDiagnosticsCluster() {}
// Cluster Commands
CHIP_ERROR ResetWatermarks(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT SwitchCluster : public ClusterBase
{
public:
SwitchCluster() : ClusterBase(app::Clusters::Switch::Id) {}
~SwitchCluster() {}
};
class DLL_EXPORT TargetNavigatorCluster : public ClusterBase
{
public:
TargetNavigatorCluster() : ClusterBase(app::Clusters::TargetNavigator::Id) {}
~TargetNavigatorCluster() {}
// Cluster Commands
CHIP_ERROR NavigateTargetRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t target, chip::CharSpan data);
};
class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase
{
public:
TemperatureMeasurementCluster() : ClusterBase(app::Clusters::TemperatureMeasurement::Id) {}
~TemperatureMeasurementCluster() {}
};
class DLL_EXPORT TestClusterCluster : public ClusterBase
{
public:
TestClusterCluster() : ClusterBase(app::Clusters::TestCluster::Id) {}
~TestClusterCluster() {}
// Cluster Commands
CHIP_ERROR SimpleStructEchoRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t a, bool b, uint8_t c, chip::ByteSpan d, chip::CharSpan e, uint8_t f, float g,
double h);
CHIP_ERROR Test(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR TestAddArguments(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t arg1,
uint8_t arg2);
CHIP_ERROR TestEmitTestEventRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t arg1, uint8_t arg2, bool arg3);
CHIP_ERROR TestEnumsRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::VendorId arg1, uint8_t arg2);
CHIP_ERROR TestListInt8UArgumentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t arg1);
CHIP_ERROR TestListInt8UReverseRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t arg1);
CHIP_ERROR TestListNestedStructListArgumentRequest(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback, uint8_t a, bool b, uint32_t e,
chip::ByteSpan f, uint8_t g);
CHIP_ERROR TestListStructArgumentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t a, bool b, uint8_t c, chip::ByteSpan d, chip::CharSpan e, uint8_t f, float g,
double h);
CHIP_ERROR TestNestedStructArgumentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t a, bool b);
CHIP_ERROR TestNestedStructListArgumentRequest(Callback::Cancelable * onSuccessCallback,
Callback::Cancelable * onFailureCallback, uint8_t a, bool b, uint32_t e,
chip::ByteSpan f, uint8_t g);
CHIP_ERROR TestNotHandled(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR TestNullableOptionalRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t arg1);
CHIP_ERROR TestSimpleOptionalArgumentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
bool arg1);
CHIP_ERROR TestSpecific(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR TestStructArgumentRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t a, bool b, uint8_t c, chip::ByteSpan d, chip::CharSpan e, uint8_t f, float g,
double h);
CHIP_ERROR TestUnknownCommand(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR TimedInvokeRequest(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT ThermostatCluster : public ClusterBase
{
public:
ThermostatCluster() : ClusterBase(app::Clusters::Thermostat::Id) {}
~ThermostatCluster() {}
// Cluster Commands
CHIP_ERROR ClearWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR GetRelayStatusLog(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR GetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t daysToReturn, uint8_t modeToReturn);
CHIP_ERROR SetWeeklySchedule(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint8_t numberOfTransitionsForSequence, uint8_t dayOfWeekForSequence, uint8_t modeForSequence,
uint8_t payload);
CHIP_ERROR SetpointRaiseLower(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback, uint8_t mode,
int8_t amount);
};
class DLL_EXPORT ThermostatUserInterfaceConfigurationCluster : public ClusterBase
{
public:
ThermostatUserInterfaceConfigurationCluster() : ClusterBase(app::Clusters::ThermostatUserInterfaceConfiguration::Id) {}
~ThermostatUserInterfaceConfigurationCluster() {}
};
class DLL_EXPORT ThreadNetworkDiagnosticsCluster : public ClusterBase
{
public:
ThreadNetworkDiagnosticsCluster() : ClusterBase(app::Clusters::ThreadNetworkDiagnostics::Id) {}
~ThreadNetworkDiagnosticsCluster() {}
// Cluster Commands
CHIP_ERROR ResetCounts(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT TimeFormatLocalizationCluster : public ClusterBase
{
public:
TimeFormatLocalizationCluster() : ClusterBase(app::Clusters::TimeFormatLocalization::Id) {}
~TimeFormatLocalizationCluster() {}
};
class DLL_EXPORT UserLabelCluster : public ClusterBase
{
public:
UserLabelCluster() : ClusterBase(app::Clusters::UserLabel::Id) {}
~UserLabelCluster() {}
};
class DLL_EXPORT WakeOnLanCluster : public ClusterBase
{
public:
WakeOnLanCluster() : ClusterBase(app::Clusters::WakeOnLan::Id) {}
~WakeOnLanCluster() {}
};
class DLL_EXPORT WiFiNetworkDiagnosticsCluster : public ClusterBase
{
public:
WiFiNetworkDiagnosticsCluster() : ClusterBase(app::Clusters::WiFiNetworkDiagnostics::Id) {}
~WiFiNetworkDiagnosticsCluster() {}
// Cluster Commands
CHIP_ERROR ResetCounts(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
class DLL_EXPORT WindowCoveringCluster : public ClusterBase
{
public:
WindowCoveringCluster() : ClusterBase(app::Clusters::WindowCovering::Id) {}
~WindowCoveringCluster() {}
// Cluster Commands
CHIP_ERROR DownOrClose(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR GoToLiftPercentage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::Percent liftPercentageValue, chip::Percent100ths liftPercent100thsValue);
CHIP_ERROR GoToLiftValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t liftValue);
CHIP_ERROR GoToTiltPercentage(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
chip::Percent tiltPercentageValue, chip::Percent100ths tiltPercent100thsValue);
CHIP_ERROR GoToTiltValue(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback,
uint16_t tiltValue);
CHIP_ERROR StopMotion(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
CHIP_ERROR UpOrOpen(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback);
};
} // namespace Controller
@@ -1,122 +0,0 @@
/*
*
* 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.
*/
#include "app_binding_handler.h"
#include "app-common/zap-generated/ids/Clusters.h"
#include "app-common/zap-generated/ids/Commands.h"
#include "app/CommandSender.h"
#include "app/clusters/bindings/BindingManager.h"
#include "app/server/Server.h"
#include "controller/InvokeInteraction.h"
#include "lib/core/CHIPError.h"
#include <esp_matter_console.h>
#if CONFIG_ENABLE_CHIP_SHELL
#include "lib/shell/Engine.h"
using chip::Shell::Engine;
using chip::Shell::shell_command_t;
using chip::Shell::streamer_get;
using chip::Shell::streamer_printf;
#endif
static bool sSwitchOnOffState = false;
#if CONFIG_ENABLE_CHIP_SHELL
static void toggle_switch(bool newState)
{
sSwitchOnOffState = newState;
chip::BindingManager::GetInstance().NotifyBoundClusterChanged(/*endpoint-id*/1, chip::app::Clusters::OnOff::Id, nullptr);
}
static esp_err_t app_switch_command_handler(int argc, char ** argv)
{
if (argc == 1 && strcmp(argv[0], "on") == 0)
{
toggle_switch(true);
return ESP_OK;
}
if (argc == 1 && strcmp(argv[0], "off") == 0)
{
toggle_switch(false);
return ESP_OK;
}
if (argc == 1 && strcmp(argv[0], "toggle") == 0)
{
toggle_switch(!sSwitchOnOffState);
return ESP_OK;
}
streamer_printf(streamer_get(), "Usage: switch [on|off|toggle]");
return ESP_OK;
}
static void app_register_switch_commands()
{
esp_matter_console_command_t command = {
.name = "switch",
.description = "Switch commands. Usage: matter esp switch [on|off|toggle] ",
.handler = app_switch_command_handler,
};
esp_matter_console_add_command(&command);
}
#endif // CONFIG_ENABLE_CHIP_SHELL
static void BoundDeviceChangedHandler(const EmberBindingTableEntry * binding, chip::DeviceProxy * peer_device, void * context)
{
using namespace chip;
using namespace chip::app;
if (binding->type == EMBER_MULTICAST_BINDING)
{
ChipLogError(NotSpecified, "Group binding is not supported now");
return;
}
if (binding->type == EMBER_UNICAST_BINDING && binding->local == 1 && binding->clusterId == Clusters::OnOff::Id)
{
auto onSuccess = [](const ConcreteCommandPath & commandPath, const StatusIB & status, const auto & dataResponse) {
ChipLogProgress(NotSpecified, "OnOff command succeeds");
};
auto onFailure = [](CHIP_ERROR error) {
ChipLogError(NotSpecified, "OnOff command failed: %" CHIP_ERROR_FORMAT, error.Format());
};
if (sSwitchOnOffState)
{
Clusters::OnOff::Commands::On::Type onCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
binding->remote, onCommand, onSuccess, onFailure);
}
else
{
Clusters::OnOff::Commands::Off::Type offCommand;
Controller::InvokeCommandRequest(peer_device->GetExchangeManager(), peer_device->GetSecureSession().Value(),
binding->remote, offCommand, onSuccess, onFailure);
}
}
}
esp_err_t app_binding_handler_init()
{
chip::BindingManager::GetInstance().SetAppServer(&chip::Server::GetInstance());
chip::BindingManager::GetInstance().RegisterBoundDeviceChangedHandler(BoundDeviceChangedHandler);
#if CONFIG_ENABLE_CHIP_SHELL
app_register_switch_commands();
#endif
return ESP_OK;
}
@@ -1,22 +0,0 @@
/*
*
* 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.
*/
#pragma once
#include "lib/core/CHIPError.h"
esp_err_t app_binding_handler_init();
+56 -10
View File
@@ -17,11 +17,28 @@
#include <app_driver.h>
using chip::kInvalidClusterId;
static constexpr chip::CommandId kInvalidCommandId = 0xFFFF'FFFF;
static const char *TAG = "app_driver";
extern int switch_endpoint_id;
static int g_cluster_id = kInvalidClusterId;
static int g_command_id = kInvalidCommandId;
static esp_err_t app_driver_console_handler(int argc, char **argv)
{
if (argc == 5 && strncmp(argv[0], "set", sizeof("set")) == 0) {
if (argc == 1 && strncmp(argv[0], "help", sizeof("help")) == 0) {
printf("Driver commands:\n"
"\thelp: Print help\n"
"\tset: <endpoint_id> <cluster_id> <attribute_id> <value>."
"Example: matter esp driver set 0x0001 0x0006 0x0000 1.\n"
"\tget: <endpoint_id> <cluster_id> <attribute_id>. "
"Example: matter esp driver get 0x0001 0x0006 0x0000.\n"
"\tsend_bind: <endpoint_id> <cluster_id> <command_id>. "
"Example: matter esp driver send_bind 0x0001 0x0006 0x0002.\n"
"\tsend: <fabric_index> <remote_node_id> <remote_endpoint_id> <cluster_id> <command_id>. "
"Example: matter esp driver send 0x0001 0xBC5C01 0x0001 0x0006 0x0002.\n");
} else if (argc == 5 && strncmp(argv[0], "set", sizeof("set")) == 0) {
int endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
int cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
int attribute_id = strtol((const char *)&argv[3][2], NULL, 16);
@@ -46,8 +63,26 @@ static esp_err_t app_driver_console_handler(int argc, char **argv)
esp_matter_attribute_t *attribute = esp_matter_attribute_get(cluster, attribute_id);
esp_matter_attr_val_t val = esp_matter_attribute_get_val(attribute);
esp_matter_attribute_val_print(endpoint_id, cluster_id, attribute_id, val);
} else if (argc == 4 && strncmp(argv[0], "send_bind", sizeof("send_bind")) == 0) {
int endpoint_id = strtol((const char *)&argv[1][2], NULL, 16);
int cluster_id = strtol((const char *)&argv[2][2], NULL, 16);
int command_id = strtol((const char *)&argv[3][2], NULL, 16);
g_cluster_id = cluster_id;
g_command_id = command_id;
esp_matter_client_cluster_update(endpoint_id, cluster_id);
} else if (argc == 6 && strncmp(argv[0], "send", sizeof("send")) == 0) {
int fabric_index = strtol((const char *)&argv[1][2], NULL, 16);
int node_id = strtol((const char *)&argv[2][2], NULL, 16);
int remote_endpoint_id = strtol((const char *)&argv[3][2], NULL, 16);
int cluster_id = strtol((const char *)&argv[4][2], NULL, 16);
int command_id = strtol((const char *)&argv[5][2], NULL, 16);
g_cluster_id = cluster_id;
g_command_id = command_id;
esp_matter_connect(fabric_index, node_id, remote_endpoint_id);
} else {
ESP_LOGE(TAG, "Incorrect arguments");
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
return ESP_ERR_INVALID_ARG;
}
return ESP_OK;
@@ -57,21 +92,31 @@ static void app_driver_register_commands()
{
esp_matter_console_command_t command = {
.name = "driver",
.description = "This can be used to simulate on-device control. "
"Usage: matter esp driver <set|get> <endpoint_id> <cluster_id> <attribute_id> [value]. "
"Example1: matter esp driver set 0x1001 0x0006 0x0000 1. "
"Example2: matter esp driver get 0x1001 0x0006 0x0000.",
.description = "This can be used to simulate on-device control. Usage: matter esp driver <driver_command>. "
"Driver commands: help, set, get, send, send_bind",
.handler = app_driver_console_handler,
};
esp_matter_console_add_command(&command);
}
void app_driver_client_command_callback(esp_matter_peer_device_t *peer_device, int remote_endpoint_id, void *priv_data)
{
/** TODO: Find a better way to get the cluster_id and command_id */
if (g_cluster_id == ZCL_ON_OFF_CLUSTER_ID) {
if (g_command_id == ZCL_OFF_COMMAND_ID) {
esp_matter_on_off_send_command_off(peer_device, remote_endpoint_id);
} else if (g_command_id == ZCL_ON_COMMAND_ID) {
esp_matter_on_off_send_command_on(peer_device, remote_endpoint_id);
} else if (g_command_id == ZCL_TOGGLE_COMMAND_ID) {
esp_matter_on_off_send_command_toggle(peer_device, remote_endpoint_id);
}
}
}
esp_err_t app_driver_attribute_update(int endpoint_id, int cluster_id, int attribute_id, esp_matter_attr_val_t val)
{
esp_err_t err = ESP_OK;
// Intentionally kept empty
return err;
/* Nothing to do here */
return ESP_OK;
}
static esp_err_t app_driver_attribute_set_defaults()
@@ -104,5 +149,6 @@ esp_err_t app_driver_init()
// device_init();
app_driver_attribute_set_defaults();
app_driver_register_commands();
esp_matter_set_client_command_callback(app_driver_client_command_callback, NULL);
return ESP_OK;
}
+1 -3
View File
@@ -17,7 +17,6 @@
#include <app_driver.h>
#include <app_qrcode.h>
#include <app_binding_handler.h>
static const char *TAG = "app_main";
@@ -69,11 +68,10 @@ extern "C" void app_main()
ESP_LOGE(TAG, "Matter device creation failed");
}
ESP_LOGI(TAG, "Switch created with endpoint_id %d", switch_endpoint_id);
/* Initialize driver */
app_driver_init();
app_binding_handler_init();
/* Matter start */
err = esp_matter_start(app_event_cb);