ECSDK.h 45 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319
  1. /*****************************************************************
  2. * Project ECSDK.
  3. * (c) copyright 2017-2020.
  4. * Company Carbit.
  5. * All rights reserved. Copy without permission
  6. ****************************************************************/
  7. ///\file ECSDK.h
  8. #ifndef CARBIT_EC_SDK_H
  9. #define CARBIT_EC_SDK_H
  10. #include <stdint.h>
  11. #include "ECTypes.h"
  12. #ifdef PLATFORM_WIN32
  13. #ifdef ECLIBRARY_EXPORTS
  14. #define DLL_EXPORT _declspec(dllexport)
  15. #else
  16. #define DLL_EXPORT _declspec(dllexport)
  17. #endif
  18. #else // !PLATFORM_WIN32
  19. #define DLL_EXPORT
  20. #endif
  21. namespace CarbitECSDK
  22. {
  23. /**
  24. * @class IECCallback
  25. *
  26. * @brief ECSDK's callback interface.
  27. * Use needs to implement this interface to receive callbacks from ECSDK.
  28. * Its instance is used to initialize ECSDK. After initialization,
  29. * the instance will get notification message or receive data from ECSDK.
  30. *
  31. * @note DO NOT call any ECSDK's methods in IECCallback's callback stack
  32. * except onMirrorVideoReceived. otherwise, user may get threads dead lock.
  33. *
  34. * @see ECSDK::initialize
  35. */
  36. class DLL_EXPORT IECCallback
  37. {
  38. public:
  39. virtual ~IECCallback();
  40. /**
  41. * @brief Called when a phone is connected to ECSDK via USB cable or WiFi.
  42. *
  43. * @param type Tells by which transport the phone is connected to ECSDK.
  44. * It's used to open corresponding transport.
  45. *
  46. * @see ECSDK::openTransport
  47. */
  48. virtual void onPhoneConnected(ECTransportType type) = 0;
  49. /**
  50. * @brief Called when a phone is disconnected.
  51. */
  52. virtual void onPhoneDisconnected() = 0;
  53. /**
  54. * @brief Called when EasyConnected status changed.
  55. *
  56. * @param status The changed EasyConnected message.
  57. */
  58. virtual void onECStatusMessage(ECStatusMessage status) = 0;
  59. /**
  60. * @brief Called when the phone app sends down HUD information.
  61. *
  62. * @param data HUD information.
  63. */
  64. virtual void onPhoneAppHUD(const ECNavigationHudInfo& data) = 0;
  65. /*
  66. * @brief Called when phone app tell the music info.
  67. *
  68. * @param data The information of music.
  69. */
  70. virtual void onPhoneAppMusicInfo(const ECAppMusicInfo& data) {};
  71. /**
  72. * @brief Called when the phone app start to send down audio data.
  73. *
  74. * @param type Audio type, TTS, VR, IM or music.
  75. *
  76. * @param info Audio information.
  77. *
  78. * @note Car needs to initialize audio player when this method is triggered.
  79. * There may be multiple audio types started. That means phone may
  80. * send down TTS and music at the same time.
  81. */
  82. virtual void onPhoneAudioStart(ECAudioType type, const ECAudioInfo& info) = 0;
  83. /**
  84. * @brief Called when the phone app sends down audio data. Audio data is raw PCM.
  85. *
  86. * @param type Audio type, TTS, VR, IM or music.
  87. *
  88. * @param data Buffer of audio data.
  89. *
  90. * @param length Buffer length.
  91. *
  92. * @note ECSDK manages an audio data queue thread for each audio type and
  93. * this method is call in corresponding thread. So, car needs to play
  94. * audio data in this method's call stack. Car should neither try play data
  95. * in another thread nor try to cache audio data(in a queue).
  96. */
  97. virtual void onPhoneAudioData(ECAudioType type, const void *data, uint32_t length) = 0;
  98. /**
  99. * @brief Called when the phone app asks car to set audio volume for corresponding audio type.
  100. *
  101. * @param type Audio type, TTS, VR, IM or music.
  102. *
  103. * @param volume Volume value, range[0, 100]. 0 means mute and 100 means the max volume.
  104. *
  105. * @note This method is called when the phone app wants to do sound mixing for multiple audio type.
  106. */
  107. virtual void onPhoneAudioSetVolume(ECAudioType type, uint32_t volume) = 0;
  108. /**
  109. * @brief Called when the phone app stops to send down audio data.
  110. *
  111. * @param type Audio type, TTS, VR, IM or music.
  112. */
  113. virtual void onPhoneAudioStop(ECAudioType type) = 0;
  114. /**
  115. * @brief Called when the phone app interrupts audio play.
  116. *
  117. * @param type Audio type, TTS, VR, IM or music.
  118. */
  119. virtual void onPhoneAudioInterrupt(ECAudioType type) = 0;
  120. /**
  121. * @brief Called when the phone app asks car to start to record audio via its microphone.
  122. *
  123. * @param info Audio info that the phone app wants.
  124. *
  125. * @return EC_OK if car is able to record audio with the specified audio info.
  126. * Otherwise, return EC_ERR_OP_FAIL.
  127. *
  128. * @note If car does not have a microphone or want to upload any audio data to the phone app,
  129. * it can set micType(in structure ECCarDescription) to EC_MIC_TYPE_PHONE when call
  130. * ECSDK::initialize, then the phone app never calls this method. If set micType to
  131. * EC_MIC_TYPE_NATIVE, the phone app will call this method whenever it needs audio data.
  132. * After this method is invoked, car can upload recorded audio data to phone app via
  133. * ECSDK::uploadAudioData.
  134. *
  135. * @see ECSDK::initialize, ECSDK::uploadAudioData, ECCarDescription
  136. */
  137. virtual int32_t onStartCarMicRecord(const ECAudioInfo& info) = 0;
  138. /**
  139. * @brief Called when the phone app asks car to stop recording audio.
  140. */
  141. virtual void onStopCarMicRecord() = 0;
  142. /**
  143. * @brief Called when the phone app sends down some information.
  144. *
  145. * @param data Buffer of app information.
  146. *
  147. * @param length Buffer length.
  148. *
  149. * @note data is json string, the fields includes os, osVersion and ip.
  150. * Called when ECSDK::openTransport succeed.
  151. */
  152. virtual void onPhoneAppInfo(const void *data, uint32_t length) = 0;
  153. /**
  154. * @brief Called when ECSDK wants car to do call operations(dial or hang up) via Bluetooth.
  155. *
  156. * @param type Operation type.
  157. *
  158. * @param name The person's name of corresponding number.
  159. *
  160. * @param number Phone numbers.
  161. *
  162. * @note Phone app is not able to dial or hang up automatically due to the latest system access limitation,
  163. * however, car is able to do it via Bluetooth. Therefore, ECSDK moves the call operations
  164. * to car, which can dial or hang up when this method is called.
  165. */
  166. virtual void onCallAction(ECCallType type, const char* name, const char* number) = 0;
  167. /**
  168. * @brief Called when a frame of mirror video data is received.
  169. *
  170. * @param data Buffer of the frame.
  171. *
  172. * @param length Buffer length.
  173. *
  174. * @param videoInfo detail info of video
  175. *
  176. * @note The mirror data format is set by "openMirrorConnection". When receives a frame,
  177. * car can decode and render the frame. ECSDK would not acquire the next frame from
  178. * phone until this method returned, so if car's decoding and rendering is low performance,
  179. * suggest car to apply frame cache strategy instead of handling the frame in current
  180. * callback thread.
  181. *
  182. * @see ECSDK::openMirrorConnection
  183. */
  184. virtual void onMirrorVideoReceived(const void *data, uint32_t length, const ECVideoInfo& videoInfo) = 0;
  185. /**
  186. *
  187. * @deprecated use onMirrorVideoReceived instead
  188. *
  189. * @brief Called when a Mirror width/height or rotation changed which android Mirror connected with AOA .
  190. *
  191. * @param mirrorWidth real mirror width encode by phone.
  192. *
  193. * @param mirrorHeight real mirror height encode by phone.
  194. *
  195. * @param rotation the phone rotation.
  196. *
  197. * @note The API is used to notify the UI,they can do something with HMI. It is different with
  198. * openMirrorConnection,which returned MirrorWidth/MirrorHeight is fill with the black area and
  199. * rotate by encoder.for example,the car(1024x600) called openMirrorConnection required a mirror
  200. * data,then phone returned a mirror width 1024x592,in stead of the onMirrorVideoInfoChanged returned a mirror
  201. * info with width=270 height=585,rotation=0.
  202. *
  203. *
  204. * @see ECSDK::openMirrorConnection
  205. */
  206. virtual void onMirrorVideoInfoChanged(int mirrorWidth,int mirrorHeight, int rotation){};
  207. /**
  208. * @brief Called when bulk data is received(RESERVED).
  209. *
  210. * @param data Buffer of bulk data.
  211. *
  212. * @param length Buffer length.
  213. *
  214. * @note THIS IS A RESERVED METHOD. PLEASE IGNORE IT NOW.
  215. */
  216. virtual void onBulkDataReceived(const void *data, uint32_t length) = 0;
  217. /**
  218. * @brief Called when mirror connection disconnected.
  219. *
  220. * @note This method is usually called when the phone app was killed by system or an error happened.
  221. * After this method is called, car should close the mirror connection and try to ask user to
  222. * launch app again. After that, car can open mirror connection again.
  223. * "onPhoneDisconnected" will not trigger this method.
  224. *
  225. * @see ECSDK::openMirrorConnection, ECSDK::closeMirrorConnection
  226. */
  227. virtual void onMirrorDisconnected() = 0;
  228. /**
  229. * @brief Called when current mirror connect was closed, then mirror reconnect was requested.
  230. *
  231. * @note the mirror should be reconnected by ECSDK::startMirror.
  232. */
  233. virtual void onMirrorRequestReconnect(){};
  234. /**
  235. * @brief Called when the transport was stopped by user. The phone app has a button
  236. * that can manually stop current connection.
  237. */
  238. virtual void onTransportStopedByApp() = 0;
  239. /**
  240. * @brief Called when the license authorization failed. After this interface was called,
  241. * all connections would be forced closed.
  242. *
  243. * @param errCode Error code.
  244. *
  245. * @param errMsg Error message.
  246. */
  247. virtual void onLicenseAuthFail(int32_t errCode, const char* errMsg) = 0;
  248. /**
  249. * @brief Called when the license authorization succeed.
  250. *
  251. * @param code success code. The code can gain specific meaning by ECAuthSuccessCode.
  252. *
  253. * @param msg success information.
  254. *
  255. * @param msg the description information.
  256. *
  257. */
  258. virtual void onLicenseAuthSuccess(int code, const char* msg) = 0;
  259. /**
  260. * @brief Called when the phone app exit. Maybe killed by system.
  261. */
  262. virtual void onPhoneAppExited() = 0;
  263. /**
  264. * @brief Called when registered command was triggered by VR.
  265. *
  266. * @param carCmd The triggered command.
  267. *
  268. * @note Voice control can be implemented with this method by VR.
  269. *
  270. * @see ECSDK::registerCarCmds
  271. */
  272. virtual void onCarCmdNotified(const ECCarCmd& carCmd) = 0;
  273. /*
  274. * @brief Called when checkOTAUpdate was called, it will tell the result of checkOTAUpdate.
  275. *
  276. * @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloadable software.
  277. *
  278. * @param downloadableLength The length of the downloadable array, if downloadableLength < 0, means network of the HU is unavailable.
  279. *
  280. * @param downloadedSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloaded software.
  281. *
  282. * @param downloadedLength The length of the downloaded array.
  283. */
  284. virtual void onOTAUpdateCheckResult(const ECOTAUpdateSoftware* downloadableSoftwares, int32_t downloadableLength, const ECOTAUpdateSoftware* downloadedSoftwares, uint32_t downloadedLength) {};
  285. /**
  286. * @brief Called when startOTAUpdate is called, it will notify the progress of downloading.
  287. *
  288. * @param downloadingSoftwareId The id of the downloading software.
  289. *
  290. * @param progress The progress of the downloading software,which is a percentage.
  291. *
  292. * @param softwareLeftTime The left time of the downloading software.
  293. *
  294. * @param otaLeftTime The left time of all the specified software by startOTAUpdate.
  295. */
  296. virtual void onOTAUpdateProgress(const char* downloadingSoftwareId, float progress, uint32_t softwareLeftTime, uint32_t otaLeftTime) {};
  297. /**
  298. * @brief Called when startOTAUpdate is called, it will notify software is downloaded.
  299. *
  300. * @param downloadedSoftwareId The id of the downloaded software.
  301. *
  302. * @param md5Path The md5 file path.
  303. *
  304. * @param packagePath The software path.
  305. *
  306. * @param iconPath The icon path.
  307. *
  308. * @param leftSoftwareNum The amount of software remaining to be downloaded.
  309. */
  310. virtual void onOTAUpdateCompleted(const char* downloadedSoftwareId, const char* md5Path, const char* packagePath, const char* iconPath, uint32_t leftSoftwareNum) {};
  311. /*
  312. * @brief Called when checkOTAUpdate or startOTAUpdate failed.
  313. *
  314. * @param errCode error code, see ECOTAUpdateErrorCode.
  315. *
  316. * @param softwarId the id of software.
  317. */
  318. virtual void onOTAUpdateError(int32_t errCode, const char* softwareId) {};
  319. /**
  320. * @brief Called when phone app request the HU to start input.
  321. *
  322. * @param info relevant parameters about the input.
  323. */
  324. virtual void onInputStart(const ECInputInfo& info) {};
  325. /**
  326. * @brief Called when phone app request the HU to cancel input.
  327. */
  328. virtual void onInputCancel() {};
  329. /**
  330. * @brief Called when phone app tell the selection of input.
  331. */
  332. virtual void onInputSelection(int start, int stop) {};
  333. };
  334. /**
  335. * @class IECAccessDevice
  336. *
  337. * @brief An interface class to implement special usb device access.
  338. */
  339. class DLL_EXPORT IECAccessDevice
  340. {
  341. public:
  342. virtual ~IECAccessDevice();
  343. /**
  344. * @brief Open usb device.
  345. *
  346. * @return Zero on success, others on fail.
  347. */
  348. virtual int32_t open() = 0;
  349. /**
  350. * @brief Read data from usb devices.
  351. *
  352. * @param data Read buffer.
  353. *
  354. * @param length Read size.
  355. *
  356. * @return The size of data read in bytes, zero if currently no read data available, or negative number on fail.
  357. */
  358. virtual int32_t read(void *data, uint32_t length) = 0;
  359. /**
  360. * @brief Write data into usb devices.
  361. *
  362. * @param data Write buffer.
  363. *
  364. * @param length Write size.
  365. *
  366. * @return The size of data written in bytes, negative number on fail.
  367. */
  368. virtual int32_t write(void *data, uint32_t length) = 0;
  369. /**
  370. * @brief Close usb device. Opposite to open.
  371. *
  372. * @see open
  373. */
  374. virtual void close() = 0;
  375. };
  376. /**
  377. * @class ECSDK
  378. *
  379. * @brief The main class providing all ECSDK methods.
  380. *
  381. * @note Most methods of class ECSDK return an int value. The returned value is named as
  382. * EC_OK or other EC_ERR_* macros(defined in class @link ECTypes.h).
  383. */
  384. class DLL_EXPORT ECSDK
  385. {
  386. public:
  387. /**
  388. * @brief Get the singleton instance of class ECSDK.
  389. *
  390. * @return Pointer of ECSDK instance.
  391. *
  392. * @note User is NOT allowed to construct ECSDK object.
  393. */
  394. static ECSDK* getInstance();
  395. /**
  396. * @brief Get the ECSDK version.
  397. *
  398. * @return The ECSDK version in string format, etc. "1.0.0".
  399. */
  400. virtual const char* getVersion() = 0;
  401. /**
  402. * @brief Get the version code of ECSDK.
  403. *
  404. * @return The version code of ECSDK.
  405. */
  406. virtual uint64_t getVersionCode() = 0;
  407. /**
  408. * @brief Initialize ECSDK environment.
  409. * After ECSDK was initialized, user can wait until IECCallback::onPhoneConnected
  410. * is invoked and then start to use other ECSDK methods to communicate with the
  411. * connected phone. ECSDK supports finding an connected phone(Android or iOS)
  412. * via USB cable and WiFi.
  413. *
  414. * @param authentication ECSDK authentication.
  415. *
  416. * @param carDesc Car description.
  417. *
  418. * @param options Initialization options.
  419. *
  420. * @param listener Pointer of IECCallback instance.
  421. *
  422. * @return EC_OK on success, others on fail.
  423. *
  424. * @see IECCallback
  425. */
  426. virtual int32_t initialize(const ECAuthentication& authentication, const ECCarDescription& carDesc, const ECOptions& options, IECCallback *listener) = 0;
  427. /**
  428. * @brief Release all ECSDK resources. Opposite to ECSDK::initialize.
  429. */
  430. virtual void release() = 0;
  431. /**
  432. * @brief set log information.
  433. *
  434. * @param level log level.Default is EC_LOG_LEVEL_INFO.
  435. *
  436. * @param type the type of log output.Default is EC_LOG_OUT_STD.
  437. *
  438. * @param logDirectory absolute path of log out when type is EC_LOG_OUT_FILE.default directory is "/tmp/",and logfile is "/tmp/ECSDK_H_M_S.log"
  439. *
  440. * @param module specify output log module.Default is EC_LOG_MODULE_SDK.Yout can do like this EC_LOG_MODULE_SDK|EC_LOG_MODULE_APP.
  441. */
  442. virtual void setLogInfo(const ECLogLevel level,const ECLogOutputType type,const char*logDirectory,int module=EC_LOG_MODULE_SDK) = 0;
  443. /**
  444. * @brief Open WIFI service to find a phone IP in local WIFI network. Use WIFI service only when car supports WIFI.
  445. * If find a phone, IECCallback::onPhoneConnected will be triggered with transport
  446. * type=EC_TRANSPORT_ANDROID_WIFI or EC_TRANSPORT_IOS_WIFI.
  447. *
  448. * @return EC_OK on success, others on fail.
  449. *
  450. */
  451. virtual int32_t openWiFiService() = 0;
  452. /**
  453. * @brief Close WIFI service. Opposite to openWiFiService.
  454. */
  455. virtual void closeWiFiService() = 0;
  456. virtual int32_t openNetLinkService() = 0;
  457. virtual void closeNetLinkService() = 0;
  458. /**
  459. * @brief Bind the transport with a special USB device.
  460. * After binding, ECSDK can access the device via the provided IECAccessDevice.
  461. * Once the transport is bound successfully, IECCallback::onPhoneConnected will be invoked.
  462. *
  463. * @param type The transport to be bound.
  464. *
  465. * @param dev The device access methods, see IECAccessDevice.
  466. *
  467. * @return EC_OK on success, others on fail.
  468. *
  469. * @note Only platform-dependent transport(i.e EAP) needs to bind a USB device.
  470. */
  471. virtual int32_t bindTransportDevice(ECTransportType type, IECAccessDevice *dev) = 0;
  472. /**
  473. * @brief Unbind USB device for the given transport. Opposite to bindTransportDevice.
  474. *
  475. * @param type The transport to be unbound.
  476. *
  477. * @see ECSDK::bindTransportDevice
  478. */
  479. virtual void unbindTransportDevice(ECTransportType type) = 0;
  480. /**
  481. * @brief Set specified phone ip.
  482. * This method gives chance to directly connect to the specified phone via wifi.
  483. *
  484. * @param ip The specified ip address.
  485. *
  486. * @return EC_OK on success, others on fail.
  487. *
  488. * @note This method would fail if ECSDK::openTransport has been successfully called.
  489. * IECCallback::onPhoneAppInfo can tell discovered phone info include ip.
  490. */
  491. virtual int32_t setWirelessDirectConnectPhoneIp(const char* ip) = 0;
  492. /**
  493. * @brief Open specified transport.
  494. * Please call this method after IECCallback::onPhoneConnected is invoked,
  495. * which tells the transport type. Only after the transport was successfully opened,
  496. * user can start to use mirror and other methods.
  497. *
  498. * @param type Transport type.
  499. *
  500. * @return EC_OK on success, others on fail.
  501. * EC_ERR_APP_NOT_STARTED if the phone app is not started or installed,
  502. * needs to guide user to install and start the app.
  503. * EC_ERR_APP_AUTH_PENDING if authorization is pending, needs to guide user to approve it.
  504. *
  505. * @see IECCallback::onPhoneConnected
  506. *
  507. * @note DO NOT call this method in IECCallback::onPhoneConnected call stack. User should
  508. * call this method in his/her own thread.
  509. */
  510. virtual int32_t openTransport(ECTransportType type) = 0;
  511. /**
  512. * @brief Close transport. Opposite to openTransport.
  513. *
  514. * @see ECSDK::openTransport
  515. */
  516. virtual void closeTransport() = 0;
  517. /**
  518. * @brief Open mirror connection.
  519. *
  520. * @param config Mirror configurations.
  521. *
  522. * @param[out] mirrorWidth Returned mirror width.
  523. *
  524. * @param[out] mirrorHeight Returned mirror height.
  525. *
  526. * @return EC_OK on success, others on fail. Returning EC_ERR_APP_AUTH_FAIL means the authorization failed.
  527. *
  528. * @note The eventual output mirror size is {mirrorWidth} x {mirrorHeight}(in pixels), which is equal to
  529. * or litter than the configured width and height. Please use the returned size to
  530. * initialize video decoder and render window.
  531. */
  532. virtual int32_t openMirrorConnection(const ECMirrorConfig& config, uint32_t& mirrorWidth, uint32_t& mirrorHeight) = 0;
  533. /**
  534. * @brief Start mirror transmission.
  535. *
  536. * @return EC_OK on success, others on fail. Returning EC_ERR_APP_AUTH_FAIL means user needs to allow phone app to capture screen and
  537. * returning EC_ERR_APP_AUTH_PENDING means waiting for the user to allow phone app to capture screen.
  538. *
  539. * @note After started mirror, car would receive mirror data via IECCallback::onMirrorVideoReceived.
  540. *
  541. * @see IECCallback::onMirrorVideoReceived
  542. */
  543. virtual int32_t startMirror() = 0;
  544. /**
  545. * @brief Pause mirror transmission.
  546. *
  547. * @return EC_OK on success, others on fail.
  548. *
  549. * @note After paused, car would not receive mirror data until mirror resumed.
  550. *
  551. * @see ECSDK::resumeMirror
  552. */
  553. virtual int32_t pauseMirror() = 0;
  554. /**
  555. * @brief Resume mirror transmission. Opposite to pauseMirror.
  556. *
  557. * @return EC_OK on success, others on fail.
  558. *
  559. * @see ECSDK::pauseMirror
  560. */
  561. virtual int32_t resumeMirror() = 0;
  562. /**
  563. * @brief Stop mirror transmission. Opposite to startMirror.
  564. *
  565. * @return EC_OK on success, others on fail.
  566. *
  567. * @note After stopped, ECSDK would not receive mirror data any more.
  568. *
  569. * @see ECSDK::startMirror
  570. */
  571. virtual void stopMirror() = 0;
  572. /**
  573. * @brief Send key event to phone.
  574. *
  575. * @param key Key code.
  576. *
  577. * @return EC_OK on success, others on fail.
  578. *
  579. * @note Whether or not the key is supported depends on the phone system.
  580. * Key event does NOT work without mirror connection.
  581. */
  582. virtual int32_t sendSystemKeyEvent(ECSystemKeyCode key) = 0;
  583. /**
  584. * @brief Send touch event to phone.
  585. *
  586. * @param touch Touch parameters.
  587. *
  588. * @param type Touch type.
  589. *
  590. * @return EC_OK on success, others on fail.
  591. *
  592. * @note Touch event does NOT work without mirror connection.
  593. */
  594. virtual int32_t sendTouchEvent(const ECTouchEventData& touch, ECTouchEventType type) = 0;
  595. /**
  596. * @brief Close mirror connection. Opposite to openMirrorConnection.
  597. */
  598. virtual void closeMirrorConnection() = 0;
  599. /**
  600. * @brief when you press button on steering wheel, send corresponding button event to phone.
  601. *
  602. * @param btnCode key code of the Button .
  603. *
  604. * @param type Event type.
  605. *
  606. * @return EC_OK on success, others on fail.
  607. *
  608. * @note Button event does NOT work without phone app.
  609. */
  610. virtual int32_t sendBtnEvent(ECBtnCode btnCode, ECBtnEventType type) = 0;
  611. /**
  612. * @brief send button code to phone.
  613. *
  614. * @param btnCode key code of the Button .
  615. *
  616. * @param type Event type.
  617. *
  618. * @param channel Which can specify the namespace of the code. Zero means standard, others means custom.
  619. * When channel is zero, the value of channel can refer to ECBtnCode.
  620. *
  621. * @return EC_OK on success, others on fail.
  622. *
  623. * @note Button event does NOT work without phone app.
  624. */
  625. virtual int32_t sendBtnEvent(int32_t btnCode, ECBtnEventType type, int32_t channel) = 0;
  626. /**
  627. * @brief Stop phone navigation.
  628. *
  629. * @return EC_OK on success, others on fail.
  630. *
  631. * @note ECSDK suggests to use only one navigation between phone and car.
  632. * If car start navigation, use this method to stop phone
  633. * navigation, opposite to IECCallback::onECStatusMessage.
  634. *
  635. * @see IECCallback::onECStatusMessage
  636. */
  637. virtual int32_t stopPhoneNavigation() = 0;
  638. /**
  639. * @brief Stop phone voice recognition(VR).
  640. *
  641. * @return EC_OK on success, others on fail.
  642. *
  643. */
  644. virtual int32_t stopPhoneVR() = 0;
  645. /**
  646. * @brief Upload car's audio data to phone. Audio is recorded by car microphone.
  647. *
  648. * @param data Buffer of audio data.
  649. *
  650. * @param length Buffer length.
  651. *
  652. * @return EC_OK on success, others on fail.
  653. */
  654. virtual int32_t uploadAudioData(const void *data, int32_t length) = 0;
  655. /**
  656. * @brief Upload GPS location to phone.
  657. *
  658. * @param timestamp The timestamp(nanosecond) of this location.
  659. *
  660. * @param latitude Latitude value. Range is [-90.0,+90.0].
  661. *
  662. * @param longitude Longitude value. Range is [-180.0,+180.0].
  663. *
  664. * @param accuracy Horizontal 68% radius meters value.
  665. *
  666. * @param altitude Altitude value.
  667. *
  668. * @param speed Car speed(m/s).
  669. *
  670. * @param bearing Car bearing. Range is [0, 360).
  671. *
  672. * @return EC_OK on success, others on fail.
  673. *
  674. * @note Uploading frequency can be consistent with GPS hardware.
  675. */
  676. virtual int32_t uploadLocation(uint64_t timestamp, float latitude, float longitude, float accuracy, float altitude, float speed, float bearing) = 0;
  677. /**
  678. * @brief Upload car's orientation to phone.
  679. *
  680. * @param bearing The compass bearing degree of car. Range is [0, 360).
  681. *
  682. * @param pitch The pitch degree of car. Range is [-90, 90].
  683. *
  684. * @param roll The roll degree of car. Range is [-90, 90].
  685. *
  686. * @return EC_OK on success, others on fail.
  687. */
  688. virtual int32_t uploadCompassBearing(float bearing, float pitch, float roll) = 0;
  689. /**
  690. * @brief Upload car's speed information to phone.
  691. *
  692. * @param speed Vehicle speed(m/s). Negative value when moving in reverse.
  693. *
  694. * @param cruiseEnabled Whether or not cruise control is enabled. True when cruise control is enabled.
  695. *
  696. * @param cruiseSetSpeed The speed(m/s) of the cruise control. Valid when cruiseEnabled is true.
  697. *
  698. * @return EC_OK on success, others on fail.
  699. */
  700. virtual int32_t uploadVehicleSpeed(float speed, bool cruiseEnabled, float cruiseSetSpeed) = 0;
  701. /**
  702. * @brief Upload car's rotational speed to phone.
  703. *
  704. * @param rpm Vehicle RPM in rad/sec.
  705. *
  706. * @return EC_OK on success, others on fail.
  707. */
  708. virtual int32_t uploadEngineRpm(float rpm) = 0;
  709. /**
  710. * @brief Upload car's odometer to phone.
  711. *
  712. * @param odometer The odometer value.
  713. *
  714. * @param tripKms Distance traveled since ignition was turned on in km.
  715. *
  716. * @return EC_OK on success, others on fail.
  717. */
  718. virtual int32_t uploadOdometer(float odometer, int32_t tripKms) = 0;
  719. /**
  720. * @brief Upload car's fuel information to phone.
  721. *
  722. * @param remainFuelPercent The remaining fuel in percent values.
  723. *
  724. * @param range The estimated remaining range in km for the current amount of fuel.
  725. *
  726. * @param enableFuelWarning Whether or not enable low fuel warning.
  727. *
  728. * @return EC_OK on success, others on fail.
  729. */
  730. virtual int32_t uploadFuelStatus(float remainFuelPercent, int32_t range, bool enableFuelWarning) = 0;
  731. /**
  732. * @brief Upload car's parking brake status to phone.
  733. *
  734. * @param isBrakeOn Whether or not the parking brake is on.
  735. *
  736. * @return EC_OK on success, others on fail.
  737. */
  738. virtual int32_t uploadParkingBrakeStatus(bool isBrakeOn) = 0;
  739. /**
  740. * @brief Upload car's gear status to phone.
  741. *
  742. * @param gear Gear type.
  743. *
  744. * @return EC_OK on success, others on fail.
  745. */
  746. virtual int32_t uploadGearStatus(ECGearType gear) = 0;
  747. /**
  748. * @brief Upload car's night mode status to phone.
  749. *
  750. * @param isNightModeOn Whether or not night mode is turned on.
  751. *
  752. * @return EC_OK on success, others on fail.
  753. */
  754. virtual int32_t uploadNightModeStatus(bool isNightModeOn) = 0;
  755. /**
  756. * @brief Upload car's external environment status to phone.
  757. *
  758. * @param temperature The temperature in Celsius.
  759. *
  760. * @param pressure Pressure value.
  761. *
  762. * @param rain The rain detection level. 0 means no rain.
  763. *
  764. * @return EC_OK on success, others on fail.
  765. */
  766. virtual int32_t uploadEnvironmentStatus(float temperature, float pressure, int32_t rain) = 0;
  767. /**
  768. * @brief Upload car's driving status to phone.
  769. *
  770. * @param status Driving status.
  771. *
  772. * @return EC_OK on success, others on fail.
  773. */
  774. virtual int32_t uploadDrivingStatus(ECDrivingStatus status) = 0;
  775. /**
  776. * @brief Upload car's passenger presence status to phone.
  777. *
  778. * @param present True if a passenger is present, false otherwise.
  779. *
  780. * @return EC_OK on success, others on fail.
  781. */
  782. virtual int32_t uploadPassengerStatus(bool present) = 0;
  783. /**
  784. * @brief Upload car's doors status to phone.
  785. *
  786. * @param hoodOpen True if the hood is open, false otherwise.
  787. *
  788. * @param trunkOpen True if the trunk is open, false otherwise.
  789. *
  790. * @param doorsOpened Array of door states, true if the door is open, false otherwise.
  791. *
  792. * @param nDoors The number of doors.
  793. *
  794. * @return EC_OK on success, others on fail.
  795. */
  796. virtual int32_t uploadDoorStatus(bool hoodOpen, bool trunkOpen, const bool* doorsOpened, int32_t nDoors) = 0;
  797. /**
  798. * @brief Upload car's lights status to phone.
  799. *
  800. * @param headlight The status of the head lights.
  801. *
  802. * @param indicator The status of turn indicator.
  803. *
  804. * @param hazardLightOn True if hazard lights are on, false otherwise.
  805. *
  806. * @return EC_OK on success, others on fail.
  807. */
  808. virtual int32_t uploadLightStatus(ECHeadLightStatus headlight, ECTurnIndicatorStatus indicator, bool hazardLightOn) = 0;
  809. /**
  810. * @brief Upload car's tire pressures to phone.
  811. *
  812. * @param tirePressure Array of tire pressure values in psi.
  813. *
  814. * @param nTires The number of tires.
  815. *
  816. * @return EC_OK on success, others on fail.
  817. */
  818. //
  819. virtual int32_t uploadTirePressure(const float* tirePressure, int32_t nTires) = 0;
  820. /**
  821. * @brief Upload car's accelerometer to phone. Units are m/s^2 multiplied by 1e3.
  822. *
  823. * @param accX Acceleration from left to right.
  824. *
  825. * @param accY Acceleration from back to head.
  826. *
  827. * @param accZ Acceleration from bottom to top.
  828. */
  829. virtual int32_t uploadAccelerometerStatus(int32_t accX, int32_t accY, int32_t accZ) = 0;
  830. /**
  831. * @brief Upload car's gyroscope to phone. Units are rad/s.
  832. *
  833. * @param speedX Rotation speed around axis from left to right.
  834. *
  835. * @param speedY Rotation speed around axis from back to head.
  836. *
  837. * @param speedZ Rotation speed around axis from bottom to top.
  838. *
  839. * @return EC_OK on success, others on fail.
  840. */
  841. virtual int32_t uploadGyroscopeStatus(float speedX, float speedY, float speedZ) = 0;
  842. /**
  843. * @brief Upload GPS satellite status to phone.
  844. *
  845. * @param numSatInUse The number of satellites used in GPS fix.
  846. *
  847. * @param numSatVisible The number of satellites visible to the GPS receiver.
  848. *
  849. * @param prnData Array of PRNs of satellites in view or NULL if per-satellite info unavailable.
  850. *
  851. * @param nPRN The array size of prnData.
  852. *
  853. * @param snrDBData Array of SNRs of satellites in view in dB or NULL if per-satellite info unavailable.
  854. *
  855. * @param nSRN The array size of snrDBData.
  856. *
  857. * @param usedInFix Array of flags whether this satellite was used in GPS fix or NULL if per-satellite info unavailable.
  858. *
  859. * @param nUsed The array size of usedInFix.
  860. *
  861. * @param azimuthsData Array of azimuths of satellites in degrees clockwise from north or NULL if per-satellite info
  862. * unavailable or position data for satellites is absent.
  863. *
  864. * @param nAzimuth The array size of azimuthsData.
  865. *
  866. * @param elevationData Array of elevations of satellites in degrees from horizon to zenith or NULL if per-satellite info
  867. * unavailable or position data for satellites is absent.
  868. *
  869. * @param nElevation The array size of elevationData.
  870. *
  871. * @return EC_OK on success, others on fail.
  872. */
  873. virtual int32_t uploadGpsSatelliteStatus(int32_t numSatInUse, int32_t numSatVisible, const int32_t* prnData, int32_t nPRN,
  874. const int32_t* snrDBData, int32_t nSRN, const bool* usedInFix, int32_t nUsed,
  875. const float* azimuthsData, int32_t nAzimuth, const float* elevationData, int32_t nElevation) = 0;
  876. /**
  877. * @brief Upload sensor error to phone.
  878. *
  879. * @param sensor The type of sensor having problem.
  880. *
  881. * @param sensorError The error type.
  882. *
  883. * @return EC_OK on success, others on fail.
  884. */
  885. virtual int32_t uploadSensorError(ECSensorType sensor, ECSensorErrorType sensorError) = 0;
  886. /**
  887. * @brief Upload vehicle info to phone(RESERVED).
  888. *
  889. * @param data Buffer of vehicle info.
  890. *
  891. * @param length Buffer length.
  892. *
  893. * @return EC_OK on success, others on fail.
  894. *
  895. * @note THIS IS A RESERVED METHOD. PLEASE IGNORE IT NOW.
  896. */
  897. virtual int32_t uploadVehicleInfo(const void* data, uint32_t length) = 0;
  898. /**
  899. * @brief Send bulk data to phone(RESERVED).
  900. *
  901. * @param data Buffer of bulk data.
  902. *
  903. * @param length Buffer length.
  904. *
  905. * @return EC_OK on success, others on fail.
  906. *
  907. * @note THIS IS A RESERVED METHOD. PLEASE IGNORE IT NOW.
  908. */
  909. virtual int32_t sendBulkDataToPhone(const void *data, uint32_t length) = 0;
  910. /**
  911. * @brief Enable downloading phone audio.
  912. *
  913. * @param enableTTS Enable downloading TTS.
  914. *
  915. * @param enableVR Enable downloading VR.
  916. *
  917. * @param enableTalkie Enable downloading Talkie.
  918. *
  919. * @param enableMusic Enable downloading Music.
  920. *
  921. * @param autoChangeToBT Whether the phone send talkie and music audio to car via Bluetooth.
  922. *
  923. * @return EC_OK on success, others on fail.
  924. *
  925. * @note If car media supports playing TTS music, it can ask phone app to send down TTS voice,
  926. * which includes navigation and/or VR voice. Driver can heart navigation voice more
  927. * clearly from car speaker than from phone speaker. This is very useful in noisy driving
  928. * environment. This method does not impact phone media(mp3, mp4, etc) voice, which may be
  929. * transferred to car via Bluetooth.
  930. *
  931. * @see IECCallback::onPhoneAudioStart, IECCallback::onPhoneAudioData,
  932. * IECCallback::onPhoneAudioStop, IECCallback::onPhoneAudioSetVolume
  933. */
  934. virtual int32_t enableDownloadPhoneAppAudio(bool enableTTS, bool enableVR, bool enableTalkie, bool enableMusic, bool autoChangeToBT = true) = 0;
  935. /**
  936. * @brief Disable downloading phone audio. Opposite to enableDownloadPhoneAppAudio.
  937. *
  938. * @see enableDownloadPhoneAppAudio
  939. */
  940. virtual void disableDownloadPhoneAppAudio() = 0;
  941. /**
  942. * @brief Enable downloading phone navigation HUD information.
  943. *
  944. * @return EC_OK on success, others on fail.
  945. *
  946. * @note If car wants to display HUD information in its screen, it can ask phone app to send down
  947. * HUD information.
  948. *
  949. * @see IECCallback::onPhoneAppHUD
  950. */
  951. virtual int32_t enableDownloadPhoneAppHud() = 0;
  952. /**
  953. * @brief Disable downloading phone navigation HUD. Opposite to enableDownloadPhoneAppHud.
  954. *
  955. * @see enableDownloadPhoneAppAudio
  956. */
  957. virtual void disableDownloadPhoneAppHud() = 0;
  958. /**
  959. * @brief Set bluetooth mac address of car and connected phone. .
  960. *
  961. * @param carBtMac Bluetooth mac address of car.
  962. *
  963. * @param phoneBtMac Bluetooth mac address of phone.
  964. *
  965. * @return EC_OK on success, others on fail.
  966. *
  967. * @note This interface shall be called only when car was connected to phone via bluetooth.
  968. * THIS IS A RESERVED METHOD. PLEASE IGNORE IT NOW.
  969. */
  970. virtual int32_t setConnectedBTAddress(const char* carBtMac, const char* phoneBtMac) = 0;
  971. /**
  972. * @brief Open ftp server which forwards the local ports on HUD to the ports on the connected phone.
  973. *
  974. * @param userName Specifying the username of ftp.
  975. *
  976. * @param pwd Specifying the password of ftp.
  977. *
  978. * @return EC_OK on success, others on fail.
  979. *
  980. * @note This interface shall be called only after ECSDK::openTransport was called successfully via usb connection.
  981. *
  982. */
  983. virtual int32_t openFtpServer(const char* userName, const char* pwd) = 0;
  984. /**
  985. * @brief Open app page.
  986. *
  987. * @param page Specifying which page of app.
  988. *
  989. * @return EC_OK on success, others on fail.
  990. */
  991. virtual int32_t openAppPage(ECAppPage page) = 0;
  992. /**
  993. * @brief Open app page.
  994. *
  995. * @param page Specifying which page of app.
  996. *
  997. * @param channel Which can specify the namespace of the page. Zero means standard, others means custom.
  998. * When channel is zero, the value of page can refer to ECAppPage.
  999. *
  1000. * @return EC_OK on success, others on fail.
  1001. */
  1002. virtual int32_t openAppPage(int32_t page, int32_t channel) = 0;
  1003. /**
  1004. * @brief Send to phone when audio play was end.
  1005. *
  1006. * @param type Audio type, TTS, VR, IM or music.
  1007. *
  1008. * @return EC_OK on success, others on fail.
  1009. *
  1010. * @note This interface should be called when the connected phone need to know a piece of audio has finished play.
  1011. * It can be called after IECCallback::onPhoneAudioStop was called.
  1012. */
  1013. virtual int32_t sendAudioPlayEnd(ECAudioType type) = 0;
  1014. /**
  1015. * @brief Send an request to phone for GPS information.
  1016. *
  1017. * @param status Whether GPS information is valid, true means valid.
  1018. *
  1019. * @param longitude GPS longitude.
  1020. *
  1021. * @param latitude GPS latitude.
  1022. *
  1023. * @return EC_OK on success, others on fail.
  1024. *
  1025. * @note The query result will be filled to parameters.
  1026. */
  1027. virtual int32_t queryGPS(bool& status, double& longitude, double& latitude) = 0;
  1028. /**
  1029. * @brief Send an request to phone for time information.
  1030. *
  1031. * @param gmtTime GMT(UTC) time in milliseconds.
  1032. *
  1033. * @param localTime Local time in milliseconds.
  1034. *
  1035. * @param timeZone Time zone, buffer for data to save, etc. "Asia/Shanghai".
  1036. *
  1037. * @param len The length of the buffer.
  1038. *
  1039. * @return EC_OK on success, others on fail.
  1040. *
  1041. * @note The query result will be filled to parameters.
  1042. */
  1043. virtual int32_t queryTime(uint64_t& gmtTime, uint64_t& localTime, char* timeZone, uint32_t len) = 0;
  1044. /**
  1045. * @brief Send car status info to phone.
  1046. *
  1047. * @param carStatus The status type of car.
  1048. *
  1049. * @param value The value of the corresponding status type.
  1050. *
  1051. * @return EC_OK on success, others on fail.
  1052. *
  1053. */
  1054. virtual int32_t sendCarStatus(ECCarStatusType carStatus, ECCarStatusValue value) = 0;
  1055. /**
  1056. * @brief Check the network status of connected phone.
  1057. *
  1058. * @param status The status of phone's network, true means network is available and false means network is unavailable.
  1059. *
  1060. * @return EC_OK on success, others on fail.
  1061. *
  1062. */
  1063. virtual int32_t checkPhoneNetwork(bool& status) = 0;
  1064. /**
  1065. * @brief Send car's blue tooth information to connected phone.
  1066. *
  1067. * @param name The name of car's bluetooth.
  1068. *
  1069. * @param adddress The adddress of car's bluetooth.
  1070. *
  1071. * @param pin The pin code of car's bluetooth.
  1072. *
  1073. * @return EC_OK on success, others on fail.
  1074. *
  1075. */
  1076. virtual int32_t sendCarBluetooth(const char* name, const char* adddress, const char* pin) = 0;
  1077. /**
  1078. * @brief Specifying commands to identify by VR.
  1079. *
  1080. * @param carCmds The command array.
  1081. *
  1082. * @param length The number of command in carCmds.
  1083. *
  1084. * @return EC_OK on success, others on fail.
  1085. *
  1086. * @note This method specify which commands can be identified by VR.
  1087. * Then IECCallback::onCarCmdNotified would be trigggered if a
  1088. * voice control command was recognized by VR.
  1089. */
  1090. virtual int32_t registerCarCmds(const ECCarCmd* carCmds, uint32_t length) = 0;
  1091. /**
  1092. * @brief upload statistics information to connected phone.
  1093. *
  1094. * @param key key with which the specified value is to be associated
  1095. *
  1096. * @param value value to be associated with the specified key
  1097. *
  1098. * @return EC_OK on success, others on fail.
  1099. *
  1100. */
  1101. virtual int32_t uploadStatistics(const char* key, const char* value) = 0;
  1102. /**
  1103. * @brief This method will trigger a check to ota update.
  1104. *
  1105. * @param otaConfigPath This path will save the config files, such as "aaaaa.2.req".
  1106. *
  1107. * @param otaPackagePath This path will save the software package and md5 file and log file.
  1108. * software package such as "aaaaa.3.bin",
  1109. * md5 file such as "aaaaa.3.md5",
  1110. * log file such as "aaaaa.2.3.succ.log" or "aaaaa.2.3.err.log".
  1111. *
  1112. *
  1113. * @param language Which language's description of software will be gained when HU's network is used for ota update.
  1114. *
  1115. * @param mode Specify which way to check ota update.
  1116. *
  1117. * @return EC_OK on success, others on fail.
  1118. *
  1119. * @note IECCallback::onOTAUpdateCheckResult will tell the result. If HU is connecting to a phone,
  1120. * the update is checked via phone, or via HU's network.
  1121. */
  1122. virtual int32_t checkOTAUpdate(const char* otaConfigPath, const char* otaPackagePath, const char* language, ECOTAUpdateCheckMode mode = EC_OTA_CHECK_VIA_DEFAULT) = 0;
  1123. /**
  1124. * @brief This method will download specified softwares sequentially.
  1125. *
  1126. * @param softwareIds The array save the software id.
  1127. *
  1128. * @param softwareNum The length of array.
  1129. *
  1130. * @return EC_OK on success, others on fail.
  1131. *
  1132. * @note The software id would gained from IECCallback::onOTAUpdateCheckResult after ECSDK::checkOTAUpdate was called.
  1133. */
  1134. virtual int32_t startOTAUpdate(const char** softwareIds, int32_t softwareNum) = 0;
  1135. /**
  1136. * @brief This method will stop downloading softwares.
  1137. *
  1138. * @note OTA update doesn't support breakpoint continuation. The software which haven't been completed
  1139. * would be removed.
  1140. */
  1141. virtual void stopOTAUpdate() = 0;
  1142. /**
  1143. * @brief This method will enable ota network update use sandbox environment.
  1144. *
  1145. * @note The default environment of ota network update is production.
  1146. */
  1147. virtual void enableSandbox() = 0;
  1148. /**
  1149. * @brief This method will directly make phone app go to main page.
  1150. */
  1151. virtual int32_t openAppMainPage() = 0;
  1152. /**
  1153. * @brief This method make phone app play the tts audio of car's text.
  1154. *
  1155. * @param text The text of tts.
  1156. *
  1157. * @param level The priority of tts, the value will be from 1 to 10, bigger value means higher priority
  1158. *
  1159. * @return EC_OK on success, others on fail.
  1160. *
  1161. * @note This method will send the text to connected phone, then the tts audio of specified text will be played.
  1162. */
  1163. virtual int32_t playCarTTS(const char* text, uint32_t level) = 0;
  1164. /**
  1165. * @brief This method send the text of HU's input to phone app.
  1166. *
  1167. * @param text The text of input
  1168. *
  1169. * @return EC_OK on success, others on fail.
  1170. *
  1171. * @note This method will send the text to connected phone.
  1172. */
  1173. virtual int32_t sendInputText(const char* text) = 0;
  1174. /**
  1175. * @brief This method send the action of HU's input to phone app.
  1176. *
  1177. * @param actionId The action of input
  1178. *
  1179. * @param keyCode The keyCode of input
  1180. *
  1181. * @return EC_OK on success, others on fail.
  1182. *
  1183. * @note This method will send the action and keyCode to connected phone.
  1184. */
  1185. virtual int32_t sendInputAction(int actionId, int keyCode) = 0;
  1186. /**
  1187. * @brief This method send the selection of HU's input to phone app.
  1188. *
  1189. * @param start The start index of the selection.
  1190. *
  1191. * @param stop The stop index of the selection.
  1192. *
  1193. * @return EC_OK on success, others on fail.
  1194. *
  1195. * @note This method will send the selection to connected phone.
  1196. */
  1197. virtual int32_t sendInputSelection(int start, int stop) = 0;
  1198. protected:
  1199. ECSDK();
  1200. virtual ~ECSDK();
  1201. }; // ECLibrary
  1202. } // namespace CarbitECLibrary
  1203. #endif // CARBIT_EC_SDK_H