zapit/src/getservices.cpp: add UpdateSatTransponders()

to add/replace satellite transponder list from transponders


Origin commit data
------------------
Branch: ni/coolstream
Commit: 4082cf3fe2
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2012-04-17 (Tue, 17 Apr 2012)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2012-04-17 15:01:18 +04:00
parent e7f127d107
commit fa91ad95bd
2 changed files with 20 additions and 1 deletions

View File

@@ -164,6 +164,7 @@ class CServiceManager
void FreeNumber(int number, bool radio);
void UseNumber(int number, bool radio);
void SetServicesChanged(bool changed) { services_changed = changed; }
void UpdateSatTransponders(t_satellite_position satellitePosition);
bool GetTransponder(transponder &t);
transponder_list_t & GetSatelliteTransponders(t_satellite_position position) { return satelliteTransponders[position]; }

View File

@@ -328,7 +328,7 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa
ret = transponders.insert(transponder_pair_t(tid, t));
if (ret.second == false)
t.dump("[zapit] duplicate");
t.dump("[zapit] duplicate in all transponders:");
/* read channels that belong to the current transponder */
ParseChannels(node->xmlChildrenNode, transport_stream_id, original_network_id, satellitePosition, freq, polarization);
@@ -336,6 +336,7 @@ void CServiceManager::ParseTransponders(xmlNodePtr node, t_satellite_position sa
/* hop to next transponder */
node = node->xmlNextNode;
}
UpdateSatTransponders(satellitePosition);
return;
}
@@ -1064,3 +1065,20 @@ bool CServiceManager::GetTransponder(transponder &t)
}
return false;
}
void CServiceManager::UpdateSatTransponders(t_satellite_position satellitePosition)
{
pair<map<transponder_id_t, transponder>::iterator,bool> ret;
transponder_list_t & stransponders = satelliteTransponders[satellitePosition];
for (transponder_list_t::iterator tI = transponders.begin(); tI != transponders.end(); tI++) {
for (stiterator stI = stransponders.begin(); stI != stransponders.end(); ++stI) {
if (stI->second.compare(tI->second)) {
stransponders.erase(stI);
break;
}
}
ret = stransponders.insert(transponder_pair_t(tI->first, tI->second));
if (ret.second == false)
tI->second.dump("[zapit] duplicate in sat transponders:");
}
}