X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/38913d046a6bac123a5e4a0adc450eb719f4c6e2..be730e09b6376a40fd3852d5a2c8876b27c2c7bb:/Readme.md?ds=inline diff --git a/Readme.md b/Readme.md index 614808e..9475a9f 100644 --- a/Readme.md +++ b/Readme.md @@ -7,8 +7,12 @@ Device verification is also supported. ## Building Building requires a C/C++ compiler and make. + To build the dependencies run `make deps`. +All dependencies are included in this repository. + To build any of the examples run `make out/examples/`. + To use the library: - Add `src/matrix.c` to compilation - Add either `src/matrix_http_mongoose.c` or `src/matrix_http_esp32.c` to compilation @@ -18,13 +22,51 @@ To use the library: - Add include path `ext/mjson/src/` - Add include path `ext/mongoose/` +To build the example for the ESP32 start an ESP-IDF shell in esp32/esp_project or esp32/esp_project_riscv and run: +- `idf.py build` +- `idf.py flash` +- `idf.py monitor` + +To use the library in an ESP-IDF project: +- Add the matrix and olm components (can be found in `esp32/esp_project/components/`) +- Add `wifi.c/.h` (can be found in `esp32/esp_project/main/`) +- Add `SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fpermissive")` to CMakeLists.txt +- Call `wifi_init("", "")` before initializing the library + ## Dependencies [Mongoose](https://github.com/cesanta/mongoose) + [mjson](https://github.com/cesanta/mjson) + [Olm](https://gitlab.matrix.org/matrix-org/olm) ## Examples +### (De)Initialization +``` +MatrixClient * client = (MatrixClient*)malloc(sizeof(MatrixClient)); +MatrixClientInit(client); + +MatrixHttpInit(&client->hc, SERVER); +MatrixClientSetUserId(client, USER_ID); + +MatrixClientLoginPassword(client, + "pscho", + "Wc23EbmB9G3faMq", + "Test1"); + +MatrixClientDeleteDevice(client); + +MatrixHttpDeinit(&client->hc); +``` + +### Uploading keys +``` +MatrixClientGenerateOnetimeKeys(client, 10); +MatrixClientUploadOnetimeKeys(client); +MatrixClientUploadDeviceKeys(client); +``` + ### Sending an encrypted message ``` MatrixMegolmOutSession * megolmOutSession;