Interface BLECallbacks


public interface BLECallbacks

Method Summary

Modifier and Type Method and Description
void onBinaryDataRead(byte[] data)
Called when Binary data has been received from a device.
void onBinaryDataWritten(byte[] data)
Called when String data has been written to a device.
void onCommandResult(int ID, Command command, Result result)
Called when the result of a command has been returned.
void onCommandSent(int ID, Command command)
Called when a command has been sent to a device.
void onConnected(java.lang.String deviceName, int services)
Called when connection is established.
void onDisconnected()
Called when connection has been disconnected (can only be connected to one device).
void onError(ErrorCode error)
Called when an error occurs.
void onFirmwareVersionRead(java.lang.String deviceName, java.lang.String version)
Called when the firmware version of the device has been read.
void onModeRead(int mode)
Called when the result of a mode read is returned.
void onModeWritten(int mode)
Called when a new mode has been written to a device.
void onScanResult(java.lang.String deviceName)
Called when a device has been found during a BLE scan.
void onStringDataRead(java.lang.String data)
Called when String data has been received from a device.
void onStringDataWritten(java.lang.String data)
Called when String data has been written to a device.

Method Detail

  • onScanResult

    void onScanResult(java.lang.String deviceName)
    Called when a device has been found during a BLE scan.
    Parameters:
    deviceName - name of BLE device
  • onConnected

    void onConnected(java.lang.String deviceName,
                   int services)
    Called when connection is established.
    Parameters:
    deviceName - name of connected device
    services - services the device supports (see below)
    • SERVICE_STATUS_NONE = 0
    • SERVICE_STATUS_ZENTRIOS_ONLY = 1
    • SERVICE_STATUS_OTA_ONLY = 2
    • SERVICE_STATUS_BOTH = 3
  • onDisconnected

    void onDisconnected()
    Called when connection has been disconnected (can only be connected to one device).
  • onStringDataWritten

    void onStringDataWritten(java.lang.String data)
    Called when String data has been written to a device. This can be used to check data was written in stream mode or bypass the internal command processing of the library in command mode.
    Parameters:
    data - data that was written
  • onBinaryDataWritten

    void onBinaryDataWritten(byte[] data)
    Called when String data has been written to a device. This can be used to check data was written in stream mode or bypass the internal command processing of the library in command mode.
    Parameters:
    data - data that was written
  • onStringDataRead

    void onStringDataRead(java.lang.String data)
    Called when String data has been received from a device. This is only called when the ReceiveMode is set to STRING.
    Parameters:
    data - data that was read
    See Also:
    BLECallbacks.ReceiveMode
  • onBinaryDataRead

    void onBinaryDataRead(byte[] data)
    Called when Binary data has been received from a device. This is only called when the ReceiveMode is set to BINARY.
    Parameters:
    data - data that was read
    See Also:
    BLECallbacks.ReceiveMode
  • onModeWritten

    void onModeWritten(int mode)
    Called when a new mode has been written to a device.
    Parameters:
    mode - mode that was written
  • onModeRead

    void onModeRead(int mode)
    Called when the result of a mode read is returned.
    Parameters:
    mode - current mode of device
    See Also:
    ZentriOSBLEManager
  • onCommandSent

    void onCommandSent(int ID,
                     Command command)
    Called when a command has been sent to a device.
    Parameters:
    ID - ID for this command (issued when command was requested).
    command - command that was sent
  • onCommandResult

    void onCommandResult(int ID,
                       Command command,
                       Result result)
    Called when the result of a command has been returned.
    Parameters:
    ID - ID for this command (issued when command was requested).
    command - command that was executed
    result - result of command
  • onFirmwareVersionRead

    void onFirmwareVersionRead(java.lang.String deviceName,
                             java.lang.String version)
    Called when the firmware version of the device has been read.
    Parameters:
    deviceName - name of device
    version - Firmware version of ZentriOS BLE device
  • onError

    void onError(ErrorCode error)
    Called when an error occurs.
    Parameters:
    error - error code
    See Also:
    ErrorCode