Commit 65e79da4 authored by Don Gagne's avatar Don Gagne

Merge pull request #1354 from Susurrus/audio_notice

Output audio for NOTICE severity STATUSTEXT messages.
parents ad8f88a6 2b20abe6
......@@ -1248,14 +1248,17 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
QByteArray b;
b.resize(MAVLINK_MSG_STATUSTEXT_FIELD_TEXT_LEN+1);
mavlink_msg_statustext_get_text(&message, b.data());
// Ensure NUL-termination
b[b.length()-1] = '\0';
QString text = QString(b);
int severity = mavlink_msg_statustext_get_severity(&message);
if (text.startsWith("#") || severity <= MAV_SEVERITY_WARNING)
// If the message is NOTIFY or higher severity, or starts with a '#',
// then read it aloud.
if (text.startsWith("#") || severity <= MAV_SEVERITY_NOTICE)
{
text.remove("#audio:");
text.remove("#");
emit textMessageReceived(uasId, message.compid, severity, text);
GAudioOutput::instance()->say(text.toLower(), severity);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment