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);
484 bool success =
false;
490 on ? SEC_TONE_ON : SEC_TONE_OFF) == 0)
498 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_SET_TONE failed" +
ENO);
514 LOG(VB_GENERAL, LOG_ERR,
LOC +
"No root device tree node!");
555 for (
uint count = 0; node;)
559 if (rotor && (++count > index))
644 bool success =
false;
648 if (ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd) == 0)
656 LOG(VB_GENERAL, LOG_ERR,
LOC +
657 "send_diseqc FE_DISEQC_SEND_MASTER_CMD failed" +
ENO);
673 [[maybe_unused]]
uint cmd,
674 [[maybe_unused]]
uint repeats,
680 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Bad DiSEqC command");
688 #else // if USING_DVB
690 bool resend_cmd =
false;
693 dvb_diseqc_master_cmd mcmd = {};
697 mcmd.msg_len = data.size() + 3;
700 std::copy(data.cbegin(), data.cend(), mcmd.msg + 3);
704 for (
uint byte = 0;
byte < mcmd.msg_len;
byte++)
705 cmdstr += QString(
"%1 ").arg(mcmd.msg[
byte], 2, 16);
707 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Sending DiSEqC Command: " + cmdstr);
711 repeats = repeats - 10;
716 for (
uint i = 0; i <= repeats; i++)
720 LOG(VB_GENERAL, LOG_ERR,
LOC +
"DiSEqC command failed" +
ENO);
749 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Power-cycling DiSEqC Bus");
765 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Resetting DiSEqC Bus");
768 LOG(VB_GENERAL, LOG_ERR,
LOC +
"DiSEqC reset failed" +
ENO);
777 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Skipping reset: already done for this SCR bus");
804 if (voltage == SEC_VOLTAGE_18)
806 else if (voltage == SEC_VOLTAGE_13)
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++)
1364 [[maybe_unused]]
uint pos)
1366 #if defined(USING_DVB) && defined(FE_DISHNETWORK_SEND_LEGACY_CMD)
1367 static const cmd_vec_t kSw21Cmds { 0x34, 0x65, };
1368 static const cmd_vec_t kSw42Cmds { 0x46, 0x17, };
1369 static const cmd_vec_t kSw64VCmds { 0x39, 0x4b, 0x0d, };
1370 static const cmd_vec_t kSw64HCmds { 0x1a, 0x5c, 0x2e, };
1373 unsigned char horizcmd = 0x00;
1376 bool horizontal =
false;
1403 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1404 QString(
"Changing to Legacy switch port %1/%2")
1405 .arg(pos + 1).arg(cmds.size()));
1408 if (ioctl(
m_tree.
GetFD(), FE_DISHNETWORK_SEND_LEGACY_CMD,
1409 cmds[pos] | horizcmd) == -1)
1411 LOG(VB_GENERAL, LOG_ERR,
LOC +
1412 "FE_DISHNETWORK_SEND_LEGACY_CMD failed" +
ENO);
1419 #else // !FE_DISHNETWORK_SEND_LEGACY_CMD
1421 LOG(VB_GENERAL, LOG_ERR,
LOC +
"You must compile with a newer "
1422 "version of the linux headers for DishNet Legacy switch support.");
1425 #endif // !FE_DISHNETWORK_SEND_LEGACY_CMD
1431 bool success =
false;
1435 if (ioctl(fd, FE_SET_TONE, tone) == 0)
1443 LOG(VB_GENERAL, LOG_ERR,
LOC +
"set_tone failed" +
ENO);
1453 bool success =
false;
1457 if (0 == ioctl(fd, FE_SET_VOLTAGE, volt))
1465 LOG(VB_GENERAL, LOG_ERR,
LOC +
"FE_SET_VOLTAGE failed" +
ENO);
1475 bool success =
false;
1479 if (ioctl(fd, FE_DISEQC_SEND_BURST, cmd) == 0)
1487 LOG(VB_GENERAL, LOG_ERR,
LOC +
1488 "mini_diseqc FE_DISEQC_SEND_BURST failed" +
ENO);
1499 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to Tone switch port " +
1500 QString(
"%1/2").arg(pos + 1));
1507 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Tone Switch failed." +
ENO);
1515 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to Voltage Switch port " +
1516 QString(
"%1/2").arg(pos + 1));
1520 (0 == pos) ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18))
1526 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Voltage Switch failed." +
ENO);
1535 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to MiniDiSEqC Switch port " +
1536 QString(
"%1/2").arg(pos + 1));
1543 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Setting Mini DiSEqC Switch failed." +
ENO);
1559 bool high_band =
false;
1560 bool horizontal =
false;
1576 bool horizontal =
false;
1597 auto pos =
static_cast<uint8_t
>(pos32);
1599 bool high_band =
false;
1600 bool horizontal =
false;
1612 LOG(VB_GENERAL, LOG_ERR,
LOC +
1613 QString(
"Invalid number of ports for DiSEqC 1.x Switch (%1)")
1624 data[0] = ((pos << 2) | (horizontal ? 2 : 0) | (high_band ? 1 : 0));
1628 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Changing to DiSEqC switch port " +
1629 QString(
"%1/%2").arg(pos + 1).arg(
m_numPorts));
1646 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Port %1 ").arg(pos + 1) +
1647 QString(
"is not in range [0..%1)").arg(
m_numPorts));
1654 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"Port %1 ").arg(pos + 1) +
1655 "has no connected devices configured.");
1667 struct timeval curtime {};
1668 gettimeofday(&curtime,
nullptr);
1669 return (
double)curtime.tv_sec + (((double)curtime.tv_usec) / 1000000);
1678 {
"diseqc_1_2", kTypeDiSEqC_1_2 },
1679 {
"diseqc_1_3", kTypeDiSEqC_1_3 },
1680 {
nullptr, kTypeDiSEqC_1_3 }
1691 bool success =
true;
1706 LOG(VB_GENERAL, LOG_ERR,
LOC +
"Unknown rotor type " +
1785 LOG(VB_CHANNEL, LOG_INFO,
LOC +
1786 "Overriding voltage to 18V for faster rotor movement");
1793 return SEC_VOLTAGE_18;
1801 "SELECT subtype, rotor_positions, "
1802 " rotor_hi_speed, rotor_lo_speed, "
1805 "WHERE diseqcid = :DEVID");
1821 QString positions = query.
value(1).toString();
1822 QStringList pos = positions.split(
":", Qt::SkipEmptyParts);
1823 for (
const auto & kv : std::as_const(pos))
1825 const QStringList eq = kv.split(
"=", Qt::SkipEmptyParts);
1827 m_posmap[eq[0].toFloat()] = eq[1].toUInt();
1841 "WHERE parentid = :DEVID");
1851 uint child_dev_id = query.
value(0).toUInt();
1860 QString posmap =
"";
1867 dbl_to_uint_t::const_iterator it =
m_posmap.begin();
1869 pos.push_back(QString(
"%1=%2").arg(it.key()).arg(*it));
1871 posmap = pos.join(
":");
1880 "UPDATE diseqc_tree "
1881 "SET parentid = :PARENT, "
1882 " ordinal = :ORDINAL, "
1884 " description = :DESC, "
1885 " subtype = :TYPE, "
1886 " rotor_hi_speed = :HISPEED, "
1887 " rotor_lo_speed = :LOSPEED, "
1888 " rotor_positions = :POSMAP, "
1889 " cmd_repeat = :REPEAT "
1890 "WHERE diseqcid = :DEVID");
1896 "INSERT INTO diseqc_tree "
1897 " ( parentid, ordinal, type, "
1898 " description, subtype, rotor_hi_speed, "
1899 " rotor_lo_speed, rotor_positions, cmd_repeat ) "
1901 " (:PARENT, :ORDINAL, 'rotor', "
1902 " :DESC, :TYPE, :HISPEED, "
1903 " :LOSPEED, :POSMAP, :REPEAT )");
1948 double duration = change / speed;
1952 double completed = time_since_move / duration;
1977 dbl_to_uint_t::const_iterator it;
1979 inv_posmap[*it] = it.key();
1988 uint_to_dbl_t::const_iterator it;
1989 for (it = inv_posmap.begin(); it != inv_posmap.end(); ++it)
1998 dbl_to_uint_t::const_iterator it =
2000 cmd_vec_t index {
static_cast<uint8_t
>(angle) };
2007 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"Rotor - " +
2008 QString(
"Goto Stored Position %1").arg(index[0]));
2021 LOG(VB_CHANNEL, LOG_INFO,
LOC +
"USALS Rotor - " +
2022 QString(
"Goto %1 (Azimuth %2)").arg(angle).arg(azimuth));
2024 uint az16 = (
uint) (abs(azimuth) * 16.0);
2026 static_cast<uint8_t
>(((azimuth > 0.0) ? 0xE0 : 0xD0) | ((az16 >> 8) & 0x0f)),
2027 static_cast<uint8_t
>(az16 & 0xff) };
2046 return TO_DEC * atan( tan(Us - Ue) / sin(P) );
2087 {
"A", kTypeScrPosA },
2088 {
"B", kTypeScrPosB },
2089 { QString(), kTypeScrPosA },
2109 LOG(VB_GENERAL, LOG_ERR,
LOC +
"SCR: No LNB for this configuration!");
2124 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: Userband ID=%1 is out of range (0-7)!")
2131 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: T=%1 is out of range!").arg(
t));
2135 LOG(VB_GENERAL, LOG_INFO, QString(
"SCR: Tuning to %1kHz, %2, %3 using UB=%4, FREQ=%5MHz, POS=%6%7")
2137 .arg(high_band ?
"HiBand" :
"LoBand",
2138 horizontal ?
"H" :
"V")
2141 .arg((scr_position) ?
"B" :
"A",
2143 QString(
", PIN=%1").arg(
m_scrPin) : QString(
"")));
2148 static_cast<uint8_t
>(
t & 0x00FF) };
2151 data[0] |= (1 << 2);
2154 data[0] |= (1 << 3);
2157 data[0] |= (1 << 4);
2170 LOG(VB_GENERAL, LOG_ERR,
LOC + QString(
"SCR: Userband ID=%1 is out of range (0-7)!")
2175 LOG(VB_CHANNEL, LOG_INFO,
LOC + QString(
"SCR: Power off UB=%1%7")
2178 ? QString(
", PIN=%1").arg(
m_scrPin)
2192 [[maybe_unused]]
uint repeats,
2213 return SEC_VOLTAGE_13;
2219 return (((
t + 350) * 4) * 1000) - frequency;
2227 "SELECT scr_userband, scr_frequency, "
2228 " scr_pin, cmd_repeat "
2230 "WHERE diseqcid = :DEVID");
2256 "WHERE parentid = :DEVID");
2266 uint child_dev_id = query.
value(0).toUInt();
2281 "UPDATE diseqc_tree "
2282 "SET parentid = :PARENT, "
2283 " ordinal = :ORDINAL, "
2285 " description = :DESC, "
2286 " scr_userband = :USERBAND, "
2287 " scr_frequency = :FREQUENCY, "
2289 " cmd_repeat = :REPEAT "
2290 "WHERE diseqcid = :DEVID");
2296 "INSERT INTO diseqc_tree"
2297 " ( parentid, ordinal, type, "
2298 " description, scr_userband, scr_frequency, "
2299 " scr_pin, cmd_repeat) "
2301 " (:PARENT, :ORDINAL, 'scr', "
2302 " :DESC, :USERBAND, :FREQUENCY,"
2303 " :PIN, :REPEAT) ");
2361 {
"fixed", kTypeFixed },
2362 {
"voltage", kTypeVoltageControl },
2363 {
"voltage_tone", kTypeVoltageAndToneControl },
2364 {
"bandstacked", kTypeBandstacked },
2365 { QString(), kTypeVoltageAndToneControl },
2380 uint voltage = SEC_VOLTAGE_18;
2385 voltage = (
IsHorizontal(tuning) ? SEC_VOLTAGE_18 : SEC_VOLTAGE_13);
2396 "SELECT subtype, lnb_lof_switch, "
2397 " lnb_lof_hi, lnb_lof_lo, "
2398 " lnb_pol_inv, cmd_repeat "
2400 "WHERE diseqcid = :DEVID");
2430 "UPDATE diseqc_tree "
2431 "SET parentid = :PARENT, "
2432 " ordinal = :ORDINAL, "
2434 " description = :DESC, "
2435 " subtype = :TYPE, "
2436 " lnb_lof_switch = :LOFSW, "
2437 " lnb_lof_lo = :LOFLO, "
2438 " lnb_lof_hi = :LOFHI, "
2439 " lnb_pol_inv = :POLINV, "
2440 " cmd_repeat = :REPEAT "
2441 "WHERE diseqcid = :DEVID");
2447 "INSERT INTO diseqc_tree"
2448 " ( parentid, ordinal, type, "
2449 " description, subtype, lnb_lof_switch, "
2450 " lnb_lof_lo, lnb_lof_hi, lnb_pol_inv, "
2453 " (:PARENT, :ORDINAL, 'lnb', "
2454 " :DESC, :TYPE, :LOFSW, "
2455 " :LOFLO, :LOFHI, :POLINV, "
2529 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
@ kTypeVoltageAndToneControl
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
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