diff --git a/examples/all_device_types_app/main/CMakeLists.txt b/examples/all_device_types_app/main/CMakeLists.txt index 249a419a6..6e56510cd 100644 --- a/examples/all_device_types_app/main/CMakeLists.txt +++ b/examples/all_device_types_app/main/CMakeLists.txt @@ -1,5 +1,5 @@ -set(SRC_DIRS_LIST ".") -set(INCLUDE_DIRS_LIST ".") +set(SRC_DIRS_LIST "." "mock_delegates") +set(INCLUDE_DIRS_LIST "." "mock_delegates") set(ldfragments linker.lf) # set(PRIV_REQUIRES_LIST device esp_matter esp_matter_console esp_matter_thread_br app_reset console fatfs hal) diff --git a/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp new file mode 100644 index 000000000..273a796ec --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.cpp @@ -0,0 +1,62 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#include "esp_log.h" + +#include "mock_account_login_delegate.h" + +namespace chip { +namespace app { +namespace Clusters { +namespace AccountLogin { + +void MockAccountLoginDelegate::SetSetupPin(char * setupPin) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); +} + +bool MockAccountLoginDelegate::HandleLogin(const chip::CharSpan & tempAccountIdentifierString, const chip::CharSpan & setupPinString, + const chip::Optional & nodeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +bool MockAccountLoginDelegate::HandleLogout(const chip::Optional & nodeId) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return true; +} + +void MockAccountLoginDelegate::HandleGetSetupPin(CommandResponseHelper & helper, + const chip::CharSpan & tempAccountIdentifierString) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); +} + +void MockAccountLoginDelegate::GetSetupPin(char * setupPin, size_t setupPinSize, const chip::CharSpan & tempAccountIdentifierString) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); +} + +uint16_t MockAccountLoginDelegate::GetClusterRevision(chip::EndpointId endpoint) +{ + // Implement your own logic here. + ESP_LOGE(LOG_TAG, "%s is not implemented", __func__); + return 0; +} + +} // namespace AccountLogin +} // namespace Clusters +} // namespace app +} // namespace chip diff --git a/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.h b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.h new file mode 100644 index 000000000..2f3c3d738 --- /dev/null +++ b/examples/all_device_types_app/main/mock_delegates/mock_account_login_delegate.h @@ -0,0 +1,51 @@ +/* + This example code is in the Public Domain (or CC0 licensed, at your option.) + + Unless required by applicable law or agreed to in writing, this + software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR + CONDITIONS OF ANY KIND, either express or implied. +*/ + +#pragma once + +#include + +#include + +/* + * Mock AccountLogin Delegate Implementation + * This file provides a mock implementation of the AccountLogin::Delegate interface + * that returns success for all methods. + * For more details, take a look at the delegate interface in the Matter SDK. + * 1. Delegate Interface: https://github.com/project-chip/connectedhomeip/blob/master/src/app/clusters/account-login-server/account-login-delegate.h + * 2. Delegate Implementation: https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-app/android/include/account-login/AccountLoginManager.h and + * https://github.com/project-chip/connectedhomeip/blob/master/examples/tv-app/android/include/account-login/AccountLoginManager.cpp + */ + +namespace chip { +namespace app { +namespace Clusters { +namespace AccountLogin { + +class MockAccountLoginDelegate : public Delegate +{ +public: + MockAccountLoginDelegate() = default; + + void SetSetupPin(char * setupPin) override; + bool HandleLogin(const chip::CharSpan & tempAccountIdentifierString, const chip::CharSpan & setupPinString, + const chip::Optional & nodeId) override; + bool HandleLogout(const chip::Optional & nodeId) override; + void HandleGetSetupPin(CommandResponseHelper & helper, + const chip::CharSpan & tempAccountIdentifierString) override; + void GetSetupPin(char * setupPin, size_t setupPinSize, const chip::CharSpan & tempAccountIdentifierString) override; + uint16_t GetClusterRevision(chip::EndpointId endpoint) override; + +private: + const char *LOG_TAG = "account_login"; +}; + +} // namespace AccountLogin +} // namespace Clusters +} // namespace app +} // namespace chip