My Project
 All Classes Functions Variables Pages
AWS.h
1 /*
2  * AWS.h
3  *
4  * Created on: May 31, 2017
5  * Author: kolban
6  */
7 
8 #ifndef COMPONENTS_AWS_H_
9 #define COMPONENTS_AWS_H_
10 #include "sdkconfig.h"
11 #ifdef CONFIG_AWS_IOT_SDK
12 
13 #include <aws_iot_mqtt_client_interface.h>
14 #include <aws_iot_mqtt_client.h>
15 #include <string>
16 
20 class AWS {
21 public:
22  AWS();
23  virtual ~AWS();
24 
25  void connect(std::string clientId);
26  void disconnect();
27  static std::string errorToString(IoT_Error_t err); // Convert an AWS IoT error code to a string representation.
28  void init(std::string host=CONFIG_AWS_IOT_MQTT_HOST, uint16_t port=CONFIG_AWS_IOT_MQTT_PORT);
29  void publish(std::string topic, std::string payload, QoS qos = QOS0);
30  void subscribe(std::string topic);
31  void unsubscribe(std::string topic);
32 
33 private:
34  AWS_IoT_Client m_client;
35 };
36 #endif // CONFIG_AWS_IOT_SDK
37 #endif /* COMPONENTS_AWS_H_ */