00001 /* 00002 * Player - One Hell of a Robot Server 00003 * Copyright (C) 2004, 2005 Richard Vaughan 00004 * 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 */ 00021 00022 /* 00023 * Desc: Speech player driver 00024 * Author: Pooya Karimian 00025 * Date: 21 March 2006 00026 * CVS: $Id$ 00027 */ 00028 00029 00030 #include "p_driver.h" 00031 using namespace Stg; 00032 00039 InterfaceSpeech::InterfaceSpeech( player_devaddr_t addr, 00040 StgDriver* driver, 00041 ConfigFile* cf, 00042 int section ) 00043 00044 : InterfaceModel( addr, driver, cf, section, "" ) 00045 { 00046 // nothing to do 00047 } 00048 00049 void InterfaceSpeech::Publish( void ) 00050 { 00051 /* 00052 speech_data_t* sdata = (speech_data_t*)mod->data; 00053 assert(sdata); 00054 00055 player_speech_cmd_t pdata; 00056 memset( &pdata, 0, sizeof(pdata) ); 00057 00058 // Translate the Stage-formatted sdata into the Player-formatted pdata 00059 00060 // Publish it 00061 this->driver->Publish(this->addr, NULL, 00062 PLAYER_MSGTYPE_DATA, 00063 PLAYER_SPEECH_CMD_SAY, 00064 (void*)&pdata, sizeof(pdata), NULL); 00065 */ 00066 } 00067 00068 int InterfaceSpeech::ProcessMessage( QueuePointer & resp_queue, 00069 player_msghdr_t* hdr, 00070 void* data ) 00071 { 00072 // PROCESS INCOMING REQUESTS HERE 00073 if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD, 00074 PLAYER_SPEECH_CMD_SAY, 00075 this->addr)) 00076 { 00077 // if( hdr->size == sizeof(player_speech_cmd_t) ) 00078 // { 00079 player_speech_cmd_t* pcmd = (player_speech_cmd_t*)data; 00080 00081 // Pass it to stage: 00082 00083 mod->Say( pcmd->string ); 00084 00085 return( 0 ); 00086 // } 00087 // else 00088 // { 00089 // PRINT_ERR2( "wrong size speech command packet (%d/%d bytes)", 00090 // (int)hdr->size, (int)sizeof(player_speech_cmd_t) ); 00091 // 00092 // return( -1 ); 00093 // } 00094 } 00095 00096 PRINT_WARN2( "stage speech doesn't support message id:%d/%d", 00097 hdr->type, hdr->subtype ); 00098 return ( -1 ); 00099 }