Author: remi
Date: 2009-02-17 16:37:59 +0100 (Tue, 17 Feb 2009)
New Revision: 3719

Modified:
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceTTS.py
   software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
Log:
* added a second API in the server in order to separate "External resources" 
uses and "System resources" of the API functions

Modified: 
software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceTTS.py
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceTTS.py  
2009-02-17 15:07:37 UTC (rev 3718)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/resources/ResourceTTS.py  
2009-02-17 15:37:59 UTC (rev 3719)
@@ -31,7 +31,7 @@
         self.__stackMutex.acquire()
         self.__stack = []
         self.__stackMutex.release()
-        Glb_tuxApi.tts.stop()
+        Glb_tuxApiSystem.tts.stop()
 
     def push(self, text):
         '''
@@ -70,9 +70,7 @@
         while self.__getStarted():
             ret = self.__pop()
             if ret != "":
-                Glb_tuxApi.event.setDelay(0.1)
-                Glb_tuxApi.tts.speak(ret)
-                Glb_tuxApi.event.setDelay(1.0)
+                Glb_tuxApiSystem.tts.speak(ret)
             time.sleep(0.5)
 
     def start(self):
@@ -88,7 +86,7 @@
 
         if self.__stackThread != None:
             if self.__stackThread.isAlive():
-                Glb_tuxApi.tts.stop()
+                Glb_tuxApiSystem.tts.stop()
                 self.__stackThread.join()
 
 Glb_TTSStack = TTSSpeakStack()
@@ -227,7 +225,7 @@
     result, params = parseParameters(parameters, p_fmt)
 
     if result:
-        Glb_tuxApi.tts.setPitch(int(params['value']))
+        Glb_tuxApiSystem.tts.setPitch(int(params['value']))
         cmd = 'OSL_CMD:TTS:SET_PITCH:%d' % (params['value'])
         ret = Glb_TuxOSL.PerformCommand(0.0, cmd)
         cmd_rsp = {'cmd_answer' : ret}
@@ -337,7 +335,7 @@
     if result:
         if params['name'].find('8k') == -1:
             params['name'] = params['name'] + '8k'
-        Glb_tuxApi.tts.setLocutor(params['name'])
+        Glb_tuxApiSystem.tts.setLocutor(params['name'])
         cmd = 'OSL_CMD:TTS:SET_LOCUTOR:%s' % (params['name'])
         ret = Glb_TuxOSL.PerformCommand(0.0, cmd)
         cmd_rsp = {'cmd_answer' : ret}

Modified: software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py
===================================================================
--- software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2009-02-17 15:07:37 UTC (rev 3718)
+++ software_suite_v2/tuxware/tuxhttpserver/trunk/src/tuxhttpserver.py  
2009-02-17 15:37:59 UTC (rev 3719)
@@ -81,8 +81,9 @@
 Glb_DonglePresent = False
 # Shared stack object for the TTS resource
 Glb_TTSStack = None
-# Shared API client
+# Shared API clients
 Glb_tuxApi = None
+Glb_tuxApiSystem = None
 # Tuxosl object
 Glb_TuxOSL = None
 # Tuxdriver object
@@ -363,6 +364,7 @@
     """Run the server
     """
     global Glb_tuxApi
+    global Glb_tuxApiSystem
 
     # Some logs
     
Glb_ServerLog.logInfo("-------------------------------------------------------")
@@ -376,10 +378,16 @@
     if not os.path.isdir(RESOURCES_CONF_PATH):
         Glb_ServerLog.logInfo("Can't create the directory (%s)" % \
             RESOURCES_CONF_PATH)
+    # API for the additional resources
     # Create an API object and connect-it to the server
     Glb_tuxApi = TuxAPI('INTERNAL', 270)
-    Glb_tuxApi.server.autoConnect(CLIENT_LEVEL_FREE, 'HTTPServer', 
'myPassword')
+    Glb_tuxApi.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'ExtRessources',
+        'myPassword')
     Glb_tuxApi.event.setDelay(1.0)
+    #API for the system ressources
+    Glb_tuxApiSystem = TuxAPI('INTERNAL', 270)
+    Glb_tuxApiSystem.server.autoConnect(CLIENT_LEVEL_FREE, 'SysResources',
+        'myPassword')
     # Create the server at port 270
     hrs = TuxDroidHHTPRESTServer(270)
     hrs.start()


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to