summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorasanoaozora <fifitaneki@hotmail.com>2017-09-26 13:55:44 +0200
committerasanoaozora <fifitaneki@hotmail.com>2017-09-26 13:55:44 +0200
commitb9bda20d81ea44ed8265de8819eb95e2e31dabf9 (patch)
tree084b28b6af44b393137a21f7abb6c7e1402daafe /test
parentf14e57e3656a5500563bdd32537ac1295d4a3f52 (diff)
downloadpoi-service-b9bda20d81ea44ed8265de8819eb95e2e31dabf9.tar.gz
update speech POC and connect it to navigation (some improvements needed)
Diffstat (limited to 'test')
-rw-r--r--test/navigation/script/genivi.py36
-rw-r--r--test/navigation/script/lbs-api-test.e4p3
-rwxr-xr-xtest/navigation/script/test-speech.py111
3 files changed, 149 insertions, 1 deletions
diff --git a/test/navigation/script/genivi.py b/test/navigation/script/genivi.py
index 7c0d301..0b2be2e 100644
--- a/test/navigation/script/genivi.py
+++ b/test/navigation/script/genivi.py
@@ -47,3 +47,39 @@ MANEUVER_APPEARED = 0x0051
PRE_ADVICE = 0x0052
ADVICE = 0x0053
PASSED = 0x0054
+
+SPEECHSERVICE_MAX_CHUNK_LENGTH = 1024
+SPEECHSERVICE_CS_UNKNOWN = 0x0000
+SPEECHSERVICE_CS_ESTABLISHED = 0x0001
+SPEECHSERVICE_CS_REFUSED = 0x0002
+SPEECHSERVICE_CS_POSSIBLE = 0x0003
+SPEECHSERVICE_CS_PENDING = 0x0004
+SPEECHSERVICE_CS_PAUSED = 0x0005
+SPEECHSERVICE_CS_TERMINATED = 0x0006
+SPEECHSERVICE_CS_MAX = 0x0007
+SPEECHSERVICE_CT_NAVIGATION = 0x0010
+SPEECHSERVICE_CT_READER = 0x0011
+SPEECHSERVICE_CT_GEN_HIGH = 0x0012
+SPEECHSERVICE_CT_GEN_MEDIUM = 0x0013
+SPEECHSERVICE_CT_GEN_LOW = 0x0014
+SPEECHSERVICE_CT_MAX = 0x0015
+SPEECHSERVICE_PPT_DIALOG = 0x0020
+SPEECHSERVICE_PPT_NAVIGATION = 0x0021
+SPEECHSERVICE_PPT_NONE = 0x0022
+SPEECHSERVICE_PPT_READER = 0x0023
+SPEECHSERVICE_PPT_MAX = 0x0024
+SPEECHSERVICE_QS_UNKNOWN = 0x0030
+SPEECHSERVICE_QS_FULL = 0x0031
+SPEECHSERVICE_QS_HIGH_FILL = 0x0032
+SPEECHSERVICE_QS_LOW_FILL = 0x0033
+SPEECHSERVICE_QS_MAX = 0x0034
+SPEECHSERVICE_TS_UNKNOWN = 0x0040
+SPEECHSERVICE_TS_NOT_INITIALIZED = 0x0041
+SPEECHSERVICE_TS_ACTIVE = 0x0042
+SPEECHSERVICE_TS_ABORTED = 0x0043
+SPEECHSERVICE_TS_MARKER = 0x0044
+SPEECHSERVICE_TS_IDLE = 0x0045
+SPEECHSERVICE_TS_ENQUEUED = 0x0046
+SPEECHSERVICE_TS_FINISHED = 0x0047
+SPEECHSERVICE_TS_FAILED = 0x0048
+SPEECHSERVICE_TS_MAX = 0x0049
diff --git a/test/navigation/script/lbs-api-test.e4p b/test/navigation/script/lbs-api-test.e4p
index b0f184b..6ef49c7 100644
--- a/test/navigation/script/lbs-api-test.e4p
+++ b/test/navigation/script/lbs-api-test.e4p
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
<!-- eric project file for project lbs-api-test -->
-<!-- Saved: 2017-08-29, 11:17:14 -->
+<!-- Saved: 2017-09-26, 09:47:38 -->
<!-- Copyright (C) 2017 asanoaozora, -->
<Project version="5.1">
<Language>en_US</Language>
@@ -24,6 +24,7 @@
<Source>test-route-calculation.py</Source>
<Source>genivi.py</Source>
<Source>test-poi-guidance.py</Source>
+ <Source>test-speech.py</Source>
</Sources>
<Forms/>
<Translations/>
diff --git a/test/navigation/script/test-speech.py b/test/navigation/script/test-speech.py
new file mode 100755
index 0000000..01e68bc
--- /dev/null
+++ b/test/navigation/script/test-speech.py
@@ -0,0 +1,111 @@
+#!/usr/bin/python
+
+"""
+**************************************************************************
+* @licence app begin@
+* SPDX-License-Identifier: MPL-2.0
+*
+* \copyright Copyright (C) 2016, PSA GROUP
+*
+* \file test-speech.py
+*
+* \brief This simple test shows how the speech
+* could be easily tested using a python script
+*
+* \author Philippe Colliot <philippe.colliot@mpsa.com>
+*
+* \version 1.0
+*
+* This Source Code Form is subject to the terms of the
+* Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with
+# this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+* List of changes:
+*
+* @licence end@
+**************************************************************************
+"""
+
+import dbus
+import gobject
+import dbus.mainloop.glib
+
+import genivi
+try:
+ from dltTrigger import *
+ dltTrigger=True
+ print('DLT signal sent')
+except dltTriggerNotBuilt:
+ dltTrigger=False
+#import pdb; pdb.set_trace()
+
+#name of the test
+test_name = "speech output"
+
+#constants used into the script
+TIME_OUT = 10000
+
+def catch_speech_notifyConnectionStatus_signal_handler(connectionStatus):
+ print("Connection status: " + str(int(connectionStatus)))
+
+def catch_speech_notifyMarkerReached_signal_handler(chunkID,marker):
+ print("Chunk ID: " + chunkID)
+
+def catch_speech_notifyQueueStatus_signal_handler(queueStatus):
+ print("Queue status: " + str(int(queueStatus)))
+ if queueStatus==genivi.SPEECHSERVICE_QS_LOW_FILL:
+ g_speech_interface.closePrompter()
+ exit(0)
+
+def catch_speech_notifyTTSStatus_signal_handler(ttsStatus):
+ print("TTS status: " + str(int(ttsStatus)))
+
+#timeout
+def timeout():
+ print ('Timeout Expired\n')
+ exit(1)
+
+def exit(value):
+ global g_exit
+ g_exit=value
+ if dltTrigger==True:
+ stopTrigger(test_name)
+ loop.quit()
+
+print('\n--------------------------')
+print('Speech Test')
+print('--------------------------\n')
+
+g_exit=0
+
+if __name__ == '__main__':
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+
+#connect to session bus
+bus = dbus.SessionBus()
+
+bus.add_signal_receiver(catch_speech_notifyConnectionStatus_signal_handler, \
+ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \
+ signal_name = "notifyConnectionStatus")
+bus.add_signal_receiver(catch_speech_notifyMarkerReached_signal_handler, \
+ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \
+ signal_name = "notifyMarkerReached")
+bus.add_signal_receiver(catch_speech_notifyQueueStatus_signal_handler, \
+ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \
+ signal_name = "notifyQueueStatus")
+bus.add_signal_receiver(catch_speech_notifyTTSStatus_signal_handler, \
+ dbus_interface = "org.genivi.hmi.speechservice.SpeechOutput", \
+ signal_name = "notifyTTSStatus")
+
+if dltTrigger==True:
+ startTrigger(test_name)
+
+speech = bus.get_object('org.genivi.hmi.speechservice.SpeechOutput','/org/genivi/hmi/speechservice/SpeechOutput')
+g_speech_interface = dbus.Interface(speech, dbus_interface='org.genivi.hmi.speechservice.SpeechOutput')
+
+g_speech_interface.openPrompter(genivi.SPEECHSERVICE_CT_NAVIGATION, genivi.SPEECHSERVICE_PPT_NAVIGATION)
+g_speech_interface.addTextChunk(dbus.String("Hello"))
+
+#main loop
+gobject.timeout_add(TIME_OUT, timeout)
+loop = gobject.MainLoop()
+loop.run()