A UDP class which makes sure that we can use UDP as AudioSource and AudioSink. By default the WiFiUDP object is used and we login to wifi if the ssid and password is provided and we are not already connected.
More...
#include <UDPStream.h>
|
|
| UDPStream ()=default |
| | Default Constructor.
|
| |
| | UDPStream (const char *ssid, const char *password) |
| | Convinience constructor which defines the optional ssid and password.
|
| |
| | UDPStream (UDP &udp) |
| | Constructor which defines an alternative UDP object. By default we use WiFiUDP.
|
| |
| void | setUDP (UDP &udp) |
| | Defines an alternative UDP object. By default we use WiFiUDP.
|
| |
| int | availableForWrite () |
| |
| int | available () override |
| |
|
bool | begin (IPAddress a, uint16_t port) |
| | Starts to send data to the indicated address / port.
|
| |
|
bool | begin (uint16_t port, uint16_t port_ext=0) |
| | Starts to receive data from/with the indicated port.
|
| |
|
bool | beginMulticast (IPAddress address, uint16_t port) |
| | Starts to receive data in multicast from/with the indicated address / port.
|
| |
|
uint16_t | remotePort () |
| | We use the same remote port as defined in begin for write.
|
| |
|
IPAddress | remoteIP () |
| | We use the same remote ip as defined in begin for write.
|
| |
| size_t | write (const uint8_t *data, size_t len) override |
| | Replys will be sent to the initial remote caller.
|
| |
| size_t | readBytes (uint8_t *data, size_t len) override |
| | Reads bytes using WiFi::readBytes.
|
| |
|
void | setSSID (const char *ssid) |
| |
|
void | setPassword (const char *pwd) |
| |
|
| BaseStream (BaseStream &)=default |
| |
|
BaseStream & | operator= (BaseStream &)=default |
| |
| virtual bool | begin () |
| |
| virtual void | end () |
| |
| virtual size_t | readBytes (uint8_t *data, size_t len) STREAM_READ_OVERRIDE=0 |
| |
| virtual size_t | write (const uint8_t *data, size_t len) override=0 |
| |
|
virtual size_t | write (uint8_t ch) override |
| |
| virtual int | available () |
| |
| virtual int | availableForWrite () |
| |
|
virtual void | flush () override |
| |
|
virtual size_t | readBytes (char *data, size_t len) STREAM_READCHAR_OVERRIDE |
| |
|
virtual int | read () override |
| |
|
virtual int | peek () override |
| |
|
void | setWriteBufferSize (int size) |
| |
|
|
void | printIP () |
| |
|
void | connect () |
| | connect to WIFI if necessary
|
| |
|
void | refillReadBuffer () |
| |
|
|
WiFiUDP | default_udp |
| |
|
UDP * | p_udp = &default_udp |
| |
|
uint16_t | remote_port_ext = 0 |
| |
|
IPAddress | remote_address_ext |
| |
|
const char * | ssid = nullptr |
| |
|
const char * | password = nullptr |
| |
|
RingBuffer< uint8_t > | tmp_in {0} |
| |
|
RingBuffer< uint8_t > | tmp_out {0} |
| |
|
int | write_buffer_size = MAX_SINGLE_CHARS |
| |
A UDP class which makes sure that we can use UDP as AudioSource and AudioSink. By default the WiFiUDP object is used and we login to wifi if the ssid and password is provided and we are not already connected.
- Author
- Phil Schatzmann
◆ UDPStream() [1/2]
| UDPStream |
( |
const char * |
ssid, |
|
|
const char * |
password |
|
) |
| |
|
inline |
Convinience constructor which defines the optional ssid and password.
- Parameters
-
◆ UDPStream() [2/2]
Constructor which defines an alternative UDP object. By default we use WiFiUDP.
- Parameters
-
◆ available()
Provides the available size of the current package and if this is used up of the next package
Reimplemented from BaseStream.
◆ availableForWrite()
| int availableForWrite |
( |
| ) |
|
|
inlinevirtual |
Always return 1492 (MTU 1500 - 8 byte header) as UDP packet available to write
Reimplemented from BaseStream.
◆ readBytes()
| size_t readBytes |
( |
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
Reads bytes using WiFi::readBytes.
Implements BaseStream.
◆ setUDP()
Defines an alternative UDP object. By default we use WiFiUDP.
- Parameters
-
◆ write()
| size_t write |
( |
const uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
|
inlineoverridevirtual |
Replys will be sent to the initial remote caller.
Implements BaseStream.
The documentation for this class was generated from the following file: