com.aispeech.dui.dds

## Class DDS

- java.lang.Object
- - com.aispeech.dui.dds.DDS

-     public class DDS
      extends java.lang.Object

  Disclaim

  This program is the property of AI Speech Ltd. It shall be communicated to authorized personnel only. It is not to be disclosed outside the group without prior written consent. If you are not sure if you’re authorized to read this program, please contact info@aispeech.com before reading.

  Created by jinrui.gan on 17-3-12.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `AUTH_COMPLETE_FULL`
    `static int` | `AUTH_COMPLETE_NONE`
    `static int` | `AUTH_COMPLETE_NOT_FULL`
    `static java.lang.String` | `BUS_SERVER_ADDR`
    `static java.lang.String` | `DNS_SERVER`
    `static int` | `ERROR_EXTRACT_DDS_BIN` Extract dds.bin error.
    `static int` | `ERROR_KERNEL_READY_TIMEOUT` Waiting sys.kernel.ready timeout error.
    `static int` | `ERROR_LASA_EXECUTE_FAILED` Lasa execute bootloader error.
    `static int` | `ERROR_MD5SUM_NOT_EXIST` md5sum not exist.
    `static java.lang.String` | `ERROR_MD5SUM_NOT_EXIST_MSG`
    `static int` | `ERROR_NO_SPACE_LEFT`
    `static int` | `INIT_COMPLETE_FULL`
    `static int` | `INIT_COMPLETE_NONE`
    `static int` | `INIT_COMPLETE_NOT_FULL`
    `android.content.Context` | `mContext`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `doAuth()` 执行设备授权操作 异步返回，见 `DDSAuthListener`
    `Agent` | `getAgent()` 获取Agent
    `java.lang.String` | `getDeviceName()` 返回Profile授权方式下的deviceName信息
    `int` | `getInitStatus()` 获取当前初始化的状态
    `static DDS` | `getInstance()` 获取DDS实例
    `DDSUpdater` | `getUpdater()` 获取DDSUpdater
    `java.lang.String` | `getVersionName()` 获取DDS SDK的版本号
    `void` | `init(android.content.Context context, DDSConfig configs, DDSInitListener ddsInitListener, DDSAuthListener ddsAuthListener)` 初始化DDS SDK
    `boolean` | `isAuthSuccess()` 授权是否成功，该方法适用于api key授权
    `boolean` | `isInitComplete()` Deprecated.
    `void` | `release()` 销毁DDS SDK
    `void` | `releaseSync()` 同步销毁 DDS SDK
    `void` | `setDDSErrorListener(DDSErrorListener listener)` 设置DDS异常监听器,如果DDS有不可逆的异常会通过此接口抛出,客户收到此异常之后可以消毁并重启DDS
    `boolean` | `setDebugMode(int level)` 设置日志模式,必须在`init(android.content.Context, com.aispeech.dui.dds.DDSConfig, com.aispeech.dui.dds.DDSInitListener, com.aispeech.dui.dds.DDSAuthListener)`之前调用才生效
    `boolean` | `setReverseRecorderDataListener(ReverseRecorderDataListener listener)` 设置录音机音频反转监听器
    `void` | `startDebug()` 开启调试模式: 1.
    `void` | `stopDebug()` 关闭调试模式: 1.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### ERROR_EXTRACT_DDS_BIN

          public static final int ERROR_EXTRACT_DDS_BIN

      Extract dds.bin error.
      See Also:
        Constant Field Values

    - #### ERROR_LASA_EXECUTE_FAILED

          public static final int ERROR_LASA_EXECUTE_FAILED

      Lasa execute bootloader error. Contact us.
      See Also:
        Constant Field Values

    - #### ERROR_KERNEL_READY_TIMEOUT

          public static final int ERROR_KERNEL_READY_TIMEOUT

      Waiting sys.kernel.ready timeout error. Contact us.
      See Also:
        Constant Field Values

    - #### ERROR_NO_SPACE_LEFT

          public static final int ERROR_NO_SPACE_LEFT

      See Also:
        Constant Field Values

    - #### ERROR_MD5SUM_NOT_EXIST

          public static final int ERROR_MD5SUM_NOT_EXIST

      md5sum not exist. will break DDS
      See Also:
        Constant Field Values

    - #### ERROR_MD5SUM_NOT_EXIST_MSG

          public static final java.lang.String ERROR_MD5SUM_NOT_EXIST_MSG

      See Also:
        Constant Field Values

    - #### INIT_COMPLETE_NONE

          public static final int INIT_COMPLETE_NONE

      See Also:
        Constant Field Values

    - #### INIT_COMPLETE_NOT_FULL

          public static final int INIT_COMPLETE_NOT_FULL

      See Also:
        Constant Field Values

    - #### INIT_COMPLETE_FULL

          public static final int INIT_COMPLETE_FULL

      See Also:
        Constant Field Values

    - #### AUTH_COMPLETE_NONE

          public static final int AUTH_COMPLETE_NONE

      See Also:
        Constant Field Values

    - #### AUTH_COMPLETE_NOT_FULL

          public static final int AUTH_COMPLETE_NOT_FULL

      See Also:
        Constant Field Values

    - #### AUTH_COMPLETE_FULL

          public static final int AUTH_COMPLETE_FULL

      See Also:
        Constant Field Values

    - #### mContext

          public android.content.Context mContext

    - #### DNS_SERVER

          public static final java.lang.String DNS_SERVER

      See Also:
        Constant Field Values

    - #### BUS_SERVER_ADDR

          public static java.lang.String BUS_SERVER_ADDR

  - ### Method Detail

    - #### getInstance

          public static DDS getInstance()

      获取DDS实例
      Returns:
        DDS DDS实例

    - #### getVersionName

          public java.lang.String getVersionName()

      获取DDS SDK的版本号
      Returns:
        String 版本号

    - #### init

          public void init(android.content.Context context,
                           DDSConfig configs,
                           DDSInitListener ddsInitListener,
                           DDSAuthListener ddsAuthListener)

      初始化DDS SDK
      Parameters:
        `context` - Android context.
        `configs` - 初始化的配置
        `ddsInitListener` - 初始化回调方法
        `ddsAuthListener` - 授权回调方法

    - #### release

          public void release()

      销毁DDS SDK

    - #### releaseSync

          public void releaseSync()

      同步销毁 DDS SDK

    - #### getAgent

          public Agent getAgent()

      获取Agent
      Returns:
        Agent agent实例

    - #### getUpdater

          public DDSUpdater getUpdater()
                                throws DDSNotInitCompleteException

      获取DDSUpdater
      Returns:
        DDSUpdater DDSUpdater实例
      Throws:
        `DDSNotInitCompleteException` - 如果DDS没有初始化完成，会抛出exception

    - #### doAuth

          public void doAuth()
                      throws DDSNotInitCompleteException

      执行设备授权操作 异步返回，见 `DDSAuthListener`
      Throws:
        `DDSNotInitCompleteException`

    - #### getDeviceName

          public java.lang.String getDeviceName()
                                         throws DDSNotInitCompleteException

      返回Profile授权方式下的deviceName信息
      Returns:
        deviceName 未授权则该值为空字符串""
      Throws:
        `DDSNotInitCompleteException`

    - #### isAuthSuccess

          public boolean isAuthSuccess()
                                throws DDSNotInitCompleteException

      授权是否成功，该方法适用于api key授权
      Returns:
        boolean true：成功 false:没有成功
      Throws:
        `DDSNotInitCompleteException`

    - #### isInitComplete

          @Deprecated
          public boolean isInitComplete()

      Deprecated.
      初始化是否成功
      Returns:
        boolean true：成功 false:没有成功 此方法已弃用，参见`DDS#getInstance()#getInitStatus()`

    - #### getInitStatus

          public int getInitStatus()

      获取当前初始化的状态
      Returns:
        DDS.INIT_COMPLETE_NONE 还未初始化完成，表示DDS正在初始化 DDS.INIT_COMPLETE_NOT_FULL 部分初始化完成，表示DDS已经初始化完成，但还没有完成更新 DDS.INIT_COMPLETE_FULL 完全初始化完成，已经完成更新

    - #### setDebugMode

          public boolean setDebugMode(int level)

      设置日志模式,必须在`init(android.content.Context, com.aispeech.dui.dds.DDSConfig, com.aispeech.dui.dds.DDSInitListener, com.aispeech.dui.dds.DDSAuthListener)`之前调用才生效
      Parameters:
        `level` - 可选值1,2,3,4,5 默认值：4

    - #### setDDSErrorListener

          public void setDDSErrorListener(DDSErrorListener listener)

      设置DDS异常监听器,如果DDS有不可逆的异常会通过此接口抛出,客户收到此异常之后可以消毁并重启DDS
      Parameters:
        `listener` -

    - #### setReverseRecorderDataListener

          public boolean setReverseRecorderDataListener(ReverseRecorderDataListener listener)

      设置录音机音频反转监听器
      Parameters:
        `listener` -

    - #### startDebug

          public void startDebug()
                          throws DDSNotInitCompleteException

      开启调试模式: 1. 日志级别调为V 2. 保存调试音频
      Throws:
        `DDSNotInitCompleteException`

    - #### stopDebug

          public void stopDebug()
                         throws DDSNotInitCompleteException

      关闭调试模式: 1. 日志级别修改为E 2. 停止保存调试音频
      Throws:
        `DDSNotInitCompleteException`