mbed OS5
Fork of UIPEthernet by
utility/Client.h@9:e55652bed36c, 2017-08-06 (annotated)
- Committer:
- pilotak
- Date:
- Sun Aug 06 16:01:26 2017 +0000
- Revision:
- 9:e55652bed36c
- Parent:
- 8:4acb22344932
mBed OS5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hudakz | 4:d774541a34da | 1 | /* |
hudakz | 4:d774541a34da | 2 | Client.h - Base class that provides Client |
hudakz | 4:d774541a34da | 3 | Copyright (c) 2011 Adrian McEwen. All right reserved. |
hudakz | 4:d774541a34da | 4 | |
hudakz | 4:d774541a34da | 5 | Modified (ported to mbed) by Zoltan Hudak <hudakz@inbox.com> |
hudakz | 4:d774541a34da | 6 | |
hudakz | 4:d774541a34da | 7 | This library is free software; you can redistribute it and/or |
hudakz | 4:d774541a34da | 8 | modify it under the terms of the GNU Lesser General Public |
hudakz | 4:d774541a34da | 9 | License as published by the Free Software Foundation; either |
hudakz | 4:d774541a34da | 10 | version 2.1 of the License, or (at your option) any later version. |
hudakz | 4:d774541a34da | 11 | |
hudakz | 4:d774541a34da | 12 | This library is distributed in the hope that it will be useful, |
hudakz | 4:d774541a34da | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
hudakz | 4:d774541a34da | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
hudakz | 4:d774541a34da | 15 | Lesser General Public License for more details. |
hudakz | 4:d774541a34da | 16 | |
hudakz | 4:d774541a34da | 17 | You should have received a copy of the GNU Lesser General Public |
hudakz | 4:d774541a34da | 18 | License along with this library; if not, write to the Free Software |
hudakz | 4:d774541a34da | 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
hudakz | 4:d774541a34da | 20 | */ |
hudakz | 4:d774541a34da | 21 | #ifndef client_h |
hudakz | 8:4acb22344932 | 22 | #define client_h |
hudakz | 8:4acb22344932 | 23 | #include "IPAddress.h" |
hudakz | 4:d774541a34da | 24 | |
hudakz | 4:d774541a34da | 25 | class Client |
hudakz | 4:d774541a34da | 26 | { |
hudakz | 4:d774541a34da | 27 | public: |
hudakz | 4:d774541a34da | 28 | virtual int connect(IPAddress ip, uint16_t port) = 0; |
hudakz | 4:d774541a34da | 29 | virtual int connect(const char* host, uint16_t port) = 0; |
hudakz | 4:d774541a34da | 30 | virtual size_t write(uint8_t) = 0; |
hudakz | 4:d774541a34da | 31 | virtual size_t write(const uint8_t* buf, size_t size) = 0; |
hudakz | 4:d774541a34da | 32 | virtual int available(void) = 0; |
hudakz | 4:d774541a34da | 33 | virtual int read(void) = 0; |
hudakz | 4:d774541a34da | 34 | virtual int read(uint8_t* buf, size_t size) = 0; |
hudakz | 4:d774541a34da | 35 | virtual int peek(void) = 0; |
hudakz | 4:d774541a34da | 36 | virtual void flush(void) = 0; |
hudakz | 4:d774541a34da | 37 | virtual void stop(void) = 0; |
hudakz | 4:d774541a34da | 38 | virtual uint8_t connected(void) = 0; |
hudakz | 4:d774541a34da | 39 | virtual operator bool(void) = 0; |
hudakz | 4:d774541a34da | 40 | protected: |
hudakz | 4:d774541a34da | 41 | uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; |
hudakz | 4:d774541a34da | 42 | }; |
hudakz | 4:d774541a34da | 43 | #endif |