mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'mock-account-login-delegate' into 'main'
example/all-device: Add empty mock delegate for account login cluster. See merge request app-frameworks/esp-matter!1213
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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> & nodeId)
|
||||
{
|
||||
// Implement your own logic here.
|
||||
ESP_LOGE(LOG_TAG, "%s is not implemented", __func__);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MockAccountLoginDelegate::HandleLogout(const chip::Optional<NodeId> & nodeId)
|
||||
{
|
||||
// Implement your own logic here.
|
||||
ESP_LOGE(LOG_TAG, "%s is not implemented", __func__);
|
||||
return true;
|
||||
}
|
||||
|
||||
void MockAccountLoginDelegate::HandleGetSetupPin(CommandResponseHelper<Commands::GetSetupPINResponse::Type> & 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
|
||||
@@ -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 <app-common/zap-generated/cluster-objects.h>
|
||||
|
||||
#include <app/clusters/account-login-server/account-login-delegate.h>
|
||||
|
||||
/*
|
||||
* 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> & nodeId) override;
|
||||
bool HandleLogout(const chip::Optional<NodeId> & nodeId) override;
|
||||
void HandleGetSetupPin(CommandResponseHelper<Commands::GetSetupPINResponse::Type> & 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
|
||||
Reference in New Issue
Block a user