2 * Copyright (c) 2012, 2013, Intel Corporation
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
8 * * Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * * Neither the name of Intel Corporation nor the names of its contributors
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #ifndef __SRS_NATIVE_MESSAGES_H__
31 #define __SRS_NATIVE_MESSAGES_H__
34 #include <murphy/common/native-types.h>
35 #include <murphy/common/transport.h>
37 #include "srs/daemon/voice-api-types.h"
48 SRS_REQUEST_UNREGISTER,
50 SRS_REQUEST_RENDERVOICE,
51 SRS_REQUEST_CANCELVOICE,
52 SRS_REQUEST_QUERYVOICES,
55 SRS_REPLY_RENDERVOICE,
57 SRS_REPLY_QUERYVOICES,
68 * registration request
72 uint32_t type; /* SRS_REQUEST_REGISTER */
73 uint32_t reqno; /* request number */
74 char *name; /* application name */
75 char *appclass; /* application class */
76 char **commands; /* speech commands */
77 uint32_t ncommand; /* number of speech commands */
82 * unregistration request
86 uint32_t type; /* SRS_REQUEST_UNREGISTER */
87 uint32_t reqno; /* request number */
88 } srs_req_unregister_t;
96 SRS_STATUS_OK = 0, /* success */
97 SRS_STATUS_FAILED, /* request failed */
106 uint32_t type; /* message type */
107 uint32_t reqno; /* request number */
108 uint32_t status; /* an error code, or 0 */
109 char *msg; /* error message, if any */
114 * voice focus request
118 uint32_t type; /* SRS_REQUEST_FOCUS */
119 uint32_t reqno; /* request number */
120 uint32_t focus; /* current voice focus */
125 * voice focus notification
129 uint32_t type; /* SRS_EVENT_FOCUS */
130 uint32_t focus; /* granted focus */
135 * voice render request
139 uint32_t type; /* SRS_REQUEST_VOICERENDER */
140 uint32_t reqno; /* request number */
141 char *msg; /* message to render */
142 char *voice; /* voice to use */
143 double rate; /* voice pitch (0 or 1 = default) */
144 double pitch; /* voice pitch (0 or 1 = default) */
145 uint32_t timeout; /* message timeout */
146 uint32_t events; /* mask of events to notify about */
151 * reply to voice render request
155 uint32_t type; /* SRS_REPLY_RENDERVOICE */
156 uint32_t reqno; /* request number */
157 uint32_t id; /* client-side id */
162 * voice cancel request
166 uint32_t type; /* SRS_REQUEST_VOICECANCEL */
167 uint32_t reqno; /* request number */
168 uint32_t id; /* voice render id */
173 * voice progress notification event
177 uint32_t type; /* SRS_EVENT_VOICE */
178 uint32_t event; /* SRS_VOICE_EVENT_* */
179 uint32_t id; /* voice render id */
180 double pcnt; /* progress in percentages */
181 uint32_t msec; /* progress in milliseconds */
186 * voice query request
190 uint32_t type; /* SRS_REQUEST_QUERYVOICES */
191 uint32_t reqno; /* request number */
192 char *lang; /* language to request voices for */
193 } srs_req_voiceqry_t;
201 uint32_t type; /* SRS_REPLY_QUERYVOICES */
202 uint32_t reqno; /* request number */
203 srs_voice_actor_t *actors; /* queried actors */
204 uint32_t nactor; /* number of actors */
205 } srs_rpl_voiceqry_t;
209 * command notification event
213 uint32_t type; /* SRS_EVENT_COMMAND */
214 uint32_t idx; /* client command index */
215 char **tokens; /* command tokens */
216 uint32_t ntoken; /* number of tokens */
221 * a generic request or reply
225 uint32_t type; /* message type */
226 uint32_t reqno; /* request number */
229 typedef srs_req_any_t srs_rpl_any_t;
237 srs_req_any_t any_req;
238 srs_rpl_any_t any_rpl;
239 srs_req_register_t reg_req;
240 srs_req_unregister_t bye_req;
241 srs_rpl_status_t status_rpl;
242 srs_req_focus_t focus_req;
243 srs_evt_focus_t focus_evt;
244 srs_req_voice_t voice_req;
245 srs_rpl_voice_t voice_rpl;
246 srs_ccl_voice_t voice_ccl;
247 srs_evt_voice_t voice_evt;
248 srs_req_voiceqry_t voice_qry;
249 srs_rpl_voiceqry_t voice_lst;
250 srs_evt_command_t command_evt;
254 mrp_typemap_t *register_message_types(void);
255 int send_message(mrp_transport_t *t, srs_msg_t *msg);
256 uint32_t message_typeid(uint32_t type);
257 uint32_t message_type(uint32_t type_id);
259 #endif /* __SRS_NATIVE_MESSAGES_H__ */