]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - Readme.md
remove newline
[matrix_esp_thesis] / Readme.md
index 9475a9f20824f678c78f4fcbad87af7f0dc2e2c4..2049b21da42847e3470607165a2fe1d0f65df3f4 100644 (file)
--- a/Readme.md
+++ b/Readme.md
@@ -27,6 +27,23 @@ To build the example for the ESP32 start an ESP-IDF shell in esp32/esp_project o
 - `idf.py flash`\r
 - `idf.py monitor`\r
 \r
 - `idf.py flash`\r
 - `idf.py monitor`\r
 \r
+Examples for the ESP32 are in `esp32/esp_project/main`.\r
+There are currently two, SendEncrypted and Verify.\r
+The example can be set in `esp32/esp_project(_risc_v)/main/CMakeLists.txt` as the second argument after SRCS.\r
+\r
+Any code using the library should compile under ESP-IDF if the following code is added at the end of the file:\r
+```c\r
+#include "wifi.h"\r
+\r
+void\r
+app_main(void)\r
+{\r
+    wifi_init(WIFI_SSID, WIFI_PASSWORD);\r
+\r
+    main();\r
+}\r
+```\r
+\r
 To use the library in an ESP-IDF project:\r
 - Add the matrix and olm components (can be found in `esp32/esp_project/components/`)\r
 - Add `wifi.c/.h` (can be found in `esp32/esp_project/main/`)\r
 To use the library in an ESP-IDF project:\r
 - Add the matrix and olm components (can be found in `esp32/esp_project/components/`)\r
 - Add `wifi.c/.h` (can be found in `esp32/esp_project/main/`)\r
@@ -43,7 +60,7 @@ To use the library in an ESP-IDF project:
 ## Examples\r
 \r
 ### (De)Initialization\r
 ## Examples\r
 \r
 ### (De)Initialization\r
-```\r
+```c\r
 MatrixClient * client = (MatrixClient*)malloc(sizeof(MatrixClient));\r
 MatrixClientInit(client);\r
 \r
 MatrixClient * client = (MatrixClient*)malloc(sizeof(MatrixClient));\r
 MatrixClientInit(client);\r
 \r
@@ -51,9 +68,9 @@ MatrixHttpInit(&client->hc, SERVER);
 MatrixClientSetUserId(client, USER_ID);\r
 \r
 MatrixClientLoginPassword(client,\r
 MatrixClientSetUserId(client, USER_ID);\r
 \r
 MatrixClientLoginPassword(client,\r
-    "pscho",\r
-    "Wc23EbmB9G3faMq",\r
-    "Test1");\r
+    USERNAME,\r
+    PASSWORD,\r
+    DEVICE_NAME);\r
 \r
 MatrixClientDeleteDevice(client);\r
     \r
 \r
 MatrixClientDeleteDevice(client);\r
     \r
@@ -61,23 +78,22 @@ MatrixHttpDeinit(&client->hc);
 ```\r
 \r
 ### Uploading keys\r
 ```\r
 \r
 ### Uploading keys\r
-```\r
+```c\r
 MatrixClientGenerateOnetimeKeys(client, 10);\r
 MatrixClientUploadOnetimeKeys(client);\r
 MatrixClientUploadDeviceKeys(client);\r
 ```\r
 \r
 ### Sending an encrypted message\r
 MatrixClientGenerateOnetimeKeys(client, 10);\r
 MatrixClientUploadOnetimeKeys(client);\r
 MatrixClientUploadDeviceKeys(client);\r
 ```\r
 \r
 ### Sending an encrypted message\r
-```\r
+```c\r
 MatrixMegolmOutSession * megolmOutSession;\r
 MatrixClientNewMegolmOutSession(&client,\r
     ROOM_ID,\r
     &megolmOutSession);\r
 MatrixMegolmOutSession * megolmOutSession;\r
 MatrixClientNewMegolmOutSession(&client,\r
     ROOM_ID,\r
     &megolmOutSession);\r
-printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key);\r
 \r
 MatrixClientShareMegolmOutSession(&client,\r
     USER_ID,\r
 \r
 MatrixClientShareMegolmOutSession(&client,\r
     USER_ID,\r
-    "ULZZOKJBYN",\r
+    DEVICE_ID2,\r
     megolmOutSession);\r
 \r
 MatrixClientSendEventEncrypted(&client,\r
     megolmOutSession);\r
 \r
 MatrixClientSendEventEncrypted(&client,\r
@@ -87,7 +103,7 @@ MatrixClientSendEventEncrypted(&client,
 ```\r
 \r
 ### Verification\r
 ```\r
 \r
 ### Verification\r
-```\r
+```c\r
 // Request an encrypted event to enable verification\r
 STATIC char eventBuffer[1024];\r
 MatrixClientGetRoomEvent(client,\r
 // Request an encrypted event to enable verification\r
 STATIC char eventBuffer[1024];\r
 MatrixClientGetRoomEvent(client,\r
@@ -102,4 +118,4 @@ STATIC char nextBatch[1024];
 while (! client->verified) {\r
     MatrixClientSync(client, syncBuffer, SYNC_BUFFER_SIZE, nextBatch, 1024);\r
 }\r
 while (! client->verified) {\r
     MatrixClientSync(client, syncBuffer, SYNC_BUFFER_SIZE, nextBatch, 1024);\r
 }\r
-```
\ No newline at end of file
+```\r