add python files for socket mmi plugin
[enigma2.git] / lib / python / Plugins / Extensions / SocketMMI / plugin.py
diff --git a/lib/python/Plugins/Extensions/SocketMMI/plugin.py b/lib/python/Plugins/Extensions/SocketMMI/plugin.py
new file mode 100644 (file)
index 0000000..4eadf2e
--- /dev/null
@@ -0,0 +1,27 @@
+from Plugins.Plugin import PluginDescriptor
+from SocketMMI import SocketMMIMessageHandler
+
+socketHandler = None
+
+def main(session, **kwargs):
+       socketHandler.startMMI()
+
+def menu(menuid, **kwargs):
+       if menuid == "setup" and socketHandler and socketHandler.connected():
+               return [(socketHandler.getName(), main, "socket_mmi", 0)]
+       return [ ]
+
+def sessionstart(reason, session):
+       socketHandler.setSession(session)
+
+def autostart(reason, **kwargs):
+       global socketHandler
+       if reason == 1:
+               socketHandler = None
+       else:
+               socketHandler = SocketMMIMessageHandler()
+
+def Plugins(**kwargs):
+       return [ PluginDescriptor(name = "SocketMMI", description = "Python frontend for /tmp/mmi.socket", where = PluginDescriptor.WHERE_MENU, fnc = menu),
+               PluginDescriptor(where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart),
+               PluginDescriptor(where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart) ]