Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Client.h 1.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Client.h - Base class that provides Client
  3. Copyright (c) 2011 Adrian McEwen. All right reserved.
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with this library; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  15. Modified by Marcelo Aquino <marceloaqno@gmail.org> for MySensors use
  16. */
  17. #ifndef client_h
  18. #define client_h
  19. #include "Stream.h"
  20. #include "IPAddress.h"
  21. #if !DOXYGEN
  22. class Client : public Stream
  23. {
  24. public:
  25. virtual int connect(IPAddress ip, uint16_t port) = 0;
  26. virtual int connect(const char *host, uint16_t port) = 0;
  27. virtual size_t write(uint8_t) = 0;
  28. virtual size_t write(const uint8_t *buf, size_t size) = 0;
  29. virtual int available() = 0;
  30. virtual int read() = 0;
  31. virtual int read(uint8_t *buf, size_t size) = 0;
  32. virtual int peek() = 0;
  33. virtual void flush() = 0;
  34. virtual void stop() = 0;
  35. virtual uint8_t connected() = 0;
  36. virtual operator bool() = 0;
  37. protected:
  38. uint8_t* rawIPAddress(IPAddress& addr)
  39. {
  40. return addr.raw_address();
  41. };
  42. };
  43. #endif
  44. #endif