+ class parseSats(ContentHandler):
+ def __init__(self, satList, satellites, transponders):
+ self.isPointsElement, self.isReboundsElement = 0, 0
+ self.satList = satList
+ self.satellites = satellites
+ self.transponders = transponders
+
+ def startElement(self, name, attrs):
+ if (name == "sat"):
+ #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
+ tpos = int(attrs.get('position',""))
+ if tpos < 0:
+ tpos = 3600 + tpos
+ tname = attrs.get('name',"")
+ self.satellites[tpos] = tname
+ self.satList.append( (tname, tpos) )
+ self.parsedSat = int(tpos)
+ elif (name == "transponder"):
+ freq = int(attrs.get('frequency',""))
+ sr = int(attrs.get('symbol_rate',""))
+ pol = int(attrs.get('polarization',""))
+ fec = int(attrs.get('fec_inner',""))
+ if self.parsedSat in self.transponders:
+ pass
+ else:
+ self.transponders[self.parsedSat] = [ ]
+
+ self.transponders[self.parsedSat].append((0, freq, sr, pol, fec))
+
+ class parseCables(ContentHandler):
+ def __init__(self, cablesList, transponders):
+ self.isPointsElement, self.isReboundsElement = 0, 0
+ self.cablesList = cablesList
+ self.transponders = transponders
+
+ def startElement(self, name, attrs):
+ if (name == "cable"):
+ #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
+ tname = attrs.get('name',"")
+ self.cablesList.append(str(tname))
+ self.parsedCab = str(tname)
+ elif (name == "transponder"):
+ freq = int(attrs.get('frequency',""))
+ sr = int(attrs.get('symbol_rate',""))
+ mod = int(attrs.get('modulation',""))
+ fec = int(attrs.get('fec_inner',""))
+ if self.parsedCab in self.transponders:
+ pass
+ else:
+ self.transponders[self.parsedCab] = [ ]
+
+ self.transponders[self.parsedCab].append((1, freq, sr, mod, fec))
+
+ class parseTerrestrials(ContentHandler):
+ def __init__(self, terrestrialsList, transponders):
+ self.isPointsElement, self.isReboundsElement = 0, 0
+ self.terrestrialsList = terrestrialsList
+ self.transponders = transponders
+
+ def startElement(self, name, attrs):
+ if (name == "terrestrial"):
+ #print "found sat " + attrs.get('name',"") + " " + str(attrs.get('position',""))
+ tname = attrs.get('name',"")
+ tflags = attrs.get('flags',"")
+ self.terrestrialsList.append((tname, tflags))
+ self.parsedTer = str(tname)
+ elif (name == "transponder"):
+ # TODO finish this!
+ freq = int(attrs.get('centre_frequency',""))
+ bw = int(attrs.get('bandwidth',""))
+ const = int(attrs.get('constellation',""))
+ crh = int(attrs.get('code_rate_hp',""))
+ crl = int(attrs.get('code_rate_lp',""))
+ guard = int(attrs.get('guard_interval',""))
+ transm = int(attrs.get('transmission_mode',""))
+ hierarchy = int(attrs.get('hierarchy_information',""))
+ inv = int(attrs.get('inversion',""))
+ if self.parsedTer in self.transponders:
+ pass
+ else:
+ self.transponders[self.parsedTer] = [ ]
+
+ self.transponders[self.parsedTer].append((2, freq, bw, const, crh, crl, guard, transm, hierarchy, inv))
+
+ def getTransponders(self, pos):
+ return self.transponders[pos]
+
+ def getConfiguredSats(self):
+ return self.sec.getSatList()
+
+ def getSatDescription(self, pos):
+ return self.satellites[pos]
+