[hbbtv] upgraded.
[vuplus_dvbapp] / lib / python / Components / NimManager.py
old mode 100644 (file)
new mode 100755 (executable)
index bd1a363..31e59a6
@@ -118,8 +118,11 @@ class SecConfigure:
 
        def linkNIMs(self, sec, nim1, nim2):
                print "link tuner", nim1, "to tuner", nim2
-               if nim2 == (nim1 - 1):
-                       self.linkInternally(nim1)
+#              if nim2 == (nim1 - 1):
+#                      self.linkInternally(nim1)
+#
+# for internally connect tuner A to B
+               self.linkInternally(nim1)
                sec.setTunerLinked(nim1, nim2)
                
        def getRoot(self, slotid, connto):
@@ -150,7 +153,7 @@ class SecConfigure:
 
                for slot in nim_slots:
                        if slot.type is not None:
-                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.frontend_id is None and -1 or slot.frontend_id))
+                               used_nim_slots.append((slot.slot, slot.description, slot.config.configMode.value != "nothing" and True or False, slot.isCompatible("DVB-S2"), slot.isCompatible("DVB-T2"), slot.frontend_id is None and -1 or slot.frontend_id))
                eDVBResourceManager.getInstance().setFrontendSlotInformations(used_nim_slots)
 
                for slot in nim_slots:
@@ -485,7 +488,7 @@ class NIM(object):
        def __init__(self, slot, type, description, has_outputs = True, internally_connectable = None, multi_type = {}, frontend_id = None, i2c = None, is_empty = False):
                self.slot = slot
 
-               if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", None):
+               if type not in ("DVB-S", "DVB-C", "DVB-T", "DVB-S2", "DVB-T2", None):
                        print "warning: unknown NIM type %s, not using." % type
                        type = None
 
@@ -497,18 +500,27 @@ class NIM(object):
                self.i2c = i2c
                self.frontend_id = frontend_id
                self.__is_empty = is_empty
-
-       def isCompatible(self, what):
-               if not self.isSupported():
-                       return False
-               compatible = {
+               self.compatible = {
                                None: (None,),
                                "DVB-S": ("DVB-S", None),
                                "DVB-C": ("DVB-C", None),
                                "DVB-T": ("DVB-T", None),
-                               "DVB-S2": ("DVB-S", "DVB-S2", None)
+                               "DVB-S2": ("DVB-S", "DVB-S2", None),
+                               "DVB-T2": ("DVB-T", "DVB-T2", None)
                        }
-               return what in compatible[self.type]
+
+       def isCompatible(self, what):
+               if not self.isSupported():
+                       return False
+               return what in self.compatible[self.type]
+
+       def canBeCompatible(self, what):
+               if self.isCompatible(what):
+                       return True
+               for type in self.getMultiTypeList().values():
+                       if what in self.compatible[type]:
+                               return True
+               return False
        
        def getType(self):
                return self.type
@@ -518,7 +530,8 @@ class NIM(object):
                                "DVB-S": ("DVB-S", "DVB-S2"),
                                "DVB-C": ("DVB-C",),
                                "DVB-T": ("DVB-T",),
-                               "DVB-S2": ("DVB-S", "DVB-S2")
+                               "DVB-S2": ("DVB-S", "DVB-S2"),
+                               "DVB-T2": ("DVB-T", "DVB-T2",)
                        }
                return connectable[self.type]
 
@@ -572,8 +585,9 @@ class NIM(object):
                return {
                        "DVB-S": "DVB-S", 
                        "DVB-T": "DVB-T",
-                       "DVB-S2": "DVB-S2",
                        "DVB-C": "DVB-C",
+                       "DVB-S2": "DVB-S2",
+                       "DVB-T2": "DVB-T2",
                        None: _("empty")
                        }[self.type]
 
@@ -758,11 +772,8 @@ class NimManager:
 
        def hasNimType(self, chktype):
                for slot in self.nim_slots:
-                       if slot.isCompatible(chktype):
+                       if slot.canBeCompatible(chktype):
                                return True
-                       for type in slot.getMultiTypeList().values():
-                               if chktype == type:
-                                       return True
                return False
        
        def getNimType(self, slotid):
@@ -838,6 +849,8 @@ class NimManager:
                type = self.getNimType(slotid)
                if type == "DVB-S2":
                        type = "DVB-S"
+               elif type == "DVB-T2":
+                       type = "DVB-T"
                nimList = self.getNimListOfType(type, slotid)
                for nim in nimList[:]:
                        mode = self.getNimConfig(nim)
@@ -849,6 +862,8 @@ class NimManager:
                type = self.getNimType(slotid)
                if type == "DVB-S2":
                        type = "DVB-S"
+               elif type == "DVB-T2":
+                       type = "DVB-T"
                nimList = self.getNimListOfType(type, slotid)
                positionerList = []
                for nim in nimList[:]: