ECSDKAPPManager.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  1. #ifndef ECSDKAPPMANAGER_H
  2. #define ECSDKAPPMANAGER_H
  3. #include "ECSDKTypes.h"
  4. namespace ECSDKFrameWork {
  5. /**
  6. * @brief The APPManagerListener class
  7. *
  8. * You need to implement this interface to get some information about the mobile app running
  9. *
  10. */
  11. class EC_DLL_EXPORT IECAPPManagerListener
  12. {
  13. public:
  14. /**
  15. * @brief ~APPManagerListener
  16. */
  17. virtual ~IECAPPManagerListener();
  18. /**
  19. * @brief Called when EasyConnected status changed.
  20. *
  21. * @param status The changed EasyConnected message.
  22. */
  23. virtual void onECStatusMessage(ECStatusMessage status) {};
  24. /**
  25. * @brief Called when the phone app sends down HUD information.
  26. *
  27. * @param data HUD information.
  28. */
  29. virtual void onPhoneAppHUD(const ECNavigationHudInfo& data) {};
  30. /**
  31. * @brief Called when the phone app sends down HUD Road Junction Picture.
  32. * @param data
  33. */
  34. virtual void onPhoneAppHUDRoadJunctionPicture(const ECHudRoadJunctionPictureInfo& data) {};
  35. /*
  36. * @brief Called when phone app tell the music info.
  37. *
  38. * @param data The information of music.
  39. */
  40. virtual void onPhoneAppMusicInfo(const ECAppMusicInfo& data) {};
  41. /**
  42. * @brief Called when the phone app sends down some information.
  43. *
  44. * @param data Buffer of app information.
  45. *
  46. * @param length Buffer length.
  47. *
  48. * @note data is json string, the fields includes os, osVersion and ip.
  49. * Called when IECSDKListener::onSdkConnectStatus connect succeed.
  50. */
  51. virtual void onPhoneAppInfo(const string& info) {};
  52. /**
  53. * @brief Called when ECSDK wants car to do call operations(dial or hang up) via Bluetooth.
  54. *
  55. * @param type Operation type.
  56. *
  57. * @param name The person's name of corresponding number.
  58. *
  59. * @param number Phone numbers.
  60. *
  61. * @note Phone app is not able to dial or hang up automatically due to the latest system access limitation,
  62. * however, car is able to do it via Bluetooth. Therefore, ECSDK moves the call operations
  63. * to car, which can dial or hang up when this method is called.
  64. */
  65. virtual void onCallAction(ECCallType type, const string& name, const string& number) {};
  66. /**
  67. * @brief onCarCmdNotified
  68. * @param carCmd
  69. *
  70. * \note The result of speech recognition on the phone.
  71. * This interface will not return the corresponding result until you call ECSDKAudioManager::registerCarCmds
  72. */
  73. virtual void onCarCmdNotified(const ECCarCmd& carCmd) {};
  74. /**
  75. * @brief Called when phone app request the HU to start input.
  76. *
  77. * @param info relevant parameters about the input.
  78. */
  79. virtual void onInputStart(const ECInputInfo& info) {};
  80. /**
  81. * @brief Called when phone app request the HU to cancel input.
  82. */
  83. virtual void onInputCancel() {};
  84. /**
  85. * @brief Called when phone app tell the selection of input.
  86. */
  87. virtual void onInputSelection(int start, int stop) {};
  88. /**
  89. * @brief Called when phone app tell the text of input.
  90. */
  91. virtual void onInputText(const char* text) {};
  92. /**
  93. * @brief Called when phone app send the text of VR or TTS.
  94. */
  95. virtual void onVRTextReceived(const ECVRTextInfo& info) {};
  96. /**
  97. * @brief Called when phone app tell the page list.
  98. *
  99. * @param pages Array of the struct ECPageInfo.
  100. *
  101. */
  102. virtual void onPageListReceived(const vector<ECPageInfo>& pages) {};
  103. /**
  104. * @brief Called when phone app tell the icons.
  105. *
  106. * @param icons Array of the struct ECIconInfo.
  107. *
  108. */
  109. virtual void onPageIconReceived(const vector<ECIconInfo> icons) {};
  110. /**
  111. * @brief Called when phone app tell weather.
  112. *
  113. * @param data of weather information.
  114. *
  115. * @note data is a json string.
  116. */
  117. virtual void onWeatherReceived(const string& data) {};
  118. /**
  119. * @brief Called when phone app tell vr tips.
  120. *
  121. * @param data of tips information.
  122. *
  123. * @note data is a json string.
  124. */
  125. virtual void onVRTipsReceived(const string& data) {};
  126. };
  127. /**
  128. * @brief The ECSDKAppMutual class
  129. *
  130. * This module provides an interface to interact with the mobile app,
  131. * which you can use to operate the app display page, driving mode, etc
  132. */
  133. class EC_DLL_EXPORT ECSDKAPPManager
  134. {
  135. public:
  136. /**
  137. * @brief getInstance
  138. * @return
  139. */
  140. static ECSDKAPPManager* getInstance();
  141. /**
  142. * @brief initialize
  143. * @param listener
  144. * @return
  145. */
  146. virtual bool initialize(IECAPPManagerListener* listener = nullptr) = 0;
  147. /**
  148. * @brief release
  149. * @return
  150. */
  151. virtual void release() = 0;
  152. /**
  153. * @brief Stop phone navigation.
  154. *
  155. * @return ECSDK_OK on success, others on fail.
  156. *
  157. * @note ECSDKFramework suggests to use only one navigation between phone and car.
  158. * If car start navigation, use this method to stop phone
  159. * navigation, opposite to APPManagerListener::onECStatusMessage.
  160. *
  161. * @see APPManagerListener::onECStatusMessage
  162. */
  163. virtual int32_t stopPhoneNavigation() = 0;
  164. /**
  165. * @brief Open app page.
  166. *
  167. * @param page Specifying which page of app.
  168. *
  169. * @return ECSDK_OK on success, others on fail.
  170. */
  171. virtual int32_t openAppPage(ECAppPage page) = 0;
  172. /**
  173. * @brief Send car status info to phone.
  174. *
  175. * @param carStatus The status type of car.
  176. *
  177. * @param value The value of the corresponding status type.
  178. *
  179. * @return ECSDK_OK on success, others on fail.
  180. *
  181. */
  182. virtual int32_t sendCarStatus(ECCarStatusType carStatus, ECCarStatusValue value) = 0;
  183. /**
  184. * @brief upload statistics information to connected phone.
  185. *
  186. * @param key key with which the specified value is to be associated
  187. *
  188. * @param value value to be associated with the specified key
  189. *
  190. * @return ECSDK_OK on success, others on fail.
  191. *
  192. */
  193. virtual int32_t uploadStatistics(const string& key, const string& value) = 0;
  194. /**
  195. * @brief Enable downloading phone navigation HUD information.
  196. *
  197. * @param supportFunction APP HUD support function, @see ECAPPHUDSupportFunction
  198. *
  199. * @return ECSDK_OK on success, others on fail.
  200. *
  201. * @note If car wants to display HUD information in its screen, it can ask phone app to send down
  202. * HUD information.
  203. *
  204. * @see APPManagerListener::onPhoneAppHUD
  205. */
  206. virtual int32_t enableDownloadPhoneAppHud(uint32_t supportFunction = 0) = 0;
  207. /**
  208. * @brief Disable downloading phone navigation HUD. Opposite to enableDownloadPhoneAppHud.
  209. *
  210. * @see enableDownloadPhoneAppAudio
  211. */
  212. virtual void disableDownloadPhoneAppHud() = 0;
  213. /**
  214. * @brief Send car's blue tooth information to connected phone.
  215. *
  216. * @param name The name of car's bluetooth.
  217. *
  218. * @param adddress The adddress of car's bluetooth.
  219. *
  220. * @param pin The pin code of car's bluetooth.
  221. *
  222. * @return ECSDK_OK on success, others on fail.
  223. *
  224. */
  225. virtual int32_t sendCarBluetooth(const string& name, const string& adddress, const string& pin) = 0;
  226. /**
  227. * @brief Set bluetooth mac address of car and connected phone. .
  228. *
  229. * @param carBtMac Bluetooth mac address of car.
  230. *
  231. * @param phoneBtMac Bluetooth mac address of phone.
  232. *
  233. * @return ECSDK_OK on success, others on fail.
  234. *
  235. * @note This interface shall be called only when car was connected to phone via bluetooth.
  236. * THIS IS A RESERVED METHOD. PLEASE IGNORE IT NOW.
  237. */
  238. virtual int32_t setConnectedBTAddress(const string& carBtMac, const string& phoneBtMac) = 0;
  239. /**
  240. * @brief Stop phone voice recognition(VR).
  241. *
  242. * @return ECSDK_OK on success, others on fail.
  243. *
  244. */
  245. virtual int32_t stopPhoneVR() = 0;
  246. /**
  247. * @brief This method make phone app play the tts audio of car's text.
  248. *
  249. * @param text The text of tts.
  250. *
  251. * @param level The priority of tts, the value will be from 1 to 10, bigger value means higher priority
  252. *
  253. * @return ECSDK_OK on success, others on fail.
  254. *
  255. * @note This method will send the text to connected phone, then the tts audio of specified text will be played.
  256. */
  257. virtual int32_t playCarTTS(const string& text, uint32_t level) = 0;
  258. /**
  259. * @brief Specifying commands to identify by VR.
  260. *
  261. * @param carCmds The command array.
  262. *
  263. *
  264. * @return ECSDK_OK on success, others on fail.
  265. *
  266. * @note This method specify which commands can be identified by VR.
  267. * Then IECAudioManagerListener::onCarCmdNotified would be trigggered if a
  268. * voice control command was recognized by VR.
  269. */
  270. virtual int32_t registerCarCmds(const vector<ECCarCmd>& cmdList, ECCarCmdEFFECTType type = EC_CAR_CMD_TYPE_EFFECTIVE_GLOBAL) = 0;
  271. /**
  272. * @brief This method will register a series similary sounding words to phone's app.
  273. *
  274. * @param data string.
  275. *
  276. * @return ECSDK_OK on success, others on fail.
  277. */
  278. virtual int32_t registerSimilarSoundingWords(const string& data) = 0;
  279. /**
  280. * @brief This method send the text of HU's input to phone app.
  281. *
  282. * @param text The text of input
  283. *
  284. * @return ECSDK_OK on success, others on fail.
  285. *
  286. * @note This method will send the text to connected phone.
  287. */
  288. virtual int32_t sendInputText(const string& text) = 0;
  289. /**
  290. * @brief This method send the action of HU's input to phone app.
  291. *
  292. * @param actionId The action of input
  293. *
  294. * @param keyCode The keyCode of input
  295. *
  296. * @return ECSDK_OK on success, others on fail.
  297. *
  298. * @note This method will send the action and keyCode to connected phone.
  299. */
  300. virtual int32_t sendInputAction(int32_t actionId, int32_t keyCode) = 0;
  301. /**
  302. * @brief This method send the selection of HU's input to phone app.
  303. *
  304. * @param start The start index of the selection.
  305. *
  306. * @param stop The stop index of the selection.
  307. *
  308. * @return ECSDK_OK on success, others on fail.
  309. *
  310. * @note This method will send the selection to connected phone.
  311. */
  312. virtual int32_t sendInputSelection(int32_t start, int32_t stop) = 0;
  313. /**
  314. * @brief This method will query the page list from connected phone's app.
  315. * IECAPPManagerListener::onPageListReceived will tell the result of the query.
  316. *
  317. * @return ECSDK_OK on success, others on fail.
  318. */
  319. virtual int32_t queryPageList() = 0;
  320. /**
  321. * @brief This method will query the icons of specified pages from connected phone's app.
  322. * IECAPPManagerListener::onPageIconReceived will tell the result of the query.
  323. *
  324. * @param pages Array of the specified pages.
  325. *
  326. * @return ECSDK_OK on success, others on fail.
  327. */
  328. virtual int32_t queryPageIcon(const vector<int32_t>& pages) = 0;
  329. /**
  330. * @brief This method will query weather via the connected phone's app.
  331. * IECAPPManagerListener::onWeatherReceived will tell the result of the query.
  332. *
  333. * @return ECSDK_OK on success, others on fail.
  334. */
  335. virtual int32_t queryWeather() = 0;
  336. /**
  337. * @brief This method will query vr tips via the connected phone's app.
  338. * IECAPPManagerListener::onVRTipsReceived will tell the result of the query.
  339. *
  340. * @return ECSDK_OK on success, others on fail.
  341. */
  342. virtual int32_t queryVRTips() = 0;
  343. /**
  344. * @brief This method will upload gps information to connected phone's app.
  345. * IECAPPManagerListener::onECStatusMessage with status EC_STATUS_MESSAGE_ENABLE_UPLOAD_GPS_INFO
  346. * and EC_STATUS_MESSAGE_DISABLE_UPLOAD_GPS_INFO will enable and disable the upload of gps infomation.
  347. *
  348. * @return ECSDK_OK on success, others on fail.
  349. */
  350. virtual int32_t uploadGPSInfo(const string& data) = 0;
  351. /**
  352. * @brief Upload car's night mode status to phone.
  353. *
  354. * @param isNightModeOn Whether or not night mode is turned on.
  355. *
  356. * @return ECSDK_OK on success, others on fail.
  357. */
  358. virtual int32_t uploadNightModeStatus(bool isNightModeOn) = 0;
  359. protected:
  360. ECSDKAPPManager();
  361. virtual ~ECSDKAPPManager();
  362. };
  363. }
  364. #endif // ECSDKAPPMANAGER_H