Jack Hansdampf / UIPEthernet
Committer:
hudakz
Date:
Thu Nov 20 21:26:54 2014 +0000
Revision:
1:01c2344f98a3
Parent:
uitility/Client.h@0:5350a66d5279
rev. 01

Who changed what in which revision?

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