"""
NAO stub text-to-speech component.
"""
from sic_framework.core.actuator_python2 import SICActuator
from sic_framework.core.connector import SICConnector
from sic_framework.core.message_python2 import SICMessage, SICConfMessage, TextMessage, TextRequest
[docs]
class NaoStubTTSActuator(SICActuator):
"""Stub for NAO TTS - logs what would be said instead of actually speaking."""
[docs]
@staticmethod
def get_conf():
return SICConfMessage()
[docs]
@staticmethod
def get_output():
return SICMessage
[docs]
def execute(self, request):
"""Log what would be spoken."""
text = request.text
self.logger.info("NaoStub.tts: Would say '{}'".format(text))
return SICMessage()
[docs]
def on_message(self, message):
"""Handle incoming text messages."""
if hasattr(message, 'text'):
self.logger.info("NaoStub.tts: Would say '{}'".format(message.text))
[docs]
def stop(self):
"""Stop the TTS actuator."""
self._stopped.set()
super(NaoStubTTSActuator, self).stop()
[docs]
class NaoStubTTS(SICConnector):
component_class = NaoStubTTSActuator