RF24Ethernet - TCP/IP over RF24Network v2.0.1
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
RF24UDP Class Reference

#include <RF24Udp.h>

Inheritance diagram for RF24UDP:

Public Member Functions

 RF24UDP ()
 Constructor.
uint8_t begin (uint16_t)
 initialize, start listening on specified port.
void stop ()
 Finish with the UDP socket.
int beginPacket (IPAddress ip, uint16_t port)
 Sending UDP packets.
int beginPacket (const char *host, uint16_t port)
int endPacket ()
 Finish off this packet and send it.
size_t write (uint8_t)
 Write a single byte into the packet.
size_t write (const uint8_t *buffer, size_t size)
 Write size bytes from buffer into the packet.
int parsePacket ()
int available ()
int read ()
int read (unsigned char *buffer, size_t len)
int read (char *buffer, size_t len)
int peek ()
void flush ()
IPAddress remoteIP ()
uint16_t remotePort ()

Friends

class RF24EthernetClass
class RF24Client
void uipudp_appcall (void)

Detailed Description

Definition at line 59 of file RF24Udp.h.

Constructor & Destructor Documentation

◆ RF24UDP()

RF24UDP::RF24UDP ( )

Constructor.

Definition at line 58 of file RF24Udp.cpp.

Member Function Documentation

◆ begin()

uint8_t RF24UDP::begin ( uint16_t port)

initialize, start listening on specified port.

Returns
1 if successful, 0 if there are no sockets available to use

Definition at line 65 of file RF24Udp.cpp.

◆ stop()

void RF24UDP::stop ( )

Finish with the UDP socket.

Definition at line 96 of file RF24Udp.cpp.

◆ beginPacket() [1/2]

int RF24UDP::beginPacket ( IPAddress ip,
uint16_t port )

Sending UDP packets.

Start building up a packet to send to the remote host specific in ip and port

Returns
1 if successful, 0 if there was a problem with the supplied IP address or port

Definition at line 124 of file RF24Udp.cpp.

References IF_RF24ETHERNET_DEBUG_UDP.

Referenced by beginPacket().

◆ beginPacket() [2/2]

int RF24UDP::beginPacket ( const char * host,
uint16_t port )

Start building up a packet to send to the remote host specific in host and port

Returns
1 if successful, 0 if there was a problem resolving the hostname or port

Definition at line 203 of file RF24Udp.cpp.

References DNSClient::begin(), beginPacket(), DNSClient::getHostByName(), and RF24Ethernet.

◆ endPacket()

int RF24UDP::endPacket ( )

Finish off this packet and send it.

Returns
1 if the packet was sent successfully, 0 if there was an error

Definition at line 245 of file RF24Udp.cpp.

References IF_RF24ETHERNET_DEBUG_UDP.

◆ write() [1/2]

size_t RF24UDP::write ( uint8_t c)

Write a single byte into the packet.

Definition at line 273 of file RF24Udp.cpp.

References write().

Referenced by write().

◆ write() [2/2]

size_t RF24UDP::write ( const uint8_t * buffer,
size_t size )

Write size bytes from buffer into the packet.

Definition at line 281 of file RF24Udp.cpp.

References RF24Client::all_data, and IF_RF24ETHERNET_DEBUG_UDP.

◆ parsePacket()

int RF24UDP::parsePacket ( )

Start processing the next available incoming packet

Returns
The size of the packet in bytes, or 0 if no packets are available

Definition at line 306 of file RF24Udp.cpp.

References IF_RF24ETHERNET_DEBUG_UDP.

◆ available()

int RF24UDP::available ( )

Number of bytes remaining in the current packet

Definition at line 333 of file RF24Udp.cpp.

◆ read() [1/3]

int RF24UDP::read ( )

Read a single byte from the current packet

Definition at line 346 of file RF24Udp.cpp.

References read().

Referenced by flush(), read(), and read().

◆ read() [2/3]

int RF24UDP::read ( unsigned char * buffer,
size_t len )

Read up to len bytes from the current packet and place them into buffer

Returns
The number of bytes read, or 0 if none are available

Definition at line 360 of file RF24Udp.cpp.

References RF24Client::all_data.

◆ read() [3/3]

int RF24UDP::read ( char * buffer,
size_t len )
inline

Read up to len characters from the current packet and place them into buffer

Returns
The number of characters read, or 0 if none are available

Definition at line 148 of file RF24Udp.h.

References read().

◆ peek()

int RF24UDP::peek ( )
Returns
The next byte from the current packet without moving on to the next byte

Definition at line 397 of file RF24Udp.cpp.

References RF24Client::all_data.

◆ flush()

void RF24UDP::flush ( )

< Finish reading the current packet

Definition at line 419 of file RF24Udp.cpp.

References read().

◆ remoteIP()

IPAddress RF24UDP::remoteIP ( )

Return the IP address of the host who sent the current incoming packet

Definition at line 435 of file RF24Udp.cpp.

◆ remotePort()

uint16_t RF24UDP::remotePort ( )

Return the port of the host who sent the current incoming packet

Definition at line 456 of file RF24Udp.cpp.

◆ RF24EthernetClass

friend class RF24EthernetClass
friend

Definition at line 168 of file RF24Udp.h.

References RF24EthernetClass.

Referenced by RF24EthernetClass.

◆ RF24Client

friend class RF24Client
friend

Definition at line 169 of file RF24Udp.h.

References RF24Client.

Referenced by RF24Client.

◆ uipudp_appcall

void uipudp_appcall ( void )
friend

Definition at line 473 of file RF24Udp.cpp.

References RF24Client::all_data, IF_RF24ETHERNET_DEBUG_UDP, and UDPBUF.