ProtocolHandler Class Reference

Processes all client commands. More...

Inheritance diagram for ProtocolHandler:

AbstractProtocolHandler

List of all members.

Public Types

typedef std::map< std::string,
AbstractTextProcessor * > 
StringToTextProcMap

Public Member Functions

void onFamily (Client &client, const std::string lang, const std::string &family)
 Notifies the command to select new voice family was received from client.
void onLetter (Client &client, wchar_t c)
 Notifies the command to say one letter was received from client.
void onParam (Client &client, int paramType, TextParam value)
 Notifies there was a command to set new value of speech parameter.
void onProcMode (Client &client, const std::string &procMode)
 Notifies the command to select another processing mode was received.
void onStop (Client &client)
 Notifies new command to stop playback was received from client.
void onText (Client &client, const std::wstring &t)
 Notifies the command to say text was received from client.
void onTone (Client &client, size_t freq, size_t duration)
 Notifies the new command to produce tone signal was received from client.
 ProtocolHandler (const OutputSet &outputSet, ExecutorInterface &executorInterface)
 The constructor.
void reinit (const Configuration &c)
 Initializes all internal structures.
virtual ~ProtocolHandler ()
 the destructor


Detailed Description

ProtocolHandler class processes all commands received from all clients. It makes all required transformations on the text to say, splits it onto sequence of text items with text processing classes and sends everything to ExecutorInterface. Also ProtocolHandler class handles commands to modify any client-specific settings and some others. It contains methods for each client command. They are called by VoicemanProtocol class during client data handling.

See also:
VoicemanProtocol AbstractProtocolHandler ExecutorInterface

Constructor & Destructor Documentation

ProtocolHandler::ProtocolHandler ( const OutputSet outputSet,
ExecutorInterface executorInterface 
) [inline]

Parameters:
[in] outputSet The reference to used OutputSet object
[in] executorInterface The reference to used ExecutorInterface object


Member Function Documentation

void ProtocolHandler::onFamily ( Client client,
const std::string  lang,
const std::string &  family 
) [inline, virtual]

The protocol implementation class cals this method each time when the command to select new voice family was received from client. The client object this command was received from, the language name to select family for and new voice family name are provided. The language string can be empty and it means new family must be selected for all languages in which it is registered.

Parameters:
[in] client The client this command was received from
[in] lang The language name to select family for, can be empty
[in] family The voice family to select

Implements AbstractProtocolHandler.

void ProtocolHandler::onLetter ( Client client,
wchar_t  c 
) [inline, virtual]

The protocol implementation calls this method each time when it receives command to say one letter. The client object this command was received from is provided.

Parameters:
[in] client The client object this command was received from
[in] c The character to say

Implements AbstractProtocolHandler.

void ProtocolHandler::onParam ( Client client,
int  paramType,
TextParam  value 
) [inline, virtual]

This method is called by protocol implementation object on every new command to change speech attribute value. Speech attribute can be one of three types: pitch, rate and volume.

Parameters:
[in] client The client object this command was received from
[in] paramType The attribute type to change, can be ParamPitch, ParamRate and ParamVolume
[in] value The new value to set

Implements AbstractProtocolHandler.

void ProtocolHandler::onProcMode ( Client client,
const std::string &  procMode 
) [inline, virtual]

This method is called by protocol implementation class on each command to select new text processing mode. The client object new command was received from and new mode name are provided.

Parameters:
[in] client The client this command was received from
[in] procMode The name of new text processing mode

Implements AbstractProtocolHandler.

void ProtocolHandler::onStop ( Client client  )  [inline, virtual]

The protocol implementation calls this function when it receives the command to stop any playback. The client object new command was received from is provided.

Parameters:
[in] client The client object this command was received from

Implements AbstractProtocolHandler.

void ProtocolHandler::onText ( Client client,
const std::wstring &  t 
) [inline, virtual]

The protocol implementation class calls this method on every command to say part of text and provides the client object this command was transmitted from.

Parameters:
[in] client The client object the command was received from
[in] t The text to say

Implements AbstractProtocolHandler.

void ProtocolHandler::onTone ( Client client,
size_t  freq,
size_t  duration 
) [inline, virtual]

This method is called by protocol implementation object each time when new command to produce tone signal is received from a client. The client object this command was received from is provided.

Parameters:
[in] client The client object this command was received from
[in] freq The frequency of tone signal to produce
[in] duration The new signal duration

Implements AbstractProtocolHandler.

void ProtocolHandler::reinit ( const Configuration &  c  )  [inline]

This method fills all internal structures with settings from provided configuration data. This method can be called so many times as it required. For example, it is called each time on cerver configuration reloading.

Parameters:
[in] c The configuration data to take settings from


Generated on Thu May 6 16:10:58 2010 for VoiceMan by  doxygen 1.5.9