#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum Interface {
EcmgScs,
EmmgPdgMux,
CpSigPSig,
}
impl Interface {
pub const PROTOCOL_VERSION: u8 = 0x03;
#[must_use]
pub const fn protocol_version(self) -> u8 {
match self {
Self::EcmgScs | Self::EmmgPdgMux | Self::CpSigPSig => Self::PROTOCOL_VERSION,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs => "ECMG<->SCS",
Self::EmmgPdgMux => "EMMG/PDG<->MUX",
Self::CpSigPSig => "C(P)SIG<->(P)SIG",
}
}
}
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 CpSigMessageType {
ChannelSetup,
ChannelStatus,
ChannelTest,
ChannelClose,
ChannelError,
StreamSetup,
StreamStatus,
StreamTest,
StreamClose,
StreamCloseRequest,
StreamCloseResponse,
StreamError,
StreamServiceChange,
StreamTriggerEnableRequest,
StreamTriggerEnableResponse,
Trigger,
TableRequest,
TableResponse,
DescriptorInsertRequest,
DescriptorInsertResponse,
PidProvisionRequest,
PidProvisionResponse,
Reserved(u16),
}
impl CpSigMessageType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x0301 => Self::ChannelSetup,
0x0302 => Self::ChannelStatus,
0x0303 => Self::ChannelTest,
0x0304 => Self::ChannelClose,
0x0305 => Self::ChannelError,
0x0311 => Self::StreamSetup,
0x0312 => Self::StreamStatus,
0x0313 => Self::StreamTest,
0x0314 => Self::StreamClose,
0x0315 => Self::StreamCloseRequest,
0x0316 => Self::StreamCloseResponse,
0x0317 => Self::StreamError,
0x0318 => Self::StreamServiceChange,
0x0319 => Self::StreamTriggerEnableRequest,
0x031A => Self::StreamTriggerEnableResponse,
0x031B => Self::Trigger,
0x031C => Self::TableRequest,
0x031D => Self::TableResponse,
0x031E => Self::DescriptorInsertRequest,
0x031F => Self::DescriptorInsertResponse,
0x0320 => Self::PidProvisionRequest,
0x0321 => Self::PidProvisionResponse,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::ChannelSetup => 0x0301,
Self::ChannelStatus => 0x0302,
Self::ChannelTest => 0x0303,
Self::ChannelClose => 0x0304,
Self::ChannelError => 0x0305,
Self::StreamSetup => 0x0311,
Self::StreamStatus => 0x0312,
Self::StreamTest => 0x0313,
Self::StreamClose => 0x0314,
Self::StreamCloseRequest => 0x0315,
Self::StreamCloseResponse => 0x0316,
Self::StreamError => 0x0317,
Self::StreamServiceChange => 0x0318,
Self::StreamTriggerEnableRequest => 0x0319,
Self::StreamTriggerEnableResponse => 0x031A,
Self::Trigger => 0x031B,
Self::TableRequest => 0x031C,
Self::TableResponse => 0x031D,
Self::DescriptorInsertRequest => 0x031E,
Self::DescriptorInsertResponse => 0x031F,
Self::PidProvisionRequest => 0x0320,
Self::PidProvisionResponse => 0x0321,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::ChannelSetup => "channel_setup",
Self::ChannelStatus => "channel_status",
Self::ChannelTest => "channel_test",
Self::ChannelClose => "channel_close",
Self::ChannelError => "channel_error",
Self::StreamSetup => "stream_setup",
Self::StreamStatus => "stream_status",
Self::StreamTest => "stream_test",
Self::StreamClose => "stream_close",
Self::StreamCloseRequest => "stream_close_request",
Self::StreamCloseResponse => "stream_close_response",
Self::StreamError => "stream_error",
Self::StreamServiceChange => "stream_service_change",
Self::StreamTriggerEnableRequest => "stream_trigger_enable_request",
Self::StreamTriggerEnableResponse => "stream_trigger_enable_response",
Self::Trigger => "trigger",
Self::TableRequest => "table_request",
Self::TableResponse => "table_response",
Self::DescriptorInsertRequest => "descriptor_insert_request",
Self::DescriptorInsertResponse => "descriptor_insert_response",
Self::PidProvisionRequest => "PID_provision_request",
Self::PidProvisionResponse => "PID_provision_response",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(CpSigMessageType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum MessageType {
EcmgScs(EcmgScsMessageType),
EmmgPdgMux(EmmgMuxMessageType),
CpSigPSig(CpSigMessageType),
}
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)),
Interface::CpSigPSig => Self::CpSigPSig(CpSigMessageType::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(),
Self::CpSigPSig(m) => m.to_u16(),
}
}
#[must_use]
pub const fn interface(self) -> Interface {
match self {
Self::EcmgScs(_) => Interface::EcmgScs,
Self::EmmgPdgMux(_) => Interface::EmmgPdgMux,
Self::CpSigPSig(_) => Interface::CpSigPSig,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs(m) => m.name(),
Self::EmmgPdgMux(m) => m.name(),
Self::CpSigPSig(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 CpSigParameterType {
AccessCriteria,
BouquetId,
CaDescriptorInsertionMode,
CustomCaSystemId,
CustomChannelId,
CustomStreamId,
Descriptor,
DescriptorInsertStatus,
Duration,
EcmRelatedData,
EsId,
EventId,
EventRelatedData,
FlowId,
FlowPid,
FlowPidChangeRelatedData,
FlowSuperCasId,
FlowType,
InsertionDelay,
InsertionDelayType,
LastSectionIndicator,
LocationId,
MaxCompTime,
MaxStreams,
MpegSection,
NetworkId,
OriginalNetworkId,
PrivateData,
PrivateDataSpecifier,
PSigType,
SegmentNumber,
ServiceId,
ServiceParameters,
StartTime,
StreamChangeTimestamp,
StreamChangeType,
TableId,
TransactionId,
TransportStreamId,
TriggerId,
TriggerList,
TriggerType,
PdRelatedData,
FlowStreamType,
ErrorStatus,
ErrorInformation,
Reserved(u16),
}
impl CpSigParameterType {
#[must_use]
pub const fn from_u16(v: u16) -> Self {
match v {
0x000D => Self::AccessCriteria,
0x0100 => Self::BouquetId,
0x0101 => Self::CaDescriptorInsertionMode,
0x0102 => Self::CustomCaSystemId,
0x0103 => Self::CustomChannelId,
0x0104 => Self::CustomStreamId,
0x0105 => Self::Descriptor,
0x0106 => Self::DescriptorInsertStatus,
0x0107 => Self::Duration,
0x0108 => Self::EcmRelatedData,
0x010B => Self::EsId,
0x010C => Self::EventId,
0x010D => Self::EventRelatedData,
0x010E => Self::FlowId,
0x010F => Self::FlowPid,
0x0110 => Self::FlowPidChangeRelatedData,
0x0111 => Self::FlowSuperCasId,
0x0112 => Self::FlowType,
0x0113 => Self::InsertionDelay,
0x0114 => Self::InsertionDelayType,
0x0115 => Self::LastSectionIndicator,
0x0116 => Self::LocationId,
0x0117 => Self::MaxCompTime,
0x0118 => Self::MaxStreams,
0x0119 => Self::MpegSection,
0x011A => Self::NetworkId,
0x011B => Self::OriginalNetworkId,
0x011C => Self::PrivateData,
0x011D => Self::PrivateDataSpecifier,
0x011E => Self::PSigType,
0x011F => Self::SegmentNumber,
0x0120 => Self::ServiceId,
0x0121 => Self::ServiceParameters,
0x0122 => Self::StartTime,
0x0123 => Self::StreamChangeTimestamp,
0x0124 => Self::StreamChangeType,
0x0125 => Self::TableId,
0x0126 => Self::TransactionId,
0x0127 => Self::TransportStreamId,
0x0128 => Self::TriggerId,
0x0129 => Self::TriggerList,
0x012A => Self::TriggerType,
0x012B => Self::PdRelatedData,
0x012C => Self::FlowStreamType,
0x7000 => Self::ErrorStatus,
0x7001 => Self::ErrorInformation,
other => Self::Reserved(other),
}
}
#[must_use]
pub const fn to_u16(self) -> u16 {
match self {
Self::AccessCriteria => 0x000D,
Self::BouquetId => 0x0100,
Self::CaDescriptorInsertionMode => 0x0101,
Self::CustomCaSystemId => 0x0102,
Self::CustomChannelId => 0x0103,
Self::CustomStreamId => 0x0104,
Self::Descriptor => 0x0105,
Self::DescriptorInsertStatus => 0x0106,
Self::Duration => 0x0107,
Self::EcmRelatedData => 0x0108,
Self::EsId => 0x010B,
Self::EventId => 0x010C,
Self::EventRelatedData => 0x010D,
Self::FlowId => 0x010E,
Self::FlowPid => 0x010F,
Self::FlowPidChangeRelatedData => 0x0110,
Self::FlowSuperCasId => 0x0111,
Self::FlowType => 0x0112,
Self::InsertionDelay => 0x0113,
Self::InsertionDelayType => 0x0114,
Self::LastSectionIndicator => 0x0115,
Self::LocationId => 0x0116,
Self::MaxCompTime => 0x0117,
Self::MaxStreams => 0x0118,
Self::MpegSection => 0x0119,
Self::NetworkId => 0x011A,
Self::OriginalNetworkId => 0x011B,
Self::PrivateData => 0x011C,
Self::PrivateDataSpecifier => 0x011D,
Self::PSigType => 0x011E,
Self::SegmentNumber => 0x011F,
Self::ServiceId => 0x0120,
Self::ServiceParameters => 0x0121,
Self::StartTime => 0x0122,
Self::StreamChangeTimestamp => 0x0123,
Self::StreamChangeType => 0x0124,
Self::TableId => 0x0125,
Self::TransactionId => 0x0126,
Self::TransportStreamId => 0x0127,
Self::TriggerId => 0x0128,
Self::TriggerList => 0x0129,
Self::TriggerType => 0x012A,
Self::PdRelatedData => 0x012B,
Self::FlowStreamType => 0x012C,
Self::ErrorStatus => 0x7000,
Self::ErrorInformation => 0x7001,
Self::Reserved(v) => v,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::AccessCriteria => "access_criteria",
Self::BouquetId => "bouquet_id",
Self::CaDescriptorInsertionMode => "CA_descriptor_insertion_mode",
Self::CustomCaSystemId => "custom_CA_system_id",
Self::CustomChannelId => "custom_channel_id",
Self::CustomStreamId => "custom_stream_id",
Self::Descriptor => "descriptor",
Self::DescriptorInsertStatus => "descriptor_insert_status",
Self::Duration => "duration",
Self::EcmRelatedData => "ECM_related_data",
Self::EsId => "ES_id",
Self::EventId => "event_id",
Self::EventRelatedData => "event_related_data",
Self::FlowId => "flow_id",
Self::FlowPid => "flow_PID",
Self::FlowPidChangeRelatedData => "flow_PID_change_related_data",
Self::FlowSuperCasId => "flow_super_CAS_id",
Self::FlowType => "flow_type",
Self::InsertionDelay => "insertion_delay",
Self::InsertionDelayType => "insertion_delay_type",
Self::LastSectionIndicator => "last_section_indicator",
Self::LocationId => "location_id",
Self::MaxCompTime => "max_comp_time",
Self::MaxStreams => "max_streams",
Self::MpegSection => "MPEG_section",
Self::NetworkId => "network_id",
Self::OriginalNetworkId => "original_network_id",
Self::PrivateData => "private_data",
Self::PrivateDataSpecifier => "private_data_specifier",
Self::PSigType => "(P)SIG_type",
Self::SegmentNumber => "segment_number",
Self::ServiceId => "service_id",
Self::ServiceParameters => "service_parameters",
Self::StartTime => "start_time",
Self::StreamChangeTimestamp => "stream_change_timestamp",
Self::StreamChangeType => "stream_change_type",
Self::TableId => "table_id",
Self::TransactionId => "transaction_id",
Self::TransportStreamId => "transport_stream_id",
Self::TriggerId => "trigger_id",
Self::TriggerList => "trigger_list",
Self::TriggerType => "trigger_type",
Self::PdRelatedData => "PD_related_data",
Self::FlowStreamType => "flow_stream_type",
Self::ErrorStatus => "error_status",
Self::ErrorInformation => "error_information",
Self::Reserved(_) => "reserved",
}
}
}
dvb_common::impl_spec_display!(CpSigParameterType, Reserved);
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[non_exhaustive]
pub enum ParameterType {
EcmgScs(EcmgScsParameterType),
EmmgPdgMux(EmmgMuxParameterType),
CpSigPSig(CpSigParameterType),
}
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)),
Interface::CpSigPSig => Self::CpSigPSig(CpSigParameterType::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(),
Self::CpSigPSig(p) => p.to_u16(),
}
}
#[must_use]
pub const fn interface(self) -> Interface {
match self {
Self::EcmgScs(_) => Interface::EcmgScs,
Self::EmmgPdgMux(_) => Interface::EmmgPdgMux,
Self::CpSigPSig(_) => Interface::CpSigPSig,
}
}
#[must_use]
pub fn name(&self) -> &'static str {
match self {
Self::EcmgScs(p) => p.name(),
Self::EmmgPdgMux(p) => p.name(),
Self::CpSigPSig(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);