NanoOcp
Minimal AES70 / OCP.1 TCP client/server library for d&b Soundscape devices
Loading...
Searching...
No Matches
NanoOcp1::Ocp1Header Class Reference

#include <Ocp1Message.h>

Public Member Functions

 Ocp1Header (std::uint8_t msgType, std::size_t parameterDataLength)
 
 Ocp1Header (const ByteVector &memory)
 
virtual ~Ocp1Header ()=default
 
std::uint8_t GetMessageType () const
 
std::uint32_t GetMessageSize () const
 
bool IsValid () const
 
ByteVector GetSerializedData () const
 

Static Public Member Functions

static std::uint32_t CalculateMessageSize (std::uint8_t msgType, size_t parameterDataLength)
 

Static Public Attributes

static constexpr std::uint32_t Ocp1HeaderSize = 10
 

Protected Attributes

std::uint8_t m_syncVal
 
std::uint16_t m_protoVers
 
std::uint32_t m_msgSize
 
std::uint8_t m_msgType
 
std::uint16_t m_msgCnt
 

Detailed Description

Representation of the header of a OCA message.

Definition at line 171 of file Ocp1Message.h.

Constructor & Destructor Documentation

◆ Ocp1Header() [1/2]

NanoOcp1::Ocp1Header::Ocp1Header ( std::uint8_t  msgType,
std::size_t  parameterDataLength 
)
inline

Class constructor.

Definition at line 177 of file Ocp1Message.h.

◆ Ocp1Header() [2/2]

NanoOcp1::Ocp1Header::Ocp1Header ( const ByteVector memory)
explicit

Class constructor which creates a Ocp1Header based on a ByteVector.

Definition at line 88 of file Ocp1Message.cpp.

References NanoOcp1::Ocp1Message::KeepAlive, m_msgCnt, m_msgSize, m_msgType, m_protoVers, m_syncVal, Ocp1HeaderSize, NanoOcp1::ReadUint16(), and NanoOcp1::ReadUint32().

◆ ~Ocp1Header()

virtual NanoOcp1::Ocp1Header::~Ocp1Header ( )
virtualdefault

Class destructor.

Member Function Documentation

◆ CalculateMessageSize()

std::uint32_t NanoOcp1::Ocp1Header::CalculateMessageSize ( std::uint8_t  msgType,
size_t  parameterDataLength 
)
static

Helper method to calculate the OCA message size based on the message's type and the number of parameter data bytes contained in the message.

Parameters
[in]msgTypeType of OCA message (i.e. Notification, KeepAlive, etc).
[in]parameterDataLengthNumber of parameter data bytes contained in the message.
Returns
Size of the complete OCA message in bytes, excluding the initial sync bit.

Definition at line 139 of file Ocp1Message.cpp.

References NanoOcp1::Ocp1Message::Command, NanoOcp1::Ocp1Message::CommandResponseRequired, NanoOcp1::Ocp1Message::KeepAlive, NanoOcp1::Ocp1Message::Notification, and NanoOcp1::Ocp1Message::Response.

◆ GetMessageSize()

std::uint32_t NanoOcp1::Ocp1Header::GetMessageSize ( ) const
inline

Gets the size of the OCA message.

Returns
Size of OCA message, in byes.

Definition at line 211 of file Ocp1Message.h.

References m_msgSize.

Referenced by NanoOcp1::Ocp1CommandResponseRequired::GetSerializedData(), NanoOcp1::Ocp1Response::GetSerializedData(), and NanoOcp1::Ocp1Notification::GetSerializedData().

◆ GetMessageType()

std::uint8_t NanoOcp1::Ocp1Header::GetMessageType ( ) const
inline

Gets the type of the OCA message. (i.e. Notification, KeepAlive, etc).

Returns
Type of OCA message.

Definition at line 201 of file Ocp1Message.h.

References m_msgType.

Referenced by NanoOcp1::Ocp1Message::GetMessageType(), and NanoOcp1::Ocp1Message::UnmarshalOcp1Message().

◆ GetSerializedData()

ByteVector NanoOcp1::Ocp1Header::GetSerializedData ( ) const

Returns a vector of bytes representing the binary contents of the header.

Returns
A vector of 10 bytes containing the OCA header.

Definition at line 121 of file Ocp1Message.cpp.

References m_msgCnt, m_msgSize, m_msgType, m_protoVers, and m_syncVal.

Referenced by NanoOcp1::Ocp1CommandResponseRequired::GetSerializedData(), NanoOcp1::Ocp1Response::GetSerializedData(), NanoOcp1::Ocp1Notification::GetSerializedData(), and NanoOcp1::Ocp1KeepAlive::GetSerializedData().

◆ IsValid()

bool NanoOcp1::Ocp1Header::IsValid ( ) const

Checks if the header is valid.

Returns
True if the header's sync byte is correct, protoVers is 1, messageSize is large enough, messageType is valid, and messageCount at least 1.

Definition at line 115 of file Ocp1Message.cpp.

References NanoOcp1::Ocp1Message::KeepAlive, m_msgCnt, m_msgSize, m_msgType, m_protoVers, m_syncVal, and Ocp1HeaderSize.

Referenced by NanoOcp1::Ocp1Message::UnmarshalOcp1Message().

Member Data Documentation

◆ m_msgCnt

std::uint16_t NanoOcp1::Ocp1Header::m_msgCnt
protected

Definition at line 251 of file Ocp1Message.h.

Referenced by GetSerializedData(), IsValid(), and Ocp1Header().

◆ m_msgSize

std::uint32_t NanoOcp1::Ocp1Header::m_msgSize
protected

Definition at line 249 of file Ocp1Message.h.

Referenced by GetMessageSize(), GetSerializedData(), IsValid(), and Ocp1Header().

◆ m_msgType

std::uint8_t NanoOcp1::Ocp1Header::m_msgType
protected

Definition at line 250 of file Ocp1Message.h.

Referenced by GetMessageType(), GetSerializedData(), IsValid(), and Ocp1Header().

◆ m_protoVers

std::uint16_t NanoOcp1::Ocp1Header::m_protoVers
protected

Definition at line 248 of file Ocp1Message.h.

Referenced by GetSerializedData(), IsValid(), and Ocp1Header().

◆ m_syncVal

std::uint8_t NanoOcp1::Ocp1Header::m_syncVal
protected

Definition at line 247 of file Ocp1Message.h.

Referenced by GetSerializedData(), IsValid(), and Ocp1Header().

◆ Ocp1HeaderSize

constexpr std::uint32_t NanoOcp1::Ocp1Header::Ocp1HeaderSize = 10
staticconstexpr

Size of an OCA message header, in bytes, including the starting sync byte.

Definition at line 244 of file Ocp1Message.h.

Referenced by IsValid(), Ocp1Header(), and NanoOcp1::Ocp1Message::UnmarshalOcp1Message().


The documentation for this class was generated from the following files: