MythTV  master
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
DiSEqCDevSwitch Class Reference

Switch class, including tone, legacy and DiSEqC switches. More...

#include <diseqc.h>

Inheritance diagram for DiSEqCDevSwitch:
Inheritance graph
[legend]
Collaboration diagram for DiSEqCDevSwitch:
Collaboration graph
[legend]

Public Types

enum  dvbdev_switch_t {
  kTypeTone = 0, kTypeDiSEqCCommitted = 1, kTypeDiSEqCUncommitted = 2, kTypeLegacySW21 = 3,
  kTypeLegacySW42 = 4, kTypeLegacySW64 = 5, kTypeVoltage = 6, kTypeMiniDiSEqC = 7
}
 
- Public Types inherited from DiSEqCDevDevice
enum  dvbdev_t { kTypeSwitch = 0, kTypeRotor = 1, kTypeSCR = 2, kTypeLNB = 3 }
 

Public Member Functions

 DiSEqCDevSwitch (DiSEqCDevTree &tree, uint devid)
 
 ~DiSEqCDevSwitch () override
 
void Reset (void) override
 Resets to the last known settings for this device. More...
 
bool Execute (const DiSEqCDevSettings &, const DTVMultiplex &) override
 Applies DiSEqC settings to this node and any children. More...
 
bool Load (void) override
 Loads this device from the database. More...
 
bool Store (void) const override
 
void SetType (dvbdev_switch_t type)
 
void SetAddress (uint address)
 
void SetNumPorts (uint num_ports)
 
bool SetChild (uint ordinal, DiSEqCDevDevice *device) override
 Changes the nth child of this node. More...
 
dvbdev_switch_t GetType (void) const
 
uint GetAddress (void) const
 
uint GetNumPorts (void) const
 
