--- /dev/null
+# -*- 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 <http://www.gnu.org/licenses/>.
+#
+# ============================================================================
+# 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.player = None
+ self.service = ""
+ self.addr = None
+
+ #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.service)
+ self.keyboard_srv = KeyBoard_Server(self.service)
+ elif self.service == 'Slideshow':
+ self.mouse_srv = Mouse_Server(self.service)
+ self.keyboard_srv = KeyBoard_Server(self.service)
+ elif self.service == 'Player':
+ self.player_srv = Player_Server()
+ 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])
+ elif cmd[0] == "Player":
+ if self.addr:
+ cmd += self.addr
+ self.player_srv.execute(cmd)
+ else:
+ self.player_srv.execute(cmd)
+
+ def set_address_to_download(self, addr):
+ self.addr = addr
+
+ # clean all button and keys pressed
+ def clean_all(self):
+ self.mouse_srv.clean_up()
+ self.keyboard_srv.clean_up()
+
+#teste unitario
+if __name__ == '__main__':
+ import utils.plistparser