[tuxdroid-svn] r5160 - software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_i
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-07-24 10:43:33
|
Author: remi
Date: 2009-07-24 12:43:17 +0200 (Fri, 24 Jul 2009)
New Revision: 5160
Modified:
software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
Log:
* Updated log messages
* Updated some data protections
Modified: software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py 2009-07-24 10:42:03 UTC (rev 5159)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/04_robot_content_interactions/00_resourceRobotContentInteractions.py 2009-07-24 10:43:17 UTC (rev 5160)
@@ -88,7 +88,7 @@
"""
"""
if not self.contextIsComplete():
- print "PGU Context [%s] content is complete" % self.getPguName()
+ print "PGU Context [%s] : content is complete" % self.getPguName()
self.__contextCompleteMutex.acquire()
self.__contextComplete = True
self.__contextCompleteMutex.release()
@@ -112,9 +112,7 @@
'arguments' : arguments,
})
self.__eventStackMutex.release()
- print "Inserted event in PGU context [%s] :" % self.getPguName()
- print " ", eventType
- print " ", arguments
+ print "PGU context [%s] : Insert event (%s)" % (self.getPguName(), eventType)
def __getEvent(self):
"""
@@ -178,7 +176,7 @@
self.__execStarted = True
self.__execPaused = False
self.__startStopPauseMutex.release()
- print "Start execution of PGU context [%s]" % self.getPguName()
+ print "PGU context [%s] : Start execution" % self.getPguName()
self.__executionLoop()
def executionIsStarted(self):
@@ -198,7 +196,7 @@
time.sleep(0.1)
if not self.executionIsStarted():
return
- print "Stop execution of PGU context [%s]" % self.getPguName()
+ print "PGU context [%s] : Stop execution" % self.getPguName()
self.__startStopPauseMutex.acquire()
self.__execStarted = False
self.__execPaused = False
@@ -209,7 +207,7 @@
self.__breakAttitune()
self.__breakMessage()
self.__breakActuation()
- print "Execution of PGU context [%s] stopped" % self.getPguName()
+ print "PGU context [%s] : Execution stopped" % self.getPguName()
if not self.getPluginCommand().isNotifier():
if self.getContextLayer() == PGU_CONTEXT_LAYER_SCHEDULER:
resourceTuxDriver.playSound(15, 100.0)
@@ -224,7 +222,7 @@
return
if self.executionIsPaused():
return
- print "Pause execution of PGU context [%s]" % self.getPguName()
+ print "PGU context [%s] : Pause execution" % self.getPguName()
self.__startStopPauseMutex.acquire()
self.__execPaused = True
self.__startStopPauseMutex.release()
@@ -239,7 +237,7 @@
return
if not self.executionIsPaused():
return
- print "Unpause execution of PGU context [%s]" % self.getPguName()
+ print "PGU context [%s] : Unpause execution" % self.getPguName()
self.__startStopPauseMutex.acquire()
self.__execPaused = False
self.__startStopPauseMutex.release()
@@ -346,7 +344,7 @@
self.__execStarted = False
self.__execPaused = False
self.__startStopPauseMutex.release()
- print "Execution of PGU context [%s] stopped" % self.getPguName()
+ print "PGU context [%s] : Execution stopped" % self.getPguName()
if not self.getPluginCommand().isNotifier():
if self.getContextLayer() == PGU_CONTEXT_LAYER_SCHEDULER:
resourceTuxDriver.playSound(15, 100.0)
@@ -355,9 +353,7 @@
time.sleep(0.5)
return
else:
- print "Execute event from PGU context [%s] :" % self.getPguName()
- print " ", nextEvent['type']
- print " ", nextEvent['arguments']
+ print "PGU context [%s] : Execute event (%s)" % (self.getPguName(), nextEvent['type'])
arguments = nextEvent['arguments']
if not self.executionIsStarted():
continue
@@ -369,7 +365,7 @@
arguments['actuationArguments'])
elif nextEvent['type'] == PGU_EVENT_TYPE_ATTITUNE:
self.__executeAttitune(arguments['attituneName'])
- print "Event finished"
+ print "PGU context [%s] : Event finished (%s)" % (self.getPguName(), nextEvent['type'])
time.sleep(0.1)
class PguContextsManager(object):
@@ -561,12 +557,14 @@
"""
"""
result = {}
- pguContext = self.getForegroundPguContext()
+ self.__bfPguContextMutex.acquire()
+ pguContext = self.__foregroundPguContext
if pguContext != None:
if pguContext.getContextLayer() == PGU_CONTEXT_LAYER_SCHEDULER:
result['icon'] = "/%s/icon.png" % pguContext.getPguObject().getParentGadget().getDescription().getUuid()
result['name'] = pguContext.getPguObject().getDescription().getName()
result['uuid'] = pguContext.getPguObject().getDescription().getUuid()
+ self.__bfPguContextMutex.release()
return result
def getLastStartedOnDemandUgcMessages(self):
@@ -593,11 +591,17 @@
message = String.toUtf8(message)
result['msg_%d' % i] = message
return result
- pguContext = self.getForegroundPguContext()
+ self.__bfPguContextMutex.acquire()
+ pguContext = self.__foregroundPguContext
if pguContext != None:
if pguContext.getContextLayer() != PGU_CONTEXT_LAYER_SCHEDULER:
- return fillResult(pguContext)
- return fillResult(self.getBackgroundPguContext())
+ ret = fillResult(pguContext)
+ else:
+ ret = fillResult(self.__backgroundPguContext)
+ else:
+ ret = fillResult(self.__backgroundPguContext)
+ self.__bfPguContextMutex.release()
+ return ret
def __setStarted(self, value):
"""
|