Skip to content

Commit e6dcada

Browse files
committedSep 24, 2024·
Merge branch 'Add_secondary_network_interface_device' into 'main'
Added secondary network interface device type in esp-matter See merge request app-frameworks/esp-matter!887
2 parents 131c1ae + e8df098 commit e6dcada

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
 

‎SUPPORTED_DEVICE_TYPES.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Utility Device Types
1010
5. Bridged Node
1111
6. Electrical Sensor
1212
7. Device Energy Management
13+
8. Secondary Network Interface
1314

1415
Application Device Types
1516

‎components/esp_matter/esp_matter_endpoint.cpp

+31
Original file line numberDiff line numberDiff line change
@@ -1919,6 +1919,37 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
19191919

19201920
} /* thread_border_router */
19211921

1922+
namespace secondary_network_interface {
1923+
uint32_t get_device_type_id()
1924+
{
1925+
return ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID;
1926+
}
1927+
1928+
uint8_t get_device_type_version()
1929+
{
1930+
return ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION;
1931+
}
1932+
1933+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data)
1934+
{
1935+
return common::create<config_t>(node, config, flags, priv_data, add);
1936+
}
1937+
1938+
esp_err_t add(endpoint_t *endpoint, config_t *config)
1939+
{
1940+
VerifyOrReturnError(endpoint != nullptr, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Endpoint cannot be NULL"));
1941+
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
1942+
if (err != ESP_OK) {
1943+
ESP_LOGE(TAG, "Failed to add device type id:%" PRIu32 ",err: %d", get_device_type_id(), err);
1944+
return err;
1945+
}
1946+
1947+
network_commissioning::create(endpoint, &(config->network_commissioning), CLUSTER_FLAG_SERVER);
1948+
1949+
return ESP_OK;
1950+
}
1951+
} /* secondary_network_interface */
1952+
19221953
} /* endpoint */
19231954

19241955
namespace node {

‎components/esp_matter/esp_matter_endpoint.h

+14
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@
130130
#define ESP_MATTER_WATER_VALVE_DEVICE_TYPE_VERSION 1
131131
#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_ID 0x050D
132132
#define ESP_MATTER_DEVICE_ENERGY_MANAGEMENT_DEVICE_TYPE_VERSION 1
133+
#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_ID 0x0019
134+
#define ESP_MATTER_SECONDARY_NETWORK_INTERFACE_DEVICE_TYPE_VERSION 1
133135

134136
#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID 0x0091
135137
#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 1
@@ -869,6 +871,18 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
869871
esp_err_t add(endpoint_t *endpoint, config_t *config);
870872
} /* thread_border_router */
871873

874+
namespace secondary_network_interface {
875+
typedef struct config {
876+
cluster::descriptor::config_t descriptor;
877+
cluster::network_commissioning::config_t network_commissioning;
878+
} config_t;
879+
880+
uint32_t get_device_type_id();
881+
uint8_t get_device_type_version();
882+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data);
883+
esp_err_t add(endpoint_t *endpoint, config_t *config);
884+
} /* secondary_network_interface */
885+
872886
} /* endpoint */
873887

874888
namespace node {

0 commit comments

Comments
 (0)
Please sign in to comment.