
# 初始化等基础接口
 #### createHRtcEngine
```
huawei::rtc::IHRTCEngine* createHRtcEngine(void);
```
【**功能说明**】
创建IHRTCEngine对象。
【**返回参数**】
- huawei::rtc::IHRTCEngine\*：IHRTCEngine对象。
- NULL：创建失败。
 
 #### getHRtcEngine
```
huawei::rtc::IHRTCEngine* getHRtcEngine(void);
```
【**功能说明**】
调用createHRtcEngine成功后，可通过该函数，获取IHRTCEngine对象。
【**返回参数**】
- huawei::rtc::IHRTCEngine\*：IHRTCEngine对象。
- NULL：IHRTCEngine对象不存在时返回。
 
 #### enableStats
```
virtual int enableStats(bool enabled)
```
【**功能说明**】
开启打点统计，在initialize前调用。
【**请求参数**】
enabled：是否开启打点，默认开启。
【**返回参数**】
- 0：方法调用成功。
- \> 0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
 #### initialize
virtual int initialize(const HRTCEngineContext \&context);
【**功能说明**】
IHRtcEngine对象初始化函数。
【**请求参数**】
context：引擎初始化参数, 具体请参见[HRTCEngineContext](https://support.huaweicloud.com/csdk-rtc/rtc_05_0128.html#rtc_05_0128__section1671735584318)。
【**返回参数**】
- 0：方法调用成功。
- \> 0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
 #### release
```
virtual void release()
```
【**功能说明**】
释放IHRtcEngine对象资源。
![](https://support.huaweicloud.com/csdk-rtc/public_sys-resources/caution_3.0-zh-cn.png)
如果资源已经释放，需要重新调用[createHRtcEngine](https://support.huaweicloud.com/csdk-rtc/rtc_05_0098.html#rtc_05_0098__zh-cn_topic_0000001160409611_section15582155102019)和[initialize]进行初始化。
 #### logUpload
```
virtual int logUpload()
```
【**功能说明**】
开启日志上传。
【**返回参数**】
- 0：方法调用成功。
- \> 0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
![](https://support.huaweicloud.com/csdk-rtc/public_sys-resources/caution_3.0-zh-cn.png)
- 加入房间后才能主动上传日志。
- 会触发以下回调：
  - [onLogUploadResult](https://support.huaweicloud.com/csdk-rtc/rtc_05_0107.html#rtc_05_0107__zh-cn_topic_0277015530_section1874913143493)：日志上传结果回调。
  
  - [onLogUploadProgress](https://support.huaweicloud.com/csdk-rtc/rtc_05_0107.html#rtc_05_0107__zh-cn_topic_0277015530_section238204424911)：日志上传进度回调，远端服务器不通时不会收到此回调。
   
 
 #### getVersion
```
virtual char* getVersion()
```
【**功能说明**】
获取当前SDK版本号。
【**请求参数**】
无
【**返回参数**】
SDK当前版本号。
 #### getAudioDeviceManager
```
virtual IHRTCAudioDeviceManager* getAudioDeviceManager()
```
【**功能说明**】
获取系统音频设备管理对象。通过该对象进行音频设备管理，具体请参见[音频设备管理](https://support.huaweicloud.com/csdk-rtc/rtc_05_0116.html)。
【**请求参数**】
无
【**返回参数**】
- IHRTCAudioDeviceManager\*：IHRTCAudioDeviceManager对象。
- NULL：返回失败。
 
 #### getVideoDeviceManager
```
virtual IHRTCVideoDeviceManager* getVideoDeviceManager()
```
【**功能说明**】
获取系统视频设备管理对象。通过该对象进行视频设备管理，具体请参见[视频设备管理](https://support.huaweicloud.com/csdk-rtc/rtc_05_0117.html)。
【**请求参数**】
无
【**返回参数**】
- IHRTCVideoDeviceManager\*：IHRTCVideoDeviceManager对象。
- NULL：返回失败。
 
 #### setJniLoadParams
```
int setJniLoadParams(void *jvm, void *context);
```
**【功能说明】**
安卓全平台传递jvm context参数，需要在[initialize]之前设置。
 #### setEncryption
```
virtual int setEncryption(const HRTCEncryptionConfig &cryption)
```
【**功能说明**】
设置端到端加密模式，必须调用接口，在加入房间前调用生效。
【**请求参数**】
cryption：加密参数，具体请参见[HRTCEncryptionConfig](https://support.huaweicloud.com/csdk-rtc/rtc_05_0128.html#rtc_05_0128__section16592173205116)。
【**返回参数** 】
- 0：方法调用成功。
- \>0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
 #### setAccessResourceType
```
virtual int setAccessResourceType(int resType) = 0;
```
【**功能说明**】
设置接入的环境，不支持跨房间场景。
【**请求参数**】
resType：环境类型。
- 0：公网sfu资源。
- 1：公司局Sfu。
【**返回参数**】
- 0：方法调用成功。
- \<0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
#### setAccessResourceType
```
virtual int setAccessResourceType(const char *resourceTags[HRTCConstant::HRTC_MAX_RESOURCE_TAG_COUNT], int num, int intranetType) = 0;
```
【**功能说明**】
指定使用的sfu服务器，设置接入的环境，不支持跨房间场景。
【**请求参数**】
resourceTags：资源标签，指定连接的sfu
num：资源标签数组长度
intranetType：环境类型。
- 0：公网sfu资源。
- 1：公司局Sfu。
【**返回参数**】
- 0：方法调用成功。
- \<0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
 #### setNetworkBandwidth
```
virtual int setNetworkBandwidth(const HRTCNetworkBandwidth &bandwidthParam)
```
【**功能说明**】
设置网络带宽限制，在每次加入房间之前调用。
【**请求参数**】
bandwidthParam：带宽设置参数，具体请参见[HRTCNetworkBandwidth](https://support.huaweicloud.com/csdk-rtc/rtc_05_0128.html#rtc_05_0128__section131901152173617)。
【**返回参数** 】
- 0：方法调用成功。
- \>0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
 #### renewAppid
```
virtual int renewAppid(const char* appid)
```
【**功能说明**】
设置Appid，用来更新AppId，在加入房间调用前才会生效，否则只能下一次入会生效。
【**请求参数**】
appid：设置appid。
【**返回参数** 】
- 0：方法调用成功。
- \>0：方法调用失败。具体请参见[HRTCErrorCode](https://support.huaweicloud.com/csdk-rtc/rtc_05_0125.html)。
 
