RDK Documentation (Open Sourced RDK Components)
vrexMgr.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21 * @file vrexMgr.h
22 *
23 * @brief IARM-Bus VREX Manager Public API.
24 *
25 * This API defines the public interfaces for Voice Recognition manager
26 *
27 * @par Document
28 * Document reference.
29 *
30 * @par Open Issues (in no particular order)
31 * -# None
32 *
33 * @par Assumptions
34 * -# None
35 *
36 * @par Abbreviations
37 * - BE: ig-Endian.
38 * - cb: allback function (suffix).
39 * - DS: Device Settings.
40 * - FPD: Front-Panel Display.
41 * - HAL: Hardware Abstraction Layer.
42 * - LE: Little-Endian.
43 * - LS: Least Significant.
44 * - MBZ: Must be zero.
45 * - MS: Most Significant.
46 * - RDK: Reference Design Kit.
47 * - _t: Type (suffix).
48 *
49 * @par Implementation Notes
50 * -# None
51 *
52 */
53 /** @defgroup IARM_BUS IARM-VREX Manager API
54 * @ingroup IARM_RDK
55 *
56 * IARM-Bus is a platform agnostic Inter-process communication (IPC) interface. It allows
57 * applications to communicate with each other by sending Events or invoking Remote
58 * Procedure Calls. The common programming APIs offered by the RDK IARM-Bus interface is
59 * independent of the operating system or the underlying IPC mechanism.
60 *
61 * Two applications connected to the same instance of IARM-Bus are able to exchange events
62 * or RPC calls. On a typical system, only one instance of IARM-Bus instance is needed. If
63 * desired, it is possible to have multiple IARM-Bus instances. However, applications
64 * connected to different buses will not be able to communicate with each other.
65 */
66 
67 /** @todo complete the implementation with adding required RPCs.
68 */
69 
70 /** @addtogroup IARM_BUS_VREXMGR_API IARM-VREX Manager API.
71 * @ingroup IARM_BUS
72 *
73 * Described herein are the VREX Manager events and functions.
74 *
75 * @{
76 */
77 
78 
79 
80 
81 /**
82 * @defgroup iarmmgrs
83 * @{
84 * @defgroup vrexmgr
85 * @{
86 **/
87 
88 
89 #ifndef _IARM_BUS_VREXMGR_H
90 #define _IARM_BUS_VREXMGR_H
91 
92 #include "libIARM.h"
93 
94 #ifdef __cplusplus
95 extern "C"
96 {
97 #endif
98 
99 #define IARM_BUS_VREXMGR_NAME "VREXMgr" /*!< IARM BUS name for VREX manager */
100 
101 #define IARM_BUS_VREXMGR_SPEECH_FRAGMENTLENGTH 1024
102 #define IARM_BUS_VREXMGR_SPEECH_MIME_LENGTH 64
103 #define IARM_BUS_VREXMGR_SPEECH_SUBTYPE_LENGTH 64
104 #define IARM_BUS_VREXMGR_SPEECH_LANG_LENGTH 3
105 
106 #define IARM_BUS_VREXMGR_ERROR_MESSAGE_LENGTH 256
107 
108 /*! Published Events from sys manager */
109 typedef enum _VREXMgr_EventId_t {
110  IARM_BUS_VREXMGR_EVENT_MOTION = 0,
111  IARM_BUS_VREXMGR_EVENT_SPEECH,
112  IARM_BUS_VREXMGR_EVENT_ERROR,
113  IARM_BUS_VREXMGR_EVENT_SUCCESS,
114  IARM_BUS_VREXMGR_EVENT_SETTINGS,
115  IARM_BUS_VREXMGR_EVENT_MAX /*!< Max Event Id */
117 
118 typedef enum _VREXMgr_SpeechType {
119  IARM_BUS_VREXMGR_SPEECH_BEGIN = 0,
120  IARM_BUS_VREXMGR_SPEECH_FRAGMENT,
121  IARM_BUS_VREXMGR_SPEECH_END
122 } IARM_Bus_VREXMgr_SpeechType_t;
123 
124 // Note that these *must* match AudioReasonEnd enum in vrexSession.h
125 typedef enum _VREXMgr_SpeechEndReason {
126  IARM_BUS_VREXMGR_SPEECH_DONE = 0,
127  IARM_BUS_VREXMGR_SPEECH_ABORT,
128  IARM_BUS_VREXMGR_SPEECH_ERROR
129 } IARM_Bus_VREXMgr_SpeechEndReason_t;
130 
131 typedef struct {
132  /// @brief payload description for the Motion Event
133  /// @brief The acceleration values in G's against the various axis
134  double x;
135  double y;
136  double z;
137 } _MOTION_EVENT;
138 
139 typedef enum _VREXMgr_VoiceCallType {
140  KNOCKKNOCK=1,
141  SENDSTATE=2,
142  SPEECH=3
143 }IARM_Bus_VREXMgr_VoiceCallType_t;
144 
145 
146 typedef struct {
147  unsigned char jsonData[IARM_BUS_VREXMGR_ERROR_MESSAGE_LENGTH];
148 } _JSON_EVENT;
149 
150 typedef struct {
151  unsigned char type;
152  union {
153  struct _SPEECH_BEGIN_EVENT {
154  /// @brief The mime type of the data audio/vnd.wave;codec=1 for PCM or audio/x-adpcm for ADPCM
155  /// see http://www.isi.edu/in-notes/rfc2361.txt wrt mime types
156  unsigned char mimeType[IARM_BUS_VREXMGR_SPEECH_MIME_LENGTH];
157  /// @brief The subtype (using exising definitions such as PCM_16_16K, PCM_16_32K, PCM_16_22K)
158  unsigned char subType[IARM_BUS_VREXMGR_SPEECH_SUBTYPE_LENGTH];
159  /// @brief The language code (ISO-639-1)
160  unsigned char language[IARM_BUS_VREXMGR_SPEECH_LANG_LENGTH];
161  } begin;
162 
163  struct _SPEECH_FRAGMENT_EVENT {
164  /// @brief The length of the fragment
165  unsigned long length;
166 
167  /// @brief The voice data itself
168  unsigned char fragment[IARM_BUS_VREXMGR_SPEECH_FRAGMENTLENGTH];
169  } fragment;
170 
171  struct _SPEECH_END_EVENT {
172  /// @brief The reason for ending
173  unsigned char reason;
174  } end;
175  } data;
176 } _SPEECH_EVENT;
177 
178 /*! Event Data associated with Sys Managers */
180  /// @brief A unique identifier of the remote that transmitted the motion command
181  unsigned char remoteId;
182  union {
183  _MOTION_EVENT motionEvent;
184  _SPEECH_EVENT speechEvent;
185  _JSON_EVENT jsonEvent;
186  } data;
188 
189 
190 /*! Possible Firmware Download state */
192 {
193  IARM_BUS_VREXMGR_CARD_FWDNLD_START,
194  IARM_BUS_VREXMGR_CARD_FWDNLD_COMPLETE,
196 
197 
198 
199 /*
200  * Declare RPC API names and their arguments
201  * TODO: This will be populated later code download functions
202  */
203 #define IARM_BUS_VREXMGR_API_AnnounceFirmware "AnnounceFirmware"
204 
205 #ifdef __cplusplus
206 }
207 #endif
208 
209 #endif
210 
211 /* End of IARM_BUS_VREXMGR_API doxygen group */
212 /**
213  * @}
214  */
215 
216 
217 
218 /** @} */
219 /** @} */
IARM_BUS_VREXMGR_EVENT_MAX
@ IARM_BUS_VREXMGR_EVENT_MAX
Definition: vrexMgr.h:115
_IARM_BUS_VREXMgr_EventData_t::remoteId
unsigned char remoteId
A unique identifier of the remote that transmitted the motion command.
Definition: vrexMgr.h:181
_VREXMgr_EventId_t
_VREXMgr_EventId_t
Definition: vrexMgr.h:109
IARM_Bus_VREXMgr_EventData_t
struct _IARM_BUS_VREXMgr_EventData_t IARM_Bus_VREXMgr_EventData_t
_VREXMgr_CARD_FWDNLDState_t
_VREXMgr_CARD_FWDNLDState_t
Definition: vrexMgr.h:191
_SPEECH_EVENT
Definition: vrexMgr.h:150
_MOTION_EVENT
Definition: vrexMgr.h:131
_JSON_EVENT
Definition: vrexMgr.h:146
_IARM_BUS_VREXMgr_EventData_t
Definition: vrexMgr.h:179
_MOTION_EVENT::x
double x
payload description for the Motion Event
Definition: vrexMgr.h:134
IARM_Bus_VREXMGR_FWDNLDState_t
enum _VREXMgr_CARD_FWDNLDState_t IARM_Bus_VREXMGR_FWDNLDState_t
IARM_Bus_VREXMgr_EventId_t
enum _VREXMgr_EventId_t IARM_Bus_VREXMgr_EventId_t