bool ShouldSwitch (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const
 
uint GetChildCount (void) const override
 Retrieves the proper number of children for this node. More...
 
bool IsCommandNeeded (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
 Determines if this device or any child will be sending a command for the given configuration chain. More...
 
uint GetVoltage (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
 Retrives the desired voltage for this config. More...
 
DiSEqCDevDeviceGetSelectedChild (const DiSEqCDevSettings &settings) const override
 Retrieves the selected child for this configuration, if any. More...
 
DiSEqCDevDeviceGetChild (uint ordinal) override
 Retrieves the nth child of this node. More...
 
- Public Member Functions inherited from DiSEqCDevDevice
 DiSEqCDevDevice (DiSEqCDevTree &tree, uint devid)
 
virtual ~DiSEqCDevDevice ()
 
void SetDeviceType (dvbdev_t type)
 
void SetParent (DiSEqCDevDevice *parent)
 
void SetOrdinal (uint ordinal)
 
void SetDescription (const QString &desc)
 
void SetRepeatCount (uint repeat)
 
dvbdev_t GetDeviceType (void) const
 
uint GetDeviceID (void) const
 
bool IsRealDeviceID (void) const
 
DiSEqCDevDeviceGetParent (void) const
 
uint GetOrdinal (void) const
 
QString GetDescription (void) const
 
uint GetRepeatCount (void) const
 
DiSEqCDevDeviceFindDevice (uint dev_id)
 

Static Public Member Functions

static QString SwitchTypeToString (dvbdev_switch_t type)
 
static dvbdev_switch_t SwitchTypeFromString (const QString &type)
 
- Static Public Member Functions inherited from DiSEqCDevDevice
static QString DevTypeToString (dvbdev_t type)
 
static dvbdev_t DevTypeFromString (const QString &type)
 
static DiSEqCDevDeviceCreateById (DiSEqCDevTree &tree, uint devid)
 
static DiSEqCDevDeviceCreateByType (DiSEqCDevTree &tree, dvbdev_t type, uint dev_id=0)
 

Protected Member Functions

bool ExecuteLegacy (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
 
bool ExecuteTone (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
 
bool ExecuteVoltage (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
 
bool ExecuteMiniDiSEqC (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
 
bool ExecuteDiseqc (const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
 
int GetPosition (const DiSEqCDevSettings &settings) const
 
- Protected Member Functions inherited from DiSEqCDevDevice
void SetDeviceID (uint devid) const
 

Private Attributes

dvbdev_switch_t m_type {kTypeTone}
 
uint m_address {0x10}
 
uint m_numPorts {2}
 
uint m_lastPos {UINT_MAX}
 
uint m_lastHighBand {UINT_MAX}
 
uint m_lastHorizontal {UINT_MAX}
 
dvbdev_vec_t m_children
 

Static Private Attributes

static const TypeTableVec kSwitchTypeTable
 

Additional Inherited Members

- Protected Types inherited from DiSEqCDevDevice
using TypeTableVec = std::vector< TypeTable >
 
- Static Protected Member Functions inherited from DiSEqCDevDevice
static QString TableToString (uint type, const TypeTableVec &table)
 
static uint TableFromString (const QString &type, const TypeTableVec &table)
 
- Protected Attributes inherited from DiSEqCDevDevice
uint m_devid
 
dvbdev_t m_devType {kTypeLNB}
 
QString m_desc
 
DiSEqCDevTreem_tree
 
DiSEqCDevDevicem_parent {nullptr}
 
uint m_ordinal {0}
 
uint m_repeat {1}
 

Detailed Description

Switch class, including tone, legacy and DiSEqC switches.

Definition at line 223 of file diseqc.h.

Member Enumeration Documentation

◆ dvbdev_switch_t

Enumerator
kTypeTone 
kTypeDiSEqCCommitted 
kTypeDiSEqCUncommitted 
kTypeLegacySW21 
kTypeLegacySW42 
kTypeLegacySW64 
kTypeVoltage 
kTypeMiniDiSEqC 

Definition at line 237 of file diseqc.h.

Constructor & Destructor Documentation

◆ DiSEqCDevSwitch()

DiSEqCDevSwitch::DiSEqCDevSwitch ( DiSEqCDevTree tree,
uint  devid 
)

Definition at line 1060 of file diseqc.cpp.

◆ ~DiSEqCDevSwitch()

DiSEqCDevSwitch::~DiSEqCDevSwitch ( )
override

Definition at line 1071 of file diseqc.cpp.

Member Function Documentation

◆ Reset()

void DiSEqCDevSwitch::Reset ( void  )
overridevirtual

Resets to the last known settings for this device.

Device will not actually have commands issued until next Execute() method.

Reimplemented from DiSEqCDevDevice.

Definition at line 1134 of file diseqc.cpp.

Referenced by DiSEqCDevSwitch().

◆ Execute()

bool DiSEqCDevSwitch::Execute ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning 
)
overridevirtual

Applies DiSEqC settings to this node and any children.

Parameters
settingsConfiguration chain to apply.
tuningTuning parameters.
Returns
True if execution completed successfully.

Implements DiSEqCDevDevice.

Definition at line 1077 of file diseqc.cpp.

◆ Load()

bool DiSEqCDevSwitch::Load ( void  )
overridevirtual

Loads this device from the database.

Returns
True if successful.

Implements DiSEqCDevDevice.

Definition at line 1210 of file diseqc.cpp.

◆ Store()

bool DiSEqCDevSwitch::Store ( void  ) const
overridevirtual

Stores this device to the database.

Returns
True if successful.

Implements DiSEqCDevDevice.

Definition at line 1271 of file diseqc.cpp.

◆ SetType()

void DiSEqCDevSwitch::SetType ( dvbdev_switch_t  type)
inline

Definition at line 248 of file diseqc.h.

Referenced by SwitchTypeSetting::Save().

◆ SetAddress()

void DiSEqCDevSwitch::SetAddress ( uint  address)
inline

Definition at line 249 of file diseqc.h.

Referenced by SwitchAddressSetting::Save().

◆ SetNumPorts()

void DiSEqCDevSwitch::SetNumPorts ( uint  num_ports)

Definition at line 1336 of file diseqc.cpp.

Referenced by SwitchPortsSetting::Save().

◆ SetChild()

bool DiSEqCDevSwitch::SetChild ( uint  ordinal,
DiSEqCDevDevice device 
)
overridevirtual

Changes the nth child of this node.

Parameters
ordinalChild number (starting at 0).
deviceNew child device. (may be nullptr)
Returns
true if object was added to tree.

Reimplemented from DiSEqCDevDevice.

Definition at line 1180 of file diseqc.cpp.

Referenced by Load().

◆ GetType()

dvbdev_switch_t DiSEqCDevSwitch::GetType ( void  ) const
inline

Definition at line 254 of file diseqc.h.

Referenced by SwitchTypeSetting::Load().

◆ GetAddress()

uint DiSEqCDevSwitch::GetAddress ( void  ) const
inline

Definition at line 255 of file diseqc.h.

Referenced by SwitchAddressSetting::Load().

◆ GetNumPorts()

uint DiSEqCDevSwitch::GetNumPorts ( void  ) const
inline

Definition at line 256 of file diseqc.h.

Referenced by SwitchPortsSetting::Load().

◆ ShouldSwitch()

bool DiSEqCDevSwitch::ShouldSwitch ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning 
) const

Definition at line 1545 of file diseqc.cpp.

Referenced by Execute(), and IsCommandNeeded().

◆ GetChildCount()

uint DiSEqCDevSwitch::GetChildCount ( void  ) const
overridevirtual

Retrieves the proper number of children for this node.

Returns
Number of children

Reimplemented from DiSEqCDevDevice.

Definition at line 1167 of file diseqc.cpp.

◆ IsCommandNeeded()

bool DiSEqCDevSwitch::IsCommandNeeded ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning 
) const
overridevirtual

Determines if this device or any child will be sending a command for the given configuration chain.

Parameters
settingsConfiguration chain in effect.
tuningTuning parameters.
Returns
true if a command would be sent if Execute() were called.

Reimplemented from DiSEqCDevDevice.

Definition at line 1146 of file diseqc.cpp.

Referenced by Execute().

◆ GetVoltage()

uint DiSEqCDevSwitch::GetVoltage ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning 
) const
overridevirtual

Retrives the desired voltage for this config.

Parameters
settingsConfiguration chain in effect.
tuningTuning parameters.
Returns
Voltage required.

Implements DiSEqCDevDevice.

Definition at line 1198 of file diseqc.cpp.

◆ GetSelectedChild()

DiSEqCDevDevice * DiSEqCDevSwitch::GetSelectedChild ( const DiSEqCDevSettings settings) const
overridevirtual

Retrieves the selected child for this configuration, if any.

Parameters
settingsConfiguration chain in effect.
Returns
Child node object, or nullptr if none.

Reimplemented from DiSEqCDevDevice.

Definition at line 1157 of file diseqc.cpp.

Referenced by GetVoltage().

◆ GetChild()

DiSEqCDevDevice * DiSEqCDevSwitch::GetChild ( uint  ordinal)
overridevirtual

Retrieves the nth child of this node.

Parameters
ordinalChild number (starting at 0).
Returns
Pointer to device object, or nullptr if no child.

Reimplemented from DiSEqCDevDevice.

Definition at line 1172 of file diseqc.cpp.

◆ SwitchTypeToString()

static QString DiSEqCDevSwitch::SwitchTypeToString ( dvbdev_switch_t  type)
inlinestatic

Definition at line 270 of file diseqc.h.

Referenced by Store().

◆ SwitchTypeFromString()

static dvbdev_switch_t DiSEqCDevSwitch::SwitchTypeFromString ( const QString &  type)
inlinestatic

Definition at line 272 of file diseqc.h.

Referenced by Load().

◆ ExecuteLegacy()

bool DiSEqCDevSwitch::ExecuteLegacy ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning,
uint  pos 
)
protected

Definition at line 1359 of file diseqc.cpp.

Referenced by Execute().

◆ ExecuteTone()

bool DiSEqCDevSwitch::ExecuteTone ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning,
uint  pos 
)
protected

Definition at line 1492 of file diseqc.cpp.

Referenced by Execute().

◆ ExecuteVoltage()

bool DiSEqCDevSwitch::ExecuteVoltage ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning,
uint  pos 
)
protected

Definition at line 1508 of file diseqc.cpp.

Referenced by Execute().

◆ ExecuteMiniDiSEqC()

bool DiSEqCDevSwitch::ExecuteMiniDiSEqC ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning,
uint  pos 
)
protected

