Ticket #9726: 0003-libmythtv-Unicable-SCR-DIN-EN-50494.patch
File 0003-libmythtv-Unicable-SCR-DIN-EN-50494.patch, 23.2 KB (added by , 13 years ago) |
---|
-
mythtv/libs/libmythtv/diseqc.cpp
From 484ec272414d0fc7b069f1ea720297cc5ad4d928 Mon Sep 17 00:00:00 2001 From: Matthias Benesch <twoof7@freenet.de> Date: Sat, 21 May 2011 10:57:24 +0200 Subject: [PATCH] libmythtv: Unicable / SCR / DIN EN 50494 Add support for Unicable / Satellite Channel Router / DIN EN 50494 standard. --- mythtv/libs/libmythtv/diseqc.cpp | 327 +++++++++++++++++++++++++++++- mythtv/libs/libmythtv/diseqc.h | 73 +++++++- mythtv/libs/libmythtv/diseqcsettings.cpp | 165 +++++++++++++++ mythtv/libs/libmythtv/diseqcsettings.h | 11 + mythtv/libs/libmythtv/dvbchannel.cpp | 7 + 5 files changed, 580 insertions(+), 3 deletions(-) diff --git a/mythtv/libs/libmythtv/diseqc.cpp b/mythtv/libs/libmythtv/diseqc.cpp index 7446a8f..17f332c 100644
a b 68 68 #define DISEQC_CMD_WRITE_N0 0x38 69 69 #define DISEQC_CMD_WRITE_N1 0x39 70 70 #define DISEQC_CMD_WRITE_FREQ 0x58 71 #define DISEQC_CMD_ODU 0x5A 72 #define DISEQC_CMD_ODU_MDU 0x5C 71 73 #define DISEQC_CMD_HALT 0x60 72 74 #define DISEQC_CMD_LMT_OFF 0x63 73 75 #define DISEQC_CMD_LMT_E 0x66 … … DiSEqCDevLNB *DiSEqCDevTree::FindLNB(const DiSEqCDevSettings &settings) 565 567 return lnb; 566 568 } 567 569 570 /** \fn DiSEqCDevTree::FindSCR(const DiSEqCDevSettings&) 571 * \brief Returns the SCR device object selected by the configuration chain. 572 * \param settings Configuration chain in effect. 573 * \return Pointer to SCR object if found, NULL otherwise. 574 */ 575 DiSEqCDevSCR *DiSEqCDevTree::FindSCR(const DiSEqCDevSettings &settings) 576 { 577 DiSEqCDevDevice *node = m_root; 578 DiSEqCDevSCR *scr = NULL; 579 580 while (node) 581 { 582 scr = dynamic_cast<DiSEqCDevSCR*>(node); 583 584 if (scr) 585 break; 586 587 node = node->GetSelectedChild(settings); 588 } 589 590 return scr; 591 } 592 568 593 569 594 /** \fn DiSEqCDevTree::FindDevice(uint) 570 595 * \brief Returns a device by ID. … … bool DiSEqCDevTree::ApplyVoltage(const DiSEqCDevSettings &settings, 787 812 * \brief Represents a node in a DVB-S device network. 788 813 */ 789 814 790 const DiSEqCDevDevice::TypeTable DiSEqCDevDevice::dvbdev_lookup[ 4] =815 const DiSEqCDevDevice::TypeTable DiSEqCDevDevice::dvbdev_lookup[5] = 791 816 { 792 817 { "switch", kTypeSwitch }, 793 818 { "rotor", kTypeRotor }, 819 { "scr", kTypeSCR }, 794 820 { "lnb", kTypeLNB }, 795 821 { QString::null, kTypeLNB }, 796 822 }; … … DiSEqCDevDevice *DiSEqCDevDevice::CreateByType(DiSEqCDevTree &tree, 894 920 if (node) 895 921 node->SetDescription("Rotor"); 896 922 break; 923 case kTypeSCR: 924 node = new DiSEqCDevSCR(tree, dev_id); 925 if (node) 926 node->SetDescription("Unicable"); 927 break; 897 928 case kTypeLNB: 898 929 node = new DiSEqCDevLNB(tree, dev_id); 899 930 if (node) … … void DiSEqCDevRotor::RotationComplete(void) const 2062 2093 2063 2094 //////////////////////////////////////// 2064 2095 2096 /** \class DiSEqCDevSCR 2097 * \brief Unicable / SCR Class. 2098 */ 2099 2100 const DiSEqCDevDevice::TypeTable DiSEqCDevSCR::SCRPositionTable[3] = 2101 { 2102 { "A", kTypeScrPosA }, 2103 { "B", kTypeScrPosB }, 2104 { QString::null, kTypeScrPosA }, 2105 }; 2106 2107 DiSEqCDevSCR::DiSEqCDevSCR(DiSEqCDevTree &tree, uint devid) 2108 : DiSEqCDevDevice(tree, devid) 2109 , m_scr_userband(0) 2110 , m_scr_frequency(1400) 2111 , m_scr_pin(-1) 2112 , m_child(0) 2113 { 2114 Reset(); 2115 } 2116 2117 DiSEqCDevSCR::~DiSEqCDevSCR() 2118 { 2119 if (m_child) 2120 delete m_child; 2121 } 2122 2123 void DiSEqCDevSCR::Reset(void) 2124 { 2125 if (m_child) 2126 m_child->Reset(); 2127 } 2128 2129 bool DiSEqCDevSCR::Execute(const DiSEqCDevSettings &settings, const DTVMultiplex &tuning) 2130 { 2131 // retrieve LNB info 2132 DiSEqCDevLNB *lnb = m_tree.FindLNB(settings); 2133 if (!lnb) 2134 { 2135 VERBOSE(VB_IMPORTANT, LOC_ERR + "SCR: No LNB for this configuration!"); 2136 return false; 2137 } 2138 2139 bool high_band = lnb->IsHighBand(tuning); 2140 bool horizontal = lnb->IsHorizontal(tuning); 2141 uint32_t frequency = lnb->GetIntermediateFrequency(settings, tuning); 2142 uint t = (frequency / 1000 + m_scr_frequency + 2) / 4 - 350; 2143 2144 // retrieve position settings 2145 dvbdev_pos_t scr_position = (dvbdev_pos_t) settings.GetValue(GetDeviceID()); 2146 2147 // check parameters 2148 if (m_scr_userband > 7) 2149 { 2150 VERBOSE(VB_IMPORTANT, LOC_ERR + "SCR: Userband ID configuration out of range!"); 2151 return false; 2152 } 2153 2154 if (t >= 1024) 2155 { 2156 VERBOSE(VB_IMPORTANT, LOC_ERR + "SCR: T out of range!"); 2157 return false; 2158 } 2159 2160 VERBOSE(VB_CHANNEL, LOC + QString("SCR: Tuning to %1kHz, %2, %3 using UB=%4, FREQ=%5MHz, POS=%6%7") 2161 .arg(tuning.frequency) 2162 .arg(high_band ? "HiBand" : "LoBand") 2163 .arg(horizontal ? "H" : "V") 2164 .arg(m_scr_userband) 2165 .arg(m_scr_frequency) 2166 .arg((scr_position) ? "B" : "A") 2167 .arg((m_scr_pin >= 0 && m_scr_pin <= 255) ? 2168 QString(", PIN=%1").arg(m_scr_pin) : QString(""))); 2169 2170 // build command 2171 unsigned char data[3]; 2172 data[0] = t >> 8 | m_scr_userband << 5; 2173 data[1] = t & 0x00FF; 2174 2175 if (high_band) 2176 data[0] |= (1 << 2); 2177 2178 if (horizontal) 2179 data[0] |= (1 << 3); 2180 2181 if (scr_position) 2182 data[0] |= (1 << 4); 2183 2184 // send command 2185 if (m_scr_pin >= 0 && m_scr_pin <= 255) 2186 { 2187 data[2] = m_scr_pin; 2188 return SendCommand(DISEQC_CMD_ODU_MDU, m_repeat, 3, data); 2189 } else { 2190 return SendCommand(DISEQC_CMD_ODU, m_repeat, 2, data); 2191 } 2192 } 2193 2194 bool DiSEqCDevSCR::PowerOff(void) const 2195 { 2196 // check parameters 2197 if (m_scr_userband > 7) 2198 { 2199 VERBOSE(VB_IMPORTANT, LOC_ERR + "SCR: Userband ID configuration out of range!"); 2200 return false; 2201 } 2202 2203 VERBOSE(VB_CHANNEL, LOC + QString("SCR: Power off UB=%1%7") 2204 .arg(m_scr_userband) 2205 .arg((m_scr_pin >= 0 && m_scr_pin <= 255) 2206 ? QString(", PIN=%1").arg(m_scr_pin) 2207 : QString(""))); 2208 2209 // build command 2210 unsigned char data[3]; 2211 data[0] = (uint8_t) (m_scr_userband << 5); 2212 data[1] = 0x00; 2213 2214 // send command 2215 if (m_scr_pin >= 0 && m_scr_pin <= 255) 2216 { 2217 data[2] = m_scr_pin; 2218 return SendCommand(DISEQC_CMD_ODU_MDU, m_repeat, 3, data); 2219 } else { 2220 return SendCommand(DISEQC_CMD_ODU, m_repeat, 2, data); 2221 } 2222 } 2223 2224 bool DiSEqCDevSCR::SendCommand(uint cmd, uint repeats, uint data_len, 2225 unsigned char *data) const 2226 { 2227 (void) repeats; 2228 2229 // power on bus 2230 if (!m_tree.SetVoltage(SEC_VOLTAGE_18)) 2231 return false; 2232 usleep(DISEQC_SHORT_WAIT); 2233 2234 // send command 2235 bool ret = m_tree.SendCommand(DISEQC_ADR_SW_ALL, cmd, 0, data_len, data); 2236 2237 // power off bus 2238 if (!m_tree.SetVoltage(SEC_VOLTAGE_13)) 2239 return false; 2240 2241 return ret; 2242 } 2243 2244 uint DiSEqCDevSCR::GetVoltage(const DiSEqCDevSettings &settings, 2245 const DTVMultiplex &tuning) const 2246 { 2247 return SEC_VOLTAGE_13; 2248 } 2249 2250 uint32_t DiSEqCDevSCR::GetIntermediateFrequency(const uint32_t frequency) const 2251 { 2252 uint t = (frequency / 1000 + m_scr_frequency + 2) / 4 - 350; 2253 return ((t + 350) * 4) * 1000 - frequency; 2254 } 2255 2256 bool DiSEqCDevSCR::Load(void) 2257 { 2258 // populate scr parameters from db 2259 MSqlQuery query(MSqlQuery::InitCon()); 2260 query.prepare( 2261 "SELECT scr_userband, scr_frequency, " 2262 " scr_pin, cmd_repeat " 2263 "FROM diseqc_tree " 2264 "WHERE diseqcid = :DEVID"); 2265 query.bindValue(":DEVID", GetDeviceID()); 2266 2267 if (!query.exec() || !query.isActive()) 2268 { 2269 MythDB::DBError("DiSEqCDevSCR::Load 1", query); 2270 return false; 2271 } 2272 else if (query.next()) 2273 { 2274 m_scr_userband = query.value(0).toUInt(); 2275 m_scr_frequency = query.value(1).toUInt(); 2276 m_scr_pin = query.value(2).toInt(); 2277 m_repeat = query.value(3).toUInt(); 2278 } 2279 2280 // load children from db 2281 if (m_child) 2282 { 2283 delete m_child; 2284 m_child = NULL; 2285 } 2286 2287 query.prepare( 2288 "SELECT diseqcid " 2289 "FROM diseqc_tree " 2290 "WHERE parentid = :DEVID"); 2291 query.bindValue(":DEVID", GetDeviceID()); 2292 2293 if (!query.exec() || !query.isActive()) 2294 { 2295 MythDB::DBError("DiSEqCDevSCR::Load 2", query); 2296 return false; 2297 } 2298 else if (query.next()) 2299 { 2300 uint child_dev_id = query.value(0).toUInt(); 2301 SetChild(0, CreateById(m_tree, child_dev_id)); 2302 } 2303 2304 return true; 2305 } 2306 2307 bool DiSEqCDevSCR::Store(void) const 2308 { 2309 MSqlQuery query(MSqlQuery::InitCon()); 2310 2311 // insert new or update old 2312 if (IsRealDeviceID()) 2313 { 2314 query.prepare( 2315 "UPDATE diseqc_tree " 2316 "SET parentid = :PARENT, " 2317 " ordinal = :ORDINAL, " 2318 " type = 'scr', " 2319 " description = :DESC, " 2320 " scr_userband = :USERBAND, " 2321 " scr_frequency = :FREQUENCY, " 2322 " scr_pin = :PIN, " 2323 " cmd_repeat = :REPEAT " 2324 "WHERE diseqcid = :DEVID"); 2325 query.bindValue(":DEVID", GetDeviceID()); 2326 } 2327 else 2328 { 2329 query.prepare( 2330 "INSERT INTO diseqc_tree" 2331 " ( parentid, ordinal, type, " 2332 " description, scr_userband, scr_frequency, " 2333 " scr_pin, cmd_repeat) " 2334 "VALUES " 2335 " (:PARENT, :ORDINAL, 'scr', " 2336 " :DESC, :USERBAND, :FREQUENCY," 2337 " :PIN, :REPEAT) "); 2338 } 2339 2340 if (m_parent) 2341 query.bindValue(":PARENT", m_parent->GetDeviceID()); 2342 2343 query.bindValue(":ORDINAL", m_ordinal); 2344 query.bindValue(":DESC", GetDescription()); 2345 query.bindValue(":USERBAND", m_scr_userband); 2346 query.bindValue(":FREQUENCY", m_scr_frequency); 2347 query.bindValue(":PIN", m_scr_pin); 2348 query.bindValue(":REPEAT", m_repeat); 2349 2350 // update dev_id 2351 if (!query.exec()) 2352 { 2353 MythDB::DBError("DiSEqCDevSCR::Store", query); 2354 return false; 2355 } 2356 2357 // figure out devid if we did an insert 2358 if (!IsRealDeviceID()) 2359 SetDeviceID(query.lastInsertId().toUInt()); 2360 2361 // chain to child 2362 if (m_child) 2363 return m_child->Store(); 2364 2365 return true; 2366 } 2367 2368 bool DiSEqCDevSCR::SetChild(uint ordinal, DiSEqCDevDevice *device) 2369 { 2370 if (ordinal) 2371 return false; 2372 2373 DiSEqCDevDevice *old_child = m_child; 2374 m_child = NULL; 2375 if (old_child) 2376 delete old_child; 2377 2378 m_child = device; 2379 if (m_child) 2380 { 2381 m_child->SetOrdinal(ordinal); 2382 m_child->SetParent(this); 2383 } 2384 2385 return true; 2386 } 2387 2388 //////////////////////////////////////// 2389 2065 2390 /** \class DiSEqCDevLNB 2066 2391 * \brief LNB Class. 2067 2392 */ -
mythtv/libs/libmythtv/diseqc.h
diff --git a/mythtv/libs/libmythtv/diseqc.h b/mythtv/libs/libmythtv/diseqc.h index 643dcc8..58d2ea0 100644
a b class DiSEqCDevTree; 27 27 class DiSEqCDevDevice; 28 28 class DiSEqCDevRotor; 29 29 class DiSEqCDevLNB; 30 class DiSEqCDevSCR; 30 31 31 32 typedef QMap<uint, double> uint_to_dbl_t; 32 33 typedef QMap<double, uint> dbl_to_uint_t; … … class DiSEqCDevTree 85 86 86 87 DiSEqCDevRotor *FindRotor(const DiSEqCDevSettings &settings, uint index = 0); 87 88 DiSEqCDevLNB *FindLNB(const DiSEqCDevSettings &settings); 89 DiSEqCDevSCR *FindSCR(const DiSEqCDevSettings &settings); 88 90 DiSEqCDevDevice *FindDevice(uint dev_id); 89 91 90 92 /** \brief Retrieves the root node in the tree. */ … … class DiSEqCDevDevice 142 144 virtual bool Store(void) const = 0; 143 145 144 146 // Sets 145 enum dvbdev_t { kTypeSwitch = 0, kTypeRotor = 1, kTypeLNB = 2, }; 147 enum dvbdev_t 148 { 149 kTypeSwitch = 0, 150 kTypeRotor = 1, 151 kTypeSCR = 2, 152 kTypeLNB = 3, 153 }; 146 154 void SetDeviceType(dvbdev_t type) { m_dev_type = type; } 147 155 void SetParent(DiSEqCDevDevice* parent) { m_parent = parent; } 148 156 void SetOrdinal(uint ordinal) { m_ordinal = ordinal; } … … class DiSEqCDevDevice 201 209 const TypeTable *table); 202 210 203 211 private: 204 static const TypeTable dvbdev_lookup[ 4];212 static const TypeTable dvbdev_lookup[5]; 205 213 }; 206 214 207 215 class DiSEqCDevSwitch : public DiSEqCDevDevice … … class DiSEqCDevRotor : public DiSEqCDevDevice 359 367 static const TypeTable RotorTypeTable[3]; 360 368 }; 361 369 370 class DiSEqCDevSCR : public DiSEqCDevDevice 371 { 372 public: 373 DiSEqCDevSCR(DiSEqCDevTree &tree, uint devid); 374 ~DiSEqCDevSCR(); 375 376 // Commands 377 virtual void Reset(void); 378 virtual bool Execute(const DiSEqCDevSettings&, const DTVMultiplex&); 379 bool PowerOff(void) const; 380 virtual bool Load(void); 381 virtual bool Store(void) const; 382 383 // Sets 384 enum dvbdev_pos_t 385 { 386 kTypeScrPosA = 0, 387 kTypeScrPosB = 1, 388 }; 389 void SetUserBand(uint userband) { m_scr_userband = userband; } 390 void SetFrequency(uint freq) { m_scr_frequency = freq; } 391 void SetPIN(int pin) { m_scr_pin = pin; } 392 virtual bool SetChild(uint ordinal, DiSEqCDevDevice* device); 393 394 // Gets 395 uint GetUserBand(void) const { return m_scr_userband; } 396 uint GetFrequency(void) const { return m_scr_frequency; } 397 int GetPIN(void) const { return m_scr_pin; } 398 virtual uint GetChildCount(void) const { return 1; } 399 virtual bool IsCommandNeeded(const DiSEqCDevSettings&, 400 const DTVMultiplex&) const { return false; } 401 virtual uint GetVoltage(const DiSEqCDevSettings&, 402 const DTVMultiplex&) const; 403 uint32_t GetIntermediateFrequency(const uint32_t frequency) const; 404 405 // Non-const Gets 406 virtual DiSEqCDevDevice *GetSelectedChild(const DiSEqCDevSettings&) const 407 { return m_child; } 408 virtual DiSEqCDevDevice *GetChild(uint) { return m_child; } 409 410 // statics 411 static QString SCRPositionToString(dvbdev_pos_t pos) 412 { return TableToString((uint)pos, SCRPositionTable); } 413 414 static dvbdev_pos_t SCRPositionFromString(const QString &pos) 415 { return (dvbdev_pos_t) TableFromString(pos, SCRPositionTable); } 416 417 protected: 418 bool SendCommand(uint cmd, uint repeats, uint data_len = 0, 419 unsigned char *data = NULL) const; 420 421 private: 422 uint m_scr_userband; /* 0-7 */ 423 uint m_scr_frequency; 424 int m_scr_pin; /* 0-255, -1=disabled */ 425 426 DiSEqCDevDevice *m_child; 427 428 static const TypeTable SCRPositionTable[3]; 429 }; 430 362 431 class DiSEqCDevLNB : public DiSEqCDevDevice 363 432 { 364 433 public: -
mythtv/libs/libmythtv/diseqcsettings.cpp
diff --git a/mythtv/libs/libmythtv/diseqcsettings.cpp b/mythtv/libs/libmythtv/diseqcsettings.cpp index f01b857..acebd9e 100644
a b class DeviceTypeSetting : public ComboBoxSetting, public Storage 49 49 QString::number((uint) DiSEqCDevDevice::kTypeSwitch)); 50 50 addSelection(DeviceTree::tr("Rotor"), 51 51 QString::number((uint) DiSEqCDevDevice::kTypeRotor)); 52 addSelection(DeviceTree::tr("Unicable"), 53 QString::number((uint) DiSEqCDevDevice::kTypeSCR)); 52 54 addSelection(DeviceTree::tr("LNB"), 53 55 QString::number((uint) DiSEqCDevDevice::kTypeLNB)); 54 56 } … … void RotorConfig::RunRotorPositionsDialog(void) 558 560 config.Save(); 559 561 } 560 562 563 //////////////////////////////////////// SCRUserBandSetting 564 565 class SCRUserBandSetting : public SpinBoxSetting, public Storage 566 { 567 public: 568 SCRUserBandSetting(DiSEqCDevSCR &scr) : 569 SpinBoxSetting(this, 0, 7, 1), m_scr(scr) 570 { 571 setLabel(DeviceTree::tr("Userband")); 572 setHelpText(DeviceTree::tr("Unicable userband id (0-7)")); 573 } 574 575 virtual void Load(void) 576 { 577 setValue(m_scr.GetUserBand()); 578 } 579 580 virtual void Save(void) 581 { 582 m_scr.SetUserBand(intValue()); 583 } 584 585 virtual void Save(QString /*destination*/) { } 586 587 private: 588 DiSEqCDevSCR &m_scr; 589 }; 590 591 //////////////////////////////////////// SCRFrequencySetting 592 593 class SCRFrequencySetting : public LineEditSetting, public Storage 594 { 595 public: 596 SCRFrequencySetting(DiSEqCDevSCR &scr) : LineEditSetting(this), m_scr(scr) 597 { 598 setLabel(DeviceTree::tr("Frequency (MHz)")); 599 setHelpText(DeviceTree::tr("Unicable userband frequency (950 - 2150MHz)")); 600 } 601 602 virtual void Load(void) 603 { 604 setValue(QString::number(m_scr.GetFrequency())); 605 } 606 607 virtual void Save(void) 608 { 609 m_scr.SetFrequency(getValue().toUInt()); 610 } 611 612 virtual void Save(QString /*destination*/) { } 613 614 private: 615 DiSEqCDevSCR &m_scr; 616 }; 617 618 //////////////////////////////////////// SCRPINSetting 619 620 class SCRPINSetting : public LineEditSetting, public Storage 621 { 622 public: 623 SCRPINSetting(DiSEqCDevSCR &scr) : LineEditSetting(this), m_scr(scr) 624 { 625 setLabel(DeviceTree::tr("PIN code")); 626 setHelpText(DeviceTree::tr("Unicable PIN code (-1 disabled, 0 - 255)")); 627 } 628 629 virtual void Load(void) 630 { 631 setValue(QString::number(m_scr.GetPIN())); 632 } 633 634 virtual void Save(void) 635 { 636 m_scr.SetPIN(getValue().toInt()); 637 } 638 639 virtual void Save(QString /*destination*/) { } 640 641 private: 642 DiSEqCDevSCR &m_scr; 643 }; 644 645 //////////////////////////////////////// SCRConfig 646 647 SCRConfig::SCRConfig(DiSEqCDevSCR &scr) : m_scr(scr) 648 { 649 ConfigurationGroup *group = 650 new VerticalConfigurationGroup(false, false); 651 group->setLabel(DeviceTree::tr("Unicable Configuration")); 652 653 group->addChild(new SCRUserBandSetting(scr)); 654 group->addChild(new SCRFrequencySetting(scr)); 655 group->addChild(new SCRPINSetting(scr)); 656 657 addChild(group); 658 } 659 561 660 //////////////////////////////////////// LnbPresetSetting 562 661 563 662 class lnb_preset … … bool DeviceTree::EditNodeDialog(uint nodeid) 948 1047 } 949 1048 break; 950 1049 1050 case DiSEqCDevDevice::kTypeSCR: 1051 { 1052 DiSEqCDevSCR *scr = dynamic_cast<DiSEqCDevSCR*>(dev); 1053 if (scr) 1054 { 1055 SCRConfig config(*scr); 1056 changed = (config.exec() == MythDialog::Accepted); 1057 } 1058 } 1059 break; 1060 951 1061 case DiSEqCDevDevice::kTypeLNB: 952 1062 { 953 1063 DiSEqCDevLNB *lnb = dynamic_cast<DiSEqCDevLNB*>(dev); … … bool DeviceTree::RunTypeDialog(DiSEqCDevDevice::dvbdev_t &type) 977 1087 MythListBox *list = new MythListBox(popup); 978 1088 list->insertItem(tr("Switch")); 979 1089 list->insertItem(tr("Rotor")); 1090 list->insertItem(tr("Unicable")); 980 1091 list->insertItem(tr("LNB")); 981 1092 list->setCurrentRow(0, QItemSelectionModel::Select); 982 1093 … … class USALSRotorSetting : public HorizontalConfigurationGroup 1263 1374 DiSEqCDevSettings &m_settings; 1264 1375 }; 1265 1376 1377 //////////////////////////////////////// SCRPositionSetting 1378 1379 class SCRPositionSetting : public ComboBoxSetting, public Storage 1380 { 1381 public: 1382 SCRPositionSetting(DiSEqCDevDevice &node, DiSEqCDevSettings &settings) 1383 : ComboBoxSetting(this), m_node(node), m_settings(settings) 1384 { 1385 setLabel("Position"); 1386 setHelpText(DeviceTree::tr("Unicable satellite position (A/B)")); 1387 addSelection(DiSEqCDevSCR::SCRPositionToString(DiSEqCDevSCR::kTypeScrPosA), 1388 QString::number((uint)DiSEqCDevSCR::kTypeScrPosA), true); 1389 addSelection(DiSEqCDevSCR::SCRPositionToString(DiSEqCDevSCR::kTypeScrPosB), 1390 QString::number((uint)DiSEqCDevSCR::kTypeScrPosB), false); 1391 } 1392 1393 virtual void Load(void) 1394 { 1395 double value = m_settings.GetValue(m_node.GetDeviceID()); 1396 setValue(getValueIndex(QString::number((uint)value))); 1397 } 1398 1399 virtual void Save(void) 1400 { 1401 m_settings.SetValue(m_node.GetDeviceID(), getValue().toDouble()); 1402 } 1403 1404 virtual void Save(QString /*destination*/) { } 1405 1406 private: 1407 DiSEqCDevDevice &m_node; 1408 DiSEqCDevSettings &m_settings; 1409 }; 1410 1266 1411 //////////////////////////////////////// DTVDeviceConfigGroup 1267 1412 1268 1413 DTVDeviceConfigGroup::DTVDeviceConfigGroup( … … void DTVDeviceConfigGroup::AddNodes( 1305 1450 setting = new USALSRotorSetting(*node, m_settings); 1306 1451 break; 1307 1452 } 1453 case DiSEqCDevDevice::kTypeSCR: 1454 { 1455 setting = new SCRPositionSetting(*node, m_settings); 1456 break; 1457 } 1308 1458 default: 1309 1459 break; 1310 1460 } … … enum OLD_DISEQC_TYPES 1379 1529 DISEQC_POSITIONER_X_SWITCH_2 = 9, 1380 1530 DISEQC_SW21 = 10, 1381 1531 DISEQC_SW64 = 11, 1532 DISEQC_SCR = 12, 1382 1533 }; 1383 1534 1384 1535 // import old diseqc configuration into tree … … bool convert_diseqc_db(void) 1548 1699 break; 1549 1700 } 1550 1701 1702 case DISEQC_SCR: 1703 { 1704 // SCR + LNB 1705 root = DiSEqCDevDevice::CreateByType( 1706 tree, DiSEqCDevDevice::kTypeSCR); 1707 DiSEqCDevSCR *scr = dynamic_cast<DiSEqCDevSCR*>(root); 1708 if (scr) 1709 { 1710 add_lnbs = 1; 1711 } 1712 break; 1713 } 1714 1551 1715 default: 1552 1716 { 1553 1717 VERBOSE(VB_IMPORTANT, QString("Unknown DiSEqC device type ") + … … bool convert_diseqc_db(void) 1614 1778 1615 1779 case DISEQC_POSITIONER_1_2: 1616 1780 case DISEQC_POSITIONER_X: 1781 case DISEQC_SCR: 1617 1782 lnb = dynamic_cast<DiSEqCDevLNB*>(root->GetChild(0)); 1618 1783 set.SetValue(root->GetDeviceID(), pos); 1619 1784 break; -
mythtv/libs/libmythtv/diseqcsettings.h
diff --git a/mythtv/libs/libmythtv/diseqcsettings.h b/mythtv/libs/libmythtv/diseqcsettings.h index de78a71..da0b203 100644
a b class RotorConfig : public QObject, public ConfigurationWizard 73 73 TransButtonSetting *m_pos; 74 74 }; 75 75 76 class SCRConfig : public QObject, public ConfigurationWizard 77 { 78 Q_OBJECT 79 80 public: 81 SCRConfig(DiSEqCDevSCR &scr); 82 83 private: 84 DiSEqCDevSCR &m_scr; 85 }; 86 76 87 class LNBTypeSetting; 77 88 class LNBLOFSwitchSetting; 78 89 class LNBLOFLowSetting; -
mythtv/libs/libmythtv/dvbchannel.cpp
diff --git a/mythtv/libs/libmythtv/dvbchannel.cpp b/mythtv/libs/libmythtv/dvbchannel.cpp index 61e8d47..a800841 100644
a b bool DVBChannel::Tune(const DTVMultiplex &tuning, 805 805 intermediate_freq = lnb->GetIntermediateFrequency( 806 806 diseqc_settings, tuning); 807 807 808 // retrieve scr intermediate frequency 809 DiSEqCDevSCR *scr = diseqc_tree->FindSCR(diseqc_settings); 810 if (lnb) 811 { 812 intermediate_freq = scr->GetIntermediateFrequency(intermediate_freq); 813 } 814 808 815 // if card can auto-FEC, use it -- sometimes NITs are inaccurate 809 816 if (capabilities & FE_CAN_FEC_AUTO) 810 817 can_fec_auto = true;