mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Controller: Make the commissioner feature optional
This commit is contained in:
@@ -14,7 +14,11 @@
|
||||
|
||||
#include <controller/CommissioneeDeviceProxy.h>
|
||||
#include <esp_log.h>
|
||||
#if CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
|
||||
#include <esp_matter_commissioner.h>
|
||||
#else
|
||||
#include <app/server/Server.h>
|
||||
#endif
|
||||
#include <esp_matter_controller_read_command.h>
|
||||
|
||||
#include "DataModelLogger.h"
|
||||
@@ -74,11 +78,19 @@ void read_command::on_device_connection_failure_fcn(void *context, const ScopedN
|
||||
|
||||
esp_err_t read_command::send_command()
|
||||
{
|
||||
#if CONFIG_ESP_MATTER_COMMISSIONER_ENABLE
|
||||
if (CHIP_NO_ERROR ==
|
||||
commissioner::get_device_commissioner()->GetConnectedDevice(m_node_id, &on_device_connected_cb,
|
||||
&on_device_connection_failure_cb)) {
|
||||
return ESP_OK;
|
||||
}
|
||||
#else
|
||||
chip::Server *server = &(chip::Server::GetInstance());
|
||||
server->GetCASESessionManager()->FindOrEstablishSession(ScopedNodeId(m_node_id, /* fabric index */ 1),
|
||||
&on_device_connected_cb, &on_device_connection_failure_cb);
|
||||
return ESP_OK;
|
||||
#endif
|
||||
|
||||
chip::Platform::Delete(this);
|
||||
return ESP_FAIL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user