mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'add_client_interaction_apis' into 'main'
Add client interaction APIs for interaction actions Closes CON-1142 See merge request app-frameworks/esp-matter!673
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -19,24 +19,28 @@
|
||||
#include <esp_matter_core.h>
|
||||
|
||||
namespace esp_matter {
|
||||
namespace cluster {
|
||||
using client::peer_device_t;
|
||||
|
||||
/** Custom command send APIs
|
||||
*
|
||||
* They can be used for all the commands of all the clusters, including the custom clusters.
|
||||
*/
|
||||
namespace custom {
|
||||
namespace command {
|
||||
namespace client {
|
||||
namespace interaction {
|
||||
|
||||
using chip::Optional;
|
||||
using chip::app::AttributePathParams;
|
||||
using chip::app::CommandPathParams;
|
||||
using chip::app::CommandSender;
|
||||
using chip::app::ConcreteCommandPath;
|
||||
using chip::app::EventPathParams;
|
||||
using chip::app::ReadClient;
|
||||
using chip::app::StatusIB;
|
||||
using chip::app::WriteClient;
|
||||
using chip::Messaging::ExchangeManager;
|
||||
using chip::System::Clock::Timeout;
|
||||
using chip::TLV::TLVReader;
|
||||
using client::peer_device_t;
|
||||
|
||||
/** Command invoke APIs
|
||||
*
|
||||
* They can be used for all the commands of all the clusters, including the custom clusters.
|
||||
*/
|
||||
namespace invoke {
|
||||
|
||||
class custom_command_callback final : public chip::app::CommandSender::Callback {
|
||||
public:
|
||||
@@ -96,380 +100,42 @@ private:
|
||||
void *context;
|
||||
};
|
||||
|
||||
esp_err_t send_command(void *ctx, peer_device_t *remote_device, const CommandPathParams &command_path,
|
||||
esp_err_t send_request(void *ctx, peer_device_t *remote_device, const CommandPathParams &command_path,
|
||||
const char *command_data_json_str, custom_command_callback::on_success_callback_t on_success,
|
||||
custom_command_callback::on_error_callback_t on_error,
|
||||
const Optional<uint16_t> &timed_invoke_timeout_ms,
|
||||
const Optional<Timeout> &response_timeout = chip::NullOptional);
|
||||
|
||||
esp_err_t send_group_command(const uint8_t fabric_index, const CommandPathParams &command_path,
|
||||
esp_err_t send_group_request(const uint8_t fabric_index, const CommandPathParams &command_path,
|
||||
const char *command_data_json_str);
|
||||
} // namespace invoke
|
||||
|
||||
} // namespace command
|
||||
} // namespace custom
|
||||
|
||||
/** Specific command send APIs
|
||||
/** Attribute/event read API
|
||||
*
|
||||
* If some standard command is not present here, it can be added.
|
||||
* It can be used for reading all the attributes/events of all the clusters, including the custom clusters.
|
||||
*/
|
||||
|
||||
namespace on_off {
|
||||
namespace command {
|
||||
esp_err_t send_off(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t send_on(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t send_toggle(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t group_send_off(uint8_t fabric_index, uint16_t group_id);
|
||||
esp_err_t group_send_on(uint8_t fabric_index, uint16_t group_id);
|
||||
esp_err_t group_send_toggle(uint8_t fabric_index, uint16_t group_id);
|
||||
} // namespace command
|
||||
} // namespace on_off
|
||||
|
||||
namespace level_control {
|
||||
namespace command {
|
||||
esp_err_t send_move(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_level(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t level,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_level_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t level,
|
||||
uint16_t transition_time);
|
||||
esp_err_t send_move_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
|
||||
uint8_t rate);
|
||||
esp_err_t send_step(peer_device_t *remote_device, uint16_t 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 send_step_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
|
||||
uint8_t step_size, uint16_t transition_time);
|
||||
esp_err_t send_stop(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_stop_with_on_off(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
esp_err_t group_send_move(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_move_to_level(uint8_t fabric_index, uint16_t group_id, uint8_t level, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_level_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t level,
|
||||
uint16_t transition_time);
|
||||
esp_err_t group_send_move_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate);
|
||||
esp_err_t group_send_step(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_step_with_on_off(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
|
||||
uint16_t transition_time);
|
||||
esp_err_t group_send_stop(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_stop_with_on_off(uint8_t fabric_index, uint16_t group_id);
|
||||
} // namespace command
|
||||
} // namespace level_control
|
||||
|
||||
namespace color_control {
|
||||
namespace command {
|
||||
esp_err_t send_move_hue(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode, uint8_t rate,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
|
||||
uint8_t rate, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_hue(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t hue, uint8_t direction,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_hue_and_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t hue,
|
||||
uint8_t saturation, uint16_t transition_time, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_move_to_saturation(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t saturation,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_step_hue(peer_device_t *remote_device, uint16_t 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 send_step_saturation(peer_device_t *remote_device, uint16_t 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 send_move_to_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t color_x,
|
||||
uint16_t color_y, uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_step_color(peer_device_t *remote_device, uint16_t remote_endpoint_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_move_to_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t send_stop_move_step(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_move_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t move_mode,
|
||||
uint16_t rate, uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t send_step_color_temperature(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
|
||||
esp_err_t group_send_move_hue(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint8_t rate,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_hue(uint8_t fabric_index, uint16_t group_id, uint8_t hue, uint8_t direction,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_hue_and_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t hue,
|
||||
uint8_t saturation, uint16_t transition_time, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_move_to_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t saturation,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_step_hue(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_step_saturation(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode, uint8_t step_size,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_color(uint8_t fabric_index, uint16_t group_id, uint16_t color_x, uint16_t color_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_color(uint8_t fabric_index, uint16_t group_id, int16_t rate_x, int16_t rate_y,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_step_color(uint8_t fabric_index, uint16_t group_id, int16_t step_x, int16_t step_y,
|
||||
uint16_t transition_time, uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_move_to_color_temperature(uint8_t fabric_index, uint16_t group_id,
|
||||
uint16_t color_temperature_mireds, uint16_t transition_time,
|
||||
uint8_t option_mask, uint8_t option_override);
|
||||
esp_err_t group_send_stop_move_step(uint8_t fabric_index, uint16_t group_id, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_move_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t move_mode, uint16_t rate,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
esp_err_t group_send_step_color_temperature(uint8_t fabric_index, uint16_t group_id, uint8_t step_mode,
|
||||
uint16_t step_size, uint16_t transition_time,
|
||||
uint16_t color_temperature_minimum_mireds,
|
||||
uint16_t color_temperature_maximum_mireds, uint8_t option_mask,
|
||||
uint8_t option_override);
|
||||
|
||||
} // namespace command
|
||||
} // namespace color_control
|
||||
|
||||
namespace identify {
|
||||
namespace command {
|
||||
esp_err_t send_identify(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t identify_time);
|
||||
|
||||
esp_err_t group_send_identify(uint8_t fabric_index, uint16_t group_id, uint16_t identify_time);
|
||||
|
||||
esp_err_t send_trigger_effect(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t effect_identifier,
|
||||
uint8_t effect_variant);
|
||||
} // namespace command
|
||||
} // namespace identify
|
||||
|
||||
namespace group_key_management {
|
||||
namespace command {
|
||||
using group_keyset_struct = chip::app::Clusters::GroupKeyManagement::Structs::GroupKeySetStruct::Type;
|
||||
using keyset_read_callback =
|
||||
void (*)(void *, const chip::app::Clusters::GroupKeyManagement::Commands::KeySetRead::Type::ResponseType &);
|
||||
|
||||
esp_err_t send_keyset_write(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
group_keyset_struct &group_keyset);
|
||||
|
||||
esp_err_t send_keyset_read(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t keyset_id,
|
||||
keyset_read_callback read_callback);
|
||||
|
||||
} // namespace command
|
||||
} // namespace group_key_management
|
||||
|
||||
namespace groups {
|
||||
namespace command {
|
||||
using add_group_callback = void (*)(void *,
|
||||
const chip::app::Clusters::Groups::Commands::AddGroup::Type::ResponseType &);
|
||||
using view_group_callback = void (*)(void *,
|
||||
const chip::app::Clusters::Groups::Commands::ViewGroup::Type::ResponseType &);
|
||||
using remove_group_callback = void (*)(void *,
|
||||
const chip::app::Clusters::Groups::Commands::RemoveGroup::Type::ResponseType &);
|
||||
|
||||
esp_err_t send_add_group(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id, char *group_name,
|
||||
add_group_callback add_group_cb);
|
||||
|
||||
esp_err_t send_view_group(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
view_group_callback view_group_cb);
|
||||
|
||||
esp_err_t send_remove_group(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
remove_group_callback remove_group_cb);
|
||||
|
||||
} // namespace command
|
||||
} // namespace groups
|
||||
|
||||
namespace scenes_management {
|
||||
namespace command {
|
||||
|
||||
using extension_field_sets = chip::app::DataModel::List<chip::app::Clusters::ScenesManagement::Structs::ExtensionFieldSet::Type>;
|
||||
using add_scene_callback = void (*)(void *,
|
||||
const chip::app::Clusters::ScenesManagement::Commands::AddScene::Type::ResponseType &);
|
||||
using view_scene_callback = void (*)(void *,
|
||||
const chip::app::Clusters::ScenesManagement::Commands::ViewScene::Type::ResponseType &);
|
||||
using remove_scene_callback = void (*)(void *,
|
||||
const chip::app::Clusters::ScenesManagement::Commands::RemoveScene::Type::ResponseType &);
|
||||
using remove_all_scenes_callback =
|
||||
void (*)(void *, const chip::app::Clusters::ScenesManagement::Commands::RemoveAllScenes::Type::ResponseType &);
|
||||
using store_scene_callback = void (*)(void *,
|
||||
const chip::app::Clusters::ScenesManagement::Commands::StoreScene::Type::ResponseType &);
|
||||
using get_scene_membership_callback =
|
||||
void (*)(void *, const chip::app::Clusters::ScenesManagement::Commands::GetSceneMembership::Type::ResponseType &);
|
||||
|
||||
esp_err_t send_add_scene(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id, uint8_t scene_id,
|
||||
uint16_t transition_time, char *scene_name, extension_field_sets &efs,
|
||||
add_scene_callback add_scene_cb);
|
||||
|
||||
esp_err_t send_view_scene(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
uint8_t scene_id, view_scene_callback view_scene_cb);
|
||||
|
||||
esp_err_t send_remove_scene(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
uint8_t scene_id, remove_scene_callback remove_scene_cb);
|
||||
|
||||
esp_err_t send_remove_all_scenes(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
remove_all_scenes_callback remove_all_scenes_cb);
|
||||
|
||||
esp_err_t send_store_scene(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
uint8_t scene_id, store_scene_callback store_scene_cb);
|
||||
|
||||
esp_err_t send_recall_scene(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
uint8_t scene_id);
|
||||
|
||||
esp_err_t send_get_scene_membership(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t group_id,
|
||||
get_scene_membership_callback get_scene_membership_cb);
|
||||
|
||||
} // namespace command
|
||||
} // namespace scenes_management
|
||||
|
||||
namespace thermostat {
|
||||
namespace command {
|
||||
|
||||
using transitions =
|
||||
chip::app::DataModel::List<chip::app::Clusters::Thermostat::Structs::WeeklyScheduleTransitionStruct::Type>;
|
||||
|
||||
using get_weekly_schedule_callback =
|
||||
void (*)(void *, const chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::Type::ResponseType &);
|
||||
|
||||
esp_err_t send_setpoint_raise_lower(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t mode,
|
||||
uint8_t amount);
|
||||
|
||||
esp_err_t send_set_weekly_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint8_t num_of_tras_for_seq, uint8_t day_of_week_for_seq, uint8_t mode_for_seq,
|
||||
transitions &trans);
|
||||
|
||||
esp_err_t send_get_weekly_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t day_to_return,
|
||||
uint8_t mode_to_return, get_weekly_schedule_callback get_weekly_schedule_cb);
|
||||
|
||||
esp_err_t send_clear_weekly_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
|
||||
} // namespace command
|
||||
} // namespace thermostat
|
||||
|
||||
namespace door_lock {
|
||||
namespace command {
|
||||
|
||||
using get_week_day_schedule_callback =
|
||||
void (*)(void *, const chip::app::Clusters::DoorLock::Commands::GetWeekDaySchedule::Type::ResponseType &);
|
||||
|
||||
using get_year_day_schedule_callback =
|
||||
void (*)(void *, const chip::app::Clusters::DoorLock::Commands::GetYearDaySchedule::Type::ResponseType &);
|
||||
|
||||
using get_holiday_schedule_callback =
|
||||
void (*)(void *, const chip::app::Clusters::DoorLock::Commands::GetHolidaySchedule::Type::ResponseType &);
|
||||
|
||||
using get_user_callback = void (*)(void *,
|
||||
const chip::app::Clusters::DoorLock::Commands::GetUser::Type::ResponseType &);
|
||||
|
||||
using set_credential_callback =
|
||||
void (*)(void *, const chip::app::Clusters::DoorLock::Commands::SetCredential::Type::ResponseType &);
|
||||
|
||||
using get_credential_status_callback =
|
||||
void (*)(void *, const chip::app::Clusters::DoorLock::Commands::GetCredentialStatus::Type::ResponseType &);
|
||||
|
||||
using credential_struct = chip::app::Clusters::DoorLock::Structs::CredentialStruct::Type;
|
||||
|
||||
esp_err_t send_lock_door(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_unlock_door(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_unlock_with_timeout(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t timeout,
|
||||
uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_set_week_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t week_day_index,
|
||||
uint16_t user_index, uint8_t days_mask, uint8_t start_hour, uint8_t start_minute,
|
||||
uint8_t end_hour, uint8_t end_minute);
|
||||
|
||||
esp_err_t send_get_week_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t week_day_index,
|
||||
uint16_t user_index, get_week_day_schedule_callback success_cb);
|
||||
|
||||
esp_err_t send_clear_week_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint8_t week_day_index, uint16_t user_index);
|
||||
|
||||
esp_err_t send_set_year_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t year_day_index,
|
||||
uint16_t user_index, uint32_t local_start_time, uint32_t local_end_time);
|
||||
|
||||
esp_err_t send_get_year_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t year_day_index,
|
||||
uint16_t user_index, get_year_day_schedule_callback success_cb);
|
||||
|
||||
esp_err_t send_clear_year_day_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint8_t year_day_index, uint16_t user_index);
|
||||
|
||||
esp_err_t send_set_holiday_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t holiday_index,
|
||||
uint32_t local_start_time, uint32_t local_end_time, uint8_t operating_mode);
|
||||
|
||||
esp_err_t send_get_holiday_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t holiday_index,
|
||||
get_holiday_schedule_callback success_cb);
|
||||
|
||||
esp_err_t send_clear_holiday_schedule(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t holiday_index);
|
||||
|
||||
esp_err_t send_set_user(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t operation_type,
|
||||
uint16_t user_index, char *user_name, uint32_t user_unique_id, uint8_t user_status,
|
||||
uint8_t user_type, uint8_t credential_rule, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_get_user(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t user_index,
|
||||
get_user_callback success_cb);
|
||||
|
||||
esp_err_t send_clear_user(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t user_index,
|
||||
uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_set_credential(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t operation_type,
|
||||
credential_struct credential, uint8_t *credential_data, size_t credential_len,
|
||||
uint16_t user_index, uint8_t user_status, uint8_t user_type,
|
||||
set_credential_callback success_cb, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_get_credential_status(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
credential_struct &credential, get_credential_status_callback success_cb);
|
||||
|
||||
esp_err_t send_clear_credential(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
credential_struct &credential, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
esp_err_t send_unbolt_door(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint8_t *pin_code,
|
||||
size_t pin_code_len, uint16_t timed_invoke_timeout_ms);
|
||||
|
||||
} // namespace command
|
||||
} // namespace door_lock
|
||||
|
||||
namespace window_covering {
|
||||
namespace command {
|
||||
|
||||
esp_err_t send_up_or_open(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
|
||||
esp_err_t send_down_or_close(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
|
||||
esp_err_t send_stop_motion(peer_device_t *remote_device, uint16_t remote_endpoint_id);
|
||||
|
||||
esp_err_t send_go_to_lift_value(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t lift_value);
|
||||
|
||||
esp_err_t send_go_to_lift_percentage(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t lift_percent100ths_value);
|
||||
|
||||
esp_err_t send_go_to_tilt_value(peer_device_t *remote_device, uint16_t remote_endpoint_id, uint16_t tilt_value);
|
||||
|
||||
esp_err_t send_go_to_tilt_percentage(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t tilt_percent100ths_value);
|
||||
|
||||
} // namespace command
|
||||
} // namespace window_covering
|
||||
|
||||
namespace administrator_commissioning {
|
||||
namespace command {
|
||||
|
||||
esp_err_t send_open_commissioning_window(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t commissioning_timeout, chip::MutableByteSpan &pake_passcode_verifier,
|
||||
uint16_t discriminator, uint32_t iterations, chip::MutableByteSpan &salt,
|
||||
uint16_t timed_interaction_timeout_ms);
|
||||
|
||||
esp_err_t send_open_basic_commissioning_window(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t commissioning_timeout, uint16_t timed_interaction_timeout_ms);
|
||||
|
||||
esp_err_t send_revoke_commissioning(peer_device_t *remote_device, uint16_t remote_endpoint_id,
|
||||
uint16_t timed_interaction_timeout_ms);
|
||||
|
||||
} // namespace command
|
||||
} // namespace administrator_commissioning
|
||||
|
||||
} // namespace cluster
|
||||
namespace read {
|
||||
esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams *attr_path, size_t attr_path_size,
|
||||
EventPathParams *event_path, size_t event_path_size, ReadClient::Callback &callback);
|
||||
} // namespace read
|
||||
|
||||
/** Attribute write API
|
||||
*
|
||||
* It can be used for writing all the attributes of all the clusters, including the custom clusters.
|
||||
*/
|
||||
namespace write {
|
||||
esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams &attr_path,
|
||||
const char *attr_val_json_str, WriteClient::Callback &callback,
|
||||
const chip::Optional<uint16_t> &timeout_ms);
|
||||
} // namespace write
|
||||
|
||||
namespace subscribe {
|
||||
esp_err_t send_request(client::peer_device_t *remote_device, AttributePathParams *attr_path, size_t attr_path_size,
|
||||
EventPathParams *event_path, size_t event_path_size, uint16_t min_interval,
|
||||
uint16_t max_interval, bool keep_subscription, bool auto_resubscribe,
|
||||
ReadClient::Callback &callback);
|
||||
} // namespace subscribe
|
||||
|
||||
} // namespace interaction
|
||||
} // namespace client
|
||||
} // namespace esp_matter
|
||||
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <app/util/af-types.h>
|
||||
#include <esp_err.h>
|
||||
#include <esp_matter_attribute_utils.h>
|
||||
#include <app/AttributePathParams.h>
|
||||
#include <app/CommandPathParams.h>
|
||||
#include <app/EventPathParams.h>
|
||||
|
||||
using chip::app::ConcreteCommandPath;
|
||||
using chip::DeviceLayer::ChipDeviceEvent;
|
||||
@@ -832,23 +835,44 @@ uint32_t get_id(event_t *event);
|
||||
/* Client APIs */
|
||||
namespace client {
|
||||
|
||||
/** Command handle as the input when calling `connect()` or `cluster_update()`
|
||||
/** Client request types
|
||||
*/
|
||||
typedef enum {
|
||||
INVOKE_CMD = 0,
|
||||
READ_ATTR = 1,
|
||||
READ_EVENT = 2,
|
||||
WRITE_ATTR = 3,
|
||||
SUBSCRIBE_ATTR = 4,
|
||||
SUBSCRIBE_EVENT = 5,
|
||||
} request_type_t;
|
||||
|
||||
/** Request handle as the input when calling `connect()` or `cluster_update()`
|
||||
*
|
||||
*/
|
||||
|
||||
typedef struct command_handle {
|
||||
typedef struct request_handle {
|
||||
request_type_t type;
|
||||
union {
|
||||
uint16_t endpoint_id;
|
||||
uint16_t group_id;
|
||||
chip::app::AttributePathParams attribute_path;
|
||||
chip::app::EventPathParams event_path;
|
||||
chip::app::CommandPathParams command_path;
|
||||
};
|
||||
uint32_t cluster_id;
|
||||
uint32_t command_id;
|
||||
void *command_data;
|
||||
command_handle() : endpoint_id(chip::kInvalidEndpointId), cluster_id(chip::kInvalidClusterId),
|
||||
command_id(chip::kInvalidCommandId), command_data(NULL){}
|
||||
command_handle(struct command_handle* cmd) : endpoint_id(cmd->endpoint_id), cluster_id(cmd->cluster_id),
|
||||
command_id(cmd->command_id), command_data(cmd->command_data) {}
|
||||
} command_handle_t;
|
||||
/* This could be the command data field when the request type is INVOKE_CMD,
|
||||
* or the attribute value data when the request type is WRITE_ATTR.
|
||||
*/
|
||||
void *request_data;
|
||||
request_handle() : type(INVOKE_CMD), request_data(NULL) {}
|
||||
request_handle(struct request_handle* req) : type(req->type), request_data(req->request_data)
|
||||
{
|
||||
if (req->type == INVOKE_CMD) {
|
||||
command_path = req->command_path;
|
||||
} else if (req->type == WRITE_ATTR || req->type == READ_ATTR || req->type == SUBSCRIBE_ATTR) {
|
||||
attribute_path = req->attribute_path;
|
||||
} else if (req->type == READ_EVENT || req->type == SUBSCRIBE_EVENT) {
|
||||
event_path = req->event_path;
|
||||
}
|
||||
}
|
||||
} request_handle_t;
|
||||
|
||||
/** Peer device handle */
|
||||
typedef chip::DeviceProxy peer_device_t;
|
||||
@@ -856,28 +880,30 @@ typedef chip::DeviceProxy peer_device_t;
|
||||
/** CASE Session Manager */
|
||||
typedef chip::CASESessionManager case_session_mgr_t;
|
||||
|
||||
/** Command send callback
|
||||
/** Request send callback
|
||||
*
|
||||
* This callback will be called when `connect()` or `cluster_update()` is called and the connection completes. The
|
||||
* send_command APIs can then be called from the callback.
|
||||
* send_request APIs can then be called from the callback.
|
||||
*
|
||||
* @param[in] peer_device Peer device handle. This can be passed to the send_command APIs.
|
||||
* @param[in] cmd_handle Command handle used by `connect()` or `cluster_update()`.
|
||||
* @param[in] req_handle Request handle used by `connect()` or `cluster_update()`.
|
||||
* @param[in] priv_data (Optional) Private data associated with the callback. This will be passed to callback. It
|
||||
* should stay allocated throughout the lifetime of the device.
|
||||
*/
|
||||
typedef void (*command_callback_t)(peer_device_t *peer_device, command_handle_t *cmd_handle, void *priv_data);
|
||||
typedef void (*request_callback_t)(peer_device_t *peer_device, request_handle_t *req_handle, void *priv_data);
|
||||
|
||||
/** Group command send callback
|
||||
/** Group request send callback
|
||||
*
|
||||
* This callback will be called when `cluster_update()` is called and the group command is triggered for binding cluster.
|
||||
* This callback will be called when `cluster_update()` is called and the group request is triggered for binding cluster.
|
||||
*
|
||||
* @note: The request type should be INVOKE_CMD and the command should not expect a response.
|
||||
*
|
||||
* @param[in] fabric_index The index of the fabric that the group command is sent to.
|
||||
* @param[in] cmd_handle Command handle used by `cluster_update()`.
|
||||
* @param[in] req_handle Request handle used by `cluster_update()`.
|
||||
* @param[in] priv_data (Optional) Private data associated with the callback. This will be passed to callback. It
|
||||
* should stay allocated throughout the lifetime of the device.
|
||||
*/
|
||||
typedef void (*group_command_callback_t)(uint8_t fabric_index, command_handle_t *cmd_handle, void *priv_data);
|
||||
typedef void (*group_request_callback_t)(uint8_t fabric_index, request_handle_t *req_handle, void *priv_data);
|
||||
|
||||
/** Initialize binding
|
||||
*
|
||||
@@ -895,59 +921,59 @@ void binding_manager_init();
|
||||
|
||||
/** Connect
|
||||
*
|
||||
* Connect to another device on the same fabric to send a command.
|
||||
* Connect to another device on the same fabric to send a request.
|
||||
*
|
||||
* @param[in] case_session_mgr CASE Session Manager to find or establish the session
|
||||
* @param[in] fabric_index Fabric index.
|
||||
* @param[in] node_id Node ID of the other device.
|
||||
* @param[in] cmd_handle Command to be sent to the remote device.
|
||||
* @param[in] req_handle Request to be sent to the remote device.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t connect(case_session_mgr_t *case_session_mgr, uint8_t fabric_index, uint64_t node_id,
|
||||
command_handle_t *cmd_handle);
|
||||
request_handle_t *req_handle);
|
||||
|
||||
/** group_command_send
|
||||
/** group_request_send
|
||||
*
|
||||
* on the same fabric to send a group command.
|
||||
* on the same fabric to send a group request.
|
||||
*
|
||||
* @param[in] fabric_index Fabric index.
|
||||
* @param[in] cmd_handle Command to be sent to the group.
|
||||
* @param[in] req_handle Request to be sent to the group.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t group_command_send(uint8_t fabric_index, command_handle_t *cmd_handle);
|
||||
esp_err_t group_request_send(uint8_t fabric_index, request_handle_t *req_handle);
|
||||
|
||||
/** Set command send callback
|
||||
/** Set request send callback
|
||||
*
|
||||
* Set the common command send callback and the group command send callback. The common callback will be called
|
||||
* Set the common request send callback and the group request send callback. The common callback will be called
|
||||
* when `connect()` or `cluster_update()` is called and the connection completes. The group callback will be called
|
||||
* when `cluster_update()` is called and the group command is triggered.
|
||||
* when `cluster_update()` is called and the group request is triggered.
|
||||
*
|
||||
* @param[in] callback command send callback.
|
||||
* @param[in] g_callback group command send callback
|
||||
* @param[in] callback request send callback.
|
||||
* @param[in] g_callback group request send callback
|
||||
* @param[in] priv_data (Optional) Private data associated with the callback. This will be passed to callback. It
|
||||
* should stay allocated throughout the lifetime of the device.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t set_command_callback(command_callback_t callback, group_command_callback_t g_callback, void *priv_data);
|
||||
esp_err_t set_request_callback(request_callback_t callback, group_request_callback_t g_callback, void *priv_data);
|
||||
|
||||
/** Cluster update
|
||||
*
|
||||
* For an already binded device, this API can be used to get the command send callback, and the send_command APIs can
|
||||
* For an already binded device, this API can be used to get the request send callback, and the send_request APIs can
|
||||
* then be called from the callback.
|
||||
*
|
||||
* @param[in] local_endpoint_id The ID of the local endpoint with a binding cluster.
|
||||
* @param[in] cmd_handle Command information to notify the bound cluster changed.
|
||||
* @param[in] req_handle Request information to notify the bound cluster changed.
|
||||
*
|
||||
* @return ESP_OK on success.
|
||||
* @return error in case of failure.
|
||||
*/
|
||||
esp_err_t cluster_update(uint16_t local_endpoint_id, command_handle_t *cmd_handle);
|
||||
esp_err_t cluster_update(uint16_t local_endpoint_id, request_handle_t *req_handle);
|
||||
|
||||
} /* client */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -1,733 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// TODO: This header is removed from upstream zap generated files. We should also remove it.
|
||||
// THIS FILE IS GENERATED BY ZAP
|
||||
#pragma once
|
||||
|
||||
#include <app-common/zap-generated/ids/Clusters.h>
|
||||
#include <app-common/zap-generated/ids/Commands.h>
|
||||
|
||||
#include <controller/CHIPCluster.h>
|
||||
#include <lib/core/CHIPCallback.h>
|
||||
#include <lib/support/Span.h>
|
||||
|
||||
namespace chip {
|
||||
namespace Controller {
|
||||
|
||||
class DLL_EXPORT IdentifyCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
IdentifyCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~IdentifyCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT GroupsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
GroupsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~GroupsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ScenesManagementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ScenesManagementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ScenesManagementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OnOffCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OnOffCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OnOffCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OnOffSwitchConfigurationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OnOffSwitchConfigurationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OnOffSwitchConfigurationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LevelControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LevelControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LevelControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BinaryInputBasicCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BinaryInputBasicCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BinaryInputBasicCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DescriptorCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DescriptorCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DescriptorCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BindingCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BindingCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BindingCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT AccessControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
AccessControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~AccessControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ActionsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ActionsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ActionsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BasicInformationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BasicInformationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BasicInformationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OtaSoftwareUpdateProviderCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OtaSoftwareUpdateProviderCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OtaSoftwareUpdateProviderCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OtaSoftwareUpdateRequestorCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OtaSoftwareUpdateRequestorCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OtaSoftwareUpdateRequestorCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LocalizationConfigurationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LocalizationConfigurationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LocalizationConfigurationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TimeFormatLocalizationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TimeFormatLocalizationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TimeFormatLocalizationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT UnitLocalizationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
UnitLocalizationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~UnitLocalizationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT PowerSourceConfigurationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
PowerSourceConfigurationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~PowerSourceConfigurationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT PowerSourceCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
PowerSourceCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~PowerSourceCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT GeneralCommissioningCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
GeneralCommissioningCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~GeneralCommissioningCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT NetworkCommissioningCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
NetworkCommissioningCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~NetworkCommissioningCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DiagnosticLogsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DiagnosticLogsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DiagnosticLogsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT GeneralDiagnosticsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
GeneralDiagnosticsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~GeneralDiagnosticsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT SoftwareDiagnosticsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
SoftwareDiagnosticsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~SoftwareDiagnosticsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ThreadNetworkDiagnosticsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ThreadNetworkDiagnosticsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ThreadNetworkDiagnosticsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT WiFiNetworkDiagnosticsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
WiFiNetworkDiagnosticsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~WiFiNetworkDiagnosticsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT EthernetNetworkDiagnosticsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
EthernetNetworkDiagnosticsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~EthernetNetworkDiagnosticsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TimeSynchronizationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TimeSynchronizationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TimeSynchronizationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BridgedDeviceBasicInformationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BridgedDeviceBasicInformationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BridgedDeviceBasicInformationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT SwitchCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
SwitchCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~SwitchCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT AdministratorCommissioningCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
AdministratorCommissioningCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~AdministratorCommissioningCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OperationalCredentialsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OperationalCredentialsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OperationalCredentialsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT GroupKeyManagementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
GroupKeyManagementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~GroupKeyManagementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT FixedLabelCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
FixedLabelCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~FixedLabelCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT UserLabelCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
UserLabelCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~UserLabelCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BooleanStateCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BooleanStateCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BooleanStateCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT IcdManagementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
IcdManagementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~IcdManagementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TimerCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TimerCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TimerCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OvenCavityOperationalStateCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OvenCavityOperationalStateCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OvenCavityOperationalStateCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OvenModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OvenModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OvenModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LaundryDryerControlsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LaundryDryerControlsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LaundryDryerControlsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ModeSelectCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ModeSelectCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ModeSelectCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LaundryWasherModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LaundryWasherModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LaundryWasherModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RefrigeratorAndTemperatureControlledCabinetModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RefrigeratorAndTemperatureControlledCabinetModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RefrigeratorAndTemperatureControlledCabinetModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LaundryWasherControlsCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LaundryWasherControlsCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LaundryWasherControlsCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RvcRunModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RvcRunModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RvcRunModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RvcCleanModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RvcCleanModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RvcCleanModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TemperatureControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TemperatureControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TemperatureControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RefrigeratorAlarmCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RefrigeratorAlarmCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RefrigeratorAlarmCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DishwasherModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DishwasherModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DishwasherModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT AirQualityCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
AirQualityCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~AirQualityCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT SmokeCoAlarmCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
SmokeCoAlarmCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~SmokeCoAlarmCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DishwasherAlarmCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DishwasherAlarmCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DishwasherAlarmCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT MicrowaveOvenModeCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
MicrowaveOvenModeCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~MicrowaveOvenModeCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OperationalStateCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OperationalStateCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OperationalStateCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RvcOperationalStateCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RvcOperationalStateCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RvcOperationalStateCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT HepaFilterMonitoringCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
HepaFilterMonitoringCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~HepaFilterMonitoringCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ActivatedCarbonFilterMonitoringCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ActivatedCarbonFilterMonitoringCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ActivatedCarbonFilterMonitoringCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DeviceEnergyManagementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DeviceEnergyManagementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DeviceEnergyManagementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT EnergyEvseCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
EnergyEvseCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~EnergyEvseCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT DoorLockCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
DoorLockCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~DoorLockCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT WindowCoveringCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
WindowCoveringCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~WindowCoveringCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BarrierControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BarrierControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BarrierControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT PumpConfigurationAndControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
PumpConfigurationAndControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~PumpConfigurationAndControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ThermostatCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ThermostatCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ThermostatCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT FanControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
FanControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~FanControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ThermostatUserInterfaceConfigurationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ThermostatUserInterfaceConfigurationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ThermostatUserInterfaceConfigurationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ColorControlCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ColorControlCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ColorControlCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT BallastConfigurationCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
BallastConfigurationCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~BallastConfigurationCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT IlluminanceMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
IlluminanceMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~IlluminanceMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TemperatureMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TemperatureMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TemperatureMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT PressureMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
PressureMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~PressureMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT FlowMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
FlowMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~FlowMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RelativeHumidityMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RelativeHumidityMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RelativeHumidityMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OccupancySensingCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OccupancySensingCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OccupancySensingCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CarbonMonoxideConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
CarbonMonoxideConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~CarbonMonoxideConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT CarbonDioxideConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
CarbonDioxideConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~CarbonDioxideConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT NitrogenDioxideConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
NitrogenDioxideConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~NitrogenDioxideConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT OzoneConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
OzoneConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~OzoneConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT Pm25ConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
Pm25ConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~Pm25ConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT FormaldehydeConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
FormaldehydeConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~FormaldehydeConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT Pm1ConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
Pm1ConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~Pm1ConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT Pm10ConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
Pm10ConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~Pm10ConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TotalVolatileOrganicCompoundsConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TotalVolatileOrganicCompoundsConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TotalVolatileOrganicCompoundsConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT RadonConcentrationMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
RadonConcentrationMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~RadonConcentrationMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT WakeOnLanCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
WakeOnLanCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~WakeOnLanCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ChannelCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ChannelCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ChannelCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT TargetNavigatorCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
TargetNavigatorCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~TargetNavigatorCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT MediaPlaybackCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
MediaPlaybackCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~MediaPlaybackCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT MediaInputCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
MediaInputCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~MediaInputCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT LowPowerCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
LowPowerCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~LowPowerCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT KeypadInputCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
KeypadInputCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~KeypadInputCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ContentLauncherCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ContentLauncherCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ContentLauncherCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT AudioOutputCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
AudioOutputCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~AudioOutputCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ApplicationLauncherCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ApplicationLauncherCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ApplicationLauncherCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ApplicationBasicCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ApplicationBasicCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ApplicationBasicCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT AccountLoginCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
AccountLoginCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~AccountLoginCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT ElectricalMeasurementCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
ElectricalMeasurementCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~ElectricalMeasurementCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT UnitTestingCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
UnitTestingCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~UnitTestingCluster() {}
|
||||
};
|
||||
|
||||
class DLL_EXPORT SampleMeiCluster : public ClusterBase
|
||||
{
|
||||
public:
|
||||
SampleMeiCluster(Messaging::ExchangeManager & exchangeManager, const SessionHandle & session, EndpointId endpoint) : ClusterBase(exchangeManager, session, endpoint) {}
|
||||
~SampleMeiCluster() {}
|
||||
};
|
||||
|
||||
} // namespace Controller
|
||||
} // namespace chip
|
||||
@@ -29,6 +29,7 @@
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter::cluster;
|
||||
using namespace esp_matter::client;
|
||||
static const char *TAG = "cluster_command";
|
||||
|
||||
namespace esp_matter {
|
||||
@@ -153,7 +154,7 @@ void cluster_command::on_device_connected_fcn(void *context, ExchangeManager &ex
|
||||
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
|
||||
chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, 0, cmd->m_cluster_id, cmd->m_command_id,
|
||||
chip::app::CommandPathFlags::kEndpointIdValid};
|
||||
custom::command::send_command(context, &device_proxy, command_path, cmd->m_command_data_field, cmd->on_success_cb,
|
||||
interaction::invoke::send_request(context, &device_proxy, command_path, cmd->m_command_data_field, cmd->on_success_cb,
|
||||
cmd->on_error_cb, chip::NullOptional);
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
@@ -218,7 +219,7 @@ esp_err_t cluster_command::dispatch_group_command(void *context)
|
||||
#endif // CONFIG_ESP_MATTER_ENABLE_MATTER_SERVER
|
||||
chip::app::CommandPathParams command_path = {cmd->m_endpoint_id, group_id, cmd->m_cluster_id, cmd->m_command_id,
|
||||
chip::app::CommandPathFlags::kGroupIdValid};
|
||||
err = custom::command::send_group_command(fabric_index, command_path, cmd->m_command_data_field);
|
||||
err = interaction::invoke::send_group_request(fabric_index, command_path, cmd->m_command_data_field);
|
||||
chip::Platform::Delete(cmd);
|
||||
return err;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ using chip::app::StatusIB;
|
||||
using chip::Messaging::ExchangeManager;
|
||||
using chip::TLV::TLVReader;
|
||||
using esp_matter::client::peer_device_t;
|
||||
using esp_matter::cluster::custom::command::custom_command_callback;
|
||||
using esp_matter::client::interaction::invoke::custom_command_callback;
|
||||
|
||||
constexpr char k_empty_command_data_field[] = "{}";
|
||||
constexpr size_t k_command_data_field_buffer_size = CONFIG_ESP_MATTER_CONTROLLER_JSON_STRING_BUFFER_LEN;
|
||||
|
||||
@@ -12,15 +12,18 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include <app/server/Server.h>
|
||||
#include <controller/CommissioneeDeviceProxy.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_matter_client.h>
|
||||
#include <esp_matter_controller_client.h>
|
||||
#include <esp_matter_controller_read_command.h>
|
||||
|
||||
#include <app/server/Server.h>
|
||||
|
||||
#include "DataModelLogger.h"
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter::client;
|
||||
using chip::DeviceProxy;
|
||||
using chip::app::InteractionModelEngine;
|
||||
using chip::app::ReadClient;
|
||||
@@ -35,30 +38,11 @@ void read_command::on_device_connected_fcn(void *context, ExchangeManager &excha
|
||||
const SessionHandle &sessionHandle)
|
||||
{
|
||||
read_command *cmd = (read_command *)context;
|
||||
ReadPrepareParams params(sessionHandle);
|
||||
|
||||
if (cmd->m_attr_paths.AllocatedSize() == 0 && cmd->m_event_paths.AllocatedSize() == 0) {
|
||||
ESP_LOGE(TAG, "Cannot send the read command with NULL attribute path and NULL event path");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
params.mpAttributePathParamsList = cmd->m_attr_paths.Get();
|
||||
params.mAttributePathParamsListSize = cmd->m_attr_paths.AllocatedSize();
|
||||
params.mpEventPathParamsList = cmd->m_event_paths.Get();
|
||||
params.mEventPathParamsListSize = cmd->m_event_paths.AllocatedSize();
|
||||
params.mIsFabricFiltered = 0;
|
||||
params.mpDataVersionFilterList = nullptr;
|
||||
params.mDataVersionFilterListSize = 0;
|
||||
|
||||
ReadClient *client = chip::Platform::New<ReadClient>(InteractionModelEngine::GetInstance(), &exchangeMgr,
|
||||
cmd->m_buffered_read_cb, ReadClient::InteractionType::Read);
|
||||
if (!client) {
|
||||
ESP_LOGE(TAG, "Failed to alloc memory for read client");
|
||||
chip::Platform::Delete(cmd);
|
||||
}
|
||||
if (CHIP_NO_ERROR != client->SendRequest(params)) {
|
||||
ESP_LOGE(TAG, "Failed to send read request");
|
||||
chip::Platform::Delete(client);
|
||||
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
|
||||
esp_err_t err = interaction::read::send_request(&device_proxy, cmd->m_attr_paths.Get(),
|
||||
cmd->m_attr_paths.AllocatedSize(), cmd->m_event_paths.Get(),
|
||||
cmd->m_event_paths.AllocatedSize(), cmd->m_buffered_read_cb);
|
||||
if (err != ESP_OK) {
|
||||
chip::Platform::Delete(cmd);
|
||||
}
|
||||
return;
|
||||
@@ -168,7 +152,6 @@ void read_command::OnDone(ReadClient *apReadClient)
|
||||
if (read_done_cb) {
|
||||
read_done_cb(m_node_id, m_attr_paths, m_event_paths);
|
||||
}
|
||||
chip::Platform::Delete(apReadClient);
|
||||
chip::Platform::Delete(this);
|
||||
}
|
||||
|
||||
|
||||
+8
-35
@@ -15,12 +15,14 @@
|
||||
#include <app/server/Server.h>
|
||||
#include <controller/CommissioneeDeviceProxy.h>
|
||||
#include <esp_log.h>
|
||||
#include <esp_matter_client.h>
|
||||
#include <esp_matter_controller_client.h>
|
||||
#include <esp_matter_controller_subscribe_command.h>
|
||||
|
||||
#include "DataModelLogger.h"
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter::client;
|
||||
using chip::DeviceProxy;
|
||||
using chip::app::InteractionModelEngine;
|
||||
using chip::app::ReadClient;
|
||||
@@ -37,40 +39,12 @@ void subscribe_command::on_device_connected_fcn(void *context, ExchangeManager &
|
||||
const SessionHandle &sessionHandle)
|
||||
{
|
||||
subscribe_command *cmd = (subscribe_command *)context;
|
||||
ReadPrepareParams params(sessionHandle);
|
||||
CHIP_ERROR err = CHIP_NO_ERROR;
|
||||
if (cmd->m_attr_paths.AllocatedSize() == 0 && cmd->m_event_paths.AllocatedSize() == 0) {
|
||||
ESP_LOGE(TAG, "Cannot send Subscribe command with NULL attribute path and NULL event path");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
params.mpAttributePathParamsList = cmd->m_attr_paths.Get();
|
||||
params.mAttributePathParamsListSize = cmd->m_attr_paths.AllocatedSize();
|
||||
params.mpEventPathParamsList = cmd->m_event_paths.Get();
|
||||
params.mEventPathParamsListSize = cmd->m_event_paths.AllocatedSize();
|
||||
params.mIsFabricFiltered = 0;
|
||||
params.mpDataVersionFilterList = nullptr;
|
||||
params.mDataVersionFilterListSize = 0;
|
||||
params.mMinIntervalFloorSeconds = cmd->m_min_interval;
|
||||
params.mMaxIntervalCeilingSeconds = cmd->m_max_interval;
|
||||
params.mKeepSubscriptions = true;
|
||||
|
||||
ReadClient *client =
|
||||
chip::Platform::New<ReadClient>(InteractionModelEngine::GetInstance(), &exchangeMgr, cmd->m_buffered_read_cb,
|
||||
ReadClient::InteractionType::Subscribe);
|
||||
if (!client) {
|
||||
ESP_LOGE(TAG, "Failed to alloc memory for read client");
|
||||
chip::Platform::Delete(cmd);
|
||||
}
|
||||
if (cmd->m_auto_resubscribe) {
|
||||
err = client->SendAutoResubscribeRequest(std::move(params));
|
||||
} else {
|
||||
err = client->SendRequest(params);
|
||||
}
|
||||
if (err != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(TAG, "Failed to send read request");
|
||||
chip::Platform::Delete(client);
|
||||
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
|
||||
esp_err_t err = interaction::subscribe::send_request(
|
||||
&device_proxy, cmd->m_attr_paths.Get(), cmd->m_attr_paths.AllocatedSize(), cmd->m_event_paths.Get(),
|
||||
cmd->m_event_paths.AllocatedSize(), cmd->m_min_interval, cmd->m_max_interval, true, cmd->m_auto_resubscribe,
|
||||
cmd->m_buffered_read_cb);
|
||||
if (err != ESP_OK) {
|
||||
chip::Platform::Delete(cmd);
|
||||
}
|
||||
return;
|
||||
@@ -200,7 +174,6 @@ CHIP_ERROR subscribe_command::OnResubscriptionNeeded(ReadClient *apReadClient, C
|
||||
void subscribe_command::OnDone(ReadClient *apReadClient)
|
||||
{
|
||||
ESP_LOGI(TAG, "Subscription 0x%" PRIx32 " Done for remote node 0x%" PRIx64, m_subscription_id, m_node_id);
|
||||
chip::Platform::Delete(apReadClient);
|
||||
if (subscribe_done_cb) {
|
||||
// This will be called when the subscription is terminated.
|
||||
subscribe_done_cb(m_node_id, m_subscription_id);
|
||||
|
||||
@@ -13,14 +13,17 @@
|
||||
// limitations under the License.
|
||||
|
||||
#include <esp_check.h>
|
||||
#include <esp_matter_client.h>
|
||||
#include <esp_matter_controller_client.h>
|
||||
#include <esp_matter_controller_utils.h>
|
||||
#include <esp_matter_controller_write_command.h>
|
||||
#include <json_to_tlv.h>
|
||||
|
||||
#include <app/OperationalSessionSetup.h>
|
||||
#include <app/server/Server.h>
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter::client;
|
||||
using chip::ByteSpan;
|
||||
using chip::DeviceProxy;
|
||||
using chip::app::DataModel::List;
|
||||
@@ -38,72 +41,16 @@ static constexpr size_t k_encoded_buf_size = chip::kMaxAppMessageLen;
|
||||
namespace esp_matter {
|
||||
namespace controller {
|
||||
|
||||
esp_err_t write_command::encode_attribute_value(uint8_t *encoded_buf, size_t encoded_buf_size,
|
||||
const char *attr_val_json_str, TLVReader &out_reader)
|
||||
{
|
||||
TLVWriter writer;
|
||||
uint32_t encoded_len = 0;
|
||||
TLVReader reader;
|
||||
|
||||
writer.Init(encoded_buf, encoded_buf_size);
|
||||
ESP_RETURN_ON_ERROR(json_to_tlv(attr_val_json_str, writer, chip::TLV::AnonymousTag()), TAG,
|
||||
"Failed to parse attribute value");
|
||||
ESP_RETURN_ON_FALSE(writer.Finalize() == CHIP_NO_ERROR, ESP_FAIL, TAG, "Failed to finalize tlv writer");
|
||||
encoded_len = writer.GetLengthWritten();
|
||||
reader.Init(encoded_buf, encoded_len);
|
||||
ESP_RETURN_ON_FALSE(reader.Next() == CHIP_NO_ERROR, ESP_FAIL, TAG, "Failed to read next");
|
||||
ESP_RETURN_ON_FALSE(reader.GetType() == TLVType::kTLVType_Structure, ESP_ERR_INVALID_ARG, TAG,
|
||||
"The TLV type must be structure");
|
||||
ESP_RETURN_ON_FALSE(reader.OpenContainer(out_reader) == CHIP_NO_ERROR, ESP_FAIL, TAG, "Failed to open container");
|
||||
ESP_RETURN_ON_FALSE(out_reader.Next() == CHIP_NO_ERROR, ESP_FAIL, TAG, "Failed to read next");
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
void write_command::on_device_connected_fcn(void *context, ExchangeManager &exchangeMgr,
|
||||
const SessionHandle &sessionHandle)
|
||||
{
|
||||
write_command *cmd = (write_command *)context;
|
||||
if (cmd->m_attr_path.HasWildcardEndpointId()) {
|
||||
ESP_LOGE(TAG, "Endpoint Id Invalid");
|
||||
chip::OperationalDeviceProxy device_proxy(&exchangeMgr, sessionHandle);
|
||||
esp_err_t err = interaction::write::send_request(&device_proxy, cmd->m_attr_path, cmd->m_attr_val_str,
|
||||
cmd->m_chunked_callback, chip::NullOptional);
|
||||
if (err != ESP_OK) {
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
ConcreteDataAttributePath path(cmd->m_attr_path.mEndpointId, cmd->m_attr_path.mClusterId,
|
||||
cmd->m_attr_path.mAttributeId);
|
||||
chip::Platform::ScopedMemoryBuffer<uint8_t> encoded_buf;
|
||||
|
||||
auto write_client = MakeUnique<WriteClient>(&exchangeMgr, &(cmd->m_chunked_callback), chip::NullOptional, false);
|
||||
if (write_client == nullptr) {
|
||||
ESP_LOGE(TAG, "Failed to alloc memory for WriteClient");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
encoded_buf.Alloc(k_encoded_buf_size);
|
||||
if (!encoded_buf.Get()) {
|
||||
ESP_LOGE(TAG, "Failed to alloc memory for encoded_buf");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
TLVReader attr_val_reader;
|
||||
if (encode_attribute_value(encoded_buf.Get(), k_encoded_buf_size, cmd->m_attr_val_str, attr_val_reader) != ESP_OK) {
|
||||
ESP_LOGE(TAG, "Failed to encode attribute value to a TLV reader");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (write_client->PutPreencodedAttribute(path, attr_val_reader) != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(TAG, "Failed to put pre-encoded attribute value to WriteClient");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (write_client->SendWriteRequest(sessionHandle) != CHIP_NO_ERROR) {
|
||||
ESP_LOGE(TAG, "Failed to Send Write Request");
|
||||
chip::Platform::Delete(cmd);
|
||||
return;
|
||||
}
|
||||
// Release the write_client as it will be managed by the callbacks
|
||||
write_client.release();
|
||||
}
|
||||
|
||||
void write_command::on_device_connection_failure_fcn(void *context, const ScopedNodeId &peerId, CHIP_ERROR error)
|
||||
|
||||
@@ -79,7 +79,6 @@ public:
|
||||
void OnDone(WriteClient *client) override
|
||||
{
|
||||
ChipLogProgress(chipTool, "Write Done");
|
||||
chip::Platform::Delete(client);
|
||||
chip::Platform::Delete(this);
|
||||
}
|
||||
|
||||
@@ -93,9 +92,6 @@ private:
|
||||
const SessionHandle &sessionHandle);
|
||||
static void on_device_connection_failure_fcn(void *context, const ScopedNodeId &peerId, CHIP_ERROR error);
|
||||
|
||||
static esp_err_t encode_attribute_value(uint8_t *encoded_buf, size_t encoded_buf_size,
|
||||
const char *attr_val_json_str, TLVReader &out_reader);
|
||||
|
||||
chip::Callback::Callback<chip::OnDeviceConnected> on_device_connected_cb;
|
||||
chip::Callback::Callback<chip::OnDeviceConnectionFailure> on_device_connection_failure_cb;
|
||||
};
|
||||
|
||||
@@ -543,7 +543,7 @@ esp_err_t controller_register_commands()
|
||||
{
|
||||
.name = "subs-event",
|
||||
.description = "Subscribe events of the nodes.\n"
|
||||
"\tUsage: controller subs-attr [node-id] [endpoint-id] [cluster-id] [event-id] "
|
||||
"\tUsage: controller subs-event [node-id] [endpoint-id] [cluster-id] [event-id] "
|
||||
"[min-interval] [max-interval]",
|
||||
.handler = controller_subscribe_event_handler,
|
||||
},
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include <app_priv.h>
|
||||
|
||||
#include <app/server/Server.h>
|
||||
#include "app/CommandPathParams.h"
|
||||
|
||||
using namespace chip::app::Clusters;
|
||||
using namespace esp_matter;
|
||||
@@ -36,10 +37,11 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
"\tinvoke: <local_endpoint_id> <cluster_id> <command_id> parameters ... \n"
|
||||
"\t\tExample: matter esp bound invoke 0x0001 0x0008 0x0000 0x50 0x0 0x1 0x1.\n");
|
||||
} else if (argc >= 4 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint16_t local_endpoint_id = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
req_handle.command_path.mClusterId = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
req_handle.command_path.mCommandId = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
|
||||
if (argc > 4) {
|
||||
console_buffer[0] = argc - 4;
|
||||
@@ -51,10 +53,10 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10*i), &argv[4+i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
|
||||
client::cluster_update(local_endpoint_id, &cmd_handle);
|
||||
client::cluster_update(local_endpoint_id, &req_handle);
|
||||
}
|
||||
else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
@@ -76,12 +78,14 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
"\tinvoke-group: <fabric_index> <group_id> <cluster_id> <command_id> parameters ... \n"
|
||||
"\t\tExample: matter esp client invoke-group 0x0001 0x257 0x0008 0x0000 0x50 0x0 0x1 0x1.\n");
|
||||
} else if (argc >= 6 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint8_t fabric_index = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
uint64_t node_id = strtoull((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.endpoint_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[4][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[5][2], NULL, 16);
|
||||
req_handle.command_path = {(chip::EndpointId)strtoul((const char *)&argv[3][2], NULL, 16) /* EndpointId */,
|
||||
0 /* GroupId */, strtoul((const char *)&argv[4][2], NULL, 16) /* ClusterId */,
|
||||
strtoul((const char *)&argv[5][2], NULL, 16) /* CommandId */,
|
||||
chip::app::CommandPathFlags::kEndpointIdValid};
|
||||
|
||||
if (argc > 6) {
|
||||
console_buffer[0] = argc - 6;
|
||||
@@ -93,17 +97,19 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10*i), &argv[6+i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
|
||||
auto &server = chip::Server::GetInstance();
|
||||
client::connect(server.GetCASESessionManager(), fabric_index, node_id, &cmd_handle);
|
||||
client::connect(server.GetCASESessionManager(), fabric_index, node_id, &req_handle);
|
||||
} else if (argc >= 5 && strncmp(argv[0], "invoke-group", sizeof("invoke-group")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint8_t fabric_index = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
cmd_handle.group_id = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[4][2], NULL, 16);
|
||||
req_handle.command_path = {
|
||||
0 /* EndpointId */, (chip::GroupId)strtoul((const char *)&argv[2][2], NULL, 16) /* GroupId */,
|
||||
strtoul((const char *)&argv[3][2], NULL, 16) /* ClusterId */,
|
||||
strtoul((const char *)&argv[4][2], NULL, 16) /* CommandId */, chip::app::CommandPathFlags::kGroupIdValid};
|
||||
|
||||
if (argc > 5) {
|
||||
console_buffer[0] = argc - 5;
|
||||
@@ -115,10 +121,10 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10*i), &argv[5+i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
|
||||
client::group_command_send(fabric_index, &cmd_handle);
|
||||
client::group_request_send(fabric_index, &req_handle);
|
||||
}else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
@@ -153,81 +159,74 @@ static void app_driver_register_commands()
|
||||
}
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
|
||||
void app_driver_client_command_callback(client::peer_device_t *peer_device, client::command_handle_t *cmd_handle,
|
||||
void *priv_data)
|
||||
static void send_command_success_callback(void *context, const ConcreteCommandPath &command_path,
|
||||
const chip::app::StatusIB &status, TLVReader *response_data)
|
||||
{
|
||||
if (cmd_handle->cluster_id == OnOff::Id) {
|
||||
switch(cmd_handle->command_id) {
|
||||
case OnOff::Commands::Off::Id:
|
||||
{
|
||||
on_off::command::send_off(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::On::Id:
|
||||
{
|
||||
on_off::command::send_on(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::Toggle::Id:
|
||||
{
|
||||
on_off::command::send_toggle(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (cmd_handle->cluster_id == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::send_identify(peer_device, cmd_handle->endpoint_id,
|
||||
strtoul((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
}
|
||||
ESP_LOGI(TAG, "Send command success");
|
||||
}
|
||||
|
||||
void app_driver_client_group_command_callback(uint8_t fabric_index, client::command_handle_t *cmd_handle, void *priv_data)
|
||||
static void send_command_failure_callback(void *context, CHIP_ERROR error)
|
||||
{
|
||||
if (cmd_handle->cluster_id == OnOff::Id) {
|
||||
switch(cmd_handle->command_id) {
|
||||
case OnOff::Commands::Off::Id:
|
||||
{
|
||||
on_off::command::group_send_off(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::On::Id:
|
||||
{
|
||||
on_off::command::group_send_on(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::Toggle::Id:
|
||||
{
|
||||
on_off::command::group_send_toggle(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (cmd_handle->cluster_id == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
ESP_LOGI(TAG, "Send command failure: err :%" CHIP_ERROR_FORMAT, error.Format());
|
||||
}
|
||||
|
||||
void app_driver_client_invoke_command_callback(client::peer_device_t *peer_device, client::request_handle_t *req_handle,
|
||||
void *priv_data)
|
||||
{
|
||||
if (req_handle->type != esp_matter::client::INVOKE_CMD ||
|
||||
!req_handle->command_path.mFlags.Has(chip::app::CommandPathFlags::kEndpointIdValid)) {
|
||||
return;
|
||||
}
|
||||
char command_data_str[32];
|
||||
if (req_handle->command_path.mClusterId == OnOff::Id) {
|
||||
strcpy(command_data_str, "{}");
|
||||
} else if (req_handle->command_path.mClusterId == Identify::Id) {
|
||||
if (req_handle->command_path.mCommandId == Identify::Commands::Identify::Id) {
|
||||
if (((char *)req_handle->request_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::group_send_identify(fabric_index, cmd_handle->group_id,
|
||||
strtoul((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
sprintf(command_data_str, "{\"0:U16\": %ld}",
|
||||
strtoul((const char *)(req_handle->request_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
return;
|
||||
}
|
||||
client::interaction::invoke::send_request(NULL, peer_device, req_handle->command_path, command_data_str,
|
||||
send_command_success_callback, send_command_failure_callback,
|
||||
chip::NullOptional);
|
||||
}
|
||||
|
||||
void app_driver_client_group_invoke_command_callback(uint8_t fabric_index, client::request_handle_t *req_handle, void *priv_data)
|
||||
{
|
||||
if (req_handle->type != esp_matter::client::INVOKE_CMD ||
|
||||
!req_handle->command_path.mFlags.Has(chip::app::CommandPathFlags::kGroupIdValid)) {
|
||||
return;
|
||||
}
|
||||
char command_data_str[32];
|
||||
if (req_handle->command_path.mClusterId == OnOff::Id) {
|
||||
strcpy(command_data_str, "{}");
|
||||
} else if (req_handle->command_path.mClusterId == Identify::Id) {
|
||||
if (req_handle->command_path.mCommandId == Identify::Commands::Identify::Id) {
|
||||
if (((char *)req_handle->request_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
sprintf(command_data_str, "{\"0:U16\": %ld}",
|
||||
strtoul((const char *)(req_handle->request_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
return;
|
||||
}
|
||||
client::interaction::invoke::send_group_request(fabric_index, req_handle->command_path, command_data_str);
|
||||
}
|
||||
|
||||
/* Do any conversions/remapping for the actual value here */
|
||||
@@ -371,7 +370,7 @@ app_driver_handle_t app_driver_button_init()
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
app_driver_register_commands();
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
client::set_command_callback(app_driver_client_command_callback, app_driver_client_group_command_callback, NULL);
|
||||
client::set_request_callback(app_driver_client_invoke_command_callback, app_driver_client_group_invoke_command_callback, NULL);
|
||||
|
||||
return (app_driver_handle_t)handle;
|
||||
}
|
||||
|
||||
@@ -35,19 +35,20 @@ static void espnow_ctrl_onoff(espnow_addr_t src_addr, bool status)
|
||||
ESP_LOGI(TAG, "ESP-NOW button pressed");
|
||||
|
||||
// Update bound light
|
||||
client::command_handle_t cmd_handle;
|
||||
cmd_handle.cluster_id = OnOff::Id;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
req_handle.command_path.mClusterId = OnOff::Id;
|
||||
if (status) {
|
||||
cmd_handle.command_id = OnOff::Commands::On::Id;
|
||||
req_handle.command_path.mCommandId = OnOff::Commands::On::Id;
|
||||
} else {
|
||||
cmd_handle.command_id = OnOff::Commands::Off::Id;
|
||||
req_handle.command_path.mCommandId = OnOff::Commands::Off::Id;
|
||||
}
|
||||
uint16_t bridged_switch_endpoint_id = app_bridge_get_matter_endpointid_by_espnow_macaddr(src_addr);
|
||||
ESP_LOGI(TAG, "Using bridge endpoint: %d", bridged_switch_endpoint_id);
|
||||
|
||||
if (bridged_switch_endpoint_id != chip::kInvalidEndpointId) {
|
||||
lock::chip_stack_lock(portMAX_DELAY);
|
||||
client::cluster_update(bridged_switch_endpoint_id, &cmd_handle);
|
||||
client::cluster_update(bridged_switch_endpoint_id, &req_handle);
|
||||
lock::chip_stack_unlock();
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Can't find endpoint for bridged device: " MACSTR, MAC2STR(src_addr));
|
||||
|
||||
@@ -6,6 +6,9 @@
|
||||
CONDITIONS OF ANY KIND, either express or implied.
|
||||
*/
|
||||
|
||||
#include "esp_matter_client.h"
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
#include <esp_log.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -18,6 +21,7 @@
|
||||
#include <app_reset.h>
|
||||
|
||||
#include <app/server/Server.h>
|
||||
#include <lib/core/Optional.h>
|
||||
|
||||
using chip::kInvalidClusterId;
|
||||
static constexpr chip::CommandId kInvalidCommandId = 0xFFFF'FFFF;
|
||||
@@ -39,10 +43,11 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
"\tinvoke: <local_endpoint_id> <cluster_id> <command_id> parameters ... \n"
|
||||
"\t\tExample: matter esp bound invoke 0x0001 0x0003 0x0000 0x78.\n");
|
||||
} else if (argc >= 4 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint16_t local_endpoint_id = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
req_handle.command_path.mClusterId = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
req_handle.command_path.mCommandId = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
|
||||
if (argc > 4) {
|
||||
console_buffer[0] = argc - 4;
|
||||
@@ -55,10 +60,10 @@ static esp_err_t app_driver_bound_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[4 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
|
||||
client::cluster_update(local_endpoint_id, &cmd_handle);
|
||||
client::cluster_update(local_endpoint_id, &req_handle);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
@@ -78,12 +83,14 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
"\tinvoke-group: <fabric_index> <group_id> <cluster_id> <command_id> parameters ... \n"
|
||||
"\t\tExample: matter esp client invoke-group 0x0001 0x257 0x0003 0x0000 0x78.\n");
|
||||
} else if (argc >= 6 && strncmp(argv[0], "invoke", sizeof("invoke")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint8_t fabric_index = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
uint64_t node_id = strtoull((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.endpoint_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[4][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[5][2], NULL, 16);
|
||||
req_handle.command_path = {(chip::EndpointId)strtoul((const char *)&argv[3][2], NULL, 16) /* EndpointId */,
|
||||
0 /* GroupId */, strtoul((const char *)&argv[4][2], NULL, 16) /* ClusterId */,
|
||||
strtoul((const char *)&argv[5][2], NULL, 16) /* CommandId */,
|
||||
chip::app::CommandPathFlags::kEndpointIdValid};
|
||||
|
||||
if (argc > 6) {
|
||||
console_buffer[0] = argc - 6;
|
||||
@@ -96,16 +103,21 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[6 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
auto &server = chip::Server::GetInstance();
|
||||
client::connect(server.GetCASESessionManager(), fabric_index, node_id, &cmd_handle);
|
||||
client::connect(server.GetCASESessionManager(), fabric_index, node_id, &req_handle);
|
||||
} else if (argc >= 5 && strncmp(argv[0], "invoke-group", sizeof("invoke-group")) == 0) {
|
||||
client::command_handle_t cmd_handle;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
uint8_t fabric_index = strtoul((const char *)&argv[1][2], NULL, 16);
|
||||
cmd_handle.group_id = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
cmd_handle.cluster_id = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
cmd_handle.command_id = strtoul((const char *)&argv[4][2], NULL, 16);
|
||||
req_handle.command_path.mGroupId = strtoul((const char *)&argv[2][2], NULL, 16);
|
||||
req_handle.command_path.mClusterId = strtoul((const char *)&argv[3][2], NULL, 16);
|
||||
req_handle.command_path.mCommandId = strtoul((const char *)&argv[4][2], NULL, 16);
|
||||
req_handle.command_path = {
|
||||
0 /* EndpointId */, (chip::GroupId)strtoul((const char *)&argv[2][2], NULL, 16) /* GroupId */,
|
||||
strtoul((const char *)&argv[3][2], NULL, 16) /* ClusterId */,
|
||||
strtoul((const char *)&argv[4][2], NULL, 16) /* CommandId */, chip::app::CommandPathFlags::kGroupIdValid};
|
||||
|
||||
if (argc > 5) {
|
||||
console_buffer[0] = argc - 5;
|
||||
@@ -118,10 +130,10 @@ static esp_err_t app_driver_client_console_handler(int argc, char **argv)
|
||||
strcpy((console_buffer + 1 + 10 * i), &argv[5 + i][2]);
|
||||
}
|
||||
|
||||
cmd_handle.command_data = console_buffer;
|
||||
req_handle.request_data = console_buffer;
|
||||
}
|
||||
|
||||
client::group_command_send(fabric_index, &cmd_handle);
|
||||
client::group_request_send(fabric_index, &req_handle);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Incorrect arguments. Check help for more details.");
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
@@ -154,89 +166,87 @@ static void app_driver_register_commands()
|
||||
}
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
|
||||
void app_driver_client_command_callback(client::peer_device_t *peer_device, client::command_handle_t *cmd_handle,
|
||||
void *priv_data)
|
||||
static void send_command_success_callback(void *context, const ConcreteCommandPath &command_path,
|
||||
const chip::app::StatusIB &status, TLVReader *response_data)
|
||||
{
|
||||
// on_off light switch should support on_off cluster and identify cluster commands sending.
|
||||
if (cmd_handle->cluster_id == OnOff::Id) {
|
||||
switch (cmd_handle->command_id) {
|
||||
case OnOff::Commands::Off::Id: {
|
||||
on_off::command::send_off(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::On::Id: {
|
||||
on_off::command::send_on(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
case OnOff::Commands::Toggle::Id: {
|
||||
on_off::command::send_toggle(peer_device, cmd_handle->endpoint_id);
|
||||
break;
|
||||
};
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (cmd_handle->cluster_id == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::send_identify(peer_device, cmd_handle->endpoint_id,
|
||||
strtoul((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
}
|
||||
ESP_LOGI(TAG, "Send command success");
|
||||
}
|
||||
|
||||
void app_driver_client_group_command_callback(uint8_t fabric_index, client::command_handle_t *cmd_handle,
|
||||
void *priv_data)
|
||||
static void send_command_failure_callback(void *context, CHIP_ERROR error)
|
||||
{
|
||||
ESP_LOGI(TAG, "Send command failure: err :%" CHIP_ERROR_FORMAT, error.Format());
|
||||
}
|
||||
|
||||
void app_driver_client_invoke_command_callback(client::peer_device_t *peer_device, client::request_handle_t *req_handle,
|
||||
void *priv_data)
|
||||
{
|
||||
if (req_handle->type != esp_matter::client::INVOKE_CMD) {
|
||||
return;
|
||||
}
|
||||
char command_data_str[32];
|
||||
// on_off light switch should support on_off cluster and identify cluster commands sending.
|
||||
if (cmd_handle->cluster_id == OnOff::Id) {
|
||||
switch (cmd_handle->command_id) {
|
||||
case OnOff::Commands::Off::Id: {
|
||||
on_off::command::group_send_off(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
}
|
||||
case OnOff::Commands::On::Id: {
|
||||
on_off::command::group_send_on(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
}
|
||||
case OnOff::Commands::Toggle::Id: {
|
||||
on_off::command::group_send_toggle(fabric_index, cmd_handle->group_id);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else if (cmd_handle->cluster_id == Identify::Id) {
|
||||
if (cmd_handle->command_id == Identify::Commands::Identify::Id) {
|
||||
if (((char *)cmd_handle->command_data)[0] != 1) {
|
||||
if (req_handle->command_path.mClusterId == OnOff::Id) {
|
||||
strcpy(command_data_str, "{}");
|
||||
} else if (req_handle->command_path.mClusterId == Identify::Id) {
|
||||
if (req_handle->command_path.mCommandId == Identify::Commands::Identify::Id) {
|
||||
if (((char *)req_handle->request_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
identify::command::group_send_identify(fabric_index, cmd_handle->group_id,
|
||||
strtoul((const char *)(cmd_handle->command_data) + 1, NULL, 16));
|
||||
sprintf(command_data_str, "{\"0:U16\": %ld}",
|
||||
strtoul((const char *)(req_handle->request_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
return;
|
||||
}
|
||||
client::interaction::invoke::send_request(NULL, peer_device, req_handle->command_path, command_data_str,
|
||||
send_command_success_callback, send_command_failure_callback,
|
||||
chip::NullOptional);
|
||||
}
|
||||
|
||||
void app_driver_client_group_invoke_command_callback(uint8_t fabric_index, client::request_handle_t *req_handle,
|
||||
void *priv_data)
|
||||
{
|
||||
if (req_handle->type != esp_matter::client::INVOKE_CMD) {
|
||||
return;
|
||||
}
|
||||
char command_data_str[32];
|
||||
// on_off light switch should support on_off cluster and identify cluster commands sending.
|
||||
if (req_handle->command_path.mClusterId == OnOff::Id) {
|
||||
strcpy(command_data_str, "{}");
|
||||
} else if (req_handle->command_path.mClusterId == Identify::Id) {
|
||||
if (req_handle->command_path.mCommandId == Identify::Commands::Identify::Id) {
|
||||
if (((char *)req_handle->request_data)[0] != 1) {
|
||||
ESP_LOGE(TAG, "Number of parameters error");
|
||||
return;
|
||||
}
|
||||
sprintf(command_data_str, "{\"0:U16\": %ld}",
|
||||
strtoul((const char *)(req_handle->request_data) + 1, NULL, 16));
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported command");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Unsupported cluster");
|
||||
return;
|
||||
}
|
||||
client::interaction::invoke::send_group_request(fabric_index, req_handle->command_path, command_data_str);
|
||||
}
|
||||
|
||||
static void app_driver_button_toggle_cb(void *arg, void *data)
|
||||
{
|
||||
ESP_LOGI(TAG, "Toggle button pressed");
|
||||
client::command_handle_t cmd_handle;
|
||||
cmd_handle.cluster_id = OnOff::Id;
|
||||
cmd_handle.command_id = OnOff::Commands::Toggle::Id;
|
||||
client::request_handle_t req_handle;
|
||||
req_handle.type = esp_matter::client::INVOKE_CMD;
|
||||
req_handle.command_path.mClusterId = OnOff::Id;
|
||||
req_handle.command_path.mCommandId = OnOff::Commands::Toggle::Id;
|
||||
|
||||
lock::chip_stack_lock(portMAX_DELAY);
|
||||
client::cluster_update(switch_endpoint_id, &cmd_handle);
|
||||
client::cluster_update(switch_endpoint_id, &req_handle);
|
||||
lock::chip_stack_unlock();
|
||||
}
|
||||
|
||||
@@ -252,7 +262,8 @@ app_driver_handle_t app_driver_switch_init()
|
||||
#if CONFIG_ENABLE_CHIP_SHELL
|
||||
app_driver_register_commands();
|
||||
#endif // CONFIG_ENABLE_CHIP_SHELL
|
||||
client::set_command_callback(app_driver_client_command_callback, app_driver_client_group_command_callback, NULL);
|
||||
client::set_request_callback(app_driver_client_invoke_command_callback,
|
||||
app_driver_client_group_invoke_command_callback, NULL);
|
||||
|
||||
return (app_driver_handle_t)btns[0];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user