RedFlyServer.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef REDFLYSERVER_h
  2. #define REDFLYSERVER_h
  3. #include <inttypes.h>
  4. #if (defined(__AVR__) || defined(ARDUINO_ARCH_AVR))
  5. # include <avr/pgmspace.h>
  6. #endif
  7. #include "Print.h"
  8. #include "RedFly.h"
  9. #include "Server.h"
  10. class RedFlyServer : public Server
  11. {
  12. public:
  13. RedFlyServer(void);
  14. RedFlyServer(uint16_t port);
  15. ~RedFlyServer(void);
  16. virtual void begin(void); //same as connect()
  17. virtual void beginUDP(void); //same as connect()
  18. virtual int connect(void);
  19. virtual int connectUDP(void);
  20. virtual int connect(uint16_t port);
  21. virtual int connectUDP(uint16_t port);
  22. int connectSocket(uint8_t p);
  23. virtual uint8_t connected(void);
  24. virtual void stop(void);
  25. uint8_t status(void);
  26. uint8_t getsocket(void);
  27. void getip(uint8_t *ip);
  28. uint16_t getport(void);
  29. virtual int available(void);
  30. virtual int read(void);
  31. virtual int read(uint8_t *s, size_t sz);
  32. //virtual int peek(void); //not available
  33. virtual void flush(void);
  34. virtual size_t write(uint8_t b);
  35. virtual size_t write(const char *s);
  36. virtual size_t write(const uint8_t *s, size_t sz);
  37. virtual size_t print_P(PGM_P s);
  38. virtual size_t println_P(PGM_P s);
  39. virtual operator bool();
  40. using Print::write;
  41. private:
  42. uint16_t s_port;
  43. uint8_t s_socket;
  44. uint8_t c_ip[4];
  45. uint16_t c_port;
  46. uint8_t proto, error;
  47. };
  48. #endif //REDFLYSERVER_h