Classes | Functions | Variables
SpeakMessage: Speaks a message via TTS (text to speech) engine

Classes

struct  RI_CSpeakMessage
 Data structure for the Request "SpeakMessage". More...
 

Functions

LRESULT RI_SpeakMessage_ReadData (LPARAM, RI_CSpeakMessage &)
 Read data from shared memory for "Speak Message".
 
LRESULT RI_SpeakMessage_WriteData (LPARAM, RI_CSpeakMessage &)
 Write data to shared memory for "Speak Message".
 

Variables

const UINT RI_MESSAGE_SPEAKMESSAGE = RegisterWindowMessage(TEXT("RI_MESSAGE_SPEAKMESSAGE"))
 

Detailed Description

Variable Documentation

const UINT RI_MESSAGE_SPEAKMESSAGE = RegisterWindowMessage(TEXT("RI_MESSAGE_SPEAKMESSAGE"))

Message ID for the Request "speak message":
RI_MESSAGE_SPEAKMESSAGE

Write Memory:

RI_SpeakMessage_WriteData(LPARAM id, RI_CSpeakMessage data );

Read Memory:

RI_SpeakMessage_ReadData(LPARAM id, RI_CSpeakMessage data );

Return Values for SpeakMessage:

RI_NOERROR = Message was spoken
RI_NODESC = Message not spoken, because no message was defined
RI_NOTTS = Message not spoken, because no TTS speaker is available

Description:

Speaks a message via TTS.

Returns a single package

Example:

#define USE_LOADLIBRARY
#include "TNSRemoteInterfaceDll.h"
LPARAM GetUniqueID()
{
//generate unique ID
static LPARAM id = 0;
if (++id == 0) ++id; // do not use 0 !!!!!
return id;
}
inline LRESULT RI_MESSAGE( const UINT request, HWND h_client, LPARAM id )
{
//check if RI handle is valid
if ( !IsWindow( RI_GetTNS() ) )
//send the request
PostMessage( RI_GetTNS(), request, WPARAM(h_client), id );
return RI_NOERROR;
}
LRESULT CDlgMFC_SpeakMessage::WindowProc ( UINT message , WPARAM wParam , LPARAM lParam )
{
//check messages for answer from RI
if ( message == RI_MESSAGE_SPEAKMESSAGE )
{
if ( (LRESULT)wParam == RI_NOERROR )
{
//Message was spoken. errorcode (0)
TRACE(TEXT("Message was spoken"));
}
else if ( (LRESULT)wParam == RI_NODESC )
{
//Message was not spoken, because no Message defined. errorcode (12)
TRACE(TEXT("Message was not spoken: No message defined."));
}
else if ( (LRESULT)wParam == RI_NOTTS )
{
//Message was not spoken, because no TTS found.
TRACE(TEXT("Message was not spoken: No TTS found."));
}
}
return CDialog::WindowProc( message, wParam, lParam );
}
void CDlgMFC_SpeakMessage::foo()
{
// *** copy data to the struct ***
wcscpy (data.m_Message, L"You have reached the maximum driving time!");
// *** write data in the Shared memory***
LPARAM id = GetUniqueID();
LRESULT sharing_ret = RI_SpeakMessage_WriteData( id, data );
if ( sharing_ret != RI_NOERROR )
return;
if ( RI_MESSAGE( RI_MESSAGE_SPEAKMESSAGE, GetSafeHwnd(), id ) == RI_NOERROR )
//message sending succeeded
return;
else
//navigation software not running
return;
}

© PTV Group 2020 Generated on Wed Apr 15 2020 12:47:52 for by doxygen 1.8.8