data header options inherit from pdu_steam_object
This commit is contained in:
parent
0614524d0b
commit
9b4f698b9a
|
@ -30,17 +30,17 @@ public:
|
|||
|
||||
const QString description() const
|
||||
{
|
||||
return QString::fromUtf8(universe_->source()->description().c_str());
|
||||
return QString::fromUtf8(universe_->source()->source_name.c_str());
|
||||
}
|
||||
|
||||
uint16_t number() const
|
||||
{
|
||||
return universe_->source()->universe();
|
||||
return universe_->source()->universe;
|
||||
}
|
||||
|
||||
uint8_t priority() const
|
||||
{
|
||||
return universe_->source()->priority();
|
||||
return universe_->source()->priority;
|
||||
}
|
||||
|
||||
double rxRate() const
|
||||
|
@ -56,19 +56,19 @@ public:
|
|||
public slots:
|
||||
void setDescription(std::string desc)
|
||||
{
|
||||
universe_->source()->setDescription(desc);
|
||||
universe_->source()->source_name = desc;
|
||||
}
|
||||
void setOptions(uint8_t o)
|
||||
void setOptions(sACN::DATA::data_options o)
|
||||
{
|
||||
universe_->source()->setOptions(o);
|
||||
universe_->source()->options = o;
|
||||
}
|
||||
void setPriority(uint8_t p)
|
||||
{
|
||||
universe_->source()->setPriority(p);
|
||||
universe_->source()->priority = p;
|
||||
}
|
||||
void setSyncAddress(uint16_t a)
|
||||
{
|
||||
universe_->source()->setSyncAddress(a);
|
||||
universe_->source()->sync_address = a;
|
||||
}
|
||||
void setValue (const uint16_t addr, const uint8_t level)
|
||||
{
|
||||
|
|
|
@ -68,6 +68,26 @@ void data_header::oStream(ACN::PDU::Stream stream) const
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief data_options::iStream
|
||||
* @param stream
|
||||
*/
|
||||
void data_options::iStream(ACN::PDU::Stream stream)
|
||||
{
|
||||
*stream >> byte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief data_options::oStream
|
||||
* @param stream
|
||||
*/
|
||||
void data_options::oStream(ACN::PDU::Stream stream) const
|
||||
{
|
||||
*stream << byte;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Pdu::Pdu
|
||||
* @param stream
|
||||
|
|
|
@ -38,15 +38,88 @@
|
|||
namespace sACN::DATA {
|
||||
|
||||
/**
|
||||
* @brief Table 6-1: E1.31 Data Packet Framing Layer
|
||||
* @brief The data_options struct
|
||||
*/
|
||||
struct data_header : ACN::PDU::pdu_header {
|
||||
std::string source_name; //!< source description
|
||||
uint8_t priority; //!< priority, between 0 and 200
|
||||
uint16_t sync_address; //!< syncronization address
|
||||
uint8_t sequence_number; //!< sequence
|
||||
uint8_t options; //!< options
|
||||
uint16_t universe; //!< universe number
|
||||
struct data_options
|
||||
: ACN::PDU::pdu_stream_object
|
||||
{
|
||||
union {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t reserved : 5;
|
||||
bool force_synchronization : 1; //!< Bit 5 = Force_Synchronization
|
||||
bool stream_terminated : 1; //!< Bit 6 = Stream_Terminated
|
||||
bool preview_data : 1; //!< Bit 7 = Preview_Data
|
||||
};
|
||||
};
|
||||
|
||||
size_t streamSize() const override { return 1; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
void oStream(ACN::PDU::Stream) const override;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief \cite sACN Table 6-1: E1.31 Data Packet Framing Layer
|
||||
*/
|
||||
struct data_header
|
||||
: ACN::PDU::pdu_header
|
||||
{
|
||||
/// \cite sACN 6.2.2 E1.31 Data Packet: Source Name
|
||||
///
|
||||
/// A user-assigned name provided by the source of the packet for use in
|
||||
/// displaying the identity of a source to a user. There is no mechanism,
|
||||
/// other than user configuration, to ensure uniqueness of this name. The
|
||||
/// source name shall be null-terminated. If the source component implements
|
||||
/// ACN discovery as defined in EPI 19 \cite epi19, then this name shall be
|
||||
/// the same as the UACN field specified in EPI 19 \cite epi19. User-Assigned
|
||||
/// Component Names, as the title suggests, supply a single name for an entire
|
||||
/// component, so this Source Name field will exist for each unique CID, but
|
||||
/// may be the same across multiple universes sourced by the same component.
|
||||
std::string source_name;
|
||||
|
||||
/// \cite sACN 6.2.3 E1.31 Data Packet: Priority
|
||||
///
|
||||
/// The Priority field is an unsigned, one octet field. The value is used by
|
||||
/// receivers in selecting between multiple sources of data for a given
|
||||
/// universe number. Sources that do not support variable priority shall
|
||||
/// transmit a priority of 100. No priority outside the range of 0 to 200
|
||||
/// shall be transmitted on the network. Priority increases with numerical
|
||||
/// value, e.g., 200 is a higher priority than 100.
|
||||
uint8_t priority;
|
||||
|
||||
/// \cite sACN 6.2.4 E1.31 Data Packet: Synchronization Address
|
||||
///
|
||||
/// The Synchronization Address identifies a universe number to be used for
|
||||
/// universe synchronization.
|
||||
uint16_t sync_address;
|
||||
|
||||
/// \cite sACN 6.2.5 E1.31 Data Packet: Sequence Number
|
||||
///
|
||||
/// In a routed network environment it is possible for packets to be received
|
||||
/// in a different order to the one in which they were sent. The sequence
|
||||
/// number allows receivers or diagnostic equipment to detect out of sequence
|
||||
/// or lost packets.
|
||||
///
|
||||
/// Sources shall maintain a sequence for each universe they
|
||||
/// transmit. The sequence number for a universe shall be incremented by one
|
||||
/// for every packet sent on that universe. There is no implied relationship
|
||||
/// between the sequence number of an E1.31 Synchronization Packet and the
|
||||
/// sequence number of an E1.31 Data Packet on that same universe.
|
||||
uint8_t sequence_number;
|
||||
|
||||
/// \cite sACN 6.2.6 E1.31 Data Packet: Options
|
||||
///
|
||||
/// This bit-oriented field is used to encode optional flags that control
|
||||
/// how the packet is used.
|
||||
data_options options;
|
||||
|
||||
/// \cite sACN 6.2.7 E1.31 Data Packet: Universe
|
||||
///
|
||||
/// The Universe is a 16-bit field that defines the universe number of the
|
||||
/// data carried in the packet. Universe values shall be limited to the range
|
||||
/// 1 to 63999.
|
||||
uint16_t universe;
|
||||
|
||||
size_t streamSize() const override { return 71; }
|
||||
void iStream(ACN::PDU::Stream) override;
|
||||
|
@ -55,17 +128,7 @@ struct data_header : ACN::PDU::pdu_header {
|
|||
|
||||
|
||||
/**
|
||||
* @brief 6.2.6 E1.31 Data Packet: Options
|
||||
*/
|
||||
enum options_t : uint8_t {
|
||||
PREVIEW_DATA = 0b10000000, //!< Bit 7 = Preview_Data
|
||||
STREAM_TERMINATED = 0b01000000, //!< Bit 6 = Stream_Terminated
|
||||
FORCE_SYNCHRONIZATION = 0b00100000, //!< Bit 5 = Force_Synchronization
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @brief The DATA::Pdu class
|
||||
* @brief \cite sACN 6.2 E1.31 Data Packet Framing Layer
|
||||
*/
|
||||
class Pdu
|
||||
: public ACN::PDU::Pdu
|
||||
|
|
|
@ -64,9 +64,13 @@ void Source::terminate(const uint16_t num)
|
|||
return;
|
||||
|
||||
auto source = universes_[num]->source();
|
||||
source->setOptions(0 | source->isForced()
|
||||
| source->isPreview()
|
||||
| DATA::STREAM_TERMINATED);
|
||||
auto options = DATA::data_options();
|
||||
|
||||
options.force_synchronization = source->options.force_synchronization;
|
||||
options.preview_data = source->options.preview_data;
|
||||
options.stream_terminated = true;
|
||||
|
||||
source->options = options;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue