-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathConnectionProvider.h
More file actions
52 lines (41 loc) · 1.7 KB
/
ConnectionProvider.h
File metadata and controls
52 lines (41 loc) · 1.7 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
#ifndef LIB_AGRIROUTERCLIENT_INC_CONNECTIONPROVIDER_H_
#define LIB_AGRIROUTERCLIENT_INC_CONNECTIONPROVIDER_H_
#include "Settings.h"
#include <string>
#include <vector>
class ConnectionProvider
{
public:
// Send message and calls callback function when receiving a response
virtual void sendMessage(MessageParameters messageParameters) = 0;
// Get messages and calls callback function when receiving a response
virtual void getMessages(void) = 0;
// Used to onboard to agrirouter
virtual void onboard(MessageParameters messageParameters) {}
virtual ~ConnectionProvider() {}
virtual void renewConnection() {}
// Function pointer for callback functions
typedef size_t (*Callback)(char *content, size_t size, size_t nmemb, void *member);
// Setter and Getter
void setSettings(Settings *settings);
Settings *getSettings();
void setBody(std::string body);
std::string getBody();
void setUrl(std::string url);
std::string getUrl();
void setHeaders(std::vector<std::string> headers);
std::vector<std::string> getHeaders();
void setCallback(Callback callback);
Callback getCallback();
void setMember(void *member);
void *getMember();
protected:
Settings *m_settings = nullptr;
std::string m_body = "";
std::string m_url = "";
std::vector<std::string> m_headers = std::vector<std::string>();
std::string m_applicationMessageId = "";
Callback m_callback;
void *m_member = nullptr;
};
#endif // LIB_AGRIROUTERCLIENT_INC_CONNECTIONPROVIDER_H_