Go to the documentation of this file.
30 static constexpr uint8_t SEC_VOLTAGE_13 { 0 };
31 static constexpr uint8_t SEC_VOLTAGE_18 { 1 };
32 static constexpr uint8_t SEC_VOLTAGE_OFF { 2 };
91 static constexpr
double EPS { 1E-4 };
93 #define LOC QString("DiSEqCDevTree: ")
99 for (
const auto &item : table)
100 if (
type == item.value)
108 for (
const auto &item : table)
109 if (
type == item.name)
111 return table[0].value;
138 "SELECT diseqcid, value "
139 "FROM diseqc_config "
140 "WHERE cardinputid = :INPUTID");
142 query.
bindValue(
":INPUTID", card_input_id);
168 "DELETE from diseqc_config "
169 "WHERE cardinputid = :INPUTID");
170 query.
bindValue(
":INPUTID", card_input_id);
180 "INSERT INTO diseqc_config "
181 " ( cardinputid, diseqcid, value) "
182 "VALUES (:INPUTID, :DEVID, :VALUE) ");
186 query.
bindValue(
":INPUTID", card_input_id);
206 uint_to_dbl_t::const_iterator it =
m_config.find(devid);
269 cardid_to_diseqc_tree_t::iterator it =
m_trees.find(cardid);
318 "WHERE hostname = :HOSTNAME AND "
319 " videodevice = :VIDEODEVICE "
330 else if (query.
next())
332 cardid = query.
value(0).toUInt();
358 "SELECT diseqcid, cardtype, inputname "
360 "WHERE cardid = :CARDID");
367 else if (!query.
next())
372 if (query.
value(0).toBool())
375 *
this, query.
value(0).toUInt());
377 else if ((query.
value(1).toString().toUpper() ==
"DVB") &&
378 ((query.
value(2).toString().toUpper() ==
"DVB-S" ) ||
379 (query.
value(2).toString().toUpper() ==
"DVB-S2") ))
381 LOG(VB_GENERAL, LOG_WARNING,
LOC +
382 QString(
"No device tree for cardid %1").arg(cardid));
400 "WHERE cardid = :CARDID");
407 else if (query.
next())
409 if (query.
value(0).toUInt() > 0)
432 "DELETE FROM diseqc_tree "
433 "WHERE diseqcid = :DEVID");
435 "DELETE FROM diseqc_config "
436 "WHERE diseqcid = :DEVID");
458 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Failed to save DiSEqC tree.");
464 "UPDATE capturecard "
465 "SET diseqcid = :DEVID "
466 "WHERE (hostname = :HOSTNAME AND "
467 " videodevice = :VIDEODEVICE) "
468 " OR cardid = :CARDID");
471 query0.
bindValue(
":VIDEODEVICE", device);
486 bool success =
false;
492 on ? SEC_TONE_ON : SEC_TONE_OFF) == 0)
500 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_SET_TONE failed" +
ENO);
516 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No root device tree node!");
557 for (
uint count = 0; node;)
561 if (rotor && (++count > index))
646 bool success =
false;
650 if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == 0)
658 LOG(VB_GENERAL, LOG_ERR,
LOC +
659 "send_diseqc FE_DISEQC_SEND_MASTER_CMD failed" +
ENO);
680 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Bad DiSEqC command");
691 #else // if USING_DVB
693 bool resend_cmd =
false;
696 dvb_diseqc_master_cmd mcmd = {};
700 mcmd.msg_len = data.size() + 3;
703 std::copy(data.cbegin(), data.cend(), mcmd.msg + 3);
707 for (
uint byte = 0;
byte < mcmd.msg_len;
byte++)
708 cmdstr += QString(
"%1 ").arg(mcmd.msg[
byte], 2, 16);
710 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Sending DiSEqC Command: " + cmdstr);
714 repeats = repeats - 10;
719 for (
uint i = 0; i <= repeats; i++)
723 LOG(VB_GENERAL, LOG_ERR,
LOC +
"DiSEqC command failed" +
ENO);
752 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Power-cycling DiSEqC Bus");
768 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Resetting DiSEqC Bus");
771 LOG(VB_GENERAL, LOG_ERR,
LOC +
"DiSEqC reset failed" +
ENO);
780 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Skipping reset: already done for this SCR bus");
806 int volts = ((voltage == SEC_VOLTAGE_18) ? 18 :
807 ((voltage == SEC_VOLTAGE_13) ? 13 : 0));
809 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing LNB voltage to " +
810 QString(
"%1V").arg(volts));
812 bool success =
false;
826 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_SET_VOLTAGE failed" +
ENO);
845 uint voltage = SEC_VOLTAGE_18;
861 {
"switch", kTypeSwitch },
862 {
"rotor", kTypeRotor },
865 { QString(), kTypeLNB },
884 for (
uint ch = 0; !dev && ch < num_children; ch++)
904 "SELECT type, description "
906 "WHERE diseqcid = :DEVID");
916 LOG(VB_GENERAL, LOG_ERR,
LOC +
"CreateById failed to find dtv dev " +
917 QString(
"%1").arg(devid));
923 QString desc = query.
value(1).toString();
1052 {
"legacy_sw21", kTypeLegacySW21 },
1053 {
"legacy_sw42", kTypeLegacySW42 },
1054 {
"legacy_sw64", kTypeLegacySW64 },
1055 {
"tone", kTypeTone },
1056 {
"diseqc", kTypeDiSEqCCommitted },
1057 {
"diseqc_uncom", kTypeDiSEqCUncommitted },
1058 {
"voltage", kTypeVoltage },
1059 {
"mini_diseqc", kTypeMiniDiSEqC },
1060 { QString(), kTypeTone },
1083 bool success =
true;
1115 LOG(VB_GENERAL, LOG_ERR,
LOC +
1116 QString(
"Unknown switch type (%1)").arg((
uint)
m_type));
1123 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Waiting for switch");
1132 success =
m_children[pos]->Execute(settings, tuning);
1204 uint voltage = SEC_VOLTAGE_18;
1208 voltage = child->
GetVoltage(settings, tuning);
1224 "SELECT subtype, address, switch_ports, cmd_repeat "
1226 "WHERE diseqcid = :DEVID");
1247 "SELECT diseqcid, ordinal "
1249 "WHERE parentid = :DEVID");
1257 while (query.
next())
1259 uint child_dev_id = query.
value(0).toUInt();
1262 if (child && !
SetChild(ordinal, child))
1264 LOG(VB_GENERAL, LOG_ERR,
LOC +
1265 QString(
"Switch port out of range (%1 > %2)")
1283 "UPDATE diseqc_tree "
1284 "SET parentid = :PARENT, "
1285 " ordinal = :ORDINAL, "
1286 " type = 'switch', "
1287 " description = :DESC, "
1288 " subtype = :TYPE, "
1289 " address = :ADDRESS, "
1290 " switch_ports = :PORTS, "
1291 " cmd_repeat = :REPEAT "
1292 "WHERE diseqcid = :DEVID");
1298 "INSERT INTO diseqc_tree"
1299 " ( parentid, ordinal, type, "
1300 " description, address, subtype, "
1301 " switch_ports, cmd_repeat ) "
1303 " (:PARENT, :ORDINAL, 'switch', "
1304 " :DESC, :ADDRESS, :TYPE, "
1305 " :PORTS, :REPEAT )");
1329 bool success =
true;
1333 success &= child->Store();
1343 if (old_num > num_ports)
1345 for (
uint ch = num_ports; ch < old_num; ch++)
1352 else if (old_num < num_ports)
1355 for (
uint ch = old_num; ch < num_ports; ch++)
1370 #if defined(USING_DVB) && defined(FE_DISHNETWORK_SEND_LEGACY_CMD)
1371 static const cmd_vec_t kSw21Cmds { 0x34, 0x65, };
1372 static const cmd_vec_t kSw42Cmds { 0x46, 0x17, };
1373 static const cmd_vec_t kSw64VCmds { 0x39, 0x4b, 0x0d, };
1374 static const cmd_vec_t kSw64HCmds { 0x1a, 0x5c, 0x2e, };
1377 unsigned char horizcmd = 0x00;
1380 bool horizontal =
false;
1407 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1408 QString(
"Changing to Legacy switch port %1/%2")
1409 .arg(pos + 1).arg(cmds.size()));
1412 if (ioctl(
m_tree.
GetFD(), FE_DISHNETWORK_SEND_LEGACY_CMD,
1413 cmds[pos] | horizcmd) == -1)
1415 LOG(VB_GENERAL, LOG_ERR,
LOC +
1416 "FE_DISHNETWORK_SEND_LEGACY_CMD failed" +
ENO);
1423 #else // !FE_DISHNETWORK_SEND_LEGACY_CMD
1425 LOG(VB_GENERAL, LOG_ERR,
LOC +
"You must compile with a newer "
1426 "version of the linux headers for DishNet Legacy switch support.");
1429 #endif // !FE_DISHNETWORK_SEND_LEGACY_CMD
1435 bool success =
false;
1439 if (ioctl(fd, FE_SET_TONE, tone) == 0)
1447 LOG(VB_GENERAL, LOG_ERR,
LOC +
"set_tone failed" +
ENO);
1457 bool success =
false;
1461 if (0 == ioctl(fd, FE_SET_VOLTAGE, volt))
1469 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_SET_VOLTAGE failed" +
ENO);
1479 bool success =
false;
1483 if (ioctl(fd, FE_DISEQC_SEND_BURST, cmd) == 0)
1491 LOG(VB_GENERAL, LOG_ERR,
LOC +
1492 "mini_diseqc FE_DISEQC_SEND_BURST failed" +
ENO);
1503 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to Tone switch port " +
1504 QString(
"%1/2").arg(pos + 1));
1511 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Tone Switch failed." +
ENO);
1521 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to Voltage Switch port " +
1522 QString(
"%1/2").arg(pos + 1));
1526 (0 == pos) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18))
1532 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Voltage Switch failed." +
ENO);
1543 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to MiniDiSEqC Switch port " +
1544 QString(
"%1/2").arg(pos + 1));
1551 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Mini DiSEqC Switch failed." +
ENO);
1567 bool high_band =
false;
1568 bool horizontal =
false;
1584 bool horizontal =
false;
1603 auto pos =
static_cast<uint8_t
>(pos32);
1605 bool high_band =
false;
1606 bool horizontal =
false;
1618 LOG(VB_GENERAL, LOG_ERR,
LOC +
1619 QString(
"Invalid number of ports for DiSEqC 1.x Switch (%1)")
1630 data[0] = ((pos << 2) | (horizontal ? 2 : 0) | (high_band ? 1 : 0));
1634 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to DiSEqC switch port " +
1635 QString(
"%1/%2").arg(pos + 1).arg(
m_numPorts));
1652 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Port %1 ").arg(pos + 1) +
1653 QString(
"is not in range [0..%1)").arg(
m_numPorts));
1660 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Port %1 ").arg(pos + 1) +
1661 "has no connected devices configured.");
1673 struct timeval curtime {};
1674 gettimeofday(&curtime,
nullptr);
1675 return (
double)curtime.tv_sec + (((double)curtime.tv_usec) / 1000000);
1684 {
"diseqc_1_2", kTypeDiSEqC_1_2 },
1685 {
"diseqc_1_3", kTypeDiSEqC_1_3 },
1686 {
nullptr, kTypeDiSEqC_1_3 }
1697 bool success =
true;
1712 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Unknown rotor type " +
1791 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1792 "Overriding voltage to 18V for faster rotor movement");
1799 return SEC_VOLTAGE_18;
1807 "SELECT subtype, rotor_positions, "
1808 " rotor_hi_speed, rotor_lo_speed, "
1811 "WHERE diseqcid = :DEVID");
1827 QString positions = query.
value(1).toString();
1828 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
1829 QStringList pos = positions.split(
":", QString::SkipEmptyParts);
1831 QStringList pos = positions.split(
":", Qt::SkipEmptyParts);
1833 for (
const auto & kv : qAsConst(pos))
1835 #if QT_VERSION < QT_VERSION_CHECK(5,14,0)
1836 const QStringList eq = kv.split(
"=", QString::SkipEmptyParts);
1838 const QStringList eq = kv.split(
"=", Qt::SkipEmptyParts);
1841 m_posmap[eq[0].toFloat()] = eq[1].toUInt();
1855 "WHERE parentid = :DEVID");
1865 uint child_dev_id = query.
value(0).toUInt();
1874 QString posmap =
"";
1881 dbl_to_uint_t::const_iterator it =
m_posmap.begin();
1883 pos.push_back(QString(
"%1=%2").arg(it.key()).arg(*it));
1885 posmap = pos.join(
":");
1894 "UPDATE diseqc_tree "
1895 "SET parentid = :PARENT, "
1896 " ordinal = :ORDINAL, "
1898 " description = :DESC, "
1899 " subtype = :TYPE, "
1900 " rotor_hi_speed = :HISPEED, "
1901 " rotor_lo_speed = :LOSPEED, "
1902 " rotor_positions = :POSMAP, "
1903 " cmd_repeat = :REPEAT "
1904 "WHERE diseqcid = :DEVID");
1910 "INSERT INTO diseqc_tree "
1911 " ( parentid, ordinal, type, "
1912 " description, subtype, rotor_hi_speed, "
1913 " rotor_lo_speed, rotor_positions, cmd_repeat ) "
1915 " (:PARENT, :ORDINAL, 'rotor', "
1916 " :DESC, :TYPE, :HISPEED, "
1917 " :LOSPEED, :POSMAP, :REPEAT )");
1962 double duration = change / speed;
1966 double completed = time_since_move / duration;
1991 dbl_to_uint_t::const_iterator it;
1993 inv_posmap[*it] = it.key();
2002 uint_to_dbl_t::const_iterator it;
2003 for (it = inv_posmap.begin(); it != inv_posmap.end(); ++it)
2012 dbl_to_uint_t::const_iterator it =
2014 cmd_vec_t index {
static_cast<uint8_t
>(angle) };
2021 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Rotor - " +
2022 QString(
"Goto Stored Position %1").arg(index[0]));
2035 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"USALS Rotor - " +
2036 QString(
"Goto %1 (Azimuth %2)").arg(angle).arg(azimuth));
2038 uint az16 = (
uint) (abs(azimuth) * 16.0);
2040 static_cast<uint8_t
>(((azimuth > 0.0) ? 0xE0 : 0xD0) | ((az16 >> 8) & 0x0f)),
2041 static_cast<uint8_t
>(az16 & 0xff) };
2060 return TO_DEC * atan( tan(Us - Ue) / sin(P) );
2101 {
"A", kTypeScrPosA },
2102 {
"B", kTypeScrPosB },
2103 { QString(), kTypeScrPosA },
2123 LOG(VB_GENERAL, LOG_ERR,
LOC +
"SCR: No LNB for this configuration!");
2138 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: Userband ID=%1 is out of range (0-7)!")
2145 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: T=%1 is out of range!").arg(
t));
2149 LOG(VB_GENERAL, LOG_INFO, QString(
"SCR: Tuning to %1kHz, %2, %3 using UB=%4, FREQ=%5MHz, POS=%6%7")
2151 .arg(high_band ?
"HiBand" :
"LoBand",
2152 horizontal ?
"H" :
"V")
2155 .arg((scr_position) ?
"B" :
"A",
2157 QString(
", PIN=%1").arg(
m_scrPin) : QString(
"")));
2162 static_cast<uint8_t
>(
t & 0x00FF) };
2165 data[0] |= (1 << 2);
2168 data[0] |= (1 << 3);
2171 data[0] |= (1 << 4);
2184 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: Userband ID=%1 is out of range (0-7)!")
2189 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"SCR: Power off UB=%1%7")
2192 ? QString(
", PIN=%1").arg(
m_scrPin)
2227 return SEC_VOLTAGE_13;
2233 return ((
t + 350) * 4) * 1000 - frequency;
2241 "SELECT scr_userband, scr_frequency, "
2242 " scr_pin, cmd_repeat "
2244 "WHERE diseqcid = :DEVID");
2270 "WHERE parentid = :DEVID");
2280 uint child_dev_id = query.
value(0).toUInt();
2295 "UPDATE diseqc_tree "
2296 "SET parentid = :PARENT, "
2297 " ordinal = :ORDINAL, "
2299 " description = :DESC, "
2300 " scr_userband = :USERBAND, "
2301 " scr_frequency = :FREQUENCY, "
2303 " cmd_repeat = :REPEAT "
2304 "WHERE diseqcid = :DEVID");
2310 "INSERT INTO diseqc_tree"
2311 " ( parentid, ordinal, type, "
2312 " description, scr_userband, scr_frequency, "
2313 " scr_pin, cmd_repeat) "
2315 " (:PARENT, :ORDINAL, 'scr', "
2316 " :DESC, :USERBAND, :FREQUENCY,"
2317 " :PIN, :REPEAT) ");
2375 {
"fixed", kTypeFixed },
2376 {
"voltage", kTypeVoltageControl },
2377 {
"voltage_tone", kTypeVoltageAndToneControl },
2378 {
"bandstacked", kTypeBandstacked },
2379 { QString(), kTypeVoltageAndToneControl },
2394 uint voltage = SEC_VOLTAGE_18;
2399 voltage = (
IsHorizontal(tuning) ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13);
2410 "SELECT subtype, lnb_lof_switch, "
2411 " lnb_lof_hi, lnb_lof_lo, "
2412 " lnb_pol_inv, cmd_repeat "
2414 "WHERE diseqcid = :DEVID");
2444 "UPDATE diseqc_tree "
2445 "SET parentid = :PARENT, "
2446 " ordinal = :ORDINAL, "
2448 " description = :DESC, "
2449 " subtype = :TYPE, "
2450 " lnb_lof_switch = :LOFSW, "
2451 " lnb_lof_lo = :LOFLO, "
2452 " lnb_lof_hi = :LOFHI, "
2453 " lnb_pol_inv = :POLINV, "
2454 " cmd_repeat = :REPEAT "
2455 "WHERE diseqcid = :DEVID");
2461 "INSERT INTO diseqc_tree"
2462 " ( parentid, ordinal, type, "
2463 " description, subtype, lnb_lof_switch, "
2464 " lnb_lof_lo, lnb_lof_hi, lnb_pol_inv, "
2467 " (:PARENT, :ORDINAL, 'lnb', "
2468 " :DESC, :TYPE, :LOFSW, "
2469 " :LOFLO, :LOFHI, :POLINV, "
2543 return (lof > abs_freq) ? (lof - abs_freq) : (abs_freq - lof);
static QString SwitchTypeToString(dvbdev_switch_t type)
bool isActive(void) const
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.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
QSqlQuery wrapper that fetches a DB connection from the connection pool.
virtual uint GetChildCount(void) const
Retrieves the proper number of children for this node.
bool Store(void) const override
bool IsInNeedOfConf(void) const
#define ENO
This can be appended to the LOG args with "+".
static dvbdev_switch_t SwitchTypeFromString(const QString &type)
DiSEqCDevDevice * FindDevice(uint dev_id)
uint32_t GetIntermediateFrequency(uint32_t frequency) const
static const TypeTableVec kSwitchTypeTable
static constexpr useconds_t DISEQC_LONG_WAIT
double GetValue(uint devid) const
Retrieves a value from this configuration chain by device id.
~DiSEqCDevRotor() override
static dvbdev_lnb_t LNBTypeFromString(const QString &type)
void SetDeviceID(uint devid) const
uint GetVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
Retrives the desired voltage for this config.
static bool set_tone(int fd, fe_sec_tone_mode tone)
std::vector< uint > m_delete
bool SetChild(uint ordinal, DiSEqCDevDevice *device) override
Changes the nth child of this node.
static constexpr uint8_t DISEQC_FRM_REPEAT
static const TypeTableVec kLNBTypeTable
bool SendCommand(uint adr, uint cmd, uint repeats, cmd_vec_t &data) const
void SetValue(uint devid, double value)
Sets a value for this configuration chain by device id.
QString GetDescription(void) const
QVariant lastInsertId()
Return the id of the last inserted row.
bool SendCommand(uint cmd, uint repeats, cmd_vec_t &data) const
bool Execute(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning)
Applies settings to the entire tree.
QVariant value(int i) const
static QString RotorTypeToString(dvbdev_rotor_t type)
DiSEqCDevDevice * GetChild(uint ordinal) override
Retrieves the nth child of this node.
void SetPosMap(const uint_to_dbl_t &posmap)
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
bool SetTone(bool on) const
bool Execute(const DiSEqCDevSettings &, const DTVMultiplex &) override
Applies DiSEqC settings to this node and any children.
DiSEqCDevDevice * m_child
Static-scoped locked tree list class.
static const TypeTableVec kRotorTypeTable
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Represents a node in a DVB-S device network.
virtual uint GetVoltage(const DiSEqCDevSettings &, const DTVMultiplex &) const =0
Retrives the desired voltage for this config.
static constexpr uint8_t DISEQC_FRM
bool Load(uint card_input_id)
Loads configuration chain from DB for specified card input id.
void Reset(void) override
Resets to the last known settings for this device.
bool Store(void) const override
int GetPosition(const DiSEqCDevSettings &settings) const
static constexpr useconds_t TIMEOUT_WAIT
static bool Exists(int cardid)
Check if a Diseqc device tree exists.
bool SetChild(uint ordinal, DiSEqCDevDevice *device) override
Changes the nth child of this node.
void Open(int fd_frontend, bool is_SCR)
Retrieve device tree.
uint m_inputId
current input id
virtual void Reset(void)
Resets to the last known settings for this device.
bool ExecuteTone(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
static constexpr double TO_DEC
bool ExecuteRotor(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, double angle)
DVB-S device settings class.
static const uint kFirstFakeDiSEqCID
dvbdev_t GetDeviceType(void) const
double GetProgress(void) const
Returns an indication of rotor progress.
std::vector< uint8_t > cmd_vec_t
static double CalculateAzimuth(double angle)
uint GetChildCount(void) const override
Retrieves the proper number of children for this node.
static QString TableToString(uint type, const TypeTableVec &table)
bool IsPolarityInverted(void) const
bool Store(void) const override
static const TypeTableVec kSCRPositionTable
static double GetCurTimeFloating(void)
bool ApplyVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning)
bool m_polInv
If a signal is circularly polarized the polarity will flip on each reflection, so antenna systems wit...
bool ExecuteMiniDiSEqC(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
bool Store(void) const override
MBASE_PUBLIC long long copy(QFile &dst, QFile &src, uint block_size=0)
Copies src file to dst file.
static uint TableFromString(const QString &type, const TypeTableVec &table)
bool SetVoltage(uint voltage)
void SetDeviceType(dvbdev_t type)
bool Load(void) override
Loads this device from the database.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
std::vector< TypeTable > TypeTableVec
virtual bool Load(void)=0
Loads this device from the database.
static void DBError(const QString &where, const MSqlQuery &query)
bool IsPositionKnown(void) const
Returns true if there is reasonable confidence in the value returned by GetProgress().
static bool send_diseqc(int fd, const dvb_diseqc_master_cmd cmd)
uint CreateFakeDiSEqCID(void)
QMap< uint, double > uint_to_dbl_t
void SetOrdinal(uint ordinal)
bool Execute(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) override
Applies DiSEqC settings to this node and any children.
static dvbdev_rotor_t RotorTypeFromString(const QString &type)
void RotationComplete(void) const
bool Load(const QString &device)
Loads the device tree from the database.
void SetParent(DiSEqCDevDevice *parent)
bool ExecuteLegacy(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
void SetRoot(DiSEqCDevDevice *root)
Changes the root node of the tree.
static constexpr useconds_t DISEQC_POWER_ON_WAIT
DiSEqCDevDevice * GetSelectedChild(const DiSEqCDevSettings &setting) const override
Retrieves the selected child for this configuration, if any.
virtual DiSEqCDevDevice * GetChild(uint)
Retrieves the nth child of this node.
bool Load(void) override
Loads this device from the database.
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.
DiSEqCDevDevice * GetSelectedChild(const DiSEqCDevSettings &settings) const override
Retrieves the selected child for this configuration, if any.
bool IsHorizontal(const DTVMultiplex &tuning) const
Determine if horizontal polarity is active (for switchable LNBs).
bool Execute(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) override
Applies DiSEqC settings to this node and any children.
DiSEqCDevDevice * m_parent
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
uint_to_dbl_t GetPosMap(void) const
bool ExecuteVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
bool Execute(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) override
Applies DiSEqC settings to this node and any children.
static DiSEqCDevTree * FindTree(uint cardid)
Retrieve device tree.
static constexpr double TO_RADS
static DiSEqCDevTrees s_trees
virtual bool IsCommandNeeded(const DiSEqCDevSettings &, const DTVMultiplex &) const
Determines if this device or any child will be sending a command for the given configuration chain.
static DiSEqCDevDevice * CreateByType(DiSEqCDevTree &tree, dvbdev_t type, uint dev_id=0)
bool SetChild(uint ordinal, DiSEqCDevDevice *device) override
Changes the nth child of this node.
DiSEqCDevDevice * FindDevice(uint dev_id)
Returns a device by ID.
bool PowerOff(void) const
bool Load(void) override
Loads this device from the database.
DiSEqCDevLNB * FindLNB(const DiSEqCDevSettings &settings)
Returns the LNB device object selected by the configuration chain.
static QString LNBTypeToString(dvbdev_lnb_t type)
void StartRotorPositionTracking(double azimuth)
bool ExecuteUSALS(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, double angle)
static bool set_voltage(int fd, fe_sec_voltage volt)
bool diseqc_bus_already_reset
void SetNumPorts(uint num_ports)
bool Store(uint card_input_id) const
Stores configuration chain to DB for specified card input id.
static void InvalidateTrees(void)
Invalidate cached trees.
bool ResetDiseqc(bool hard_reset, bool is_SCR)
Resets the DiSEqC bus.
virtual ~DiSEqCDevDevice()
static const TypeTableVec kDvbdevLookup
DiSEqCDevRotor * FindRotor(const DiSEqCDevSettings &settings, uint index=0)
Returns the nth rotor device object in the tree.
uint GetVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
Retrives the desired voltage for this config.
static constexpr useconds_t DISEQC_SHORT_WAIT
static DiSEqCDevDevice * CreateById(DiSEqCDevTree &tree, uint devid)
DiSEqCDevDevice * m_child
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
static dvbdev_t DevTypeFromString(const QString &type)
~DiSEqCDevSwitch() override
DiSEqCDevSCR * FindSCR(const DiSEqCDevSettings &settings)
Returns the SCR device object selected by the configuration chain.
bool IsRealDeviceID(void) const
bool ExecuteDiseqc(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning, uint pos)
void Reset(void) override
Resets to the last known settings for this device.
double GetApproxAzimuth(void) const
static bool mini_diseqc(int fd, fe_sec_mini_cmd cmd)
bool IsMoving(const DiSEqCDevSettings &settings) const
bool Load(void) override
Loads this device from the database.
DVB-S device tree class. Represents a tree of DVB-S devices.
virtual bool Store(void) const =0
void SetDescription(const QString &desc)
bool IsHighBand(const DTVMultiplex &tuning) const
Determine if the high frequency band is active (for switchable LNBs).
QString GetHostName(void)
bool Store(uint cardid, const QString &device="")
Stores the device tree to the database.
DiSEqCDevTree * FindTree(uint cardid)
Retrieve device tree.
uint GetDeviceID(void) const
@ kTypeVoltageAndToneControl
DiSEqCDevSwitch(DiSEqCDevTree &tree, uint devid)
void Reset(void) override
Resets to the last known settings for this device.
uint GetVoltage(void) const
static constexpr useconds_t DISEQC_POWER_OFF_WAIT
static constexpr uint8_t TIMEOUT_RETRIES
virtual DiSEqCDevDevice * GetSelectedChild(const DiSEqCDevSettings &) const
Retrieves the selected child for this configuration, if any.
virtual bool Execute(const DiSEqCDevSettings &, const DTVMultiplex &)=0
Applies DiSEqC settings to this node and any children.
cardid_to_diseqc_tree_t m_trees
static constexpr double EPS
void InvalidateTrees(void)
Invalidate cached trees.
uint GetVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
Retrives the desired voltage for this config.
uint GetVoltage(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const override
Retrives the desired voltage for this config.
void Reset(void)
Reset state of nodes in tree, forcing updates on the next Execute command.
QString GetSetting(const QString &key, const QString &defaultval="")
uint32_t GetIntermediateFrequency(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const
Calculate proper intermediate frequency for the given settings and tuning parameters.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
void AddDeferredDelete(uint dev_id)
Switch class, including tone, legacy and DiSEqC switches.
bool ShouldSwitch(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) const