pcremote-client-n8x0 -> client sources
[remotepc] / pcremote-server-desktop / debian / pcremote-server / usr / share / pcremote-server / services / .svn / text-base / service.py.svn-base
1 # -*- coding: utf-8 -*-
2
3 # ****************************************************************************
4 # Copyright (c) 2008 INdT/Fucapi.
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU Lesser General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 #  This program is distributed in the hope that it will be useful,
11 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 #  GNU Lesser General Public License for more details.
14 #
15 #  You should have received a copy of the GNU Lesser General Public License
16 #   along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 #
18 # ============================================================================
19 # Project Name : PC Remote
20 # Author       : Nilson Silva, Jonatas Isvi
21 # Email        : fergus.mao@gmail.com, jonatas.nona@gmail.com
22 # Reviewer     : Jônatas Isvi
23 # Email        :
24 # Version      : 1.0
25 # Package      : Main Application
26 # Description  : Service Application
27 # ============================================================================
28
29 from ObjectServers import *
30
31 class Service:
32     
33     """ Service
34     supports all services applications
35     """    
36
37     def __init__(self):
38         self.mouse_srv = None
39         self.keyboard_srv = None
40         self.service = ""
41
42     #Set the Service requested by the Service Manager
43     def set_service(self, command):
44
45         self.service = command
46
47         if self.service == 'Tablet':
48             self.mouse_srv    = Mouse_Server()
49             self.keyboard_srv = KeyBoard_Server()
50         elif self.service == 'Slideshow':
51             self.mouse_srv     = Mouse_Server()
52             self.keyboard_srv = KeyBoard_Server()       
53         elif self.service == 'Player':
54             print "player service."
55         elif self.service == 'Torrent':
56             print "torrent service."
57
58     #Returns the Service which is being executed
59     def get_service(self):
60         return self.service
61
62     #Executes the action requested by the Service Manager
63     def execute(self, command):
64         
65         cmd = command.split(":")
66
67         if cmd[0] == "Mouse":
68             self.mouse_srv.execute(cmd[1])
69         elif cmd[0] == "Keyboard":
70             self.keyboard_srv.execute(cmd[1])
71    
72     # clean all button and keys pressed
73     def clean_all(self):
74         self.mouse_srv.clean_up_mouse()
75         self.keyboard_srv.clean_up_keyboard()