speech
Loading...
Searching...
No Matches
start-ask.h
1/*
2 * Copyright (C) 2017 iCub Facility - Istituto Italiano di Tecnologia
3 * Author: Vadim Tikhanoff
4 * email: vadim.tikhanoff@iit.it
5 * Permission is granted to copy, distribute, and/or modify this program
6 * under the terms of the GNU General Public License, version 2 or any
7 * later version published by the Free Software Foundation.
8 *
9 * A copy of the license can be found at
10 * http://www.robotcub.org/icub/license/gpl.txt
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
15 * Public License for more details
16 */
17
18#ifndef __ICUB_STARTASK_MOD_H__
19#define __ICUB_STARTASK_MOD_H__
20
21#include <algorithm>
22#include <cstring>
23#include <string>
24#include <vector>
25#include <yarp/os/BufferedPort.h>
26#include <yarp/os/RFModule.h>
27#include <yarp/os/Network.h>
28#include <yarp/os/Thread.h>
29#include <yarp/os/PeriodicThread.h>
30#include <yarp/os/Time.h>
31#include <yarp/os/Stamp.h>
32
33
34class STARTManager : public yarp::os::BufferedPort<yarp::os::Bottle>
35{
36private:
37
38 std::string moduleName; //string containing module name
39 std::string inSpeechPortName; //string containing speech input port name
40 std::string outSTARTPortName; //string containing start output port name
41 std::string inFacePortName; //string containing face input port name
42
43 std::string outSTARTUrlName; //string containing start output port name
44
45 yarp::os::Port portURL;
46
47 yarp::os::BufferedPort<yarp::os::Bottle> speechInPort; //input port containing speech
48 yarp::os::BufferedPort<yarp::os::Bottle> startOutPort; //output port containing start
49 yarp::os::BufferedPort<yarp::os::Bottle> faceInPort; //
50
51public:
57 STARTManager( const std::string &moduleName );
58 ~STARTManager();
59
60 bool open();
61 void close();
62 void onRead( yarp::os::Bottle &bot );
63 void interrupt();
64 void removetags(std::string &first, std::string &second, std::string &text);
65
66 static bool aZCheck(char c)
67 {
68 if (isspace(c))
69 return isalpha(c);
70 else
71 return !isalpha(c);
72 }
73};
74/**********************************************************/
75
76class STARTModule:public yarp::os::RFModule
77{
78 /* module parameters */
79 std::string moduleName;
80 std::string handlerPortName;
81 yarp::os::RpcServer rpcPort;
82
83 /* pointer to a new thread */
84 STARTManager *startManager;
85 bool closing;
86
87public:
88
89 bool configure(yarp::os::ResourceFinder &rf); // configure all the module parameters and return true if successful
90 bool interruptModule(); // interrupt, e.g., the ports
91 bool close(); // close and shut down the module
92
93 double getPeriod();
94 bool updateModule();
95};
96
97
98#endif
99//empty line to make gcc happy