BDNavigation

com.rscja.deviceapi

## Class BDNavigation

- java.lang.Object
- - com.rscja.deviceapi.BDNavigation

-     public class BDNavigation
      extends java.lang.Object

  北斗导航模块操作类

  注意：
  1、使用前请确认您的机器已安装此模块。
  2、要正常使用模块需要在\libs\armeabi\目录放置libDeviceAPI.so文件。
  3、在操作设备前需要调用 `open()` 打开设备，使用完后调用 `close()` 关闭设备
  4、要实时跟踪位置的变化需要调用 `addBDLocationListener(BDProviderEnum, BDLocationListener)` 方法注册监听； 要实时跟踪定位状态需要调用 `addBDStatusListener(BDStatusListener)`方法注册监听。

  Author:
    liuruifeng

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static interface` | `BDNavigation.BDLocationListener` 北斗位置服务的监听接口 Beidou positioning service monitor contact.
    `static class` | `BDNavigation.BDProviderEnum` 导航类型枚举 Navigation type enum.
    `static class` | `BDNavigation.BDStartModeEnum` 模块启动类型枚举 Module start type enum.
    `static interface` | `BDNavigation.BDStatusListener` 北斗模块状态监听接口 Beidou module status monitor contact.
    `static interface` | `BDNavigation.TestResultRawData` 获取返回的所有数据，此接口用于测试 Acquire all feedback data, the contact is used for testing.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBDLocationListener(BDNavigation.BDProviderEnum provider, BDNavigation.BDLocationListener listener)` 跟踪位置的变化 Tracking location change
    `void` | `addBDStatusListener(BDNavigation.BDStatusListener listener)` 添加定位状态监听 Add postion status monitoring
    `void` | `addTestBDRawDataListener(BDNavigation.TestResultRawData testResultData)`
    `void` | `bdTest(int state)`
    `void` | `changeBDProvider(BDNavigation.BDProviderEnum provider)` 改变参与定位的卫星系统 Change positioning satellite system
    `void` | `changeBDStartMode(BDNavigation.BDStartModeEnum mode)` 模块改变启动模式 Module change start mode
    `boolean` | `close()` 关闭北斗导航模块 Switch off Beidou navigation module.
    `static BDNavigation` | `getInstance()` 获取北斗导航模块操作实例 Acquire Beidou navigation module operation example.
    `BDLocation` | `getLastLocation()` 获取最后一次定位数据 Acquire last postion data.
    `int` | `getLastSatelliteUCount()` 获取最新已用卫星数 Acquire latest occupied satellite qty.
    `int` | `getLastsatelliteVCount()` 获取最新可视卫星数 Acquire latest visable satellite qty.
    `java.util.Date` | `getLastUTCDateTime()` 获取最新UTC时间 Acquire latest UTC time.
    `java.lang.String` | `getResultData()` 获取模块返回的原始数据
    `int` | `getTimeToFirstFix()` 获取第一次定位成功所用时间 Acquire duration of first successful positioning.
    `boolean` | `isPowerOn()` 判断设备是否上电 Judge the device is powered on or not.
    `boolean` | `open()` 打开北斗导航模块 Switch on Beidou navigation module.
    `void` | `setClosePort()` 关闭串口 close serial port
    `void` | `setOpenPort()` 打开串口 open serial port
    `boolean` | `writeData(byte[] data)`

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

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

- - ### Method Detail

    - #### writeData

          public boolean writeData(byte[] data)

    - #### getLastUTCDateTime

          public java.util.Date getLastUTCDateTime()

      获取最新UTC时间
      Acquire latest UTC time.
      Returns:

    - #### getLastSatelliteUCount

          public int getLastSatelliteUCount()

      获取最新已用卫星数
      Acquire latest occupied satellite qty.
      Returns:
        已用卫星数

    - #### getLastsatelliteVCount

          public int getLastsatelliteVCount()

      获取最新可视卫星数
      Acquire latest visable satellite qty.
      Returns:
        可视卫星数

    - #### getTimeToFirstFix

          public int getTimeToFirstFix()

      获取第一次定位成功所用时间
      Acquire duration of first successful positioning.
      Returns:

    - #### addBDStatusListener

          public void addBDStatusListener(BDNavigation.BDStatusListener listener)

      添加定位状态监听
      Add postion status monitoring
      Parameters:
        `listener` -

    - #### addTestBDRawDataListener

          public void addTestBDRawDataListener(BDNavigation.TestResultRawData testResultData)

    - #### getInstance

          public static BDNavigation getInstance()
                                          throws ConfigurationException

      获取北斗导航模块操作实例
      Acquire Beidou navigation module operation example.
      Returns:
        北斗导航模块操作实例
      Throws:
        `ConfigurationException`

    - #### getLastLocation

          public BDLocation getLastLocation()

      获取最后一次定位数据
      Acquire last postion data.
      Returns:

    - #### open

          public boolean open()
                       throws java.lang.SecurityException,
                              java.io.IOException

      打开北斗导航模块
      Switch on Beidou navigation module.
      Returns:
        成功true，失败false
      Throws:
        `java.io.IOException`
        `java.lang.SecurityException`

    - #### bdTest

          public void bdTest(int state)

    - #### close

          public boolean close()

      关闭北斗导航模块
      Switch off Beidou navigation module.
      Returns:
        成功true，失败false

    - #### addBDLocationListener

          public void addBDLocationListener(BDNavigation.BDProviderEnum provider,
                                            BDNavigation.BDLocationListener listener)

      跟踪位置的变化
      Tracking location change
      Parameters:
        `listener` - 监听对象
        Monitoring target

    - #### changeBDProvider

          public void changeBDProvider(BDNavigation.BDProviderEnum provider)

      改变参与定位的卫星系统
      Change positioning satellite system
      Parameters:
        `provider` -

    - #### changeBDStartMode

          public void changeBDStartMode(BDNavigation.BDStartModeEnum mode)

      模块改变启动模式
      Module change start mode
      Parameters:
        `mode` -

    - #### getResultData

          public java.lang.String getResultData()

      获取模块返回的原始数据
      Returns:
        the resultData

    - #### setOpenPort

          public void setOpenPort()

      打开串口
      open serial port

    - #### setClosePort

          public void setClosePort()

      关闭串口
      close serial port

    - #### isPowerOn

          public boolean isPowerOn()

      判断设备是否上电
      Judge the device is powered on or not.
      Returns: