-
Notifications
You must be signed in to change notification settings - Fork 1
SIMYAN: simyan
Author: ancient-sentinel - Last Updated: 5/6/2021
The SIMYAN service manager provides the means for initializing and orchestrating SIMYAN services.
By default, it provides the SIMMotion
, SIMSpeech
, and SIMVision
modules, which are registered
when the startServices()
method is called. Additional default services can be easily incorporated by
adding new ServiceScope
registrations in the class's __init__()
method.
startServices() -> qi.Void
Starts and registers all default SIMYAN services. This method is thread-safe and safe to be called
by multiple applications. A particular application should not call the method multiple times before
calling stopServices()
.
stopServices() -> qi.Void
Unregisters and stops all default SIMYAN services so long as no other applications are still using
them. This is determined by keeping track of the number of times the startServices()
method is
called. When the number of calls to stopServices()
equals the number of calls to startServices()
,
the services will be stopped. This method is thread-safe and safe to be called by multiple applications.
A particular application should not call the method multiple times.
stop() -> qi.Void
Stops and unregisters the SIMYAN service manager and all managed services.
class SIMServiceManager(object):
def __init__(self, qiapp, dev=False):
"""
Initializes a new SIMYAN service manager instance.
:param qiapp: (qi.Application) The hosting qi application.
"""
# ... start of method ...
self.scoped_services = [
ServiceScope(qiapp, SIMMotion),
ServiceScope(qiapp, SIMSpeech),
ServiceScope(qiapp, SIMVision),
ServiceScope(qiapp, SIMMyCustomService) # Add your service to the list
]
# ... rest of method ...
# ... rest of class ...
- Providing service methods to query whether a particular SIMYAN service is available, or to get a list of registered SIMYAN services.
- Providing a mechanism to dynamically add SIMYAN services, either by scanning modules, or as
parameters to
__init__()
(See thesimutils.service
module for some known issues).