abouttreesummaryrefslogcommitdiff
path: root/esp32/esp_project/main/main.c
blob: f4d3c8c81d373bf39aaf51f393dc7d2ce32f7fa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * 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>

#include <esp_wifi.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);
    
    void wifi_init(const char *ssid, const char *pass);
    wifi_init("Hundehuette", "Affensicherespw55");

    MatrixHttpInit(&client);

    MatrixClientSetAccessToken(&client,
        ACCESS_TOKEN);

    MatrixClientSendEvent(&client,
        ROOM_ID,
        "m.room.message",
        "{\"body\":\"Hello\",\"msgtype\":\"m.text\"}");
        
    MatrixHttpDeinit(&client);
}