29 #if !defined(VREX_SESSION_H)
30 #define VREX_SESSION_H
36 #include <curl/curl.h>
38 #include <sys/socket.h>
44 #include "jsonParser.h"
51 #define DEFAULT_VREX_TIMEOUT 30
72 } AudioStreamEndReason;
78 FinishedRecordingWithResults,
79 FinishedRecordingWithErrors
87 #ifdef RF4CE_GENMSO_API
88 VREXSession(
unsigned char remoteId,
string receiverId,
int defaultConversationLength,
string route,
string aspect_ratio,
string language,
89 MSOBusAPI_RfStatus_t *rfStatus,
int bindRemotesIndex,
string stbName,
string appId=
"xr11v2-789ec072-d47e-4eac-9b5d-5f8f7a46e143");
90 #elif defined(RF4CE_API)
91 VREXSession(
unsigned char remoteId,
string receiverId,
int defaultConversationLength,
string route,
string aspect_ratio,
string language,
92 rf4ce_RfStatus_t *rfStatus,
int bindRemotesIndex,
string stbName,
string appId=
"xr11v2-789ec072-d47e-4eac-9b5d-5f8f7a46e143");
93 #elif defined(RF4CE_GPMSO_API)
94 VREXSession(
unsigned char remoteId,
string receiverId,
int defaultConversationLength,
string route,
string aspect_ratio,
string language,
95 gpMSOBusAPI_RfStatus_t *rfStatus,
int bindRemotesIndex,
string stbName,
string appId=
"xr11v2-789ec072-d47e-4eac-9b5d-5f8f7a46e143");
97 #warning "No RF4CE API defined"
104 void onStreamData(
void *src,
size_t size);
105 void onStreamEnd(AudioStreamEndReason);
106 bool sendState(SendState state);
107 void updateExpiration(
int expirationWindow);
110 void startTransferServer();
111 size_t serverSocketCallback(
void *buffer,
size_t size,
size_t nmemb);
112 void addKKResponse(
string responseData);
113 void addSpeechResponse(
string responseData);
114 void addSendStateResponse(
string responseData);
115 void changeServerDetails(
string route,
string aspect_ratio,
string language);
118 char * getRequestMetrics(CURL *curl,
char *);
119 void notifySuccess();
120 void notifyError(
long httpErrorCode ,
long curlErrorCode,
long vrexErrorCode ,
long rfErrorCode,
const char *message, IARM_Bus_VREXMgr_VoiceCallType_t from);
121 void safe_copy(
unsigned char *dst,
const char *src,
size_t len);
122 void getDynamicStbAndRemoteinfo();
124 #ifdef RF4CE_GENMSO_API
125 void getStaticStbAndRemoteinfo(MSOBusAPI_RfStatus_t *rfStatus,
int bindRemotesIndex);
126 #elif defined(RF4CE_API)
127 void getStaticStbAndRemoteinfo(rf4ce_RfStatus_t *rfStatus,
int bindRemotesIndex);
128 #elif defined(RF4CE_GPMSO_API)
129 void getStaticStbAndRemoteinfo(gpMSOBusAPI_RfStatus_t *rfStatus,
int bindRemotesIndex);
131 #warning "No RF4CE API defined"
133 string getPostFieldString();
134 string getUserAgentString();
144 string m_rf4ceMacAddress;
145 string m_remoteBatteryVoltage;
146 string m_iArmStatusKillCount;
151 string m_remoteSoftwareVersion;
152 string m_remoteHardwareVersion;
156 string m_conversationId;
160 string m_aspect_ratio;
161 string m_guideLanguage;
163 unsigned char m_remoteId;
164 int m_defaultConversationLength;
165 time_t m_conversationExpires;
168 bool m_curlInitialized;
172 string m_sendStateResponse;
173 string m_speechResponse;
175 string m_serverSocketName;
179 pthread_t m_dataReadThread;
181 pthread_cond_t m_cond;
182 pthread_mutex_t m_mutex;
185 map<string, JSONParser::varVal *> m_parameters;
186 map<string, JSONParser::varVal *> m_speechResults;
187 map<SendState, string> m_sendStates;