Skip to content

Commit c60f155

Browse files
committed
Merge branch 'add-doorbell-device-types' into 'main'
Add door bell, audio doorbell and video doorbell device types See merge request app-frameworks/esp-matter!1532
2 parents 1487530 + 2ad062d commit c60f155

2 files changed

Lines changed: 132 additions & 0 deletions

File tree

components/esp_matter/data_model/legacy/esp_matter_endpoint.cpp

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,97 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
23362336
return ESP_OK;
23372337
}
23382338
} /* irrigation_system */
2339+
2340+
namespace doorbell {
2341+
uint32_t get_device_type_id()
2342+
{
2343+
return ESP_MATTER_DOORBELL_DEVICE_TYPE_ID;
2344+
}
2345+
2346+
uint8_t get_device_type_version()
2347+
{
2348+
return ESP_MATTER_DOORBELL_DEVICE_TYPE_VERSION;
2349+
}
2350+
2351+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data)
2352+
{
2353+
return common::create<config_t>(node, config, flags, priv_data, add);
2354+
}
2355+
2356+
esp_err_t add(endpoint_t *endpoint, config_t *config)
2357+
{
2358+
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
2359+
VerifyOrReturnError(err == ESP_OK, err);
2360+
2361+
cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
2362+
cluster_t *switch_cluster = cluster::switch_cluster::create(endpoint, &(config->switch_cluster), CLUSTER_FLAG_SERVER);
2363+
cluster::switch_cluster::feature::momentary_switch::add(switch_cluster);
2364+
cluster::chime::create(endpoint, NULL, CLUSTER_FLAG_CLIENT);
2365+
2366+
return ESP_OK;
2367+
}
2368+
2369+
} /* doorbell */
2370+
2371+
namespace audio_doorbell {
2372+
uint32_t get_device_type_id()
2373+
{
2374+
return ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_ID;
2375+
}
2376+
2377+
uint8_t get_device_type_version()
2378+
{
2379+
return ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_VERSION;
2380+
}
2381+
2382+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data)
2383+
{
2384+
return common::create<config_t>(node, config, flags, priv_data, add);
2385+
}
2386+
2387+
esp_err_t add(endpoint_t *endpoint, config_t *config)
2388+
{
2389+
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
2390+
VerifyOrReturnError(err == ESP_OK, err);
2391+
2392+
cluster::identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
2393+
cluster::switch_cluster::create(endpoint, &(config->switch_cluster), CLUSTER_FLAG_SERVER);
2394+
cluster_t *camera_av_stream_management = cluster::camera_av_stream_management::create(endpoint, &(config->camera_av_stream_management), CLUSTER_FLAG_SERVER);
2395+
cluster::camera_av_stream_management::feature::audio::add(camera_av_stream_management);
2396+
cluster::webrtc_transport_provider::create(endpoint, &(config->webrtc_transport_provider), CLUSTER_FLAG_SERVER);
2397+
cluster::webrtc_transport_requestor::create(endpoint, NULL, CLUSTER_FLAG_CLIENT);
2398+
cluster::chime::create(endpoint, NULL, CLUSTER_FLAG_CLIENT);
2399+
2400+
return ESP_OK;
2401+
}
2402+
2403+
} /* audio_doorbell */
2404+
2405+
namespace video_doorbell {
2406+
uint32_t get_device_type_id()
2407+
{
2408+
return ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_ID;
2409+
}
2410+
2411+
uint8_t get_device_type_version()
2412+
{
2413+
return ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_VERSION;
2414+
}
2415+
2416+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data)
2417+
{
2418+
return common::create<config_t>(node, config, flags, priv_data, add);
2419+
}
2420+
2421+
esp_err_t add(endpoint_t *endpoint, config_t *config)
2422+
{
2423+
esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version());
2424+
VerifyOrReturnError(err == ESP_OK, err);
2425+
2426+
return ESP_OK;
2427+
}
2428+
2429+
} /* video_doorbell */
23392430
} /* endpoint */
23402431

23412432
namespace node {

components/esp_matter/data_model/legacy/esp_matter_endpoint_impl.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,12 @@
171171
#define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION 1
172172
#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID 0x0040
173173
#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION 1
174+
#define ESP_MATTER_DOORBELL_DEVICE_TYPE_ID 0x0148
175+
#define ESP_MATTER_DOORBELL_DEVICE_TYPE_VERSION 1
176+
#define ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_ID 0x0143
177+
#define ESP_MATTER_VIDEO_DOORBELL_DEVICE_TYPE_VERSION 1
178+
#define ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_ID 0x0141
179+
#define ESP_MATTER_AUDIO_DOORBELL_DEVICE_TYPE_VERSION 1
174180

175181
namespace esp_matter {
176182

@@ -1215,6 +1221,41 @@ uint8_t get_device_type_version();
12151221
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data);
12161222
esp_err_t add(endpoint_t *endpoint, config_t *config);
12171223
}
1224+
1225+
namespace doorbell {
1226+
typedef struct config : app_base_config {
1227+
cluster::switch_cluster::config_t switch_cluster;
1228+
} config_t;
1229+
1230+
uint32_t get_device_type_id();
1231+
uint8_t get_device_type_version();
1232+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data);
1233+
esp_err_t add(endpoint_t *endpoint, config_t *config);
1234+
} /* doorbell */
1235+
1236+
namespace audio_doorbell {
1237+
typedef struct config : app_base_config {
1238+
cluster::switch_cluster::config_t switch_cluster;
1239+
cluster::camera_av_stream_management::config_t camera_av_stream_management;
1240+
cluster::webrtc_transport_provider::config_t webrtc_transport_provider;
1241+
} config_t;
1242+
1243+
uint32_t get_device_type_id();
1244+
uint8_t get_device_type_version();
1245+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data);
1246+
esp_err_t add(endpoint_t *endpoint, config_t *config);
1247+
} /* audio_doorbell */
1248+
1249+
namespace video_doorbell {
1250+
typedef struct config {
1251+
cluster::descriptor::config_t descriptor;
1252+
} config_t;
1253+
1254+
uint32_t get_device_type_id();
1255+
uint8_t get_device_type_version();
1256+
endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data);
1257+
esp_err_t add(endpoint_t *endpoint, config_t *config);
1258+
} /* video_doorbell */
12181259
} /* endpoint */
12191260

12201261
namespace node {

0 commit comments

Comments
 (0)