diff options
| author | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-11-10 03:57:57 +0000 |
|---|---|---|
| committer | Ronny Strutz <ronny.strutz@multimedia-labs.de> | 2005-11-10 03:57:57 +0000 |
| commit | 547e6b6655c861f30c61bab5178639d4a9c57e7e (patch) | |
| tree | 7c3808e2656c4f3e5f6fa1e5c35ee1fad9183ad4 /lib/python | |
| parent | 6e0ba22a2e8859a4a415b2650805794d801cd4d8 (diff) | |
| download | enigma2-547e6b6655c861f30c61bab5178639d4a9c57e7e.tar.gz enigma2-547e6b6655c861f30c61bab5178639d4a9c57e7e.zip | |
add CiWait for synchronizing ci messages
Diffstat (limited to 'lib/python')
| -rw-r--r-- | lib/python/Screens/Ci.py | 114 |
1 files changed, 91 insertions, 23 deletions
diff --git a/lib/python/Screens/Ci.py b/lib/python/Screens/Ci.py index 8a330b86..82361ae3 100644 --- a/lib/python/Screens/Ci.py +++ b/lib/python/Screens/Ci.py @@ -10,7 +10,49 @@ from Components.HTMLComponent import * from Components.GUIComponent import * from Components.config import * -from enigma import eListbox, eListboxPythonConfigContent +#from enigma import eListbox, eListboxPythonConfigContent +from enigma import * + +#use this class to synchronize all ci to/from user communications +class CiWait(Screen): + def cancel(self): + #stop pending requests + self.Timer.stop() + self.close() + + def TimerCheck(self): + #special cases to prevent to fast resets/inits + if self.lastQuery == 0: + self.cancel() + elif self.lastQuery == 1: + self.cancel() + + def __init__(self, session, slot, query): + Screen.__init__(self, session) + + self["message"] = Label("waiting for CI...") + + self["actions"] = ActionMap(["OkCancelActions"], + { + "cancel": self.cancel + }) + + self.lastQuery = query + + self.Timer = eTimer() + self.Timer.timeout.get().append(self.TimerCheck) + + if query == 0: #reset + self.Timer.start(1000) #block 1 second + print "reset" + if query == 1: #init + self.Timer.start(1000) #block 1 second + print "init" + if query == 2: #mmi-open + print "mmi open" + if query == 3: #mmi-answer + print "mmi answer" + class CiEntryList(HTMLComponent, GUIComponent): def __init__(self, list): @@ -127,23 +169,48 @@ class CiMmi(Screen): "0": self.keyNumberGlobal }, -1) + class CiSelection(Screen): - def okbuttonClick(self): + def createMenu(self): + self.list = [ ] + self.list.append( ("Reset", 0) ) + self.list.append( ("Init", 1) ) + + self.state = eDVBCI_UI.getInstance().getState(0) + if self.state == 0: #no module + self.list.append( ("no module found", 2) ) + elif self.state == 1: #module in init + self.list.append( ("init module", 2) ) + elif self.state == 2: #module ready + #get appname + appname = "Dreamcrypt SuperCAM" + self.list.append( (appname, 2) ) + + self["entries"] .list = self.list + self["entries"] .l.setList(self.list) + + def TimerCheck(self): + state = eDVBCI_UI.getInstance().getState(0) + if self.state != state: + print "something happens" + self.state = state + self.createMenu() - if self["entries"].getCurrent()[1] == 0: #reset - print "ci reset requested" - pass - if self["entries"].getCurrent()[1] == 1: #init - print "ci init requested" - pass - if self["entries"].getCurrent()[1] == 2: #mmi open - #ci->getInstance().mmiOpen() and wait for list of elments ??? - #generate menu / list - list = [ ] - list.append( ("TEXT", "CA-Info") ) - list.append( ("TEXT", "Card Status") ) - list.append( ("PIN", 6, "Card Pin", 1) ) - self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list) + def okbuttonClick(self): + if self.state == 2: + #FIXME: find out the correct slot + self.session.open(CiWait, 0, self["entries"].getCurrent()[1]) + + #generate menu / list + #list = [ ] + #list.append( ("TEXT", "CA-Info") ) + #list.append( ("TEXT", "Card Status") ) + #list.append( ("PIN", 6, "Card Pin", 1) ) + #self.session.open(CiMmi, 0, 0, "Wichtiges CI", "Mainmenu", "Footer", list) + + def cancel(self): + self.Timer.stop() + self.close() def __init__(self, session): #FIXME support for one ci only @@ -152,12 +219,13 @@ class CiSelection(Screen): self["actions"] = ActionMap(["OkCancelActions"], { "ok": self.okbuttonClick, - "cancel": self.close + "cancel": self.cancel }) - - list = [ ] - list.append( ("Reset", 0) ) - list.append( ("Init", 1) ) - #add timer for "app-manager name" ? - list.append( ("Irdeto Blasel SE", 2) ) + + self.list = [ ] self["entries"] = CiEntryList(list) + self.createMenu() + + self.Timer = eTimer() + self.Timer.timeout.get().append(self.TimerCheck) + self.Timer.start(1000) |
