|
RF24Ethernet - TCP/IP over RF24Network v2.0.3
TMRh20 - Pushing the practical limits of RF24 modules
|
#include <RF24Client.h>
Classes | |
| struct | ConnectState |
Public Member Functions | |
| RF24Client () | |
| int | connect (IPAddress ip, uint16_t port) |
| int | connect (const char *host, uint16_t port) |
| int | read (uint8_t *buf, size_t size) |
| int | read () |
| void | stop () |
| uint8_t | connected () |
| size_t | write (uint8_t) |
| size_t | write (const uint8_t *buf, size_t size) |
| int | available () |
| int | waitAvailable (uint32_t timeout=750) |
| int | peek () |
| void | flush () |
| operator bool () | |
| virtual bool | operator== (const EthernetClient &) |
| virtual bool | operator!= (const EthernetClient &rhs) |
Protected Member Functions | |
| struct RF24Client::ConnectState | __attribute__ ((packed)) |
Static Protected Member Functions | |
| static err_t | sent_callback (void *arg, struct tcp_pcb *tpcb, uint16_t len) |
| static err_t | recv_callback (void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) |
| static err_t | srecv_callback (void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err) |
| static void | error_callback (void *arg, err_t err) |
Static Protected Attributes | |
| static ConnectState * | gState [2] |
| static bool | activeState |
Friends | |
| class | RF24EthernetClass |
| class | RF24Server |
Definition at line 95 of file RF24Client.h.
| RF24Client::RF24Client | ( | ) |
| int RF24Client::connect | ( | IPAddress | ip, |
| uint16_t | port ) |
Establish a connection to a specified IP address and port
Definition at line 623 of file RF24Client.cpp.
References activeState, error_callback(), Ethernet, finished, gState, IF_RF24ETHERNET_DEBUG_CLIENT, recv_callback(), result, stop(), and UIP_CONNECTION_TIMEOUT.
Referenced by connect().
| int RF24Client::connect | ( | const char * | host, |
| uint16_t | port ) |
Establish a connection to a given hostname and port
Definition at line 780 of file RF24Client.cpp.
References DNSClient::begin(), connect(), and DNSClient::getHostByName().
| int RF24Client::read | ( | uint8_t * | buf, |
| size_t | size ) |
Read available data into a buffer
Definition at line 1306 of file RF24Client.cpp.
References activeState, available(), and IF_ETH_DEBUG_L2.
| int RF24Client::read | ( | ) |
Read data one byte at a time
Definition at line 1376 of file RF24Client.cpp.
References read().
| void RF24Client::stop | ( | ) |
Disconnects from the current active connection
Definition at line 832 of file RF24Client.cpp.
References IF_RF24ETHERNET_DEBUG_CLIENT, and RF24Ethernet.
Referenced by connect().
| uint8_t RF24Client::connected | ( | ) |
Indicates whether the client is connected or not When using slower devices < 50MHz (uIP stack) there is a default connection timeout of 45 seconds. If data is not received or sent successfully within that timeframe the client will be disconnected. With faster devices > 50Mhz (lwIP stack), there is NO default connection timeout. Use the clientConnectionTimeout functions to set the timeout on connect or disconnect, and utilize application side timeouts to disconnect as necessary after a connection has been established.
Definition at line 609 of file RF24Client.cpp.
References activeState, and gState.
| size_t RF24Client::write | ( | uint8_t | c | ) |
Write a single byte of data to the stream
Definition at line 926 of file RF24Client.cpp.
| size_t RF24Client::write | ( | const uint8_t * | buf, |
| size_t | size ) |
Write a buffer of data, to be sent in a single TCP packet
Definition at line 933 of file RF24Client.cpp.
| int RF24Client::available | ( | ) |
Indicates whether data is available to be read by the client.
Definition at line 1272 of file RF24Client.cpp.
References RF24Ethernet.
Referenced by flush(), peek(), read(), and waitAvailable().
| int RF24Client::waitAvailable | ( | uint32_t | timeout = 750 | ) |
Wait Available
Helps to ensure all incoming data has been received, prior to writing data back to the client, etc.
Indicates whether data is available to be read by the client, after waiting a maximum period of time.
Definition at line 1256 of file RF24Client.cpp.
References available(), and RF24Ethernet.
| int RF24Client::peek | ( | ) |
Read a byte from the incoming buffer without advancing the point of reading
Definition at line 1386 of file RF24Client.cpp.
References activeState, and available().
| void RF24Client::flush | ( | ) |
Flush all incoming client data from the current connection/buffer
Definition at line 1401 of file RF24Client.cpp.
References available(), and read().
| RF24Client::operator bool | ( | ) |
Definition at line 914 of file RF24Client.cpp.
References activeState, and Ethernet.
|
virtual |
Definition at line 903 of file RF24Client.cpp.
References activeState, and RF24Client().
Referenced by __attribute__().
|
inlinevirtual |
Definition at line 183 of file RF24Client.h.
|
protected |
References EthernetClient, and operator==().
|
staticprotected |
Used internally when data is ACKed
|
staticprotected |
Used internally for receiving data via the client functions
Referenced by connect().
|
staticprotected |
Used internally for receiving data via the server functions
|
staticprotected |
Used internally when there is an error
Referenced by RF24Server::begin(), connect(), and RF24EthernetClass::listen().
|
friend |
Definition at line 281 of file RF24Client.h.
References RF24EthernetClass.
Referenced by RF24EthernetClass.
|
friend |
|
staticprotected |
Connection states
Definition at line 218 of file RF24Client.h.
Referenced by RF24Server::begin(), connect(), connected(), RF24EthernetClass::listen(), and RF24EthernetClass::RF24EthernetClass().
|
staticprotected |
Used to set client timeouts. Whenever there is no data sent, received, or acked in the given timeout period (mS) the connection will be closed. Set to 0 to disable
Definition at line 233 of file RF24Client.h.
Referenced by connect(), connected(), operator bool(), operator==(), peek(), and read().