Author: remi
Date: 2008-09-17 11:13:05 +0200 (Wed, 17 Sep 2008)
New Revision: 1865
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIAccess.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIButton.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIDongleRadio.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIFlippers.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIMouthEyes.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIServer.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISoundFlash.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISpinning.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIStatus.py
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPITTS.py
Log:
* added an exception raising when an API function in used with an not allowed
client level.
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIAccess.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIAccess.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIAccess.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -15,6 +15,7 @@
import time
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIAccess(object):
"""Class to control the resource access. When you have your level to
@@ -56,11 +57,14 @@
""" To acquiring the resource access.
Need for CLIENT_LEVEL_RESTRICTED level.
Don't forget to release the access after !!!
+ Not available for CLIENT_LEVEL_ANONYME level.
@param priorityLevel: (ACCESS_PRIORITY_LOW|ACCESS_PRIORITY_NORMAL|
ACCESS_PRIORITY_HIGH|ACCESS_PRIORITY_CRITICAL)
@return: the success of the acquiring.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/acquire?priority_level=%d" % priorityLevel
return self.__cmdSimpleResult(cmd)
@@ -85,9 +89,12 @@
def release(self):
"""To releasing the resource access.
Need for CLIENT_LEVEL_RESTRICTED level.
+ Not available for CLIENT_LEVEL_ANONYME level.
@return: the success of the command.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/release?"
return self.__cmdSimpleResult(cmd)
@@ -99,6 +106,8 @@
@param idClient: idx of the client.
@return: the success of the command.
"""
+ if self.__parent.server.getClientLevel() != CLIENT_LEVEL_ROOT:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/forcing_acquire?id_client=%d" % idClient
return self.__cmdSimpleResult(cmd)
@@ -108,6 +117,8 @@
@return: the success of the command.
"""
+ if self.__parent.server.getClientLevel() != CLIENT_LEVEL_ROOT:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/forcing_release?"
return self.__cmdSimpleResult(cmd)
@@ -118,6 +129,8 @@
@return: the success of the command.
"""
+ if self.__parent.server.getClientLevel() != CLIENT_LEVEL_ROOT:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/lock?"
return self.__cmdSimpleResult(cmd)
@@ -127,5 +140,7 @@
@return: the success of the command.
"""
+ if self.__parent.server.getClientLevel() != CLIENT_LEVEL_ROOT:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
cmd = "access/unlock?"
return self.__cmdSimpleResult(cmd)
\ No newline at end of file
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIButton.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIButton.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIButton.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIMisc import checkValue
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIButton(object):
"""Class to control the buttons.
@@ -81,10 +82,13 @@
def waitPressed(self, timeout):
"""Wait until the switch was pressed.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if self.getState():
@@ -96,10 +100,13 @@
def waitReleased(self, timeout):
"""Wait until the switch was released.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if not self.getState():
@@ -111,11 +118,14 @@
def registerEventOnPressed(self, funct, idx = None):
"""Register a callback on the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(self.__switchStName, funct,
("True", None), idx)
@@ -123,19 +133,25 @@
def unregisterEventOnPressed(self, idx):
"""Unregister a callback from the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(self.__switchStName, idx)
def registerEventOnReleased(self, funct, idx = None):
"""Register a callback on the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(self.__switchStName, funct,
("False", None), idx)
@@ -143,9 +159,12 @@
def unregisterEventOnReleased(self, idx):
"""Unregister a callback from the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(self.__switchStName, idx)
@@ -181,11 +200,14 @@
def waitPressed(self, timeout, key):
"""Wait until the remote was pressed.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@param key: key to wiat.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if not key in REMOTE_KEY_LIST:
@@ -200,10 +222,13 @@
def waitReleased(self, timeout):
"""Wait until the remote was released.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if self.getState() == K_RELEASED:
@@ -216,12 +241,15 @@
def registerEventOnPressed(self, funct, key, idx = None):
"""Register a callback on the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@param key: remote key.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(ST_NAME_REMOTE_BUTTON, funct,
@@ -230,19 +258,25 @@
def unregisterEventOnPressed(self, idx):
"""Unregister a callback from the pressed event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(ST_NAME_REMOTE_BUTTON, idx)
def registerEventOnReleased(self, funct, idx = None):
"""Register a callback on the released event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(ST_NAME_REMOTE_BUTTON, funct,
@@ -251,8 +285,11 @@
def unregisterEventOnReleased(self, idx):
"""Unregister a callback from the released event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(ST_NAME_REMOTE_BUTTON, idx)
\ No newline at end of file
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIDongleRadio.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIDongleRadio.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIDongleRadio.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIMisc import checkValue
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIDongleRadio(object):
"""Class to interact with the connection/disconnection of the radio/dongle.
@@ -51,10 +52,13 @@
def waitConnected(self, timeout):
"""Wait until the radio/dongle was connected.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if self.getConnected():
@@ -65,10 +69,13 @@
def waitDisconnected(self, timeout):
"""Wait until the radio/dongle was disconnected.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(timeout, "float"):
return False
if not self.getConnected():
@@ -79,11 +86,14 @@
def registerEventOnConnected(self, funct, idx = None):
"""Register a callback on the connected event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandler != None:
nIdx = self.__eventHandler.register(funct, ("True", None), idx)
@@ -91,19 +101,25 @@
def unregisterEventOnConnected(self, idx):
"""Unregister a callback from the connected event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandler != None:
self.__eventHandler.unregister(idx)
def registerEventOnDisconnected(self, funct, idx = None):
"""Register a callback on the disconnected event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandler != None:
nIdx = self.__eventHandler.register(funct, ("False", None), idx)
@@ -111,8 +127,11 @@
def unregisterEventOnDisconnected(self, idx):
"""Unregister a callback from the disconnected event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandler != None:
self.__eventHandler.unregister(idx)
\ No newline at end of file
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIFlippers.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIFlippers.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIFlippers.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIMisc import checkValue
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIFlippers(object):
"""Class to control the flippers movements.
@@ -202,19 +203,25 @@
def waitMovingOff(self, timeout):
"""Wait that the flippers don't move.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
return
self.__parent.event.handler.waitCondition(ST_NAME_FLIPPERS_MOTOR_ON,
("False", None), timeout)
def waitPosition(self, position, timeout):
"""Wait a specific position of the flippers.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if position not in SSV_FLIPPERS_POSITIONS:
return False
if self.getPosition() == position:
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIMouthEyes.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIMouthEyes.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIMouthEyes.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIMisc import checkValue
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIMouthEyes(object):
"""Class to control the movements of a body part (mouth or eyes).
@@ -175,20 +176,26 @@
def waitMovingOff(self, timeout):
"""Wait that this body part don't move.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
return self.__parent.event.handler.waitCondition(self.__mvmRemStName,
("0", None), timeout)
def waitPosition(self, position, timeout):
"""Wait a specific position of this body part.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param position: position to wait.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if position not in SSV_MOUTHEYES_POSITIONS:
return False
if self.getPosition() == position:
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIServer.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIServer.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIServer.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -18,6 +18,7 @@
from TuxHTTPRequest import TuxHTTPRequest
from TuxAPIConst import *
from TuxAPIMisc import checkValue
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIServer(object):
"""TuxAPIServer is a module part of TuxAPI. This class make a connection
@@ -125,10 +126,13 @@
def waitConnected(self, timeout = 99999999999.):
"""Wait until the client was connected to the server.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.getClientLevel()
if not checkValue(timeout, "float"):
return False
if self.getConnected():
@@ -140,10 +144,13 @@
def waitDisconnected(self, timeout = 99999999999.):
"""Wait until the client was disconnected from the server.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.getClientLevel()
if not checkValue(timeout, "float"):
return False
if not self.getConnected():
@@ -347,11 +354,14 @@
def autoConnect(self, level, name, passwd):
"""Start the automatic connection/reconnection loop with the server.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param level: requested level of the client.
@param name: name of the client.
@param passwd: password of the client.
"""
+ if level == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, level
if self.__getAutoConnectionRun():
return
self.__autoConnectionThread = threading.Thread(target =
self.__autoConnectionLoop,
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISoundFlash.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISoundFlash.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISoundFlash.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIConst import *
from TuxAPIMisc import checkValue
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPISoundFlash(object):
"""
@@ -90,6 +91,8 @@
SOUND_REFLASH_ERROR_RF_OFFLINE|SOUND_REFLASH_ERROR_WAV|
SOUND_REFLASH_ERROR_USB)
"""
+ if self.__parent.server.getClientLevel() not in
[CLIENT_LEVEL_RESTRICTED, CLIENT_LEVEL_ROOT]:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(wavList, "list"):
return SOUND_REFLASH_ERROR_PARAMETERS
if len(wavList) <= 0:
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISpinning.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISpinning.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPISpinning.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -14,6 +14,7 @@
from TuxAPIMisc import checkValue
from TuxAPIConst import *
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPISpinning(object):
"""Class to control the spinning movements.
@@ -231,10 +232,13 @@
def waitLeftMovingOff(self, timeout):
"""Wait that the robot don't turn to the left.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
return
self.__parent.event.handler.waitCondition(ST_NAME_SPIN_LEFT_MOTOR_ON,
("False", None), timeout)
@@ -251,10 +255,13 @@
def waitRightMovingOff(self, timeout):
"""Wait that the robot don't turn to the right.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param timeout: maximal delay to wait.
@return: the state of the wait result.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
return
self.__parent.event.handler.waitCondition(ST_NAME_SPIN_RIGHT_MOTOR_ON,
("False", None), timeout)
\ No newline at end of file
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIStatus.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIStatus.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPIStatus.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -13,6 +13,7 @@
# http://www.gnu.org/copyleft/gpl.html
from TuxAPIMisc import checkValue
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPIStatus(object):
"""
@@ -51,12 +52,15 @@
def wait(self, statusName, condition = None, timeout = 999999999.0):
"""Wait a specific state of a status.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param statusName: name of the status.
@param condition: list of the rules of the condition.
@param timeout: maximal delay to wait.
@return: the success of the waiting.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if not checkValue(statusName, "str"):
return False
if not checkValue(timeout, "float"):
Modified:
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPITTS.py
===================================================================
---
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPITTS.py
2008-09-17 08:34:17 UTC (rev 1864)
+++
software_suite_v2/tuxware/pytuxisalive/trunk/src/tuxisalive/api/TuxAPITTS.py
2008-09-17 09:13:05 UTC (rev 1865)
@@ -16,6 +16,7 @@
from TuxAPIConst import *
from TuxAPIMisc import checkValue
+from TuxAPIExceptionCL import TuxAPIExceptionCL
class TuxAPITTS(object):
"""Class to use the text to speech engine.
@@ -249,11 +250,14 @@
def registerEventOnVoiceList(self, funct, idx = None):
"""Register a callback on the voice list event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(ST_NAME_VOICE_LIST, funct,
@@ -262,19 +266,25 @@
def unregisterEventOnVoiceList(self, idx):
"""Unregister a callback from the voice list event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(ST_NAME_VOICE_LIST, idx)
def registerEventOnSoundOn(self, funct, idx = None):
"""Register a callback on the sound on event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(ST_NAME_TTS_SOUND_STATE,
funct,
@@ -283,19 +293,25 @@
def unregisterEventOnSoundOn(self, idx):
"""Unregister a callback from the sound on event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(ST_NAME_TTS_SOUND_STATE, idx)
def registerEventOnSoundOff(self, funct, idx = None):
"""Register a callback on the sound off event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param funct: pointer to the function.
@param idx: index from a previous register.
@return: the new index of the callback in the handler.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
nIdx = -1
if self.__eventHandlers != None:
nIdx = self.__eventHandlers.register(ST_NAME_TTS_SOUND_STATE,
funct,
@@ -304,8 +320,11 @@
def unregisterEventOnSoundOff(self, idx):
"""Unregister a callback from the sound off event.
+ Not available for CLIENT_LEVEL_ANONYME level.
@param idx: index from a previous register.
"""
+ if self.__parent.server.getClientLevel() == CLIENT_LEVEL_ANONYME:
+ raise TuxAPIExceptionCL, self.__parent.server.getClientLevel()
if self.__eventHandlers != None:
self.__eventHandlers.unregister(ST_NAME_TTS_SOUND_STATE, idx)
\ No newline at end of file
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn