|
NanoOcp
Minimal AES70 / OCP.1 TCP client/server library for d&b Soundscape devices
|
Abstract base class for all OCP.1 protocol messages. More...
#include <Ocp1Message.h>
Inheritance diagram for NanoOcp1::Ocp1Message:
Collaboration diagram for NanoOcp1::Ocp1Message:Public Types | |
| enum | MessageType { Command = 0 , CommandResponseRequired = 1 , Notification = 2 , Response = 3 , KeepAlive = 4 } |
| OCP.1 message type codes as defined in AES70. More... | |
Public Member Functions | |
| Ocp1Message (std::uint8_t msgType, const ByteVector ¶meterData) | |
| virtual | ~Ocp1Message ()=default |
| std::uint8_t | GetMessageType () const |
| ByteVector | GetParameterData () const |
| virtual ByteVector | GetSerializedData ()=0 |
Static Public Member Functions | |
| static std::unique_ptr< Ocp1Message > | UnmarshalOcp1Message (const ByteVector &receivedData) |
Protected Attributes | |
| Ocp1Header | m_header |
| ByteVector | m_parameterData |
Static Protected Attributes | |
| static std::uint32_t | m_nextHandle = 2 |
Abstract base class for all OCP.1 protocol messages.
Every OCP.1 frame starts with a 10-byte Ocp1Header (sync byte 0x3b, protocol version 1, message size, message type, message count) followed by type-specific payload bytes. Ocp1Message stores both and provides GetSerializedData() to produce the complete binary frame for transmission.
UnmarshalOcp1Message() is the factory entry point. Pass the raw bytes received from the socket and it returns a typed unique_ptr<Ocp1Message> (or nullptr on parse error). Dispatch on GetMessageType():
Definition at line 304 of file Ocp1Message.h.
OCP.1 message type codes as defined in AES70.
| Value | Name | Direction | Description |
|---|---|---|---|
| 0 | Command | Client→Device | Fire-and-forget; no response expected. |
| 1 | CommandResponseRequired | Client→Device | Command that expects an Ocp1Response with a matching handle. |
| 2 | Notification | Device→Client | Unsolicited property-change event (requires prior AddSubscription). |
| 3 | Response | Device→Client | Reply to a CommandResponseRequired; carries status and return value. |
| 4 | KeepAlive | Both | Heartbeat for connection supervision; carries heartbeat interval. |
Definition at line 318 of file Ocp1Message.h.
|
inline |
Class constructor.
Definition at line 330 of file Ocp1Message.h.
|
virtualdefault |
Class destructor.
|
inline |
Gets the type of the OCA message. (i.e. Notification, KeepAlive, etc).
Definition at line 347 of file Ocp1Message.h.
References NanoOcp1::Ocp1Header::GetMessageType(), and m_header.
|
inline |
Returns a vector of bytes representing the parameter data contained in the message.
Definition at line 357 of file Ocp1Message.h.
References m_parameterData.
Referenced by NanoOcp1Demo::MainComponent::OnOcp1MessageReceived().
|
pure virtual |
Returns a vector of bytes representing the binary contents of the complete message. Must be reimplemented for each message type.
Implemented in NanoOcp1::Ocp1CommandResponseRequired, NanoOcp1::Ocp1Response, NanoOcp1::Ocp1Notification, and NanoOcp1::Ocp1KeepAlive.
|
static |
Factory method which creates a new Ocp1Message object based on a vector<std::uint8_t>.
| [in] | receivedData | Vector containing the received OCA message. |
Definition at line 174 of file Ocp1Message.cpp.
References Command, CommandResponseRequired, NanoOcp1::Ocp1Header::GetMessageType(), NanoOcp1::Ocp1Header::IsValid(), KeepAlive, Notification, NanoOcp1::Ocp1Header::Ocp1HeaderSize, NanoOcp1::ReadUint16(), NanoOcp1::ReadUint32(), and Response.
Referenced by NanoOcp1Demo::MainComponent::OnOcp1MessageReceived().
|
protected |
Definition at line 381 of file Ocp1Message.h.
Referenced by GetMessageType(), NanoOcp1::Ocp1CommandResponseRequired::GetSerializedData(), NanoOcp1::Ocp1Response::GetSerializedData(), NanoOcp1::Ocp1Notification::GetSerializedData(), and NanoOcp1::Ocp1KeepAlive::GetSerializedData().
|
staticprotected |
Definition at line 383 of file Ocp1Message.h.
Referenced by NanoOcp1::Ocp1CommandResponseRequired::Ocp1CommandResponseRequired().
|
protected |
Definition at line 382 of file Ocp1Message.h.
Referenced by NanoOcp1::Ocp1KeepAlive::GetHeartBeatMilliseconds(), NanoOcp1::Ocp1KeepAlive::GetHeartBeatSeconds(), GetParameterData(), NanoOcp1::Ocp1CommandResponseRequired::GetSerializedData(), NanoOcp1::Ocp1Response::GetSerializedData(), NanoOcp1::Ocp1Notification::GetSerializedData(), and NanoOcp1::Ocp1KeepAlive::GetSerializedData().