espressif / esp-matter

Espressif's SDK for Matter
Apache License 2.0
652 stars 153 forks source link

How to use ESP Data Model instead of CHIP data model (.zap) on project: connectedhomeip/example/bridge-app/linux (CON-623) #512

Open LongND0105 opened 1 year ago

LongND0105 commented 1 year ago

How to use ESP Data Model instead of CHIP data model (.zap) on project: connectedhomeip/example/bridge-app/linux

"Hi, I am working on the Zigbee to Matter Bridge project on Raspberry Pi 4. I don't want to use the macros provided by CHIP to create dynamic endpoints. Instead, I want to utilize the ESP Data Model in the ESP Matter SDK. Therefore, I have made some modifications to the ESP library, such as replacing ESP_LOG functions with printf, etc. However, I am unsure about how to import it into my project. Can someone show me how?"

My project directory like: Screenshot from 2023-07-13 15-57-15

dhrishi commented 1 year ago

@LongND0105

How to use ESP Data Model instead of CHIP data model (.zap) on project: connectedhomeip/example/bridge-app/linux

The dynamic data model is primarily defined for ESP SoCs, through the Espressif's SDK for Matter (esp-matter). It involves using dynamic memory allocation of data structures around endpoints, clusters, attributes, commands etc and some callbacks for events and attribute updates. You can check components/esp_matter for each of the entities and include them appropriately. In addition to that, some changes related to integrating the zap with the dynamic data model will be required which you should find at components/esp_matter/zap_common/ and components/esp_matter/esp_matter_core.cpp

LongND0105 commented 1 year ago

Thank you. However I would like to know a more detailed way like how to write the BUILD.gn file to add these library files to my project. Also when I build it gives an error of undefined references to some ember callback function or Matter plugin function. Thank you very much.

shubhamdp commented 1 month ago

@LongND0105 you can find the gn build system documentation here: https://gn.googlesource.com/gn/+/main/docs/reference.md.

In connectedhomeip, ESP32 uses the gn build system through create_args_gn.py conversion script. This is all triggered from the cmake build system.

You can find the examples in the connectedhomeip repository. You can do a find . -bame BUILD.gn to get the list of example files, here's one: https://github.com/project-chip/connectedhomeip/blob/master/src/BUILD.gn

Also when I build it gives an error of undefined references to some ember callback function or Matter plugin function

Are you still facing this problem?