com.pavolibrary.commands

## Class DspAPI

- java.lang.Object
- - com.pavolibrary.commands.DspAPI

-     public class DspAPI
      extends java.lang.Object

  Created by swm on 2020-01-04

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `DspAPI.UploadListener` Upload event listener

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FAIL`
    `static int` | `SUCCESS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DspAPI(android.content.Context mContext)` Display API

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearbuffer()` 清空接收缓存区 Empty receive buffer
    `int` | `connect(java.lang.String serialPort, int baudRate, int flowControl)` 创建连接 Create connection
    `int` | `disconnect()` 断开连接 disconnect
    `boolean` | `DSP_ChangeBaudRate(int baudrate)` 临时修改波特率(不保存) Set baud rate temporarily （not save）
    `boolean` | `DSP_ChangeCharset(int n)` 选择国际编码（不保存） Select international character set (not save)
    `boolean` | `DSP_ChangeCodepage(int n)` 选择扩展编码（不保存）Select character code table (not save)
    `boolean` | `DSP_ClearLine()` 清除光标行 Clear cursor line
    `boolean` | `DSP_ClearScreen()` 清屏 Clear display screen
    `boolean` | `DSP_Dispay_At(java.lang.String text, java.lang.String charset, int row, int column)` 发送文本到客显指定位置 Send the text to the specified position of the display
    `boolean` | `DSP_Dispay_UpperLineScroll(java.lang.String text, java.lang.String charset)` 首行消息连续滚动 Upper line message scroll continuously
    `boolean` | `DSP_Dispay(java.lang.String text, java.lang.String charset)` 发送文本到客显 Send text to display
    `boolean` | `DSP_DisplayQrCode(java.lang.String text, int x, int y)` 显示二维码 Display QrCode
    `boolean` | `DSP_DisplayQrCodeOnPicture(java.lang.String data, int x, int n)` 在图片上显示二维码 Display QrCode on picture
    `int` | `DSP_GetFirmwareVersion_VFD()` 获取设备固件版本(VFD/LCM) Get Firmware Version(VFD/LCM)
    `int` | `DSP_GetFirmwareVersion()` 获取设备固件版本(LCD) Get Firmware Version(LCD)
    `java.lang.String` | `DSP_GetModel()` 获取设备型号 Get device model
    `boolean` | `DSP_Init()` 初始化 Initialize display
    `boolean` | `DSP_MoveCursor(int row, int column)` 光标移动到指定位置 Move cursor to specified position
    `boolean` | `DSP_MoveCursorDown()` 光标下移 Move cursor down
    `boolean` | `DSP_MoveCursorEnd()` 光标移动到终点 Move cursor to bottom position
    `boolean` | `DSP_MoveCursorEndLeft()` 光标移动到最左端 Move cursor to left-most position
    `boolean` | `DSP_MoveCursorEndRight()` 光标移动到最右端 Move cursor to right-most position
    `boolean` | `DSP_MoveCursorHome()` 光标返回起点 Move cursor to home position
    `boolean` | `DSP_MoveCursorLeft()` 光标左移 Move cursor left
    `boolean` | `DSP_MoveCursorRight()` 光标右移 Move cursor right
    `boolean` | `DSP_MoveCursorUp()` 光标上移 Move cursor up
    `boolean` | `DSP_Restart()` 重启客显 Restart display
    `boolean` | `DSP_Restore()` 还原出厂设置　Restore factory settings
    `boolean` | `DSP_SelfTest()` 自检 Execute self-test
    `boolean` | `DSP_SetBackGroundColor_Central(int color)` 设置中部背景颜色　Set middle BackGround color
    `boolean` | `DSP_SetBackGroundColor_Footer(int color)` 设置底部背景颜色（第二行欢迎语）　Set Footer BackGround color (second welcome line)
    `boolean` | `DSP_SetBackGroundColor_Header(int color)` 设置标题行背景颜色（第一行欢迎语）Set Header BackGround color (first line of welcome)
    `boolean` | `DSP_SetBaudRate(int n)` 设置波特率(保存) Set BaudRate to display (save)
    `boolean` | `DSP_SetBlink(int n)` 设置闪烁频率 Blink display screen
    `boolean` | `DSP_SetBodyDefaultText(java.lang.String text1, java.lang.String text2, java.lang.String text3, java.lang.String text4, java.lang.String charset)` 设置正文默认文本 Set Body default text
    `boolean` | `DSP_SetBrightness(int n)` 调节背光亮度 Brightness adjustment
    `boolean` | `DSP_SetCharset(int n)` 设置国际编码（保存） Setup international character set (save)
    `boolean` | `DSP_SetCodepage(int n)` 设置扩展编码（保存） Setup character code table (save)
    `boolean` | `DSP_SetCommandSet(int n)` 设置命令集 Set command set
    `boolean` | `DSP_SetDisplayStyle(int n)` 设置显示风格　Set display style
    `boolean` | `DSP_SetHeaderType(int n)` 设置头部标题类型　Set header title type
    `boolean` | `DSP_SetLines(int n)` 设置文本显示行数 Set the number of text display lines
    `boolean` | `DSP_SetPlayed(int value)` 设置播放的图片 Set the pictures to play
    `boolean` | `DSP_SetPlayInterval(int time)` 设置图片播放间隔时间 Set the display interval of pictures
    `boolean` | `DSP_SetStandbyTime(int time)` 设置图片播放待机时间 Set pictures display standby time
    `boolean` | `DSP_SetTextColor_Central(int color)` 设置中部文本颜色　Set middle text color
    `boolean` | `DSP_SetTextColor_Footer(int color)` 设置底部文本颜色（第二行欢迎语）　Set Footer text color (second welcome line)
    `boolean` | `DSP_SetTextColor_Header(int color)` 设置标题行文本颜色（第一行欢迎语）Set Header text color (first line of welcome)
    `boolean` | `DSP_SetWelMessage_1(java.lang.String text, java.lang.String charset)` 设置第一行欢迎语 Set the first line of welcome
    `boolean` | `DSP_SetWelMessage_2_Scroll(boolean b)` 设置第二行欢迎语滚动标志　Set the second line of welcome scrolling sign
    `boolean` | `DSP_SetWelMessage_2(java.lang.String text, java.lang.String charset)` 设置第二行欢迎语 Set the second line of welcome
    `boolean` | `DSP_ShowPicture(int n)` 展示一张图片 Show a picture
    `int` | `DSP_UploadPicture(java.lang.String fileName, java.lang.String filePath, int width, int height)` 上传图片到客显 Upload pictures to display
    `boolean` | `isConnect()` 是否连接 Is it connected
    `int` | `setBaudrate(int _baudRate)` 设置波特率 setup baud rate
    `void` | `setUploadListener(DspAPI.UploadListener mUploadListener)` Set Upload event listener

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

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

