Skip to content
Snippets Groups Projects
Commit f5a75383 authored by Stuart Mark James's avatar Stuart Mark James
Browse files

Fixed voice/jingle attribute in error cases. More cleaning up ready for release.

parent 686b4ae1
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,7 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
endif()
# Start Build Config -----------------------------------
cmake_minimum_required (VERSION 2.8)
cmake_minimum_required (VERSION 3.0)
set(CMAKE_SKIP_RPATH true)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_COLOR_MAKEFILE ON)
......
This diff is collapsed.
......@@ -103,9 +103,7 @@ public:
public:
Tango::DevString *attr_text_to_talk_read;
voiceEnum *attr_voice_read;
Tango::DevString *attr_set_voice_read;
jingleEnum *attr_jingle_read;
Tango::DevString *attr_set_jingle_read;
// Constructors and destructors
public:
......@@ -193,16 +191,6 @@ public:
virtual void read_voice(Tango::Attribute &attr);
virtual void write_voice(Tango::WAttribute &attr);
virtual bool is_voice_allowed(Tango::AttReqType type);
/**
* Attribute set_voice related methods
* Description: The actual voice in use, as a string
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_set_voice(Tango::Attribute &attr);
virtual void write_set_voice(Tango::WAttribute &attr);
virtual bool is_set_voice_allowed(Tango::AttReqType type);
/**
* Attribute jingle related methods
* Description: Currently available jingles in the jingle directory.
......@@ -213,16 +201,6 @@ public:
virtual void read_jingle(Tango::Attribute &attr);
virtual void write_jingle(Tango::WAttribute &attr);
virtual bool is_jingle_allowed(Tango::AttReqType type);
/**
* Attribute set_jingle related methods
* Description:
*
* Data type: Tango::DevString
* Attr type: Scalar
*/
virtual void read_set_jingle(Tango::Attribute &attr);
virtual void write_set_jingle(Tango::WAttribute &attr);
virtual bool is_set_jingle_allowed(Tango::AttReqType type);
//--------------------------------------------------------
......@@ -301,8 +279,14 @@ private:
void error_watch_thread();
// Quick wrapper for the various errors
void setFaultState(string message);
void set_fault_state(string message);
// wrapper for the speech request
void do_speech(const string &text);
// used to init the two devenum attributes from the database
void initalise_voice_attribute();
void initalise_jingle_attribute();
/*----- PROTECTED REGION END -----*/ // TextToSpeech::Additional Method prototypes
};
......
......@@ -128,14 +128,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Available voices returned from the text to speech library." label="Select Voice" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="set_voice" attType="Scalar" rwType="READ_WRITE" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="The actual voice in use, as a string" label="Set Voice" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="jingle" attType="Scalar" rwType="READ_WRITE" displayLevel="OPERATOR" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:EnumType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
......@@ -144,14 +136,6 @@
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="Currently available jingles in the jingle directory." label="Select Jingle" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<attributes name="set_jingle" attType="Scalar" rwType="READ_WRITE" displayLevel="EXPERT" polledPeriod="0" maxX="" maxY="" memorized="true" memorizedAtInit="true" allocReadMember="true" isDynamic="false">
<dataType xsi:type="pogoDsl:StringType"/>
<changeEvent fire="false" libCheckCriteria="false"/>
<archiveEvent fire="false" libCheckCriteria="false"/>
<dataReadyEvent fire="false" libCheckCriteria="true"/>
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
<properties description="" label="Set Jingle" unit="" standardUnit="" displayUnit="" format="" maxValue="" minValue="" maxAlarm="" minAlarm="" maxWarning="" minWarning="" deltaTime="" deltaValue=""/>
</attributes>
<states name="FAULT" description="A subsystem caused an error and the TextToSpeech state is FAULT.">
<status abstract="false" inherited="false" concrete="true" concreteHere="true"/>
</states>
......
......@@ -542,31 +542,6 @@ void TextToSpeechClass::attribute_factory(vector<Tango::Attr *> &att_list)
voice->set_memorized_init(true);
att_list.push_back(voice);
// Attribute : set_voice
set_voiceAttrib *set_voice = new set_voiceAttrib();
Tango::UserDefaultAttrProp set_voice_prop;
set_voice_prop.set_description("The actual voice in use, as a string");
set_voice_prop.set_label("Set Voice");
// unit not set for set_voice
// standard_unit not set for set_voice
// display_unit not set for set_voice
// format not set for set_voice
// max_value not set for set_voice
// min_value not set for set_voice
// max_alarm not set for set_voice
// min_alarm not set for set_voice
// max_warning not set for set_voice
// min_warning not set for set_voice
// delta_t not set for set_voice
// delta_val not set for set_voice
set_voice->set_default_properties(set_voice_prop);
// Not Polled
set_voice->set_disp_level(Tango::EXPERT);
set_voice->set_memorized();
set_voice->set_memorized_init(true);
att_list.push_back(set_voice);
// Attribute : jingle
jingleAttrib *jingle = new jingleAttrib();
Tango::UserDefaultAttrProp jingle_prop;
......@@ -592,31 +567,6 @@ void TextToSpeechClass::attribute_factory(vector<Tango::Attr *> &att_list)
jingle->set_memorized_init(true);
att_list.push_back(jingle);
// Attribute : set_jingle
set_jingleAttrib *set_jingle = new set_jingleAttrib();
Tango::UserDefaultAttrProp set_jingle_prop;
// description not set for set_jingle
set_jingle_prop.set_label("Set Jingle");
// unit not set for set_jingle
// standard_unit not set for set_jingle
// display_unit not set for set_jingle
// format not set for set_jingle
// max_value not set for set_jingle
// min_value not set for set_jingle
// max_alarm not set for set_jingle
// min_alarm not set for set_jingle
// max_warning not set for set_jingle
// min_warning not set for set_jingle
// delta_t not set for set_jingle
// delta_val not set for set_jingle
set_jingle->set_default_properties(set_jingle_prop);
// Not Polled
set_jingle->set_disp_level(Tango::EXPERT);
set_jingle->set_memorized();
set_jingle->set_memorized_init(true);
att_list.push_back(set_jingle);
// Create a list of static attributes
create_static_attribute_list(get_class_attr()->get_attr_list());
......
......@@ -88,21 +88,6 @@ public:
virtual string get_enum_type() {return string("voiceEnum");}
};
// Attribute set_voice class definition
class set_voiceAttrib: public Tango::Attr
{
public:
set_voiceAttrib():Attr("set_voice",
Tango::DEV_STRING, Tango::READ_WRITE) {};
~set_voiceAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<TextToSpeech *>(dev))->read_set_voice(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TextToSpeech *>(dev))->write_set_voice(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<TextToSpeech *>(dev))->is_set_voice_allowed(ty);}
};
// Attribute jingle class definition
class jingleAttrib: public Tango::Attr
{
......@@ -120,21 +105,6 @@ public:
virtual string get_enum_type() {return string("jingleEnum");}
};
// Attribute set_jingle class definition
class set_jingleAttrib: public Tango::Attr
{
public:
set_jingleAttrib():Attr("set_jingle",
Tango::DEV_STRING, Tango::READ_WRITE) {};
~set_jingleAttrib() {};
virtual void read(Tango::DeviceImpl *dev,Tango::Attribute &att)
{(static_cast<TextToSpeech *>(dev))->read_set_jingle(att);}
virtual void write(Tango::DeviceImpl *dev,Tango::WAttribute &att)
{(static_cast<TextToSpeech *>(dev))->write_set_jingle(att);}
virtual bool is_allowed(Tango::DeviceImpl *dev,Tango::AttReqType ty)
{return (static_cast<TextToSpeech *>(dev))->is_set_jingle_allowed(ty);}
};
//=========================================
// Define classes for commands
......
......@@ -88,26 +88,6 @@ bool TextToSpeech::is_voice_allowed(TANGO_UNUSED(Tango::AttReqType type))
return true;
}
//--------------------------------------------------------
/**
* Method : TextToSpeech::is_set_voice_allowed()
* Description : Execution allowed for set_voice attribute
*/
//--------------------------------------------------------
bool TextToSpeech::is_set_voice_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for set_voice attribute in Write access.
/*----- PROTECTED REGION ID(TextToSpeech::set_voiceStateAllowed_WRITE) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TextToSpeech::set_voiceStateAllowed_WRITE
// Not any excluded states for set_voice attribute in read access.
/*----- PROTECTED REGION ID(TextToSpeech::set_voiceStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TextToSpeech::set_voiceStateAllowed_READ
return true;
}
//--------------------------------------------------------
/**
* Method : TextToSpeech::is_jingle_allowed()
......@@ -128,26 +108,6 @@ bool TextToSpeech::is_jingle_allowed(TANGO_UNUSED(Tango::AttReqType type))
return true;
}
//--------------------------------------------------------
/**
* Method : TextToSpeech::is_set_jingle_allowed()
* Description : Execution allowed for set_jingle attribute
*/
//--------------------------------------------------------
bool TextToSpeech::is_set_jingle_allowed(TANGO_UNUSED(Tango::AttReqType type))
{
// Not any excluded states for set_jingle attribute in Write access.
/*----- PROTECTED REGION ID(TextToSpeech::set_jingleStateAllowed_WRITE) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TextToSpeech::set_jingleStateAllowed_WRITE
// Not any excluded states for set_jingle attribute in read access.
/*----- PROTECTED REGION ID(TextToSpeech::set_jingleStateAllowed_READ) ENABLED START -----*/
/*----- PROTECTED REGION END -----*/ // TextToSpeech::set_jingleStateAllowed_READ
return true;
}
//=================================================
// Commands Allowed Methods
......
# Start Build Config -----------------------------------
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 3.0)
message(STATUS "Configuring TTS Static Library")
# Need to make sure we have a good enough compiler for filesystem
......
......@@ -371,8 +371,8 @@ void TTSRunner::mainLoop()
// this covers the fact that it can take 700ms to get the speech from AWS
future<bool> jingle_result;
// play a jingle is one was requested
if(jingleEnabled() && !request._jingle.empty())
// play a jingle if one was requested
if(jingleEnabled() && request.jingleRequested())
{
jingle_result = async(std::launch::async,
[this](const string &jingle_name) -> bool
......@@ -399,7 +399,7 @@ void TTSRunner::mainLoop()
// now, if the jingle was requested and is valid, we need to ensure we wait
// for it to finish, this will block until the jingle is finished
if((jingleEnabled() && jingle_result.get() == false) || _exit_thread)
if((jingleEnabled() && request.jingleRequested() && jingle_result.get() == false) || _exit_thread)
{
// something went wrong, or the playback was aborted, skip
// the rest of this tts
......
......@@ -98,6 +98,8 @@ private:
TTSRequest(const std::string &text, const std::string &voice, const std::string &jingle) :
_text(text), _voice(voice), _jingle(jingle) { }
bool jingleRequested() const { return !_jingle.empty(); }
std::string _text;
std::string _voice;
std::string _jingle;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment