Thread: [tuxdroid-svn] r4678 - in software_suite_v3/smart-core/smart-server/trunk/resources: . 00_smart_se
Status: Beta
Brought to you by:
ks156
|
From: remi <c2m...@c2...> - 2009-05-26 16:28:56
|
Author: remi
Date: 2009-05-26 18:28:45 +0200 (Tue, 26 May 2009)
New Revision: 4678
Added:
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/04_resourceMenu.py
software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/10_resourceScheduler.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/00_resourceTuxDriver.py
software_suite_v3/smart-core/smart-server/trunk/resources/01_drivers/01_resourceTuxOSL.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/00_resourceAttitune.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/01_resourceEyes.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/02_resourceFlippers.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/03_resourceLeds.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/04_resourceMacro.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/05_resourceMouth.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/06_resourceSoundFlash.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/07_resourceSpinning.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/08_resourceTTS.py
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot/09_resourceWav.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/00_resourceAttituneManager.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/01_resourcePluginsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/02_resourceGagdetsServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/03_content_servers/03_resourceUgcServer.py
software_suite_v3/smart-core/smart-server/trunk/resources/04_user_configurations/
software_suite_v3/smart-core/smart-server/trunk/resources/05_updates/
software_suite_v3/smart-core/smart-server/trunk/resources/06_web_interfaces/
software_suite_v3/smart-core/smart-server/trunk/resources/06_web_interfaces/00_resourceWIDevel.py
Removed:
software_suite_v3/smart-core/smart-server/trunk/resources/00_server_base/
software_suite_v3/smart-core/smart-server/trunk/resources/01_robot_system/
software_suite_v3/smart-core/smart-server/trunk/resources/02_robot_api/
software_suite_v3/smart-core/smart-server/trunk/resources/03_advanced_api/
software_suite_v3/smart-core/smart-server/trunk/resources/04_web_interface/
Log:
* reorganized server resources
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,82 @@
+# ==============================================================================
+# Server resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "server".
+# ------------------------------------------------------------------------------
+class TDSResourceServer(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "server"
+ self.comment = "Resource to manage the server."
+ self.fileName = RESOURCE_FILENAME
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def stopServer(self):
+ """Stop the server.
+ """
+ httpServer.stop()
+
+ def getVersion(self):
+ """Get the server version.
+ @return: The server version.
+ """
+ return serverVersion
+
+# Create an instance of the resource
+resourceServer = TDSResourceServer("resourceServer")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceServer)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "stop".
+# ------------------------------------------------------------------------------
+class TDSServiceServerStop(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "stop"
+ self.comment = "Stop the server."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceServer.stopServer()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerStop)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "version".
+# ------------------------------------------------------------------------------
+class TDSServiceServerVersion(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "version"
+ self.comment = "Get the server version."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ data = {'version' : resourceServer.getVersion()}
+ contentStruct['root']['data'] = data
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceServer.addService(TDSServiceServerVersion)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/00_resourceServer.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,283 @@
+# ==============================================================================
+# Status resource.
+# ==============================================================================
+
+SW_NAME_EXTERNAL_STATUS = "external_status"
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "status".
+# ------------------------------------------------------------------------------
+class TDSResourceStatus(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "status"
+ self.comment = "Resource to manage the statuses and events."
+ self.fileName = RESOURCE_FILENAME
+
+ # Registering the "external" status in the events handler
+ eventsHandler.insert(SW_NAME_EXTERNAL_STATUS)
+ # Registering the "external" status in the default excluded events list
+ clientsManager.addDefaultExcludedEvent(SW_NAME_EXTERNAL_STATUS)
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def getEvents(self, idClient):
+ """Get the last events from a client stack.
+ - This function only affect the HTTP/REST clients.
+ @param idClient: Id client.
+ @return: The events from the client stack as list.
+ """
+ client = clientsManager.getClient(idClient)
+ if client == None:
+ return []
+ return client.popEvents()
+
+ def requestOne(self, statusName):
+ """Request the current state of a status.
+ @param statusName: Name of the status.
+ @return: The current state of the status as dictionary.
+ """
+ eventHandler = eventsHandler.getEventHandler(statusName)
+ if eventHandler == None:
+ return None
+ else:
+ stateStruct = eventHandler.getLastState()
+ if stateStruct != None:
+ state = {
+ 'name' : statusName,
+ 'value' : stateStruct[0],
+ 'delay' : stateStruct[1],
+ }
+ else:
+ state = {
+ 'name' : statusName,
+ 'value' : '',
+ 'delay' : 0.0,
+ }
+ return state
+
+ def requestAll(self):
+ """Request the current state of all statuses.
+ @return: The current state of all statuses as dictionary.
+ """
+ eventsNameList = eventsHandler.getEventsNameList()
+ states = []
+ for eventName in eventsNameList:
+ state = self.requestOne(eventName)
+ if state != None:
+ states.append(state)
+ return states
+
+ def sendStatus(self, name, value):
+ """Send a free status.
+ - This function inject a status in the events handler. This kind of
+ statuses are handled in the special event handler named
+ "SW_NAME_EXTERNAL_STATUS" because their names are not knowed by the
+ server.
+ @param name: Status name.
+ @param value: Status value.
+ """
+ statusStruct = {}
+ statusStruct['name'] = SW_NAME_EXTERNAL_STATUS
+ statusStruct['value'] = "%s|%s" % (name, value)
+ statusStruct['delay'] = 0.0
+ statusStruct['type'] = "string"
+ def async():
+ eventsHandler.emit(statusStruct['name'], (statusStruct['value'],
+ float(statusStruct['delay'])))
+ clientsManager.pushEvents([statusStruct,])
+ t = threading.Thread(target = async)
+ t.start()
+
+ def addExcludedEvent(self, idClient, eventName):
+ """Add an event in the excluded events list of a client.
+ - The effect is that the event/status will be anymore sent to this
+ client.
+ @idClient: Client id.
+ @eventName: Status/event name.
+ """
+ def async():
+ client = clientsManager.getClient(idClient)
+ if client != None:
+ client.addExcludedEvent(eventName)
+ t = threading.Thread(target = async)
+ t.start()
+
+ def removeExcludedEvent(self, idClient, eventName):
+ """Remove an event from the excluded events list of a client.
+ @idClient: Client id.
+ @eventName: Status/event name.
+ """
+ def async():
+ client = clientsManager.getClient(idClient)
+ if client != None:
+ client.removeExcludedEvent(eventName)
+ t = threading.Thread(target = async)
+ t.start()
+
+# Create an instance of the resource
+resourceStatus = TDSResourceStatus("resourceStatus")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceStatus)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "events".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusEvents(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "events"
+ self.comment = "Get the last events from a client stack."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ events = resourceStatus.getEvents(id)
+ if len(events) > 0:
+ i = 0
+ for event in events:
+ data_name = "data|%d" % i
+ i += 1
+ contentStruct['root'][data_name] = event
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusEvents)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "request_one".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRequestOne(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'status_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "request_one"
+ self.comment = "Request the current state of a status."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ state = resourceStatus.requestOne(parameters['status_name'])
+ if state == None:
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ else:
+ contentStruct['root']['data'] = state
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRequestOne)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "request_all".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRequestAll(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = False
+ self.name = "request_all"
+ self.comment = "Request the current state of all statuses."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ states = resourceStatus.requestAll()
+ i = 0
+ for state in states:
+ dataName = "data|%d" % i
+ i += 1
+ contentStruct['root'][dataName] = state
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRequestAll)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "send".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusSend(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'name' : 'string',
+ 'value' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ANONYMOUS
+ self.exclusiveExecution = True
+ self.name = "send"
+ self.comment = "Send a free status."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.sendStatus(parameters['name'], parameters['value'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusSend)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "register_event".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusRegisterEvent(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'event_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "register_event"
+ self.comment = "Add an event inthe registered events list of the client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.removeExcludedEvent(id, parameters['event_name'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusRegisterEvent)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "unregister_event".
+# ------------------------------------------------------------------------------
+class TDSServiceStatusUnregisterEvent(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'event_name' : 'string',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_FREE
+ self.exclusiveExecution = False
+ self.name = "unregister_event"
+ self.comment = "Remove an event from the registered events list of the client."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceStatus.addExcludedEvent(id, parameters['event_name'])
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceStatus.addService(TDSServiceStatusUnregisterEvent)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/01_resourceStatus.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,225 @@
+# ==============================================================================
+# Access resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of the resource "access".
+# ------------------------------------------------------------------------------
+class TDSResourceAccess(TDSResource):
+
+ # --------------------------------------------------------------------------
+ # Inherited methods from TDSResource
+ # --------------------------------------------------------------------------
+
+ def configure(self):
+ self.name = "access"
+ self.comment = "Resource to manage the access to the robot resources."
+ self.fileName = RESOURCE_FILENAME
+
+ # --------------------------------------------------------------------------
+ # Public methods
+ # --------------------------------------------------------------------------
+
+ def acquireAccess(self, idClient, priorityLevel):
+ """Acquire the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ @param idClient: Id client.
+ @param priorityLevel: Priority level.
+ 0 : LOW
+ 1 : NORMAL
+ 2 : HIGH
+ 3 : CRITICAL
+ @return: True or False
+ """
+ client = clientsManager.getClient(idClient)
+ if client == None:
+ return False
+ return client.acquireAccess(priorityLevel)
+
+ def releaseAccess(self, idClient):
+ """Release the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ @param idClient: Id client.
+ """
+ accessManager.releaseAccess(idClient)
+
+ def forcingReleaseAccess(self):
+ """Forcing to release the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.releaseAccess()
+
+ def forcingAcquireAccess(self, idClient, priorityLevel):
+ """Forcing to acquire the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ @param idClient: Id client.
+ @param priorityLevel: Priority level.
+ 0 : LOW
+ 1 : NORMAL
+ 2 : HIGH
+ 3 : CRITICAL
+ @return: True or False
+ """
+ accessManager.releaseAccess()
+ return accessManager.acquireAccess(idClient, priorityLevel)
+
+ def lockAccess(self):
+ """Lock the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.setLocked(True)
+
+ def unlockAccess(self):
+ """Lock the access to the robot resources.
+ - This function only affects the RESTRICTED clients
+ - This function should be called by only the ROOT client
+ """
+ accessManager.setLocked(False)
+
+# Create an instance of the resource
+resourceAccess = TDSResourceAccess("resourceAccess")
+# Register the resource into the resources manager
+resourcesManager.addResource(resourceAccess)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "acquire".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessAcquire(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'priority_level' : 'int',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_RESTRICTED
+ self.exclusiveExecution = False
+ self.name = "acquire"
+ self.comment = "Acquire the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ if not resourceAccess.acquireAccess(id, parameters['priority_level']):
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessAcquire)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "release".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessRelease(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_RESTRICTED
+ self.exclusiveExecution = False
+ self.name = "release"
+ self.comment = "Release the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.releaseAccess(id)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessRelease)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "forcing_release".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessForcingRelease(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "forcing_release"
+ self.comment = "Forcing to release the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.forcingReleaseAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessForcingRelease)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "forcing_acquire".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessForcingAcquire(TDSService):
+
+ def configure(self):
+ self.parametersDict = {
+ 'id_client' : 'string',
+ 'priority_level' : 'int',
+ }
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "forcing_acquire"
+ self.comment = "Forcing to acquire the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ if not resourceAccess.forcingAcquireAccess(parameters['id_client'],
+ parameters['priority_level']):
+ contentStruct['root']['result'] = getStrError(E_TDREST_FAILED)
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessForcingAcquire)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "lock".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessLock(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "lock"
+ self.comment = "Lock the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.lockAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessLock)
+
+# ------------------------------------------------------------------------------
+# Declaration of the service "unlock".
+# ------------------------------------------------------------------------------
+class TDSServiceAccessUnlock(TDSService):
+
+ def configure(self):
+ self.parametersDict = {}
+ self.minimalUserLevel = TDS_CLIENT_LEVEL_ROOT
+ self.exclusiveExecution = False
+ self.name = "unlock"
+ self.comment = "Lock the access to the robot resources."
+
+ def execute(self, id, parameters):
+ headersStruct = self.getDefaultHeadersStruct()
+ contentStruct = self.getDefaultContentStruct()
+ contentStruct['root']['result'] = getStrError(E_TDREST_SUCCESS)
+ resourceAccess.unlockAccess()
+ return headersStruct, contentStruct
+
+# Register the service into the resource
+resourceAccess.addService(TDSServiceAccessUnlock)
Property changes on: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/02_resourceAccess.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py
===================================================================
--- software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py (rev 0)
+++ software_suite_v3/smart-core/smart-server/trunk/resources/00_smart_server_base/03_resourceClient.py 2009-05-26 16:28:45 UTC (rev 4678)
@@ -0,0 +1,134 @@
+# ==============================================================================
+# Client resource.
+# ==============================================================================
+
+# ------------------------------------------------------------------------------
+# Declaration of ...
[truncated message content] |