pubsubclient/AAL/Client.h

35 lines
744 B
C
Raw Permalink Normal View History

#ifndef _CLIENT_H_
#define _CLIENT_H_
2020-11-12 12:29:42 +01:00
#include <stdlib.h>
#include <stdint.h>
#include <Arduino.h>
#include <IPAddress.h>
2020-11-12 12:29:42 +01:00
const int SUCCESS = 1;
const int TIMED_OUT = -1;
const int INVALID_SERVER = -2;
const int TRUNCATED = -3;
const int INVALID_RESPONSE = -4;
const uint32_t TIMEOUT_MS = 1000;
class Client {
private:
const uint8_t sockNum;
public:
Client(const uint8_t sockNum);
int connect(const char *host, uint16_t port);
int connect(IPAddress ip, uint16_t port);
int available();
void stop();
int read();
size_t write(const uint8_t *buf, size_t size);
size_t write(uint8_t b);
void flush();
uint8_t connected();
};
#endif // _CLIENT_H_