#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum Interface {
EcmgScs,
EmmgPdgMux,
}
impl Interface {
pub const PROTOCOL_VERSION: u8 = 0x03;
#[must_use]
pub const fn protocol_version(self) -> u8 {
match self {
Self::EcmgScs | Self::EmmgPdgMux => Self::PROTOCOL_VERSION,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs => "ECMG<->SCS",
Self::EmmgPdgMux => "EMMG/PDG<->MUX",
}
}
}
dvb_common::impl_spec_display!(Interface);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EcmgScsMessageType {
ChannelSetup,
ChannelTest,
ChannelStatus,
ChannelClose,
ChannelError,
StreamSetup,
StreamTest,
StreamStatus,
StreamCloseRequest,
StreamCloseResponse,
StreamError,
CwProvision,
EcmResponse,
Reserved(u16),
}
impl EcmgScsMessageType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0001 => Self::ChannelSetup,
0x0002 => Self::ChannelTest,
0x0003 => Self::ChannelStatus,
0x0004 => Self::ChannelClose,
0x0005 => Self::ChannelError,
0x0101 => Self::StreamSetup,
0x0102 => Self::StreamTest,
0x0103 => Self::StreamStatus,
0x0104 => Self::StreamCloseRequest,
0x0105 => Self::StreamCloseResponse,
0x0106 => Self::StreamError,
0x0201 => Self::CwProvision,
0x0202 => Self::EcmResponse,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::ChannelSetup => 0x0001,
Self::ChannelTest => 0x0002,
Self::ChannelStatus => 0x0003,
Self::ChannelClose => 0x0004,
Self::ChannelError => 0x0005,
Self::StreamSetup => 0x0101,
Self::StreamTest => 0x0102,
Self::StreamStatus => 0x0103,
Self::StreamCloseRequest => 0x0104,
Self::StreamCloseResponse => 0x0105,
Self::StreamError => 0x0106,
Self::CwProvision => 0x0201,
Self::EcmResponse => 0x0202,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::ChannelSetup => "channel_setup",
Self::ChannelTest => "channel_test",
Self::ChannelStatus => "channel_status",
Self::ChannelClose => "channel_close",
Self::ChannelError => "channel_error",
Self::StreamSetup => "stream_setup",
Self::StreamTest => "stream_test",
Self::StreamStatus => "stream_status",
Self::StreamCloseRequest => "stream_close_request",
Self::StreamCloseResponse => "stream_close_response",
Self::StreamError => "stream_error",
Self::CwProvision => "CW_provision",
Self::EcmResponse => "ECM_response",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EcmgScsMessageType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EmmgMuxMessageType {
ChannelSetup,
ChannelTest,
ChannelStatus,
ChannelClose,
ChannelError,
StreamSetup,
StreamTest,
StreamStatus,
StreamCloseRequest,
StreamCloseResponse,
StreamError,
StreamBwRequest,
StreamBwAllocation,
DataProvision,
Reserved(u16),
}
impl EmmgMuxMessageType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0011 => Self::ChannelSetup,
0x0012 => Self::ChannelTest,
0x0013 => Self::ChannelStatus,
0x0014 => Self::ChannelClose,
0x0015 => Self::ChannelError,
0x0111 => Self::StreamSetup,
0x0112 => Self::StreamTest,
0x0113 => Self::StreamStatus,
0x0114 => Self::StreamCloseRequest,
0x0115 => Self::StreamCloseResponse,
0x0116 => Self::StreamError,
0x0117 => Self::StreamBwRequest,
0x0118 => Self::StreamBwAllocation,
0x0211 => Self::DataProvision,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::ChannelSetup => 0x0011,
Self::ChannelTest => 0x0012,
Self::ChannelStatus => 0x0013,
Self::ChannelClose => 0x0014,
Self::ChannelError => 0x0015,
Self::StreamSetup => 0x0111,
Self::StreamTest => 0x0112,
Self::StreamStatus => 0x0113,
Self::StreamCloseRequest => 0x0114,
Self::StreamCloseResponse => 0x0115,
Self::StreamError => 0x0116,
Self::StreamBwRequest => 0x0117,
Self::StreamBwAllocation => 0x0118,
Self::DataProvision => 0x0211,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::ChannelSetup => "channel_setup",
Self::ChannelTest => "channel_test",
Self::ChannelStatus => "channel_status",
Self::ChannelClose => "channel_close",
Self::ChannelError => "channel_error",
Self::StreamSetup => "stream_setup",
Self::StreamTest => "stream_test",
Self::StreamStatus => "stream_status",
Self::StreamCloseRequest => "stream_close_request",
Self::StreamCloseResponse => "stream_close_response",
Self::StreamError => "stream_error",
Self::StreamBwRequest => "stream_BW_request",
Self::StreamBwAllocation => "stream_BW_allocation",
Self::DataProvision => "data_provision",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EmmgMuxMessageType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum MessageType {
EcmgScs(EcmgScsMessageType),
EmmgPdgMux(EmmgMuxMessageType),
}
impl MessageType {
#[must_use]
pub const fn from_u16(iface: Interface, v: u16) -> Self {
match iface {
Interface::EcmgScs => Self::EcmgScs(EcmgScsMessageType::from_u16(v)),
Interface::EmmgPdgMux => Self::EmmgPdgMux(EmmgMuxMessageType::from_u16(v)),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::EcmgScs(m) => m.to_u16(),
Self::EmmgPdgMux(m) => m.to_u16(),
}
}
#[must_use]
pub const fn interface(self) -> Interface {
match self {
Self::EcmgScs(_) => Interface::EcmgScs,
Self::EmmgPdgMux(_) => Interface::EmmgPdgMux,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs(m) => m.name(),
Self::EmmgPdgMux(m) => m.name(),
}
}
}
dvb_common::impl_spec_display!(MessageType);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EcmgScsParameterType {
SuperCasId,
SectionTspktFlag,
DelayStart,
DelayStop,
TransitionDelayStart,
TransitionDelayStop,
EcmRepPeriod,
MaxStreams,
MinCpDuration,
LeadCw,
CwPerMsg,
MaxCompTime,
AccessCriteria,
EcmChannelId,
EcmStreamId,
NominalCpDuration,
AccessCriteriaTransferMode,
CpNumber,
CpDuration,
CpCwCombination,
EcmDatagram,
AcDelayStart,
AcDelayStop,
CwEncryption,
EcmId,
ErrorStatus,
ErrorInformation,
Reserved(u16),
}
impl EcmgScsParameterType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0001 => Self::SuperCasId,
0x0002 => Self::SectionTspktFlag,
0x0003 => Self::DelayStart,
0x0004 => Self::DelayStop,
0x0005 => Self::TransitionDelayStart,
0x0006 => Self::TransitionDelayStop,
0x0007 => Self::EcmRepPeriod,
0x0008 => Self::MaxStreams,
0x0009 => Self::MinCpDuration,
0x000A => Self::LeadCw,
0x000B => Self::CwPerMsg,
0x000C => Self::MaxCompTime,
0x000D => Self::AccessCriteria,
0x000E => Self::EcmChannelId,
0x000F => Self::EcmStreamId,
0x0010 => Self::NominalCpDuration,
0x0011 => Self::AccessCriteriaTransferMode,
0x0012 => Self::CpNumber,
0x0013 => Self::CpDuration,
0x0014 => Self::CpCwCombination,
0x0015 => Self::EcmDatagram,
0x0016 => Self::AcDelayStart,
0x0017 => Self::AcDelayStop,
0x0018 => Self::CwEncryption,
0x0019 => Self::EcmId,
0x7000 => Self::ErrorStatus,
0x7001 => Self::ErrorInformation,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::SuperCasId => 0x0001,
Self::SectionTspktFlag => 0x0002,
Self::DelayStart => 0x0003,
Self::DelayStop => 0x0004,
Self::TransitionDelayStart => 0x0005,
Self::TransitionDelayStop => 0x0006,
Self::EcmRepPeriod => 0x0007,
Self::MaxStreams => 0x0008,
Self::MinCpDuration => 0x0009,
Self::LeadCw => 0x000A,
Self::CwPerMsg => 0x000B,
Self::MaxCompTime => 0x000C,
Self::AccessCriteria => 0x000D,
Self::EcmChannelId => 0x000E,
Self::EcmStreamId => 0x000F,
Self::NominalCpDuration => 0x0010,
Self::AccessCriteriaTransferMode => 0x0011,
Self::CpNumber => 0x0012,
Self::CpDuration => 0x0013,
Self::CpCwCombination => 0x0014,
Self::EcmDatagram => 0x0015,
Self::AcDelayStart => 0x0016,
Self::AcDelayStop => 0x0017,
Self::CwEncryption => 0x0018,
Self::EcmId => 0x0019,
Self::ErrorStatus => 0x7000,
Self::ErrorInformation => 0x7001,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::SuperCasId => "Super_CAS_id",
Self::SectionTspktFlag => "section_TSpkt_flag",
Self::DelayStart => "delay_start",
Self::DelayStop => "delay_stop",
Self::TransitionDelayStart => "transition_delay_start",
Self::TransitionDelayStop => "transition_delay_stop",
Self::EcmRepPeriod => "ECM_rep_period",
Self::MaxStreams => "max_streams",
Self::MinCpDuration => "min_CP_duration",
Self::LeadCw => "lead_CW",
Self::CwPerMsg => "CW_per_msg",
Self::MaxCompTime => "max_comp_time",
Self::AccessCriteria => "access_criteria",
Self::EcmChannelId => "ECM_channel_id",
Self::EcmStreamId => "ECM_stream_id",
Self::NominalCpDuration => "nominal_CP_duration",
Self::AccessCriteriaTransferMode => "access_criteria_transfer_mode",
Self::CpNumber => "CP_number",
Self::CpDuration => "CP_duration",
Self::CpCwCombination => "CP_CW_combination",
Self::EcmDatagram => "ECM_datagram",
Self::AcDelayStart => "AC_delay_start",
Self::AcDelayStop => "AC_delay_stop",
Self::CwEncryption => "CW_encryption",
Self::EcmId => "ECM_id",
Self::ErrorStatus => "error_status",
Self::ErrorInformation => "error_information",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EcmgScsParameterType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EmmgMuxParameterType {
ClientId,
SectionTspktFlag,
DataChannelId,
DataStreamId,
Datagram,
Bandwidth,
DataType,
DataId,
ErrorStatus,
ErrorInformation,
Reserved(u16),
}
impl EmmgMuxParameterType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0001 => Self::ClientId,
0x0002 => Self::SectionTspktFlag,
0x0003 => Self::DataChannelId,
0x0004 => Self::DataStreamId,
0x0005 => Self::Datagram,
0x0006 => Self::Bandwidth,
0x0007 => Self::DataType,
0x0008 => Self::DataId,
0x7000 => Self::ErrorStatus,
0x7001 => Self::ErrorInformation,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::ClientId => 0x0001,
Self::SectionTspktFlag => 0x0002,
Self::DataChannelId => 0x0003,
Self::DataStreamId => 0x0004,
Self::Datagram => 0x0005,
Self::Bandwidth => 0x0006,
Self::DataType => 0x0007,
Self::DataId => 0x0008,
Self::ErrorStatus => 0x7000,
Self::ErrorInformation => 0x7001,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::ClientId => "client_id",
Self::SectionTspktFlag => "section_TSpkt_flag",
Self::DataChannelId => "data_channel_id",
Self::DataStreamId => "data_stream_id",
Self::Datagram => "datagram",
Self::Bandwidth => "bandwidth",
Self::DataType => "data_type",
Self::DataId => "data_id",
Self::ErrorStatus => "error_status",
Self::ErrorInformation => "error_information",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EmmgMuxParameterType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum ParameterType {
EcmgScs(EcmgScsParameterType),
EmmgPdgMux(EmmgMuxParameterType),
}
impl ParameterType {
#[must_use]
pub const fn from_u16(iface: Interface, v: u16) -> Self {
match iface {
Interface::EcmgScs => Self::EcmgScs(EcmgScsParameterType::from_u16(v)),
Interface::EmmgPdgMux => Self::EmmgPdgMux(EmmgMuxParameterType::from_u16(v)),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::EcmgScs(p) => p.to_u16(),
Self::EmmgPdgMux(p) => p.to_u16(),
}
}
#[must_use]
pub const fn interface(self) -> Interface {
match self {
Self::EcmgScs(_) => Interface::EcmgScs,
Self::EmmgPdgMux(_) => Interface::EmmgPdgMux,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs(p) => p.name(),
Self::EmmgPdgMux(p) => p.name(),
}
}
}
dvb_common::impl_spec_display!(ParameterType);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum DataType {
Emm,
PrivateData,
Ecm,
Reserved(u8),
}
impl DataType {
#[must_use]
pub const fn from_u8(v: u8) -> Self {
match v {
0x00 => Self::Emm,
0x01 => Self::PrivateData,
0x02 => Self::Ecm,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u8(self) -> u8 {
match self {
Self::Emm => 0x00,
Self::PrivateData => 0x01,
Self::Ecm => 0x02,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::Emm => "EMM",
Self::PrivateData => "private data",
Self::Ecm => "ECM",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(DataType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum SectionTspktFlag {
SectionFormat,
TsPacketFormat,
ArbitraryLength,
Reserved(u8),
}
impl SectionTspktFlag {
#[must_use]
pub const fn from_u8(v: u8) -> Self {
match v {
0x00 => Self::SectionFormat,
0x01 => Self::TsPacketFormat,
0x02 => Self::ArbitraryLength,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u8(self) -> u8 {
match self {
Self::SectionFormat => 0x00,
Self::TsPacketFormat => 0x01,
Self::ArbitraryLength => 0x02,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::SectionFormat => "section_format",
Self::TsPacketFormat => "ts_packet_format",
Self::ArbitraryLength => "arbitrary_length",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(SectionTspktFlag, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EcmgErrorStatus {
InvalidMessage,
UnsupportedProtocolVersion,
UnknownMessageType,
MessageTooLong,
UnknownSuperCasId,
UnknownEcmChannelId,
UnknownEcmStreamId,
TooManyChannels,
TooManyStreamsOnChannel,
TooManyStreamsOnEcmg,
NotEnoughControlWords,
OutOfStorage,
OutOfResources,
UnknownParameterType,
InconsistentLength,
MissingMandatoryParameter,
InvalidParameterValue,
UnknownEcmId,
EcmChannelIdInUse,
EcmStreamIdInUse,
EcmIdInUse,
UnknownError,
UnrecoverableError,
Reserved(u16),
}
impl EcmgErrorStatus {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0001 => Self::InvalidMessage,
0x0002 => Self::UnsupportedProtocolVersion,
0x0003 => Self::UnknownMessageType,
0x0004 => Self::MessageTooLong,
0x0005 => Self::UnknownSuperCasId,
0x0006 => Self::UnknownEcmChannelId,
0x0007 => Self::UnknownEcmStreamId,
0x0008 => Self::TooManyChannels,
0x0009 => Self::TooManyStreamsOnChannel,
0x000A => Self::TooManyStreamsOnEcmg,
0x000B => Self::NotEnoughControlWords,
0x000C => Self::OutOfStorage,
0x000D => Self::OutOfResources,
0x000E => Self::UnknownParameterType,
0x000F => Self::InconsistentLength,
0x0010 => Self::MissingMandatoryParameter,
0x0011 => Self::InvalidParameterValue,
0x0012 => Self::UnknownEcmId,
0x0013 => Self::EcmChannelIdInUse,
0x0014 => Self::EcmStreamIdInUse,
0x0015 => Self::EcmIdInUse,
0x7000 => Self::UnknownError,
0x7001 => Self::UnrecoverableError,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::InvalidMessage => 0x0001,
Self::UnsupportedProtocolVersion => 0x0002,
Self::UnknownMessageType => 0x0003,
Self::MessageTooLong => 0x0004,
Self::UnknownSuperCasId => 0x0005,
Self::UnknownEcmChannelId => 0x0006,
Self::UnknownEcmStreamId => 0x0007,
Self::TooManyChannels => 0x0008,
Self::TooManyStreamsOnChannel => 0x0009,
Self::TooManyStreamsOnEcmg => 0x000A,
Self::NotEnoughControlWords => 0x000B,
Self::OutOfStorage => 0x000C,
Self::OutOfResources => 0x000D,
Self::UnknownParameterType => 0x000E,
Self::InconsistentLength => 0x000F,
Self::MissingMandatoryParameter => 0x0010,
Self::InvalidParameterValue => 0x0011,
Self::UnknownEcmId => 0x0012,
Self::EcmChannelIdInUse => 0x0013,
Self::EcmStreamIdInUse => 0x0014,
Self::EcmIdInUse => 0x0015,
Self::UnknownError => 0x7000,
Self::UnrecoverableError => 0x7001,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::InvalidMessage => "invalid message",
Self::UnsupportedProtocolVersion => "unsupported protocol version",
Self::UnknownMessageType => "unknown message_type value",
Self::MessageTooLong => "message too long",
Self::UnknownSuperCasId => "unknown Super_CAS_id value",
Self::UnknownEcmChannelId => "unknown ECM_channel_id value",
Self::UnknownEcmStreamId => "unknown ECM_stream_id value",
Self::TooManyChannels => "too many channels on this ECMG",
Self::TooManyStreamsOnChannel => "too many ECM streams on this channel",
Self::TooManyStreamsOnEcmg => "too many ECM streams on this ECMG",
Self::NotEnoughControlWords => "not enough control words to compute ECM",
Self::OutOfStorage => "ECMG out of storage capacity",
Self::OutOfResources => "ECMG out of computational resources",
Self::UnknownParameterType => "unknown parameter_type value",
Self::InconsistentLength => "inconsistent length for DVB parameter",
Self::MissingMandatoryParameter => "missing mandatory DVB parameter",
Self::InvalidParameterValue => "invalid value for DVB parameter",
Self::UnknownEcmId => "unknown ECM_id value",
Self::EcmChannelIdInUse => "ECM_channel_id value already in use",
Self::EcmStreamIdInUse => "ECM_stream_id value already in use",
Self::EcmIdInUse => "ECM_id value already in use",
Self::UnknownError => "unknown error",
Self::UnrecoverableError => "unrecoverable error",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EcmgErrorStatus, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum EmmgErrorStatus {
InvalidMessage,
UnsupportedProtocolVersion,
UnknownMessageType,
MessageTooLong,
UnknownDataStreamId,
UnknownDataChannelId,
TooManyChannels,
TooManyStreamsOnChannel,
TooManyStreamsOnMux,
UnknownParameterType,
InconsistentLength,
MissingMandatoryParameter,
InvalidParameterValue,
UnknownClientId,
ExceededBandwidth,
UnknownDataId,
DataChannelIdInUse,
DataStreamIdInUse,
DataIdInUse,
ClientIdInUse,
UnknownError,
UnrecoverableError,
Reserved(u16),
}
impl EmmgErrorStatus {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0001 => Self::InvalidMessage,
0x0002 => Self::UnsupportedProtocolVersion,
0x0003 => Self::UnknownMessageType,
0x0004 => Self::MessageTooLong,
0x0005 => Self::UnknownDataStreamId,
0x0006 => Self::UnknownDataChannelId,
0x0007 => Self::TooManyChannels,
0x0008 => Self::TooManyStreamsOnChannel,
0x0009 => Self::TooManyStreamsOnMux,
0x000A => Self::UnknownParameterType,
0x000B => Self::InconsistentLength,
0x000C => Self::MissingMandatoryParameter,
0x000D => Self::InvalidParameterValue,
0x000E => Self::UnknownClientId,
0x000F => Self::ExceededBandwidth,
0x0010 => Self::UnknownDataId,
0x0011 => Self::DataChannelIdInUse,
0x0012 => Self::DataStreamIdInUse,
0x0013 => Self::DataIdInUse,
0x0014 => Self::ClientIdInUse,
0x7000 => Self::UnknownError,
0x7001 => Self::UnrecoverableError,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::InvalidMessage => 0x0001,
Self::UnsupportedProtocolVersion => 0x0002,
Self::UnknownMessageType => 0x0003,
Self::MessageTooLong => 0x0004,
Self::UnknownDataStreamId => 0x0005,
Self::UnknownDataChannelId => 0x0006,
Self::TooManyChannels => 0x0007,
Self::TooManyStreamsOnChannel => 0x0008,
Self::TooManyStreamsOnMux => 0x0009,
Self::UnknownParameterType => 0x000A,
Self::InconsistentLength => 0x000B,
Self::MissingMandatoryParameter => 0x000C,
Self::InvalidParameterValue => 0x000D,
Self::UnknownClientId => 0x000E,
Self::ExceededBandwidth => 0x000F,
Self::UnknownDataId => 0x0010,
Self::DataChannelIdInUse => 0x0011,
Self::DataStreamIdInUse => 0x0012,
Self::DataIdInUse => 0x0013,
Self::ClientIdInUse => 0x0014,
Self::UnknownError => 0x7000,
Self::UnrecoverableError => 0x7001,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::InvalidMessage => "invalid message",
Self::UnsupportedProtocolVersion => "unsupported protocol version",
Self::UnknownMessageType => "unknown message_type value",
Self::MessageTooLong => "message too long",
Self::UnknownDataStreamId => "unknown data_stream_id value",
Self::UnknownDataChannelId => "unknown data_channel_id value",
Self::TooManyChannels => "too many channels on this MUX",
Self::TooManyStreamsOnChannel => "too many data streams on this channel",
Self::TooManyStreamsOnMux => "too many data streams on this MUX",
Self::UnknownParameterType => "unknown parameter_type",
Self::InconsistentLength => "inconsistent length for DVB parameter",
Self::MissingMandatoryParameter => "missing mandatory DVB parameter",
Self::InvalidParameterValue => "invalid value for DVB parameter",
Self::UnknownClientId => "unknown client_id value",
Self::ExceededBandwidth => "exceeded bandwidth",
Self::UnknownDataId => "unknown data_id value",
Self::DataChannelIdInUse => "data_channel_id value already in use",
Self::DataStreamIdInUse => "data_stream_id value already in use",
Self::DataIdInUse => "data_id value already in use",
Self::ClientIdInUse => "client_id value already in use",
Self::UnknownError => "unknown error",
Self::UnrecoverableError => "unrecoverable error",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(EmmgErrorStatus, Reserved);