# -*- coding: utf-8 -*- # **************************************************************************** # Copyright (c) 2008 INdT/Fucapi. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . # # ============================================================================ # Project Name : PC Remote # Author : Nilson Silva, Jonatas Isvi # Email : fergus.mao@gmail.com, jonatas.nona@gmail.com # Reviewer : Jônatas Isvi # Email : # Version : 1.0 # Package : Main Application # Description : Service Application # ============================================================================ from ObjectServers import * class Service: """ Service supports all services applications """ def __init__(self): self.mouse_srv = None self.keyboard_srv = None self.service = "" #Set the Service requested by the Service Manager def set_service(self, command): self.service = command if self.service == 'Tablet': self.mouse_srv = Mouse_Server() self.keyboard_srv = KeyBoard_Server() elif self.service == 'Slideshow': self.mouse_srv = Mouse_Server() self.keyboard_srv = KeyBoard_Server() elif self.service == 'Player': print "player service." elif self.service == 'Torrent': print "torrent service." #Returns the Service which is being executed def get_service(self): return self.service #Executes the action requested by the Service Manager def execute(self, command): cmd = command.split(":") if cmd[0] == "Mouse": self.mouse_srv.execute(cmd[1]) elif cmd[0] == "Keyboard": self.keyboard_srv.execute(cmd[1]) # clean all button and keys pressed def clean_all(self): self.mouse_srv.clean_up_mouse() self.keyboard_srv.clean_up_keyboard()