diff options
| author | patrick-scho | 2023-11-13 20:01:31 +0100 |
|---|---|---|
| committer | patrick-scho | 2023-11-13 20:01:31 +0100 |
| commit | 0b5fc6b640af6f13fe56a6e77598d96db78bb56c (patch) | |
| tree | b95967549e81c1fbdaf97171fd10bf34b174f8ce /esp32/esp_project/main | |
| parent | 7dd7c5d0397c942b903bbe22e3fcf12386bf358b (diff) | |
| download | matrix_esp_thesis-0b5fc6b640af6f13fe56a6e77598d96db78bb56c.tar.gz matrix_esp_thesis-0b5fc6b640af6f13fe56a6e77598d96db78bb56c.zip | |
update esp_project
Diffstat (limited to 'esp32/esp_project/main')
| -rw-r--r-- | esp32/esp_project/main/Verify.c | 72 |
1 files changed, 67 insertions, 5 deletions
diff --git a/esp32/esp_project/main/Verify.c b/esp32/esp_project/main/Verify.c index 0ac7183..989b151 100644 --- a/esp32/esp_project/main/Verify.c +++ b/esp32/esp_project/main/Verify.c @@ -2,6 +2,13 @@ #include <mjson.h> #include <olm/sas.h> +#if !CONFIG_IDF_TARGET_LINUX +#include "freertos/FreeRTOS.h" +#include "freertos/task.h" +#include "esp_system.h" +#include "driver/gpio.h" +#endif + #include <stdio.h> #define SERVER "https://matrix.org" @@ -513,11 +520,51 @@ main(void) } printf("verified!\n"); + + // create and share megolm out session + MatrixMegolmOutSession * megolmOutSession; + MatrixClientNewMegolmOutSession(client, + ROOM_ID, + &megolmOutSession); + printf("megolm session id: %.10s... key: %.10s...\n", megolmOutSession->id, megolmOutSession->key); + MatrixClientShareMegolmOutSession(client, + USER_ID, + "ULZZOKJBYN", + megolmOutSession); + - int c; - while ((c=getchar()) != 'q') { - printf("getchar() = %c [%d]\n", c, c); - Sync(client, syncBuffer, SYNC_BUFFER_SIZE); + // int c; + // while ((c=getchar()) != 'q') { + // vTaskDelay(1000/portTICK_PERIOD_MS); + + // if (c == 's') { + // Sync(client, syncBuffer, SYNC_BUFFER_SIZE); + // } + // else if (c == 'm') { + // static const char * msgs[] = { "A", "B", "C" }; + // static char msg[128]; + // snprintf(msg, 128, "{\"body\":\"%s\",\"msgtype\":\"m.text\"}", msgs[rand()%(sizeof(msgs)/sizeof(msgs[0]))]); + + // MatrixClientSendEventEncrypted(client, + // ROOM_ID, + // "m.room.message", + // msg); + // printf("Message sent. Message index: %d\n", (int)olm_outbound_group_session_message_index(megolmOutSession->session)); + // } + // } + + for (int i = 0; i < 10; i++) { + + static const char * msgs[] = { "A", "B", "C" }; + static char msg[128]; + snprintf(msg, 128, "{\"body\":\"%s\",\"msgtype\":\"m.text\"}", msgs[rand()%(sizeof(msgs)/sizeof(msgs[0]))]); + + MatrixClientSendEventEncrypted(client, + ROOM_ID, + "m.room.message", + msg); + + vTaskDelay(5000/portTICK_PERIOD_MS); } // MatrixClientRequestMegolmInSession(client, @@ -553,11 +600,26 @@ main(void) } #include "wifi.h" +#include <esp_netif.h> void app_main(void) { - wifi_init("Hundehuette", "Affensicherespw55"); + // wifi_init("Pixel_7762", "affeaffe"); + // wifi_init("Hundehuette", "Affensicherespw55"); + wifi_init("test", "/O801i25"); + + esp_netif_ip_info_t ip_info; + esp_netif_get_ip_info(IP_EVENT_STA_GOT_IP,&ip_info); + printf("My IP: " IPSTR "\n", IP2STR(&ip_info.ip)); + printf("My GW: " IPSTR "\n", IP2STR(&ip_info.gw)); + printf("My NETMASK: " IPSTR "\n", IP2STR(&ip_info.netmask)); + + // uint64_t bitmask = 0xffffffffffffffff; + // bitmask = bitmask & SOC_GPIO_VALID_GPIO_MASK; + // gpio_dump_io_configuration(stdout, bitmask); + gpio_set_direction(GPIO_NUM_2, GPIO_MODE_OUTPUT); + // gpio_dump_io_configuration(stdout, bitmask); main(); } |
