ws_common.hpp 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #pragma once
  2. #include <tiny_websockets/ws_config_defs.hpp>
  3. #include <string>
  4. #include <Arduino.h>
  5. namespace websockets {
  6. typedef std::string WSString;
  7. typedef String WSInterfaceString;
  8. namespace internals {
  9. WSString fromInterfaceString(const WSInterfaceString& str);
  10. WSString fromInterfaceString(const WSInterfaceString&& str);
  11. WSInterfaceString fromInternalString(const WSString& str);
  12. WSInterfaceString fromInternalString(const WSString&& str);
  13. }
  14. }
  15. #ifdef ESP8266
  16. #define PLATFORM_DOES_NOT_SUPPORT_BLOCKING_READ
  17. #include <tiny_websockets/network/esp8266/esp8266_tcp.hpp>
  18. #define WSDefaultTcpClient websockets::network::Esp8266TcpClient
  19. #define WSDefaultTcpServer websockets::network::Esp8266TcpServer
  20. #ifndef _WS_CONFIG_NO_SSL
  21. // OpenSSL Dependent
  22. #define WSDefaultSecuredTcpClient websockets::network::SecuredEsp8266TcpClient
  23. #endif //_WS_CONFIG_NO_SSL
  24. #elif defined(ESP32)
  25. #define PLATFORM_DOES_NOT_SUPPORT_BLOCKING_READ
  26. #include <tiny_websockets/network/esp32/esp32_tcp.hpp>
  27. #define WSDefaultTcpClient websockets::network::Esp32TcpClient
  28. #define WSDefaultTcpServer websockets::network::Esp32TcpServer
  29. #ifndef _WS_CONFIG_NO_SSL
  30. // OpenSSL Dependent
  31. #define WSDefaultSecuredTcpClient websockets::network::SecuredEsp32TcpClient
  32. #endif //_WS_CONFIG_NO_SSL
  33. #elif defined(ARDUINO_TEENSY41)
  34. #define PLATFORM_DOES_NOT_SUPPORT_BLOCKING_READ
  35. #define _WS_CONFIG_NO_SSL
  36. #include <tiny_websockets/network/teensy41/teensy41_tcp_client.hpp>
  37. #include <tiny_websockets/network/teensy41/teensy41_tcp_server.hpp>
  38. #define WSDefaultTcpClient websockets::network::Teensy41TcpClient
  39. #define WSDefaultTcpServer websockets::network::Teensy41TcpServer
  40. #endif