-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnefit-easy.h
41 lines (32 loc) · 1.04 KB
/
nefit-easy.h
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
#ifndef NEFIT_EASY_H
#define NEFIT_EASY_H
#include <sys/queue.h>
#include <json-c/json.h>
#include <openssl/aes.h>
#include <strophe.h>
#define EASY_UNUSED(var) (void)(var)
struct nefit_easy;
typedef void (netif_easy_callback)(struct nefit_easy *easy, json_object *new_obj);
struct request {
STAILQ_ENTRY(request) next;
char *http_req; /* HTTP request to send to the thermostat */
};
struct nefit_easy
{
int connected;
int busy;
AES_KEY aesKeyEnc;
AES_KEY aesKeyDec;
xmpp_conn_t *xmpp_conn;
xmpp_ctx_t *xmpp_ctx;
char *gateway;
STAILQ_HEAD(requests, request) requests;
netif_easy_callback *cb;
};
int easy_connect(struct nefit_easy *easy, const char *serial, char const *access_key,
char const *password, netif_easy_callback *cb);
int easy_get(struct nefit_easy *easy, char const *url);
int easy_put_object(struct nefit_easy *easy, char const *url, json_object *obj);
int easy_put_double(struct nefit_easy *easy, char const *url, double value);
int easy_put_string(struct nefit_easy *easy, char const *url, char const *value);
#endif