Ticket #3787: diseqc_address.diff
File diseqc_address.diff, 8.3 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/diseqc.h
225 225 kTypeLegacySW42 = 4, 226 226 kTypeLegacySW64 = 5, 227 227 }; 228 void SetType(dvbdev_switch_t type) { m_type = type; } 228 void SetType(dvbdev_switch_t type) { m_type = type; } 229 void SetAddress(uint address) { m_address = address; } 229 230 void SetNumPorts(uint num_ports); 230 231 virtual bool SetChild(uint, DiSEqCDevDevice*); 231 232 232 233 // Gets 233 dvbdev_switch_t GetType(void) const { return m_type; } 234 uint GetNumPorts(void) const { return m_num_ports; } 234 dvbdev_switch_t GetType(void) const { return m_type; } 235 uint GetAddress(void) const { return m_address; } 236 uint GetNumPorts(void) const { return m_num_ports; } 235 237 bool ShouldSwitch(const DiSEqCDevSettings &settings, 236 238 const DTVMultiplex &tuning) const; 237 239 virtual uint GetChildCount(void) const; … … 260 262 261 263 private: 262 264 dvbdev_switch_t m_type; 265 uint m_address; 263 266 uint m_num_ports; 264 267 uint m_last_pos; 265 268 uint m_last_high_band; -
libs/libmythtv/dbcheck.cpp
3163 3163 return false; 3164 3164 } 3165 3165 3166 if (dbver == "1194") 3167 { 3168 const QString updates[] = { 3169 "ALTER TABLE diseqc_tree ADD COLUMN address TINYINT(3) UNSIGNED NOT NULL default 0 AFTER description;", 3170 "UPDATE diseqc_tree SET address = 16 WHERE type = 'switch';", 3171 "" 3172 }; 3173 if (!performActualUpdate(updates, "1195", dbver)) 3174 return false; 3175 } 3176 3166 3177 //"ALTER TABLE cardinput DROP COLUMN preference;" in 0.22 3167 3178 //"ALTER TABLE channel DROP COLUMN atscsrcid;" in 0.22 3168 3179 //"ALTER TABLE recordedmarkup DROP COLUMN offset;" in 0.22 -
libs/libmythtv/diseqcsettings.cpp
178 178 DiSEqCDevSwitch &m_switch; 179 179 }; 180 180 181 //////////////////////////////////////// SwitchAddressSetting 182 183 class SwitchAddressSetting : public LineEditSetting, public Storage 184 { 185 public: 186 SwitchAddressSetting(DiSEqCDevSwitch &switch_dev) : 187 LineEditSetting(this), m_switch(switch_dev) 188 { 189 setLabel(DeviceTree::tr("Address of switch")); 190 setHelpText(DeviceTree::tr("The diseqc address of the switch.")); 191 } 192 193 virtual void load(void) 194 { 195 setValue(QString::number(m_switch.GetAddress(), 16).upper().prepend(QString("0x"))); 196 } 197 198 virtual void save(void) 199 { 200 m_switch.SetAddress(getValue().toUInt(0, 16)); 201 } 202 203 private: 204 DiSEqCDevSwitch &m_switch; 205 }; 206 181 207 //////////////////////////////////////// SwitchPortsSetting 182 208 183 209 class SwitchPortsSetting : public LineEditSetting, public Storage … … 218 244 group->addChild(new DeviceRepeatSetting(switch_dev)); 219 245 m_type = new SwitchTypeSetting(switch_dev); 220 246 group->addChild(m_type); 247 m_address = new SwitchAddressSetting(switch_dev); 248 group->addChild(m_address); 221 249 m_ports = new SwitchPortsSetting(switch_dev); 222 250 group->addChild(m_ports); 223 251 … … 234 262 case DiSEqCDevSwitch::kTypeTone: 235 263 case DiSEqCDevSwitch::kTypeLegacySW21: 236 264 case DiSEqCDevSwitch::kTypeLegacySW42: 265 m_address->setValue(QString("0x10")); 266 m_address->setEnabled(false); 237 267 m_ports->setValue("2"); 238 268 m_ports->setEnabled(false); 239 269 break; 240 270 case DiSEqCDevSwitch::kTypeLegacySW64: 271 m_address->setValue(QString("0x10")); 272 m_address->setEnabled(false); 241 273 m_ports->setValue("3"); 242 274 m_ports->setEnabled(false); 243 275 break; 244 276 case DiSEqCDevSwitch::kTypeDiSEqCCommitted: 245 277 case DiSEqCDevSwitch::kTypeDiSEqCUncommitted: 278 m_address->setEnabled(true); 246 279 m_ports->setEnabled(true); 247 280 break; 248 281 } … … 1411 1444 tree, DiSEqCDevDevice::kTypeSwitch); 1412 1445 DiSEqCDevSwitch *sw = dynamic_cast<DiSEqCDevSwitch*>(root); 1413 1446 sw->SetType(DiSEqCDevSwitch::kTypeDiSEqCCommitted); 1447 sw->SetAddress(16); 1414 1448 sw->SetNumPorts(2); 1415 1449 add_lnbs = 2; 1416 1450 break; … … 1424 1458 tree, DiSEqCDevDevice::kTypeSwitch); 1425 1459 DiSEqCDevSwitch *sw = dynamic_cast<DiSEqCDevSwitch*>(root); 1426 1460 sw->SetType(DiSEqCDevSwitch::kTypeDiSEqCCommitted); 1461 sw->SetAddress(16); 1427 1462 sw->SetNumPorts(4); 1428 1463 add_lnbs = 4; 1429 1464 break; -
libs/libmythtv/diseqcsettings.h
14 14 15 15 class SwitchTypeSetting; 16 16 class SwitchPortsSetting; 17 class SwitchAddressSetting; 17 18 18 19 class SwitchConfig : public QObject, public ConfigurationWizard 19 20 { … … 28 29 private: 29 30 SwitchTypeSetting *m_type; 30 31 SwitchPortsSetting *m_ports; 32 SwitchAddressSetting *m_address; 31 33 }; 32 34 33 35 class RotorPosMap : public ListBoxSetting, public Storage -
libs/libmythtv/diseqc.cpp
949 949 950 950 DiSEqCDevSwitch::DiSEqCDevSwitch(DiSEqCDevTree &tree, uint devid) 951 951 : DiSEqCDevDevice(tree, devid), 952 m_type(kTypeTone), m_num_ports(2) 952 m_type(kTypeTone), m_address(DISEQC_ADR_SW_ALL), 953 m_num_ports(2) 953 954 { 954 955 m_children.resize(m_num_ports); 955 956 … … 1113 1114 // populate switch parameters from db 1114 1115 MSqlQuery query(MSqlQuery::InitCon()); 1115 1116 query.prepare( 1116 "SELECT subtype, switch_ports, cmd_repeat "1117 "SELECT subtype, address, switch_ports, cmd_repeat " 1117 1118 "FROM diseqc_tree " 1118 1119 "WHERE diseqcid = :DEVID"); 1119 1120 query.bindValue(":DEVID", GetDeviceID()); … … 1126 1127 else if (query.next()) 1127 1128 { 1128 1129 m_type = SwitchTypeFromString(query.value(0).toString()); 1129 m_num_ports = query.value(1).toUInt(); 1130 m_repeat = query.value(2).toUInt(); 1130 m_address = query.value(1).toUInt(); 1131 m_num_ports = query.value(2).toUInt(); 1132 m_repeat = query.value(3).toUInt(); 1131 1133 m_children.resize(m_num_ports); 1132 1134 for (uint i = 0; i < m_num_ports; i++) 1133 1135 m_children[i] = NULL; … … 1177 1179 " type = 'switch', " 1178 1180 " description = :DESC, " 1179 1181 " subtype = :TYPE, " 1182 " address = :ADDRESS, " 1180 1183 " switch_ports = :PORTS, " 1181 1184 " cmd_repeat = :REPEAT " 1182 1185 "WHERE diseqcid = :DEVID"); … … 1186 1189 query.prepare( 1187 1190 "INSERT INTO diseqc_tree" 1188 1191 " ( parentid, ordinal, type, " 1189 " description, subtype, switch_ports, "1192 " description, address, subtype, switch_ports, " 1190 1193 " cmd_repeat )" 1191 1194 "VALUES " 1192 1195 " (:PARENT, :ORDINAL, 'switch', " 1193 " :DESC, : TYPE, :PORTS, "1196 " :DESC, :ADDRESS, :TYPE, :PORTS, " 1194 1197 " :REPEAT )"); 1195 1198 } 1196 1199 … … 1199 1202 1200 1203 query.bindValue(":ORDINAL", m_ordinal); 1201 1204 query.bindValue(":DESC", GetDescription()); 1205 query.bindValue(":ADDRESS", m_address); 1202 1206 query.bindValue(":TYPE", type); 1203 1207 query.bindValue(":PORTS", m_num_ports); 1204 1208 query.bindValue(":REPEAT", m_repeat); … … 1437 1441 VERBOSE(VB_CHANNEL, LOC + "Changing to DiSEqC switch port " + 1438 1442 QString("%1/%2").arg(pos + 1).arg(m_num_ports)); 1439 1443 1440 bool ret = m_tree.SendCommand( DISEQC_ADR_SW_ALL, cmd, m_repeat, 1, &data);1444 bool ret = m_tree.SendCommand(m_address, cmd, m_repeat, 1, &data); 1441 1445 if(ret) 1442 1446 { 1443 1447 m_last_high_band = high_band;