- - ### Field Detail

    - #### SUCCESS

          public static final int SUCCESS

      See Also:
        Constant Field Values

    - #### FAIL

          public static final int FAIL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### DspAPI

          public DspAPI(android.content.Context mContext)

      Display API
      Parameters:
        `mContext` -

  - ### Method Detail

    - #### connect

          public int connect(java.lang.String serialPort,
                             int baudRate,
                             int flowControl)

      创建连接 Create connection
      Parameters:
        `serialPort` - 端口号
        `baudRate` - 波特率
        `flowControl` - 流控 0:no 1:yes
      Returns:
        0:success

    - #### setBaudrate

          public int setBaudrate(int _baudRate)

      设置波特率 setup baud rate
      Parameters:
        `_baudRate` - 波特率
      Returns:
        0:success

    - #### disconnect

          public int disconnect()

      断开连接 disconnect
      Returns:
        0:success

    - #### isConnect

          public boolean isConnect()

      是否连接 Is it connected
      Returns:
        true:Connected

    - #### clearbuffer

          public void clearbuffer()

      清空接收缓存区 Empty receive buffer

    - #### DSP_Dispay

          public boolean DSP_Dispay(java.lang.String text,
                                    java.lang.String charset)

      发送文本到客显 Send text to display
      Parameters:
        `text` - 文本内容
        `charset` - 字符编码
      Returns:
        true:success

    - #### DSP_Dispay_At

          public boolean DSP_Dispay_At(java.lang.String text,
                                       java.lang.String charset,
                                       int row,
                                       int column)

      发送文本到客显指定位置 Send the text to the specified position of the display
      Parameters:
        `text` - 文本内容
        `charset` - 字符编码
        `row` - 行
        `column` - 列
      Returns:
        true:success

    - #### DSP_Dispay_UpperLineScroll

          public boolean DSP_Dispay_UpperLineScroll(java.lang.String text,
                                                    java.lang.String charset)

      首行消息连续滚动 Upper line message scroll continuously
      Parameters:
        `text` - 文本内容
        `charset` - 字符编码
      Returns:

    - #### DSP_MoveCursorLeft

          public boolean DSP_MoveCursorLeft()

      光标左移 Move cursor left
      Returns:
        true:success

    - #### DSP_MoveCursorRight

          public boolean DSP_MoveCursorRight()

      光标右移 Move cursor right
      Returns:
        true:success

    - #### DSP_MoveCursorUp

          public boolean DSP_MoveCursorUp()

      光标上移 Move cursor up
      Returns:
        true:success

    - #### DSP_MoveCursorDown

          public boolean DSP_MoveCursorDown()

      光标下移 Move cursor down
      Returns:
        true:success

    - #### DSP_MoveCursorHome

          public boolean DSP_MoveCursorHome()

      光标返回起点 Move cursor to home position
      Returns:
        true:success

    - #### DSP_MoveCursorEndLeft

          public boolean DSP_MoveCursorEndLeft()

      光标移动到最左端 Move cursor to left-most position
      Returns:
        true:success

    - #### DSP_MoveCursorEndRight

          public boolean DSP_MoveCursorEndRight()

      光标移动到最右端 Move cursor to right-most position
      Returns:
        true:success

    - #### DSP_MoveCursorEnd

          public boolean DSP_MoveCursorEnd()

      光标移动到终点 Move cursor to bottom position
      Returns:
        true:success

    - #### DSP_MoveCursor

          public boolean DSP_MoveCursor(int row,
                                        int column)

      光标移动到指定位置 Move cursor to specified position
      Parameters:
        `row` - 行 1 ≦ row ≦ 2(4)
        `column` - 列 1 ≦ column ≦ 20
      Returns:
        true:success

    - #### DSP_Init

          public boolean DSP_Init()

      初始化 Initialize display
      Returns:
        true:success

    - #### DSP_ClearScreen

          public boolean DSP_ClearScreen()

      清屏 Clear display screen
      Returns:
        true:success

    - #### DSP_ClearLine

          public boolean DSP_ClearLine()

      清除光标行 Clear cursor line
      Returns:
        true:success

    - #### DSP_SetWelMessage_1

          public boolean DSP_SetWelMessage_1(java.lang.String text,
                                             java.lang.String charset)

      设置第一行欢迎语 Set the first line of welcome
      Parameters:
        `text` - 文本内容
        `charset` - 字符编码
      Returns:
        true:success

    - #### DSP_SetWelMessage_2

          public boolean DSP_SetWelMessage_2(java.lang.String text,
                                             java.lang.String charset)

      设置第二行欢迎语 Set the second line of welcome
      Parameters:
        `text` - 文本内容
        `charset` - 字符编码
      Returns:
        true:success

    - #### DSP_SetWelMessage_2_Scroll

          public boolean DSP_SetWelMessage_2_Scroll(boolean b)

      设置第二行欢迎语滚动标志　Set the second line of welcome scrolling sign
      Parameters:
        `b` - false：No scrolling　true：Scrolling
      Returns:

    - #### DSP_SetHeaderType

          public boolean DSP_SetHeaderType(int n)

      设置头部标题类型　Set header title type
      Parameters:
        `n` - 0:picture 1:text
      Returns:

    - #### DSP_SetDisplayStyle

          public boolean DSP_SetDisplayStyle(int n)

      设置显示风格　Set display style
      Parameters:
        `n` - 0:文本在顶部显示 The text is at the top 1:文本在中部显示 The text is in the middle
      Returns:

    - #### DSP_SetBodyDefaultText

          public boolean DSP_SetBodyDefaultText(java.lang.String text1,
                                                java.lang.String text2,
                                                java.lang.String text3,
                                                java.lang.String text4,
                                                java.lang.String charset)

      设置正文默认文本 Set Body default text
      Parameters:
        `text1` - line1 text
        `text2` - line2 text
        `text3` - line3 text
        `text4` - line4 text
        `charset` - 字符编码
      Returns:

    - #### DSP_SetTextColor_Header

          public boolean DSP_SetTextColor_Header(int color)

      设置标题行文本颜色（第一行欢迎语）Set Header text color (first line of welcome)
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetTextColor_Central

          public boolean DSP_SetTextColor_Central(int color)

      设置中部文本颜色　Set middle text color
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetTextColor_Footer

          public boolean DSP_SetTextColor_Footer(int color)

      设置底部文本颜色（第二行欢迎语）　Set Footer text color (second welcome line)
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetBackGroundColor_Header

          public boolean DSP_SetBackGroundColor_Header(int color)

      设置标题行背景颜色（第一行欢迎语）Set Header BackGround color (first line of welcome)
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetBackGroundColor_Central

          public boolean DSP_SetBackGroundColor_Central(int color)

      设置中部背景颜色　Set middle BackGround color
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetBackGroundColor_Footer

          public boolean DSP_SetBackGroundColor_Footer(int color)

      设置底部背景颜色（第二行欢迎语）　Set Footer BackGround color (second welcome line)
      Parameters:
        `color` -
      Returns:

    - #### DSP_SetCommandSet

          public boolean DSP_SetCommandSet(int n)

      设置命令集 Set command set
      Parameters:
        `n` - 0 ~ 13 30h, LD220 31h, EPSON Esc/POS 32h, AEDEX 33h, UTC/S 34h, UTC/E 35h, ADM788 36h, DSP800 37h, CD5220 38h, EMAX 39h, LOGIC CONTROL 3Ah, ICD2002 3Bh, EZ-202 3Ch, PL-200 3Dh, PD3000
      Returns:
        true:success

    - #### DSP_SetCharset

          public boolean DSP_SetCharset(int n)

      设置国际编码（保存） Setup international character set (save)
      Parameters:
        `n` - 国际编码编号
      Returns:
        true:success

    - #### DSP_ChangeCharset

          public boolean DSP_ChangeCharset(int n)

      选择国际编码（不保存） Select international character set (not save)
      Parameters:
        `n` - 国际编码编号
      Returns:
        true:success

    - #### DSP_SetCodepage

          public boolean DSP_SetCodepage(int n)

      设置扩展编码（保存） Setup character code table (save)
      Parameters:
        `n` - 扩展编码编号
      Returns:
        true:success

    - #### DSP_ChangeCodepage

          public boolean DSP_ChangeCodepage(int n)

      选择扩展编码（不保存）Select character code table (not save)
      Parameters:
        `n` - 扩展编码编号
      Returns:
        true:success

    - #### DSP_SetBlink

          public boolean DSP_SetBlink(int n)

      设置闪烁频率 Blink display screen
      Parameters:
        `n` - 0 ≦ n ≦ 255(n*50msec)ON / (n*50msec)OFF n= 0, blinking is canceled n=255, display is turned off
      Returns:
        true:success

    - #### DSP_SetLines

          public boolean DSP_SetLines(int n)

      设置文本显示行数 Set the number of text display lines
      Parameters:
        `n` - 1: line 2 2:line 4
      Returns:
        true:success

    - #### DSP_Restart

          public boolean DSP_Restart()

      重启客显 Restart display
      Returns:
        true:success

    - #### DSP_Restore

          public boolean DSP_Restore()

      还原出厂设置　Restore factory settings
      Returns:

    - #### DSP_SelfTest

          public boolean DSP_SelfTest()

      自检 Execute self-test
      Returns:
        true:success

    - #### DSP_SetBrightness

          public boolean DSP_SetBrightness(int n)

      调节背光亮度 Brightness adjustment
      Parameters:
        `n` - 1 ≦ n ≦ 4
      Returns:

    - #### DSP_SetBaudRate

          public boolean DSP_SetBaudRate(int n)

      设置波特率(保存) Set BaudRate to display (save)
      Parameters:
        `n` - 0 ≦ n ≦ 4 n = 0, 9600 n = 1, 19200 n = 2, 38400 n = 3, 57600 n = 4, 115200
      Returns:
        true:success

    - #### DSP_ChangeBaudRate

          public boolean DSP_ChangeBaudRate(int baudrate)

      临时修改波特率(不保存) Set baud rate temporarily （not save）
      Parameters:
        `baudrate` - 9600, 19200.......
      Returns:
        true:success

    - #### DSP_DisplayQrCode

          public boolean DSP_DisplayQrCode(java.lang.String text,
                                           int x,
                                           int y)

      显示二维码 Display QrCode
      Parameters:
        `text` - 二维码内容
        `x` - 横向位置 x=1 left x=2 center x=3 right
        `y` - 纵向位置 y=1 top y=2 center y=3 bottom
      Returns:

    - #### DSP_DisplayQrCodeOnPicture

          public boolean DSP_DisplayQrCodeOnPicture(java.lang.String data,
                                                    int x,
                                                    int n)

      在图片上显示二维码 Display QrCode on picture
      Parameters:
        `data` - 二维码内容
        `x` - 横向位置 x=1 left x=2 center x=3 right
        `n` - 图片序号 Picture number 1 <= n <= 10
      Returns:
        true:success

    - #### DSP_GetModel

          public java.lang.String DSP_GetModel()

      获取设备型号 Get device model
      Returns:
        型号 model

    - #### DSP_GetFirmwareVersion

          public int DSP_GetFirmwareVersion()

      获取设备固件版本(LCD) Get Firmware Version(LCD)
      Returns:
        固件版本 Firmware Version

    - #### DSP_GetFirmwareVersion_VFD

          public int DSP_GetFirmwareVersion_VFD()

      获取设备固件版本(VFD/LCM) Get Firmware Version(VFD/LCM)
      Returns:
        固件版本 Firmware Version

    - #### DSP_SetPlayed

          public boolean DSP_SetPlayed(int value)

      设置播放的图片 Set the pictures to play
      Parameters:
        `value` - bit0~9 = picture 1~10 1=Y 0=N
      Returns:
        true:success

    - #### DSP_ShowPicture

          public boolean DSP_ShowPicture(int n)

      展示一张图片 Show a picture
      Parameters:
        `n` - 图片序号 Picture number
      Returns:
        true:success

    - #### DSP_SetPlayInterval

          public boolean DSP_SetPlayInterval(int time)

      设置图片播放间隔时间 Set the display interval of pictures
      Parameters:
        `time` - 间隔时间（秒） Interval time(second)
      Returns:
        true:success

    - #### DSP_SetStandbyTime

          public boolean DSP_SetStandbyTime(int time)

      设置图片播放待机时间 Set pictures display standby time
      Parameters:
        `time` - 待机时间（秒） Standby time(second)
      Returns:
        true:success

    - #### DSP_UploadPicture

          public int DSP_UploadPicture(java.lang.String fileName,
                                       java.lang.String filePath,
                                       int width,
                                       int height)

      上传图片到客显 Upload pictures to display
      Parameters:
        `fileName` - 文件名（固定）File name (fixed)
        `filePath` - 文件路径 File path
      Returns:
        0:success

    - #### setUploadListener

          public void setUploadListener(DspAPI.UploadListener mUploadListener)

      Set Upload event listener
      Parameters:
        `mUploadListener` -