Definition at line 1528 of file diseqc.cpp.

Referenced by Execute().

◆ ExecuteDiseqc()

bool DiSEqCDevSwitch::ExecuteDiseqc ( const DiSEqCDevSettings settings,
const DTVMultiplex tuning,
uint  pos 
)
protected

Definition at line 1588 of file diseqc.cpp.

Referenced by Execute().

◆ GetPosition()

int DiSEqCDevSwitch::GetPosition ( const DiSEqCDevSettings settings) const
protected

Definition at line 1635 of file diseqc.cpp.

Referenced by Execute(), GetSelectedChild(), IsCommandNeeded(), and ShouldSwitch().

Member Data Documentation

◆ m_type

dvbdev_switch_t DiSEqCDevSwitch::m_type {kTypeTone}
private

Definition at line 291 of file diseqc.h.

Referenced by Execute(), ExecuteDiseqc(), ExecuteLegacy(), GetType(), Load(), SetType(), ShouldSwitch(), and Store().

◆ m_address

uint DiSEqCDevSwitch::m_address {0x10}
private

Definition at line 292 of file diseqc.h.

Referenced by ExecuteDiseqc(), GetAddress(), Load(), SetAddress(), and Store().

◆ m_numPorts

uint DiSEqCDevSwitch::m_numPorts {2}
private

