#ifndef __ECTINY_API_H__ #define __ECTINY_API_H__ #include "ECTypes.h" #define ECSDK_VERSION "1.0.10" typedef struct { void (*onECConnectStatus)(ECConnectedStatus status, ECConnectedType type); void (*onMirrorStatus)(ECMirrorStatus status); /** * @brief Called when EasyConnected status changed. * * @param status The changed EasyConnected message. */ void (*onECStatusMessage)(ECStatusMessage status); /** * @brief Called when the phone app sends down HUD information. * * @param data HUD information. */ void (*onPhoneAppHUD)(const ECNavigationHudInfo *data); /** * @brief Called when the phone app sends down HUD Road Junction Picture. * @param data */ void (*onPhoneAppHUDRoadJunctionPicture)(const ECHudRoadJunctionPictureInfo* data); /* * @brief Called when phone app tell the music info. * * @param data The information of music. */ void (*onPhoneAppMusicInfo)(const ECAppMusicInfo *data); /** * @brief Called when the phone app sends down some information. * * @param data Buffer of app information. * * @param length Buffer length. * * @note data is json string, the fields includes os, osVersion and ip. * Called when ECSDK::openTransport succeed. */ void (*onPhoneAppInfo)(const void *data, uint32_t length); /** * @brief Called when ECSDK wants car to do call operations(dial or hang up) via Bluetooth. * * @param type Operation type. * * @param name The person's name of corresponding number. * * @param number Phone numbers. * * @note Phone app is not able to dial or hang up automatically due to the latest system access limitation, * however, car is able to do it via Bluetooth. Therefore, ECSDK moves the call operations * to car, which can dial or hang up when this method is called. */ void (*onCallAction)(ECCallType type, const char *name, const char *number); /** * @brief Called when bulk data is received. * * @param data Buffer of bulk data. * * @param length Buffer length. * */ void (*onBulkDataReceived)(const void *data, uint32_t length); /** * @brief onRealMirrorSizeChanged * @param realWidth * @param realHeight * * \note The actual size of the projection screen does not equal the size of the video stream in some cases. * The surrounding area is filled with black. This message calls back the actual size of the projection screen */ void (*onMirrorInfoChanged)(const ECVideoInfo *info); /** * @brief Called when the license authorization failed. After this interface was called, * all connections would be forced closed. * * @param errCode Error code. * * @param errMsg Error message. */ void (*onLicenseAuthFail)(int32_t errCode, const char *errMsg); /** * @brief Called when the license authorization succeed. * * @param code success code. The code can gain specific meaning by ECAuthSuccessCode. * * @param msg success information. * * @param msg the description information. * */ void (*onLicenseAuthSuccess)(int32_t code, const char *msg); /** * @brief Called when registered command was triggered by VR. * * @param carCmd The triggered command. * * @note Voice control can be implemented with this method by VR. * * @see ECSDK::registerCarCmds */ void (*onCarCmdNotified)(const ECCarCmd *carCmd); /** * @brief Called when phone app request the HU to start input. * * @param info relevant parameters about the input. */ void (*onInputStart)(const ECInputInfo *info); /** * @brief Called when phone app request the HU to cancel input. */ void (*onInputCancel)(); /** * @brief Called when phone app tell the selection of input. */ void (*onInputSelection)(int32_t start, int32_t stop); /** * @brief Called when phone app tell the text of input. */ void (*onInputText)(const char *text); /** * @brief Called when phone app send the text of VR or TTS. */ void (*onVRTextReceived)(const ECVRTextInfo *info); /** * @brief Called when phone app tell the page list. * * @param pages Array of the struct ECPageInfo. * * @param length The length of the array. */ void (*onPageListReceived)(const ECPageInfo *pages, int32_t length); /** * @brief Called when phone app tell the icons. * * @param icons Array of the struct ECIconInfo. * * @param length The length of the array. */ void (*onPageIconReceived)(const ECIconInfo *icons, int32_t length); /** * @brief Called when phone app tell weather. * * @param data Buffer of weather information. * * @param length Buffer length. * * @note data pointed to a json string buffer. */ void (*onWeatherReceived)(const char *data, int32_t length); /** * @brief Called when phone app tell vr tips. * * @param data Buffer of tips information. * * @param length Buffer length. * * @note data pointed to a json string buffer. */ void (*onVRTipsReceived)(const char *data, int32_t length); /** * @brief Called when the app requests networking * * @param clientInfo Mobile phone related information * * @note */ void (*onRequestBuildNet)(const ECBTClientInfo *clientInfo); /** * @brief Called when canceling networking * * @note */ void (*onRequestBuildNetCancel)(); /** * @brief Called when networking is completed * * @note */ void (*onPhoneBuildNetFinish)(); /** * @brief Called when app sends AP information * * @param netDeviceInfo AP information * * @note */ void (*onPhoneAPInfo)(const ECBTNetInfo* netDeviceInfo); /** * @brief Called when mobile phone has a notification message. * @param notification */ void (*onPhoneNotification)(const ECPhoneNotification* notification); /** * @brief Called when the phone app sends down HUD lane guidance Picture. * @param notification */ void (*onPhoneAppHUDLaneGuidancePicture)(const ECHudLaneGuidancePictureInfo * data); /** * @brief Called when checkOTAUpdate was called, it will tell the result of checkOTAUpdate. * * @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloadable software. * * @param downloadableLength The length of the downloadable array, if downloadableLength < 0, means check occur error, downloadableLength is error value of ECOTAUpdateErrorCode. * * @param downloadedSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloaded software. * * @param downloadedLength The length of the downloaded array. */ void (*onOTAUpdateCheckResult)(const ECOTAUpdateSoftware* downloadableSoftwares, const int32_t downloadableLength, const ECOTAUpdateSoftware* downloadedSoftwares, const uint32_t downloadedLength); /** * @brief Called when remote downloadable software has been downloaded to phone. * * @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which has been in phone, can be downloaded from phone to HU. * * @param downloadableLength The length of the downloadable array. */ void (*onOTAUpdateRequestDownload)(const ECOTAUpdateSoftware* downloadableSoftwares, const uint32_t downloadableLength); /** * @brief Called when startOTAUpdate is called, it will notify the progress of downloading. * * @param downloadingSoftwareId The id of the downloading software. * * @param progress The progress of the downloading software,which is a percentage. * * @param softwareLeftTime The left time of the downloading software. * * @param otaLeftTime The left time of all the specified software by startOTAUpdate. */ void (*onOTAUpdateProgress)(const char* downloadingSoftwareId, float progress, uint32_t softwareLeftTime, uint32_t otaLeftTime); /** * @brief Called when startOTAUpdate is called, it will notify software is downloaded. * * @param downloadedSoftwareId The id of the downloaded software. * * @param md5Path The md5 file path. * * @param packagePath The software path. * * @param iconPath The icon path. * * @param leftSoftwareNum The amount of software remaining to be downloaded. */ void (*onOTAUpdateCompleted)(const char* downloadedSoftwareId, const char* md5Path, const char* packagePath, const char* iconPath, uint32_t leftSoftwareNum); /** * @brief Called when checkOTAUpdate or startOTAUpdate failed. * * @param errCode error code, see ECOTAUpdateErrorCode. * * @param softwarId the id of software. */ void (*onOTAUpdateError)(int32_t errCode, const char* softwareId); } IECCallBack; typedef struct { uint32_t (*size)(const char* name); int32_t (*read)(const char* name,void *data, uint32_t length, uint32_t offset); int32_t (*write)(const char* name,void *data, uint32_t length, uint32_t offset); void (*clear)(const char* name); }IECAccessFile; typedef struct { int32_t (*open)(); int32_t (*read)(void *data, uint32_t length); int32_t (*write)(void *data, uint32_t length); void (*close)(); }IECAccessDevice; typedef struct { uint32_t (*registHid)(uint32_t deviceId,uint32_t descriptorSize); void (*unRegistHid)(uint32_t deviceId); uint32_t (*sendHiDDescriptor)(uint32_t deviceId, const unsigned char* descriptor, uint32_t len); uint32_t (*sendHidEvent)(uint32_t deviceId, const unsigned char* event, uint32_t len); }IECHidAccessDev; typedef struct { int32_t (*open)(); int32_t (*read)(uint8_t* data, uint32_t len); int32_t (*write)(const uint8_t* data, uint32_t len); int32_t (*close)(); }IECBTAccessDev; typedef struct { void (*start)(int32_t width, int32_t height); void (*stop)(); void (*play)(const void *data, uint32_t len); }IECVideoPlayer; typedef struct { void (*start)(ECAudioType type, const ECAudioInfo *info); void (*stop)(ECAudioType type); void (*play)(ECAudioType type, const void *data, uint32_t len); void (*setVolume)(ECAudioType type, uint32_t vol); }IECAudioPlayer; typedef struct { int32_t (*start)(const ECAudioInfo *info); void (*stop)(); int32_t (*record)(void *data, uint32_t len); }IECAudioRecorder; typedef void *ECConfigHandle; ECConfigHandle EC_createECConfig(); void EC_destroyECConfig(ECConfigHandle config); void EC_setBaseConfig(ECConfigHandle config,const char *uuid, const char *version,const char *writableDir); void EC_setCommonConfig(ECConfigHandle config, const char *cfgName, const char *value); /** * @brief 设置 ECTiny 连接的app版本 * @param type 0:国内版; 1:海外版 */ void EC_setLinkPhoneApp(ECConfigHandle config,int32_t type); void EC_setCommonConfig1(ECConfigHandle config, const char *cfgName, int32_t value); // This function must be called after the EC_start() function. int32_t EC_resetECConfig(const char* config); /** * @brief ECTiny 初始化函数 * @param config 项目配置 * @param listener 回调接口 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口为互联必调用的接口。 * 1.除了调用 EC_setBaseConfig() 设置基本的运行配置之外,config 一般不需要额外配置。 * 2.listener 的生命周期大于 ECTiny 生命周期。即 listener 在 EC_initialize() 调用前就需要初始化,EC_release()之后才可以释放。 */ int32_t EC_initialize(ECConfigHandle config, IECCallBack *listener); /** * @brief ECTiny 释放函数 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此函数调用后,后面声明的函数调用都会失效。 * 没有互联时,ECTiny线程处于block或者waiting状态,占用系统资源不多,所以ECTiny的一般使用场景不需要调用此函数。 */ int32_t EC_release(); /** * @brief 设置ECTiny日志 * @param level 日志级别。调试时设置成:EC_LOG_LEVEL_ALL,生产时设置成:EC_LOG_LEVEL_ERROR或者其他高级别 * @param type 日志输出类型,设置成 EC_LOG_OUT_STD标准输出。其余类型暂不支持。 * @param logDirectory 日志保存位置,暂不支持 * @param module 日志模块,通常设置成:EC_LOG_MODULE_SDK | EC_LOG_MODULE_APP * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口为互联必调用的接口。 */ int32_t EC_setLogInfo(const ECLogLevel level,const ECLogOutputType type,const char *logDirectory, int32_t module); /** * @return 获取 ECTiny 版本号 */ const char* EC_getVersion(); /** * @return 获取 ECTiny 升级版本号 */ int32_t EC_getVersionCode(); /** * @brief 开启互联服务 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口为互联必调用的接口。 */ int32_t EC_start(); /** * @brief 停止互联服务 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 没有投屏的情况下, ECTiny线程出于阻塞状态,占用的系统资源很少。 * 一般使用场景,调用 EC_start() 之后,不需要调用 EC_stop()。 */ int32_t EC_stop(); /** * @brief 绑定文件读写设备 * @param handle 文件操作接口 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 对于某些 RTOS 系统,没有标准的文件操作接口,因此需要实现此接口,把基本文件操作的接口传给 ECTiny。 * ECTiny会使用此接口读写license和OTA。 */ int32_t EC_bindAccessFile(IECAccessFile *handle); /** * @brief 绑定usb设备 * @param type 互联类型 * @param dev usb设备操作接口 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 绑定usb设备读写操作,用于实现usb互联。 * @see EC_unbindDevice() */ int32_t EC_bindUSBDevice(ECTransportType type, IECAccessDevice *dev); /** * @brief 绑定wifi互联ip * @param type 互联类型 * @param ip 对端ip地址 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此函数调用之后, ECTiny会直接连接ip,进行互联。 * @see EC_unbindDevice() */ int32_t EC_bindWIFIDevice(ECTransportType type, const char *ip); /** * @brief 释放绑定的设备 * @param type 互联类型 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此函数与 EC_bindUSBDevice(),EC_bindWIFIDevice(),有绑定与解绑定关系。 */ int32_t EC_unbindDevice(ECTransportType type); /** * @brief 绑定HID设备 * @param dev HID设备 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @see EC_unBindHidDevice() */ int32_t EC_bindHidDevice(IECHidAccessDev* dev); /** * @brief 解除HID设备绑定 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @see EC_bindHidDevice() */ int32_t EC_unBindHidDevice(); /** * @brief 绑定蓝牙ble设备操作接口 * @param ioHandle 蓝牙ble设备操作接口 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口用于BLE组网方式的互联。 * @see EC_unBindBTDevice() */ int32_t EC_bindBTDevice( IECAccessDevice* ioHandle); /** * @brief 蓝牙ble设备解绑定 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @see EC_bindBTDevice() */ int32_t EC_unBindBTDevice(); /** * @brief 设置投屏参数 * @param mirrorCfg 投屏参数 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口为互联必执行的接口。 */ int32_t EC_setMirrorConfig(const ECMirrorConfig *mirrorCfg); /** * @brief 设置解码显示设备 * @param video 解码显示器 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 解码显示器 IECVideoPlayer 通过此接口注册给 ECTiny之后,由 ECTiny主动调用解码器的开始和停止。 */ int32_t EC_setVideoPlayer(IECVideoPlayer* video); /** * @brief 设置音频播放器 * @param audio 音频播放器 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 声音数据走usb或者wifi时才需要设置此接口。一般项目声音都是走蓝牙a2dp,不需要设置此接口。 */ int32_t EC_setAudioPlayer(IECAudioPlayer* audio); /** * @brief 设置录音设备 * @param audioRecorde 录音设备 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 需要手机app回声降噪的项目才需要设置此接口。 */ int32_t EC_setAudioRecorder(IECAudioRecorder* audioRecorde); /** * @brief 仪表wifi状态通知接口 * @param action 仪表wifi模式:ap/sta。 目前此值不做要求,填写此枚举任意值即可 * @param netInfo 网络状态。ECNetWorkInfo::state 必须填写,其余字段不需要填。 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 仪表/车机wifi发生变化时,通过此接口通知给 ECTiny。wifi连接,此接口必调用 */ int32_t EC_notifyWifiStateChanged(ECWifiStateAction action, const ECNetWorkInfo* netInfo); /** * @brief 请求组网接口 * @param phoneID 手机id * @param rly 组网信息 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 只有BLE组网的连接方式,才用到此接口。 */ int32_t EC_setRequestBuildNetRly(const char *phoneID, const ECBTRequestBuildNetRly *rly); /** * @brief 仪表ip地址上报给手机 * @param info 仪表网络信息 * @param num 仪表网络信息数量 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 只有BLE组网的连接方式,才用到此接口。 */ int32_t EC_setNetInterfaceInfo(const ECNetInterfaceInfo *info,const int32_t num); /** * @brief 开始投屏 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口为互联必执行的接口。 * 此接口调用后,手机app会把 H264 数据发送给 ECTiny。 ECTiny会自动调用 IECVideoPlayer 解码器解码显示。 * onECConnectStatus 回调函数,status==EC_CONNECT_STATUS_CONNECT_SUCCEED 时才可以调用此接口,否则无效。 * @see EC_stopMirror() */ int32_t EC_startMirror(); /** * @brief 停止投屏 * @note 此接口为互联必执行的接口。 * @see EC_startMirror() */ void EC_stopMirror(); /** * @brief 暂停/开启 投屏 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 目前不调用。调用 EC_startMirror()/EC_stopMirror() */ int32_t EC_pauseMirror(); int32_t EC_resumeMirror(); /** * @brief 发送触控消息 * @param touch 触控数据 * @param type 触控类型 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 发送仪表/车机屏幕的触控消息给手机app,互联程序会映射到手机的坐标,让手机app做出响应。 */ int32_t EC_sendTouchEvent(const ECTouchEventData *touch, ECTouchEventType type); /** * @brief 发送按键消息 * @param btnCode 按键键值,取值于:ECBtnCode * @param type 按键类型,取值与:ECBtnEventType * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 发送按键消息给手机app,让手机作出响应。 */ int32_t EC_sendBtnEvent(int32_t btnCode, int32_t type); /** * @brief 结束手机导航 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 */ int32_t EC_stopPhoneNavigation(); /** * @brief 结束手机vr语音 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 */ int32_t EC_stopPhoneVR(); /** * @brief 上传汽车的夜间模式信息到手机 * @param isNightModeOn 1:夜间模式; 0: 非夜间模式 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 手机app的显示模式设置为自动时,此接口才能让手机app响应 */ int32_t EC_uploadNightModeStatus(uint32_t isNightModeOn); /** * @brief 上传汽车的驾驶信息到手机 * @param status 驾驶状态 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 */ int32_t EC_uploadDrivingStatus(ECDrivingStatus status); /** * @brief 允许手机下发声音数据到仪表/车机 * @param supportType 下载的声音类型,取值于 ECAudioType 类型,可以通过或运算下载多种声音 * @param autoChangeToBT 是否启用蓝牙优先的策略,当蓝牙连接后,声音自动走蓝牙通道。 * 也可通过该接口控制手机端蓝牙连接提示框的弹出,当该参数设置为false后,手机端不再弹出连接蓝牙提示框。 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 只有在连接层成功建立后,接口调用才能成功。参考 onECConnectStatus() * 该接口调用之后,手机app才会下传相应声音,停止音频下传接口为EC_disableDownloadPhoneAppAudio() */ int32_t EC_enableDownloadPhoneAppAudio(uint32_t supportType, uint32_t autoChangeToBT); /** * @brief 停止手机下发声音数据 */ void EC_disableDownloadPhoneAppAudio(); /** * @brief 允许手机下发HUD导航信息 * @param supportFunction hud导航功能,取值于 ECAPPHUDSupportFunction 类型,可以通过或运算开启多种hud功能 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 只有在连接层成功建立后,接口调用才能成功。参考 onECConnectStatus() * 此接口调用一次即可生效 */ int32_t EC_enableDownloadPhoneAppHud(uint32_t supportFunction); /** * @brief 停止手机下发HUD导航信息 */ void EC_disableDownloadPhoneAppHud(); /** * @brief 设置连接的蓝牙 * @param carBtMac 车机自己的蓝牙地址 * @param phoneBtMac 车机连接的蓝牙Mac地址 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 * @note 此接口的目的是用于对比手机和车机两者连接的蓝牙是不是对方。受限于手机系统限制,无法取得手机的蓝牙物理地址,目前此接口功能已经失效。 */ int32_t EC_setConnectedBTAddress(const char *carBtMac, const char *phoneBtMac); /** * @brief 发送车机的蓝牙信息给手机 * @param name 蓝牙名称 * @param adddress 蓝牙地址 * @param pin 蓝牙pin码 * @return EC_OK 为成功,其余值为失败。此返回值一般不处理 */ int32_t EC_sendCarBluetooth(const char *name, const char *adddress, const char *pin); /** * @brief 打开手机界面 * @param page 快速访问手机APP的相关界面或功能,如导航、音乐、对讲等,具体取值参考:ECAppPage * @return EC_OK 为成功,其余值为失败。 * @note 该接口主要用于如下场景,譬如车机端系统桌面集成快捷按钮,可直达互联的指定页面。 */ int32_t EC_openAppPage(int32_t page); /** * @brief 查询GPS信息 * @param status 当前的请求结果是否有效,0:无效;其余值有效 * @param gps GPS信息 * @return EC_OK 为成功,其余值为失败。 * @note 该接口主要用于车机需要使用到手机端GPS的场景,请求网络当前位置。 */ int32_t EC_queryGPS(uint32_t* status, ECGPSInfo* gps); /** * @brief 查询手机时间 * @param gmtTime 返回GMT(UTC)时间,单位毫秒。 * @param localTime 返回当前时区的时间,单位毫秒 * @param timeZone 返回当前的时区的字符串。 * @param len 当前时区字符串的长度 * @param dateTime 返回手机app当前时间字符串 * @param dateTimeLen 手机app当前时间字符串长度 * @return EC_OK 为成功,其余值为失败。 * @note 由于GMT时间涉及到系统函数和时区的计算,建议直接使用后两个参数获取当前时间字符串,然后解析字符串获取到时间 */ int32_t EC_queryTime(uint64_t *gmtTime, uint64_t *localTime, char *timeZone, uint32_t len, char* dateTime, uint32_t dateTimeLen); /** * @brief 同步车机状态到手机 * @param carStatus 车机状态类型 * @param value 部分status需要携带状态值 * @return EC_OK 为成功,其余值为失败。 * @note 部分场景下,需要将车机的部分状态信息通知到手机APP,手机APP需要根据状态做互联的相关逻辑处理。 * 如手机APP可根据行车状态,在不同的地区做不同的使用限制。该接口主要用于行车模式功能等功能。 */ int32_t EC_sendCarStatus(ECCarStatusType carStatus, ECCarStatusValue value); /** * @brief 注册控车指令 * @param carCmds 控车指令 * .type : 指令类型,是一个全局指令或是一个和页面绑定的指令,见枚举 ECCarCmdEFFECTType 。 * .id : 指令id,每个需要识别的指令,都有一个唯一的标识。 * .cmd : 期望语音识别的指令,当时一个全局指令时,可以是正则表达式;如"(打开|开启)空调",等价于"打开空调" ,"开启空调";而当是一个和页面绑定的指令词,不支持正则表达式,仅支持明确的指令,如"放大地图"。 * .vrText : 当前成功匹配的语义,仅用于当 IECCallback::onCarCmdNotified 回调时,可根据匹配的内容处理相关的动作。 * .pauseMusic : 该参数仅用于 ECSDK::registerCarCmds ,告知手机如果触发语音识别时,是否需要暂停当前正在播放的音乐。 * .responser : 语音指令执行的结果是由车机端播报,还是由手机端播报。0 车机端播报,1,手机端播报。 * .thresholdLevel : 可选项,默认值为0,由手机端指定默认的门限值, 范围参考值 1~9999,识别门限值,值越大识别率越低,误唤醒率越低,开发者在使用语音识别功能时,可在项目中调试设置合适的值。该参数仅在 type= EC_CAR_CMD_TYPE_EFFECTIVE_PAGE 生效; * @param length 注册的指令列表的长度。 * @return EC_OK 为成功,其余值为失败。 * @note 当发起语音识别后,通过手机端的VR引擎识别后,会转化后具体的指令,通过回调接口 IECCallback::onCarCmdNotified 响应,须在此进行相关处理。 */ int32_t EC_registerCarCmds(const ECCarCmd *carCmds, uint32_t length); /** * @brief 播放指定的文字 * @param text 文字信息 * @param level 优先级,0~10,优先级越高,被播放的优先级也越高。 * @return EC_OK 为成功,其余值为失败。 * @note 与手机的通讯建立成功后,把需要播报的文字传输至手机APP。 * 如果车机端配置了 ECSDK::enableDownloadPhoneAppAudio 通过车机端播放手机APP音频,此时音频将以TTS类型,通过USB/wifi传输车机端。 */ int32_t EC_playCarTTS(const char *text, uint32_t level); /** * @brief 注册近似指令 * @param data 需要注册的近音词组,数据格式为JSON格式字符串 * { * words: * [ * ["词1", ..., "词m"], ///< 数据类型为string数组,近音词集合,数组中的第一个词为显示词。 * ... * ["词a", ..., "词n"] ///< 数据类型为string数组,近音词集合,数组中的第一个词为显示词。 * ] * } * @param length 注册的指令Json字符串的长度。 * @return EC_OK 为成功,其余值为失败。 * @note 该接口主要是对 EC_registerCarCmds() 接口的补充,常见使用场景提高语音控车指令的准确度,如“上身车窗”、“上升车窗”可以正确的被识别为同一个含义。 */ int32_t EC_registerSimilarSoundingWords(const char *data, uint32_t length); /** * @brief 发送给手机端当前已输入的文字 * @param text 当前输入的车机端文字 * @return EC_OK 为成功,其余值为失败。 * @note 此函数用于车机键盘输入功能 */ int32_t EC_sendInputText(const char* text); /** * @brief 发送给手机端键盘按键事件 * @param actionId 当前输入的动作 * @param keyCode 键值 * @return EC_OK 为成功,其余值为失败。 * @note 如车机端输入法点击Enter键,此时需把事件发送给手机端。所有keycode及ActionId对安卓手机都有效; * 苹果手机仅响应actionid=0 keycode=4,苹果手机处理为隐藏手机端输入法,并把输入状态置为inActive状态。 * 此函数用于车机键盘输入功能 */ int32_t EC_sendInputAction(int32_t actionId, int32_t keyCode); /** * @brief 发送给手机端当前光标位置及选中状态 * @param start 光标开始的位置。 * @param stop 光标结束的位置。 * @return EC_OK 为成功,其余值为失败。 * @note 如果车机端的光标产生变化,需把对应状态发送至手机端同步。仅对安卓手机有效,苹果手机互联无此回调。 * 此函数用于车机键盘输入功能 */ int32_t EC_sendInputSelection(int32_t start, int32_t stop); /** * @brief 获取快捷方式列表信息 * @return EC_OK 为成功,其余值为失败。 * @note ECTiny与手机app传输建立之后。通过 IECCallback::onPageListReceived 回调接口完快捷方式列表信息的接收。 */ int32_t EC_queryPageList(); /** * @brief 获取快捷方式图标资源 * @param pages 待请求的page编号的数组,通过 EC_queryPageList 获取。 * @param length page编号的数组长度。 * @return EC_OK 为成功,其余值为失败。 * @note ECTiny与手机app传输建立之后。通过 IECCallback::onPageIconReceived 回调接口完快捷方式图标资源的的接收。 * 为了避免重复的请求,占用带宽资源,以及做到车机端的快捷方式快速显示;车机端系统需要做好缓存策略,对icon的资源信息做到增量更新: * 通过每次互联后 EC_queryPageList 获取最新的列表信息,然后比对车机端缓存的列表信息,仅对增量的资源进行请求更新; */ int32_t EC_queryPageIcon(int32_t* pages, int32_t length); /** * @brief 查询天气 * @return EC_OK 为成功,其余值为失败。 * @note 查询结果通过 IECCallback::onWeatherReceived 回调函数返回 */ int32_t EC_queryWeather(); /** * @brief 车机端语音提醒轮播 * @return EC_OK 为成功,其余值为失败。 * @note 在使用车机端本地语音助手时,一般需要有一些常驻提示类的使用帮助,这些文字主要通过手机端传输至车机端,由车机端系统完成展示。 */ int32_t EC_queryVRTips(); /** * @brief 生成二维码url * @param info 二维码信息 * @return EC_OK 为成功,其余值为失败。 */ const char* EC_generateQRCodeUrl(ECQRInfo* info); /** * @brief 允许手机下发手机消息 * @param enable 0:禁止; 1:允许 * @return EC_OK 为成功,其余值为失败。 */ int32_t EC_requestPhoneNotification(int32_t enable); /** * @brief 检测OTA升级 * @param cfg ota配置 * @param language 语言 * @param mode ota升级模式 * @return EC_OK 为成功,其余值为失败。 */ int32_t EC_checkOTAUpdate(const ECOTAConfig* cfg, const ECLanguage language, const ECOTAUpdateCheckMode mode); /** * @brief 开始OTA升级 * @param softwareIds 需要升级的软件id * @param softwareNum 需要升级的软件id数量 * @return EC_OK 为成功,其余值为失败。 */ int32_t EC_startOTAUpdate(const char** softwareIds, const int32_t softwareNum); /** * @brief 停止OTA升级 */ void EC_stopOTAUpdate(); /** * @brief 开启iperf服务端 * @param ip * @param port * @return * @note 简单实现的iperf功能。车机/仪表进行iperf测试时,建议使用标准iperf */ int32_t EC_startIperfTcpServer(const char* ip, int port); void EC_stopIperfTcpServer(); #endif