-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathSim5320MQTT.h
35 lines (28 loc) · 922 Bytes
/
Sim5320MQTT.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
/*
Sim5320MQTT..h - Library for MQTT protocol on SIM5320.
Created by Boris Deletic, October 30, 2018.
Released into the public domain.
*/
#ifndef Sim5320_h
#define Sim5320_h
#include <Arduino.h>
#include <SimInterface.h>
class SimMQTT
{
public:
SimMQTT(const int simSerialRX, const int simSerialTX, const int simPowerPin, String network, String IP);
bool MqttOpen(const char* const brokerUrl, const char* const brokerPort);
bool MqttConnect(const char* clientId, const char* username = "", const char* password = "");
bool MqttSubscribe(const char* topic);
bool MqttPublish(const char* const topic, const char* const msg);
bool MqttPingreq();
void genRandomID(char *s, const int len);
void setLogging(Stream *pntSer, bool verbosity);
private:
SimInterface interface;
Stream* logSer;
SoftwareSerial Sim5320;
bool _gDebug = false;
bool verifyResponse(const char MQTT_ACK);
};
#endif