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