forked from adamvr/XMPPArduino
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathXMPPClient.h
More file actions
executable file
·60 lines (43 loc) · 1 KB
/
XMPPClient.h
File metadata and controls
executable file
·60 lines (43 loc) · 1 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef _H_XMPP_CLIENT
#define _H_XMPP_CLIENT
#include <Base64.h>
#include <Ethernet.h>
#include <EthernetClient.h>
#include <string.h>
#include <stdarg.h>
#include <avr/pgmspace.h>
enum XMPPState {
INIT,
AUTH,
AUTH_STREAM,
BIND,
SESS,
READY,
WAIT
};
class XMPPClient : public EthernetClient {
private:
char *username;
char *server;
char *password;
char *resource;
XMPPState state;
// variables to recive messages
char recBuffer[600];
char recMsg[100];
int sendTemplate(const prog_char *strTemplate, int fillLen, ...);
int openStream(char *server);
int authenticate(char *username, char *password);
int bindResource(char *resource);
int openSession(char *server);
void processInput();
int stateAction();
public:
bool tryConnect;
int xmppLogin(char *server, char *username, char *password, char *resource, byte *macAddress);
int sendMessage(char *recipientJid, char *message);
int sendPresence();
char * receiveMessage();
int close();
};
#endif /* _H_XMPP_CLIENT */