abouttreesummaryrefslogcommitdiff
path: root/esp32/esp_project/main
diff options
context:
space:
mode:
authorPatrick2023-07-13 13:44:26 +0200
committerPatrick2023-07-13 13:44:26 +0200
commit10325eaf40c80eb91f1c1eceea880c3abd54efd7 (patch)
treee160ff671e0b4404148b0e389e3d630b62fc191e /esp32/esp_project/main
parent6646bd126f9faf1e687b203512d29da243acaa90 (diff)
downloadmatrix_esp_thesis-10325eaf40c80eb91f1c1eceea880c3abd54efd7.tar.gz
matrix_esp_thesis-10325eaf40c80eb91f1c1eceea880c3abd54efd7.zip
added esp project
Diffstat (limited to 'esp32/esp_project/main')
-rw-r--r--esp32/esp_project/main/CMakeLists.txt2
-rw-r--r--esp32/esp_project/main/main.c40
2 files changed, 42 insertions, 0 deletions
diff --git a/esp32/esp_project/main/CMakeLists.txt b/esp32/esp_project/main/CMakeLists.txt
new file mode 100644
index 0000000..8d26c93
--- /dev/null
+++ b/esp32/esp_project/main/CMakeLists.txt
@@ -0,0 +1,2 @@
+idf_component_register(SRCS "main.c"
+ INCLUDE_DIRS "") \ No newline at end of file
diff --git a/esp32/esp_project/main/main.c b/esp32/esp_project/main/main.c
new file mode 100644
index 0000000..d53fdf7
--- /dev/null
+++ b/esp32/esp_project/main/main.c
@@ -0,0 +1,40 @@
+/*
+ * SPDX-FileCopyrightText: 2010-2022 Espressif Systems (Shanghai) CO LTD
+ *
+ * SPDX-License-Identifier: CC0-1.0
+ */
+
+#define OLMLIB_VERSION_MAJOR 3
+#define OLMLIB_VERSION_MINOR 2
+#define OLMLIB_VERSION_PATCH 15
+
+#define OLM_STATIC_DEFINE
+
+#include <mongoose.h>
+#include <olm/olm.h>
+#include <matrix.h>
+
+#define SERVER "https://matrix.org"
+#define ACCESS_TOKEN "syt_cHNjaG8_yBvTjVTquGCikvsAenOJ_49mBMO"
+#define DEVICE_ID "MAZNCCZLBR"
+#define ROOM_ID "!koVStwyiiKcBVbXZYz:matrix.org"
+
+void
+app_main(void)
+{
+ MatrixClient client;
+ MatrixClientInit(&client,
+ SERVER);
+
+ MatrixHttpInit(&client);
+
+ MatrixClientSetAccessToken(&client,
+ ACCESS_TOKEN);
+
+ MatrixClientSendEvent(&client,
+ ROOM_ID,
+ "m.room.message",
+ "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
+
+ MatrixHttpDeinit(&client);
+}