◆ m_lastPos

uint DiSEqCDevSwitch::m_lastPos {UINT_MAX}
private

Definition at line 294 of file diseqc.h.

Referenced by Execute(), Reset(), and ShouldSwitch().

◆ m_lastHighBand

uint DiSEqCDevSwitch::m_lastHighBand {UINT_MAX}
private

Definition at line 295 of file diseqc.h.

Referenced by ExecuteDiseqc(), Reset(), and ShouldSwitch().

◆ m_lastHorizontal

uint DiSEqCDevSwitch::m_lastHorizontal {UINT_MAX}
private

Definition at line 296 of file diseqc.h.

Referenced by ExecuteDiseqc(), Reset(), and ShouldSwitch().

◆ m_children

dvbdev_vec_t DiSEqCDevSwitch::m_children
private

◆ kSwitchTypeTable

const std::vector< DiSEqCDevDevice::TypeTable > DiSEqCDevSwitch::kSwitchTypeTable
staticprivate
Initial value:
{
{ "legacy_sw21", kTypeLegacySW21 },
{ "legacy_sw42", kTypeLegacySW42 },
{ "legacy_sw64", kTypeLegacySW64 },
{ "tone", kTypeTone },
{ "diseqc", kTypeDiSEqCCommitted },
{ "diseqc_uncom", kTypeDiSEqCUncommitted },
{ "voltage", kTypeVoltage },
{ "mini_diseqc", kTypeMiniDiSEqC },
{ QString(), kTypeTone },
}

Definition at line 299 of file diseqc.h.

Referenced by SwitchTypeFromString(), and SwitchTypeToString().


The documentation for this class was generated from the following files:
DiSEqCDevSwitch::kTypeDiSEqCUncommitted
@ kTypeDiSEqCUncommitted
Definition: diseqc.h:241
DiSEqCDevSwitch::kTypeDiSEqCCommitted
@ kTypeDiSEqCCommitted
Definition: diseqc.h:240
DiSEqCDevSwitch::kTypeMiniDiSEqC
@ kTypeMiniDiSEqC
Definition: diseqc.h:246
DiSEqCDevSwitch::kTypeTone
@ kTypeTone
Definition: diseqc.h:239
DiSEqCDevSwitch::kTypeLegacySW64
@ kTypeLegacySW64
Definition: diseqc.h:244
DiSEqCDevSwitch::kTypeLegacySW42
@ kTypeLegacySW42
Definition: diseqc.h:243
DiSEqCDevSwitch::kTypeLegacySW21
@ kTypeLegacySW21
Definition: diseqc.h:242
DiSEqCDevSwitch::kTypeVoltage
@ kTypeVoltage
Definition: diseqc.h:245