sMQTTBroker
sMQTTplatform.h
1 #ifndef SMQTTPLATFORM_FILE
2 #define SMQTTPLATFORM_FILE
3 
4 #define SMQTT_DEPRECATED(msg) [[deprecated(msg)]]
5 
6 #if defined(WIN32)
7 class TCPClient {
8 public:
9  bool available() { return false; };
10  char read() { return 0; }
11  bool connected() {
12  return false;
13  }
14  void stop() {}
15  void write(const char *, int) {}
16 };
17 class TCPServer {
18 public:
19  TCPServer(short) {}
20  void begin() {}
21 };
22 #define SMQTT_LOGD
23 #elif defined(ESP8266)
24 #include <ESP8266WiFi.h>
25 #define TCPClient WiFiClient
26 #define TCPServer WiFiServer
27 #if defined(DEBUG_ESP_PORT)
28 #define SMQTT_LOGD(...) DEBUG_ESP_PORT.printf(__VA_ARGS__)
29 #else
30 #define SMQTT_LOGD(...)
31 #endif
32 #elif defined(ESP32)
33 #include <WiFi.h>
34 #ifdef SMQTT_WT32_ETH01
35 #include <ETH.h>
36 #endif
37 #define TCPClient WiFiClient
38 #define TCPServer WiFiServer
39 static const char *SMQTTTAG = "sMQTTBroker";
40 #define SMQTT_LOGD(...) ESP_LOGD(SMQTTTAG,__VA_ARGS__)
41 #else
42 #error "unknown platform"
43 #endif
44 
45 #endif