p_speech.cc
Go to the documentation of this file.
1 /*
2  * Player - One Hell of a Robot Server
3  * Copyright (C) 2004, 2005 Richard Vaughan
4  *
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  */
21 
22 /*
23  * Desc: Speech player driver
24  * Author: Pooya Karimian
25  * Date: 21 March 2006
26  * CVS: $Id$
27  */
28 
29 
30 #include "p_driver.h"
31 using namespace Stg;
32 
39 InterfaceSpeech::InterfaceSpeech( player_devaddr_t addr,
40  StgDriver* driver,
41  ConfigFile* cf,
42  int section )
43 
44  : InterfaceModel( addr, driver, cf, section, "" )
45 {
46  // nothing to do
47 }
48 
50 {
51 /*
52  speech_data_t* sdata = (speech_data_t*)mod->data;
53  assert(sdata);
54 
55  player_speech_cmd_t pdata;
56  memset( &pdata, 0, sizeof(pdata) );
57 
58  // Translate the Stage-formatted sdata into the Player-formatted pdata
59 
60  // Publish it
61  this->driver->Publish(this->addr, NULL,
62  PLAYER_MSGTYPE_DATA,
63  PLAYER_SPEECH_CMD_SAY,
64  (void*)&pdata, sizeof(pdata), NULL);
65 */
66 }
67 
68 int InterfaceSpeech::ProcessMessage( QueuePointer & resp_queue,
69  player_msghdr_t* hdr,
70  void* data )
71 {
72 // PROCESS INCOMING REQUESTS HERE
73  if(Message::MatchMessage(hdr, PLAYER_MSGTYPE_CMD,
74  PLAYER_SPEECH_CMD_SAY,
75  this->addr))
76  {
77 // if( hdr->size == sizeof(player_speech_cmd_t) )
78 // {
79  player_speech_cmd_t* pcmd = (player_speech_cmd_t*)data;
80 
81  // Pass it to stage:
82 
83  mod->Say( pcmd->string );
84 
85  return( 0 );
86 // }
87 // else
88 // {
89 // PRINT_ERR2( "wrong size speech command packet (%d/%d bytes)",
90 // (int)hdr->size, (int)sizeof(player_speech_cmd_t) );
91 //
92 // return( -1 );
93 // }
94  }
95 
96  PRINT_WARN2( "stage speech doesn't support message id:%d/%d",
97  hdr->type, hdr->subtype );
98  return ( -1 );
99 }
The Stage library uses its own namespace.
Definition: canvas.hh:8
#define PRINT_WARN2(m, a, b)
Definition: stage.hh:635
virtual int ProcessMessage(QueuePointer &resp_queue, player_msghdr_t *hdr, void *data)
Definition: p_speech.cc:68
void Say(const std::string &str)
Definition: model.cc:539
player_devaddr_t addr
Definition: p_driver.h:66
virtual void Publish(void)
Definition: p_speech.cc:49
Stg::Model * mod
Definition: p_driver.h:115
InterfaceSpeech(player_devaddr_t addr, StgDriver *driver, ConfigFile *cf, int section)
Definition: p_speech.cc:39


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:09