com.atid.lib.transport

## Class ATransportBluetoothLe

- java.lang.Object
- - com.atid.lib.transport.ATransport
  - - com.atid.lib.transport.ATransportBluetoothLe

- All Implemented Interfaces:
    com.atid.lib.transport.ble.IBluetoothLeEvent

      public class ATransportBluetoothLe
      extends ATransport
      implements com.atid.lib.transport.ble.IBluetoothLeEvent

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class com.atid.lib.transport.ATransport

      `ATransport.IBufferControlEventListener, ATransport.IConnectStateEventListener`

  - ### Field Summary

    - ### Fields inherited from class com.atid.lib.transport.ATransport

      `DUMP, INFO, IO, mAddress, mConnType, mDevName, mDevType, mIsAutoConnect, mIsDeviceAttached, mMacAddress, mQueue, mState, TAG`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ATransportBluetoothLe()` Create an instance of the ATransportBluetooth class
    `ATransportBluetoothLe(DeviceType type, java.lang.String name, java.lang.String address)` Create an instance of the ATransportBluetooth class

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `available()` Returns the length of data that can be read with the read method.
    `boolean` | `connect()` Attempts to connect to the appliance using an instance of the Transport class.
    `void` | `destroy()` ATransport Destroys the instance and returns the resource.
    `void` | `disconnect()` An instance of the Transport class closes the connection to the device to which the device is connected.
    `boolean` | `getAutoConnect()` Returns whether automatically connect to the appliance using an instance of the Transport class.
    `boolean` | `getDeviceAttached()` Returns whether attached to the appliance using an instance of the Transport class.
    `void` | `listen()` An instance of the ATransport class waits for the device to connect.
    `void` | `onConnected(int status)` Response : Connected BLE
    `void` | `onConnecting(int status)` Response : Connecting BLE
    `void` | `onDisconnected(int status)` Response : Disconnected BLE with status
    `void` | `onDisonnecting(int status)` Response : Disconnecting BLE
    `void` | `onReceivedData(byte[] data)` Response : Received data from BLE device
    `int` | `read(byte[] data, int offset, int length)` Read data received from the device.
    `int` | `read(byte[] data, int offset, int length, int timeout)` Read data received from the device.
    `void` | `setAutoConnect(boolean enabled)` Sets whether automatically connect to the appliance using an instance of the Transport class.
    `int` | `write(byte[] data, int offset, int length)` Transfer data to the device.
    `int` | `write(byte[] data, int offset, int length, int timeout)` Transfer data to the device.

    - ### Methods inherited from class com.atid.lib.transport.ATransport

      `checkBufferSize, getAddress, getConnectType, getDeviceName, getDeviceType, getMacAddress, getState, read, read, setAddress, setBufferControlListener, setBufferControlListener, setDeviceName, setDeviceType, setMacAddress, setState, setStateListener, toString, write, write`

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

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

- - ### Constructor Detail

    - #### ATransportBluetoothLe

          public ATransportBluetoothLe()

      Create an instance of the ATransportBluetooth class

    - #### ATransportBluetoothLe

          public ATransportBluetoothLe(DeviceType type,
                                       java.lang.String name,
                                       java.lang.String address)

      Create an instance of the ATransportBluetooth class
      Parameters:
        `type` - A DeviceType enumeration that specifies the type of connected device using an instance of the ATransportBluetooth class.
        `name` - A string that specifies the name of the connected device using an instance of the ATransportBluetooth class.
        `address` - A string that specifies the address of the connected device by using an instance of the ATransportBluetooth class.

  - ### Method Detail

    - #### destroy

          public void destroy()

      Description copied from class: `ATransport`
      ATransport Destroys the instance and returns the resource.
      Specified by:
        `destroy` in class `ATransport`

    - #### setAutoConnect

          public void setAutoConnect(boolean enabled)

      Description copied from class: `ATransport`
      Sets whether automatically connect to the appliance using an instance of the Transport class. Supported the usb interface only.
      Specified by:
        `setAutoConnect` in class `ATransport`
      Parameters:
        `enabled` - A boolean specifying whether the device automatically connect.

    - #### getAutoConnect

          public boolean getAutoConnect()

      Description copied from class: `ATransport`
      Returns whether automatically connect to the appliance using an instance of the Transport class. Supported the usb interface only.
      Specified by:
        `getAutoConnect` in class `ATransport`
      Returns:
        Returns true if enabled the automatically connection, false if it disabled.

    - #### getDeviceAttached

          public boolean getDeviceAttached()

      Description copied from class: `ATransport`
      Returns whether attached to the appliance using an instance of the Transport class. Supported the usb interface only.
      Specified by:
        `getDeviceAttached` in class `ATransport`
      Returns:
        Returns true if attached the usb device, false if it detached.

    - #### connect

          public boolean connect()

      Description copied from class: `ATransport`
      Attempts to connect to the appliance using an instance of the Transport class.
      Specified by:
        `connect` in class `ATransport`
      Returns:
        Returns true if the connection attempt with the device is successful, false if it fails.

    - #### listen

          public void listen()

      Description copied from class: `ATransport`
      An instance of the ATransport class waits for the device to connect.
      Specified by:
        `listen` in class `ATransport`

    - #### disconnect

          public void disconnect()

      Description copied from class: `ATransport`
      An instance of the Transport class closes the connection to the device to which the device is connected.
      Specified by:
        `disconnect` in class `ATransport`

    - #### write

          public int write(byte[] data,
                           int offset,
                           int length)

      Description copied from class: `ATransport`
      Transfer data to the device.
      Specified by:
        `write` in class `ATransport`
      Parameters:
        `data` - A byte array that specifies the data to transfer to the Device.
        `offset` - An integer indicating the start address of the data to be transferred to the Device.
        `length` - An integer indicating the length of the data to be transferred to the Device.
      Returns:
        Returns the length of the data transferred to the Device.

    - #### write

          public int write(byte[] data,
                           int offset,
                           int length,
                           int timeout)

      Description copied from class: `ATransport`
      Transfer data to the device.
      Specified by:
        `write` in class `ATransport`
      Parameters:
        `data` - A byte array that specifies the data to transfer to the Device.
        `offset` - An integer indicating the start address of the data to be transferred to the Device.
        `length` - An integer indicating the length of the data to be transferred to the Device.
        `timeout` - An integer specifying the timeout of data transmission to the device.
      Returns:
        Returns the length of the data transferred to the Device.

    - #### available

          public int available()

      Description copied from class: `ATransport`
      Returns the length of data that can be read with the read method.
      Specified by:
        `available` in class `ATransport`
      Returns:
        Returns the length of data received from the device.

    - #### read

          public int read(byte[] data,
                          int offset,
                          int length)

      Description copied from class: `ATransport`
      Read data received from the device.
      Specified by:
        `read` in class `ATransport`
      Parameters:
        `data` - A byte array to store the data received from the device.
        `offset` - Integer specifying the start address at which data received from device will begin to be stored in a byte array.
        `length` - An integer specifying the maximum length at which data received from the device can be stored in a byte array.
      Returns:
        Returns the length of data received from device and stored in a byte array.

    - #### read

          public int read(byte[] data,
                          int offset,
                          int length,
                          int timeout)

      Description copied from class: `ATransport`
      Read data received from the device.
      Specified by:
        `read` in class `ATransport`
      Parameters:
        `data` - A byte array to store the data received from the device.
        `offset` - Integer specifying the start address at which data received from device will begin to be stored in a byte array.
        `length` - An integer specifying the maximum length at which data received from the device can be stored in a byte array.
        `timeout` - An integer that specifies the timeout for reading data received from the device.
      Returns:
        Returns the length of data received from device and stored in a byte array.

    - #### onConnected

          public void onConnected(int status)

      Description copied from interface: `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Response : Connected BLE
      Specified by:
        `onConnected` in interface `com.atid.lib.transport.ble.IBluetoothLeEvent`

    - #### onConnecting

          public void onConnecting(int status)

      Description copied from interface: `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Response : Connecting BLE
      Specified by:
        `onConnecting` in interface `com.atid.lib.transport.ble.IBluetoothLeEvent`

    - #### onDisonnecting

          public void onDisonnecting(int status)

      Description copied from interface: `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Response : Disconnecting BLE
      Specified by:
        `onDisonnecting` in interface `com.atid.lib.transport.ble.IBluetoothLeEvent`

    - #### onDisconnected

          public void onDisconnected(int status)

      Description copied from interface: `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Response : Disconnected BLE with status
      Specified by:
        `onDisconnected` in interface `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Parameters:
        `status` - 0 : success

    - #### onReceivedData

          public void onReceivedData(byte[] data)

      Description copied from interface: `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Response : Received data from BLE device
      Specified by:
        `onReceivedData` in interface `com.atid.lib.transport.ble.IBluetoothLeEvent`
      Parameters:
        `data` - : Received data