|
NanoOcp
Minimal AES70 / OCP.1 TCP client/server library for d&b Soundscape devices
|
Abstract base class shared by NanoOcp1Client and NanoOcp1Server.
More...
#include <NanoOcp1.h>
Inheritance diagram for NanoOcp1::NanoOcp1Base:Public Member Functions | |
| NanoOcp1Base (const juce::String &address, const int port) | |
| virtual | ~NanoOcp1Base () |
| void | setAddress (const juce::String &address) |
| Sets the IP address or hostname of the remote OCA device. | |
| const juce::String & | getAddress () |
| Returns the current target address. | |
| void | setPort (const int port) |
| Sets the TCP port number of the remote OCA device. DS100 default: 50014. | |
| const int | getPort () |
| Returns the current target port number. | |
| virtual bool | start ()=0 |
| Starts the client/server. For the client, begins periodic reconnect attempts. | |
| virtual bool | stop ()=0 |
| Stops the client/server and closes any open TCP connection. | |
| virtual bool | sendData (const ByteVector &data)=0 |
| Sends raw bytes over the active TCP connection. | |
Public Attributes | |
| std::function< bool(const ByteVector &)> | onDataReceived |
| Fired when a complete OCP.1 frame is received. | |
| std::function< void()> | onConnectionEstablished |
| Fired once after a successful TCP connection is established. | |
| std::function< void()> | onConnectionLost |
| Fired when the TCP connection is dropped or a connect attempt fails. | |
Protected Member Functions | |
| bool | processReceivedData (const ByteVector &data) |
Called by derived classes when bytes arrive from the socket. Invokes onDataReceived if set; the frame has already been delimited by Ocp1Connection::readNextMessage(). | |
Abstract base class shared by NanoOcp1Client and NanoOcp1Server.
Holds the target address/port, exposes the three user-facing callbacks, and provides processReceivedData() which invokes onDataReceived — the only point at which raw received bytes are handed to the caller.
Concrete subclasses implement start(), stop(), and sendData().
Definition at line 129 of file NanoOcp1.h.
| NanoOcp1::NanoOcp1Base::NanoOcp1Base | ( | const juce::String & | address, |
| const int | port | ||
| ) |
Definition at line 27 of file NanoOcp1.cpp.
References setAddress(), and setPort().
|
virtual |
Definition at line 33 of file NanoOcp1.cpp.
| const juce::String & NanoOcp1::NanoOcp1Base::getAddress | ( | ) |
Returns the current target address.
Definition at line 42 of file NanoOcp1.cpp.
Referenced by NanoOcp1::NanoOcp1Client::start(), NanoOcp1::NanoOcp1Server::start(), and NanoOcp1::NanoOcp1Client::timerCallback().
| const int NanoOcp1::NanoOcp1Base::getPort | ( | ) |
Returns the current target port number.
Definition at line 52 of file NanoOcp1.cpp.
Referenced by NanoOcp1::NanoOcp1Client::start(), NanoOcp1::NanoOcp1Server::start(), and NanoOcp1::NanoOcp1Client::timerCallback().
|
protected |
Called by derived classes when bytes arrive from the socket. Invokes onDataReceived if set; the frame has already been delimited by Ocp1Connection::readNextMessage().
Definition at line 57 of file NanoOcp1.cpp.
References onDataReceived.
Referenced by NanoOcp1::NanoOcp1Client::messageReceived().
|
pure virtual |
Sends raw bytes over the active TCP connection.
| data | Serialized OCP.1 message bytes (from Ocp1Message::GetSerializedData()). |
Implemented in NanoOcp1::NanoOcp1Client, and NanoOcp1::NanoOcp1Server.
| void NanoOcp1::NanoOcp1Base::setAddress | ( | const juce::String & | address | ) |
Sets the IP address or hostname of the remote OCA device.
Definition at line 37 of file NanoOcp1.cpp.
Referenced by NanoOcp1Base().
| void NanoOcp1::NanoOcp1Base::setPort | ( | const int | port | ) |
Sets the TCP port number of the remote OCA device. DS100 default: 50014.
Definition at line 47 of file NanoOcp1.cpp.
Referenced by NanoOcp1Base().
|
pure virtual |
Starts the client/server. For the client, begins periodic reconnect attempts.
Implemented in NanoOcp1::NanoOcp1Client, and NanoOcp1::NanoOcp1Server.
|
pure virtual |
Stops the client/server and closes any open TCP connection.
Implemented in NanoOcp1::NanoOcp1Client, and NanoOcp1::NanoOcp1Server.
| std::function<void()> NanoOcp1::NanoOcp1Base::onConnectionEstablished |
Fired once after a successful TCP connection is established.
DeviceController usage: resets the device state and sends the first GetValue command to read Fixed_GUID for firmware/model detection.
Threading: same thread as onDataReceived.
Definition at line 183 of file NanoOcp1.h.
Referenced by NanoOcp1::NanoOcp1Client::connectionMade().
| std::function<void()> NanoOcp1::NanoOcp1Base::onConnectionLost |
Fired when the TCP connection is dropped or a connect attempt fails.
DeviceController usage: clears all pending command handles, resets the connection state, and lets the client's internal retry timer re-attempt.
Threading: same thread as onDataReceived.
Definition at line 193 of file NanoOcp1.h.
Referenced by NanoOcp1::NanoOcp1Client::connectionLost(), and NanoOcp1::NanoOcp1Client::stop().
| std::function<bool(const ByteVector&)> NanoOcp1::NanoOcp1Base::onDataReceived |
Fired when a complete OCP.1 frame is received.
The caller should unmarshal the bytes with Ocp1Message::UnmarshalOcp1Message(), then dispatch on GetMessageType().
Threading: fires on the socket thread when callbacksOnMessageThread=false (as used by DeviceController), or on the JUCE message thread otherwise.
Definition at line 173 of file NanoOcp1.h.
Referenced by NanoOcp1::NanoOcp1Server::createConnectionObject(), and processReceivedData().