Class ZentriOSBLEManager

  • java.lang.Object
    • com.zentri.zentri_ble_command.ZentriOSBLEManager

public class ZentriOSBLEManager
extends java.lang.Object

Field Summary

Modifier and Type Field and Description
static int GPIO_MAX
Maximum GPIO # allowed.
static int GPIO_MIN
Minimum GPIO # allowed.
static int GPIO_VAL_MAX
Maximum GPIO value allowed.
static int GPIO_VAL_MIN
Minimum GPIO value allowed.
static int ID_INVALID
Value of invalid ID for validation.
static int MODE_COMMAND_LOCAL
Mode for entering commands via serial terminal (not used over BLE).
static int MODE_COMMAND_REMOTE
Mode for running commands over BLE.
static int MODE_STREAM
Mode for streaming data.

Constructor Summary

Constructor and Description
ZentriOSBLEManager() 

Method Summary

Modifier and Type Method and Description
int adc(int gpio)
Reads the analog voltage of the given pin using the adc.
int beep(int duration)
Activates the buzzer (available on some evaluation boards).
boolean connect(java.lang.String deviceName)
Connects to a device.
boolean connect(java.lang.String deviceName, boolean autoReconnect)
Connects to a device.
void deinit()
De-initialises manager.
boolean disconnect(boolean disableTxNotification)
Disconnects from a device.
int factoryReset(java.lang.String BLEAddress)
Factory resets the device (this will cause the device to drop the connection).
int getBluetoothAddress()
Gets the BLE address of the connected ZentriOS BLE device.
int getBluetoothAdvHighDur()
Gets the BLE advertising high mode duration setting of the connected device.
int getBluetoothAdvHighInt()
Gets BLE advertising high mode interval setting of the connected device.
int getBluetoothAdvLowDur()
Gets the BLE advertising low mode duration setting of the connected device.
int getBluetoothAdvLowInt()
Gets the BLE advertising low mode interval setting of the connected device.
int getBluetoothAdvMode()
Gets the current BLE advertising mode.
int getBluetoothConnectionCount()
Gets number of BLE connections that are currently open on the device (as peripheral).
int getBluetoothServiceUUID()
Gets the service UUID of the connected ZentriOS BLE device.
int getBluetoothTxPowerAdv()
Gets the BLE advertising TX power setting of the connected device.
int getBluetoothTxPowerCon()
Gets the BLE connection TX power setting of the connected device.
int getBusInitMode()
Gets the serial bus initialisation mode of the connected device.
int getBusSerialControl()
Gets the serial bus control mode of the connected device.
int getCentralConCount()
Gets the number of BLE connections that are currently open on the connected device (as a central).
int getCentralConMode()
Gets the central connection mode of the connected device.
int getCentralScanHighDur()
Gets the central scan high mode duration setting of the connected device.
int getCentralScanHighInt()
Gets the central scan high mode interval setting of the connected device.
int getCentralScanLowDur()
Gets the central scan low mode duration setting of the connected device.
int getCentralScanLowInt()
Gets the central scan low mode interval setting of the connected device.
int getCentralScanMode()
Gets the current central scan mode of the connected device.
java.lang.String getDeviceName()
Gets the BLE name of the connected device.
boolean getMode()
Gets the current mode of the connected device.
BLECallbacks.ReceiveMode getReceiveMode()
Gets the current receive mode.
int getSystemActivityTimeout()
Gets the system activity timeout setting of the connected device.
int getSystemBoardName()
Gets the system board name of the connected device.
int getSystemCommandEcho()
Gets the system command echo setting of the connected device.
int getSystemCommandHeader()
Gets the system command header setting of the connected device.
int getSystemCommandPrompt()
Gets the system command prompt setting of the connected device.
int getSystemDeviceName()
Gets the system device name of the connected device.
int getSystemGoToSleepTimeout()
Gets the system go-to-sleep timeout setting of the connected device.
int getSystemIndicatorStatus()
Gets the system indicator status of the connected device.
int getSystemOTAEnable()
Gets the system ota enable setting of the connected device.
int getSystemPrintLevel()
Gets the system print level of the connected device.
int getSystemRemoteEnable()
Gets the system remote mode enable setting of the connected device.
int getSystemUUID()
Gets the system UUID of the connected device.
int getSystemWakeUpTimeout()
Gets the system wake-up timeout setting of the connected device.
int getUARTBaudRate()
Gets the UART baud rate of the connected device.
int getUARTFlowControl()
Gets the UART flow control enable setting of the connected device.
int getUserVariable()
Gets the user storage variable value of the connected device.
int getVersion()
Gets the firmware version of the connected device.
int GPIODirectionSet(int gpio, GPIODirection dir)
Sets the GPIO direction of a pin (function must be set first with GPIOFunctionSet()).
int GPIOFunctionSet(int gpio, GPIOFunction func)
Sets the GPIO function for a pin.
int GPIOGet(int gpio)
Gets the logic value of a gpio pin.
int GPIOSet(int gpio, int value)
Sets the logic value of a gpio pin.
boolean init(android.content.Context context, BLECallbacks callbacks)
Initialise the manager with the given callbacks.
boolean isConnected()
Checks if connected to a device.
boolean isInitialised()
Checks if manager has been initialised.
int pwmStart(int gpio, float dutyCycle, int frequency)
Starts the PWM output on the given gpio.
int pwmStop(int gpio)
Stop PWM output on given pin.
boolean readFirmwareVersion()
Reads the device firmware version (using the characteristic).
int reboot()
Reboots the connected device.
int save()
Saves the current settings on the device to it's non-volatile memory.
int setActivityTimeout(int timeout)
Sets the activity timeout setting of the connected device.
int setBluetoothAdvHighDur(int dur)
Sets the BLE advertising high mode duration of the connected device.
int setBluetoothAdvHighInt(int interval)
Sets the BLE advertising high mode interval of the connected device.
int setBluetoothAdvLowDur(int dur)
Sets the BLE advertising low mode duration of the connected device.
int setBluetoothAdvLowInt(int interval)
Sets the BLE advertising low mode interval of the connected device.
int setBluetoothServiceUUID(java.lang.String uuid)
Sets the BLE service UUID of the connected device from a string.
int setBluetoothServiceUUID(java.util.UUID uuid)
Sets the BLE service UUID of the connected device.
int setBluetoothTxPowerAdv(int power)
Sets the BLE advertising TX power setting of the connected device.
int setBluetoothTxPowerCon(int power)
Sets the BLE connection TX power setting of the connected device.
int setBusInitMode(BusInitMode mode)
Sets the serial bus initialisation mode of the connected device.
int setBusSerialControl(SerialControl control)
Sets the serial bus control mode of the connected device.
int setCentralScanHighDur(int dur)
Sets the central scan high mode duration of the connected device.
int setCentralScanHighInt(int interval)
Sets the central scan high mode interval of the connected device.
int setCentralScanLowDur(int dur)
Sets the central scan high low duration of the connected device.
int setCentralScanLowInt(int interval)
Sets the central scan low mode interval of the connected device.
boolean setMode(int mode)
Sets the mode of the connected device.
boolean setReceiveMode(BLECallbacks.ReceiveMode mode)
Set receive mode.
int setSystemBoardName(java.lang.String name)
Sets the system board name of the connected device.
int setSystemCommandEcho(boolean enabled)
Sets the the system command echo setting of the connected device.
int setSystemCommandHeader(boolean enabled)
Sets the system command header setting of the connected device.
int setSystemCommandMode(CommandMode mode)
Sets the system command mode of the connected device.
int setSystemCommandPrompt(boolean enabled)
Sets the system command prompt setting of the connected device.
int setSystemDeviceName(java.lang.String name)
Sets the name of the connected device that appears during a BLE scan.
int setSystemGoToSleepTimeout(int timeout)
Sets the system go-to-sleep timeout setting of the connected device.
int setSystemGoWakeUpTimeout(int timeout)
Sets the system wake-up timeout setting of the connected device.
int setSystemIndicatorBlinkRate(float dutyDiscon, float periodDiscon, float dutyCon, float periodCon)
Sets the blink rate and duty cycle for the status LED when disconnected and connected.
int setSystemOTAEnable(boolean enabled)
Sets the system OTA enable setting of the connected device.
int setSystemPrintLevel(PrintLevel level)
Sets the system print level of the connected device.
int setSystemRemoteCommandEnable(boolean enabled)
Sets the system remote command enable setting of the connected device.
int setUARTBaudRate(BaudRate baud)
Sets the UART serial port baud rate.
int setUARTFlowControl(boolean enabled)
Sets the UART serial port flow control enable setting of the connected device.
int setUserVariable(java.lang.String value)
Sets the user variable value of the connected device.
int sleep()
Puts the device into sleep mode (low-power).
boolean startScan()
Starts a BLE scan.
boolean stopScan()
Stops a running BLE scan.
int streamMode()
Sets the mode to stream mode by command.
boolean writeData(byte[] data)
Writes binary data to the device.
boolean writeData(java.lang.String data)
Writes String data to the device.
  • Methods inherited from class java.lang.Object

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

Field Detail

  • GPIO_VAL_MIN

    public static final int GPIO_VAL_MIN
    Minimum GPIO value allowed.
    See Also:
    Constant Field Values
  • GPIO_VAL_MAX

    public static final int GPIO_VAL_MAX
    Maximum GPIO value allowed.
    See Also:
    Constant Field Values
  • MODE_STREAM

    public static final int MODE_STREAM
    Mode for streaming data.
    See Also:
    Constant Field Values
  • MODE_COMMAND_LOCAL

    public static final int MODE_COMMAND_LOCAL
    Mode for entering commands via serial terminal (not used over BLE).
    See Also:
    Constant Field Values
  • MODE_COMMAND_REMOTE

    public static final int MODE_COMMAND_REMOTE
    Mode for running commands over BLE.
    See Also:
    Constant Field Values
  • ID_INVALID

    public static final int ID_INVALID
    Value of invalid ID for validation.
    See Also:
    Constant Field Values

Constructor Detail

  • ZentriOSBLEManager

    public ZentriOSBLEManager()

Method Detail

  • init

    public boolean init(android.content.Context context,
               BLECallbacks callbacks)
    Initialise the manager with the given callbacks.
    Parameters:
    context - Android Application context.
    callbacks - callbacks to use
    Returns:
    true on success
  • deinit

    public void deinit()
    De-initialises manager.
  • startScan

    public boolean startScan()
    Starts a BLE scan. Results are returned via the onScanResult() callback.
    Returns:
    true if scan started successfully
    See Also:
    BLECallbacks
  • stopScan

    public boolean stopScan()
    Stops a running BLE scan.
    Returns:
    true if scan stopped successfully
  • connect

    public boolean connect(java.lang.String deviceName)
    Connects to a device. The device must have been detected in the last BLE scan (see startScan).
    Parameters:
    deviceName - name of device to connect to (reported in onScanResult callback)
    Returns:
    true if request submitted successfully
  • connect

    public boolean connect(java.lang.String deviceName,
                  boolean autoReconnect)
    Connects to a device. The device must have been detected in the last BLE scan (see startScan).
    Parameters:
    deviceName - name of device to connect to (reported in onScanResult callback)
    autoReconnect - true if BLE stack should attempt to reconnect automatically if connection is lost
    Returns:
    true if request submitted successfully
  • disconnect

    public boolean disconnect(boolean disableTxNotification)
    Disconnects from a device.
    Parameters:
    disableTxNotification - true if notifications on the TX characteristic should be disabled (enabled on connect)
    Returns:
    true if request submitted successfully
  • isConnected

    public boolean isConnected()
    Checks if connected to a device.
    Returns:
    true if connected
  • isInitialised

    public boolean isInitialised()
    Checks if manager has been initialised.
    Returns:
    true if init has been called
  • setMode

    public boolean setMode(int mode)
    Sets the mode of the connected device.
    Parameters:
    mode - mode to set (see MODE_COMMAND_REMOTE and MODE_STREAM)
    Returns:
    true if request submitted successfully
  • getMode

    public boolean getMode()
    Gets the current mode of the connected device.
    Returns:
    true if request submitted successfully
  • getDeviceName

    public java.lang.String getDeviceName()
    Gets the BLE name of the connected device.
    Returns:
    name of device
  • adc

    public int adc(int gpio)
    Reads the analog voltage of the given pin using the adc. NOTE: Not all pins support ADC, see the ZentriOS BLE wiki for details.
    Parameters:
    gpio - GPIO# of pin to read
    Returns:
    command ID (matches a response)
  • beep

    public int beep(int duration)
    Activates the buzzer (available on some evaluation boards).
    Parameters:
    duration - duration in ms to activate for (50 - 1000)
    Returns:
    command ID (matches a response)
  • factoryReset

    public int factoryReset(java.lang.String BLEAddress)
    Factory resets the device (this will cause the device to drop the connection).
    Parameters:
    BLEAddress - BLE address (used to prevent accidental resets).
    Returns:
    command ID (matches a response)
  • GPIOFunctionSet

    public int GPIOFunctionSet(int gpio,
                      GPIOFunction func)
    Sets the GPIO function for a pin. If a function is already set, it must be cleared before setting again. Clear the current function by setting it to NONE.
    Parameters:
    gpio - GPIO# of pin
    func - function to set
    Returns:
    command ID (matches a response)
  • GPIODirectionSet

    public int GPIODirectionSet(int gpio,
                       GPIODirection dir)
    Sets the GPIO direction of a pin (function must be set first with GPIOFunctionSet()).
    Parameters:
    gpio - GPIO# of pin
    dir - stdio direction to set
    Returns:
    command ID (matches a response)
  • GPIOGet

    public int GPIOGet(int gpio)
    Gets the logic value of a gpio pin. The function must be set to stdio.
    Parameters:
    gpio - GPIO# of pin
    Returns:
    command ID (matches a response)
    See Also:
    GPIOFunction
  • GPIOSet

    public int GPIOSet(int gpio,
              int value)
    Sets the logic value of a gpio pin. The function must be set to stdio.
    Parameters:
    gpio - GPIO# of pin
    value - value to set, see GPIO_VAL_MIN and GPIO_VAL_MAX
    Returns:
    command ID (matches a response)
  • getBluetoothAddress

    public int getBluetoothAddress()
    Gets the BLE address of the connected ZentriOS BLE device.
    Returns:
    command ID (matches a response)
  • getBluetoothConnectionCount

    public int getBluetoothConnectionCount()
    Gets number of BLE connections that are currently open on the device (as peripheral).
    Returns:
    command ID (matches a response)
  • getBluetoothServiceUUID

    public int getBluetoothServiceUUID()
    Gets the service UUID of the connected ZentriOS BLE device.
    Returns:
    command ID (matches a response)
  • getBluetoothTxPowerAdv

    public int getBluetoothTxPowerAdv()
    Gets the BLE advertising TX power setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBluetoothTxPowerCon

    public int getBluetoothTxPowerCon()
    Gets the BLE connection TX power setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBluetoothAdvMode

    public int getBluetoothAdvMode()
    Gets the current BLE advertising mode.
    Returns:
    command ID (matches a response)
  • getBluetoothAdvHighDur

    public int getBluetoothAdvHighDur()
    Gets the BLE advertising high mode duration setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBluetoothAdvHighInt

    public int getBluetoothAdvHighInt()
    Gets BLE advertising high mode interval setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBluetoothAdvLowDur

    public int getBluetoothAdvLowDur()
    Gets the BLE advertising low mode duration setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBluetoothAdvLowInt

    public int getBluetoothAdvLowInt()
    Gets the BLE advertising low mode interval setting of the connected device.
    Returns:
    command ID (matches a response)
  • getBusInitMode

    public int getBusInitMode()
    Gets the serial bus initialisation mode of the connected device.
    Returns:
    command ID (matches a response)
  • getBusSerialControl

    public int getBusSerialControl()
    Gets the serial bus control mode of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralConCount

    public int getCentralConCount()
    Gets the number of BLE connections that are currently open on the connected device (as a central).
    Returns:
    command ID (matches a response)
  • getCentralConMode

    public int getCentralConMode()
    Gets the central connection mode of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralScanHighDur

    public int getCentralScanHighDur()
    Gets the central scan high mode duration setting of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralScanHighInt

    public int getCentralScanHighInt()
    Gets the central scan high mode interval setting of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralScanLowDur

    public int getCentralScanLowDur()
    Gets the central scan low mode duration setting of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralScanLowInt

    public int getCentralScanLowInt()
    Gets the central scan low mode interval setting of the connected device.
    Returns:
    command ID (matches a response)
  • getCentralScanMode

    public int getCentralScanMode()
    Gets the current central scan mode of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemActivityTimeout

    public int getSystemActivityTimeout()
    Gets the system activity timeout setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemBoardName

    public int getSystemBoardName()
    Gets the system board name of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemCommandEcho

    public int getSystemCommandEcho()
    Gets the system command echo setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemCommandHeader

    public int getSystemCommandHeader()
    Gets the system command header setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemCommandPrompt

    public int getSystemCommandPrompt()
    Gets the system command prompt setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemDeviceName

    public int getSystemDeviceName()
    Gets the system device name of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemIndicatorStatus

    public int getSystemIndicatorStatus()
    Gets the system indicator status of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemOTAEnable

    public int getSystemOTAEnable()
    Gets the system ota enable setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemPrintLevel

    public int getSystemPrintLevel()
    Gets the system print level of the connected device.
    Returns:
    command ID (matches a response)
    See Also:
    PrintLevel
  • getSystemRemoteEnable

    public int getSystemRemoteEnable()
    Gets the system remote mode enable setting of the connected device.
    NOTE: This must be enabled to control the device over BLE!.
    Returns:
    command ID (matches a response)
  • getSystemGoToSleepTimeout

    public int getSystemGoToSleepTimeout()
    Gets the system go-to-sleep timeout setting of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemUUID

    public int getSystemUUID()
    Gets the system UUID of the connected device.
    Returns:
    command ID (matches a response)
  • getVersion

    public int getVersion()
    Gets the firmware version of the connected device.
    Returns:
    command ID (matches a response)
  • getSystemWakeUpTimeout

    public int getSystemWakeUpTimeout()
    Gets the system wake-up timeout setting of the connected device.
    Returns:
    command ID (matches a response)
  • getUARTBaudRate

    public int getUARTBaudRate()
    Gets the UART baud rate of the connected device.
    Returns:
    command ID (matches a response)
    See Also:
    for supported rates
  • getUARTFlowControl

    public int getUARTFlowControl()
    Gets the UART flow control enable setting of the connected device.
    Returns:
    command ID (matches a response)
  • getUserVariable

    public int getUserVariable()
    Gets the user storage variable value of the connected device.
    Returns:
    command ID (matches a response)
  • pwmStart

    public int pwmStart(int gpio,
               float dutyCycle,
               int frequency)
    Starts the PWM output on the given gpio.
    NOTE: Not all pins support PWM, see the ZentriOS BLE wiki for details.
    Parameters:
    gpio - pin to enable PWM for
    dutyCycle - duty cycle of output (0 - 1)
    frequency - frequency of output (128 - 65536 Hz)
    Returns:
    command ID (matches a response)
  • pwmStop

    public int pwmStop(int gpio)
    Stop PWM output on given pin.
    Parameters:
    gpio - pin with PWM enabled
    Returns:
    command ID (matches a response)
  • reboot

    public int reboot()
    Reboots the connected device.
    NOTE: This will cause the connection to drop and cause errors!
    Returns:
    command ID (matches a response)
  • save

    public int save()
    Saves the current settings on the device to it's non-volatile memory.
    Returns:
    command ID (matches a response)
  • setBluetoothServiceUUID

    public int setBluetoothServiceUUID(java.util.UUID uuid)
    Sets the BLE service UUID of the connected device.
    Parameters:
    uuid - 128-bit UUID to set
    Returns:
    command ID (matches a response)
  • setBluetoothServiceUUID

    public int setBluetoothServiceUUID(java.lang.String uuid)
    Sets the BLE service UUID of the connected device from a string.
    Parameters:
    uuid - 128-bit UUID to set as a string eg "175f8f23-a570-49bd-9627-815a6a27de2a"
    Returns:
    command ID (matches a response)
  • setBluetoothTxPowerAdv

    public int setBluetoothTxPowerAdv(int power)
    Sets the BLE advertising TX power setting of the connected device.
    Parameters:
    power - power in dBm (-25 to 4)
    Returns:
    command ID (matches a response)
  • setBluetoothTxPowerCon

    public int setBluetoothTxPowerCon(int power)
    Sets the BLE connection TX power setting of the connected device.
    Parameters:
    power - power in dBm (-25 to 4)
    Returns:
    command ID (matches a response)
  • setBluetoothAdvHighDur

    public int setBluetoothAdvHighDur(int dur)
    Sets the BLE advertising high mode duration of the connected device.
    Parameters:
    dur - duration in secs (0-1000, 0=forever)
    Returns:
    command ID (matches a response)
  • setBluetoothAdvHighInt

    public int setBluetoothAdvHighInt(int interval)
    Sets the BLE advertising high mode interval of the connected device.
    Parameters:
    interval - interval slots (32-8000)
    Returns:
    command ID (matches a response)
  • setBluetoothAdvLowDur

    public int setBluetoothAdvLowDur(int dur)
    Sets the BLE advertising low mode duration of the connected device.
    Parameters:
    dur - duration in secs (0-1000, 0=forever)
    Returns:
    command ID (matches a response)
  • setBluetoothAdvLowInt

    public int setBluetoothAdvLowInt(int interval)
    Sets the BLE advertising low mode interval of the connected device.
    Parameters:
    interval - interval slots (32-8000)
    Returns:
    command ID (matches a response)
  • setBusInitMode

    public int setBusInitMode(BusInitMode mode)
    Sets the serial bus initialisation mode of the connected device.
    Parameters:
    mode - mode to set
    Returns:
    command ID (matches a response)
    See Also:
    BusInitMode
  • setBusSerialControl

    public int setBusSerialControl(SerialControl control)
    Sets the serial bus control mode of the connected device.
    Parameters:
    control - control setting
    Returns:
    command ID (matches a response)
    See Also:
    SerialControl
  • setCentralScanHighDur

    public int setCentralScanHighDur(int dur)
    Sets the central scan high mode duration of the connected device.
    Parameters:
    dur - duration in secs (0-1000, 0=forever)
    Returns:
    command ID (matches a response)
  • setCentralScanHighInt

    public int setCentralScanHighInt(int interval)
    Sets the central scan high mode interval of the connected device.
    Parameters:
    interval - interval slots (32-8000)
    Returns:
    command ID (matches a response)
  • setCentralScanLowDur

    public int setCentralScanLowDur(int dur)
    Sets the central scan high low duration of the connected device.
    Parameters:
    dur - duration in secs (0-1000, 0=forever)
    Returns:
    command ID (matches a response)
  • setCentralScanLowInt

    public int setCentralScanLowInt(int interval)
    Sets the central scan low mode interval of the connected device.
    Parameters:
    interval - interval slots (32-8000)
    Returns:
    command ID (matches a response)
  • setActivityTimeout

    public int setActivityTimeout(int timeout)
    Sets the activity timeout setting of the connected device.
    Parameters:
    timeout - timeout is secs
    Returns:
    command ID (matches a response)
  • setSystemBoardName

    public int setSystemBoardName(java.lang.String name)
    Sets the system board name of the connected device.
    Parameters:
    name - name to set
    Returns:
    command ID (matches a response)
  • setSystemCommandEcho

    public int setSystemCommandEcho(boolean enabled)
    Sets the the system command echo setting of the connected device.
    Parameters:
    enabled - true to enable serial echo
    Returns:
    command ID (matches a response)
  • setSystemCommandHeader

    public int setSystemCommandHeader(boolean enabled)
    Sets the system command header setting of the connected device.
    Parameters:
    enabled - true to enable command headers
    Returns:
    command ID (matches a response)
  • setSystemCommandMode

    public int setSystemCommandMode(CommandMode mode)
    Sets the system command mode of the connected device.
    Parameters:
    mode - command mode to set
    Returns:
    command ID (matches a response)
    See Also:
    CommandMode
  • setSystemCommandPrompt

    public int setSystemCommandPrompt(boolean enabled)
    Sets the system command prompt setting of the connected device.
    Parameters:
    enabled - true to enable the command prompt
    Returns:
    command ID (matches a response)
  • setSystemDeviceName

    public int setSystemDeviceName(java.lang.String name)
    Sets the name of the connected device that appears during a BLE scan.
    Parameters:
    name - name to set
    Returns:
    command ID (matches a response)
  • setSystemIndicatorBlinkRate

    public int setSystemIndicatorBlinkRate(float dutyDiscon,
                                  float periodDiscon,
                                  float dutyCon,
                                  float periodCon)
    Sets the blink rate and duty cycle for the status LED when disconnected and connected.
    Parameters:
    dutyDiscon - duty cycle of PWM output when disconnected (0.0 - 1.0)
    periodDiscon - period of PWM output when disconnected in secs
    dutyCon - duty cycle of PWM output when connected (0.0 - 1.0)
    periodCon - period of PWM output when connected in secs
    Returns:
    command ID (matches a response)
  • setSystemOTAEnable

    public int setSystemOTAEnable(boolean enabled)
    Sets the system OTA enable setting of the connected device.
    NOTE: This must be enabled for the device to be able to OTA update firmware.
    Parameters:
    enabled - true to enable OTA updates
    Returns:
    command ID (matches a response)
  • setSystemPrintLevel

    public int setSystemPrintLevel(PrintLevel level)
    Sets the system print level of the connected device.
    Parameters:
    level - print level to set
    Returns:
    command ID (matches a response)
    See Also:
    PrintLevel
  • setSystemRemoteCommandEnable

    public int setSystemRemoteCommandEnable(boolean enabled)
    Sets the system remote command enable setting of the connected device.
    NOTE: This must be enabled to control the device over BLE!
    Parameters:
    enabled - true to enable remote command mode
    Returns:
    command ID (matches a response)
  • setSystemGoToSleepTimeout

    public int setSystemGoToSleepTimeout(int timeout)
    Sets the system go-to-sleep timeout setting of the connected device.
    Parameters:
    timeout - timeout after which the device will go to sleep in secs (10 - 86400, 0 to disable)
    Returns:
    command ID (matches a response)
  • setSystemGoWakeUpTimeout

    public int setSystemGoWakeUpTimeout(int timeout)
    Sets the system wake-up timeout setting of the connected device.
    Parameters:
    timeout - Timeout after which the device will wake-up from sleep, in secs (10 - 86400, 0 to disable)
    Returns:
    command ID (matches a response)
  • setUARTBaudRate

    public int setUARTBaudRate(BaudRate baud)
    Sets the UART serial port baud rate. Limited rates are supported.
    Parameters:
    baud - baud rate to set
    Returns:
    command ID (matches a response)
    See Also:
    BaudRate
  • setUARTFlowControl

    public int setUARTFlowControl(boolean enabled)
    Sets the UART serial port flow control enable setting of the connected device.
    Parameters:
    enabled - true to enable serial port flow control
    Returns:
    command ID (matches a response)
  • setUserVariable

    public int setUserVariable(java.lang.String value)
    Sets the user variable value of the connected device.
    Parameters:
    value - value to set (32 bytes)
    Returns:
    command ID (matches a response)
  • sleep

    public int sleep()
    Puts the device into sleep mode (low-power).
    NOTE: This will cause the connection to drop and cause errors!
    Returns:
    command ID (matches a response)
  • streamMode

    public int streamMode()
    Sets the mode to stream mode by command.
    NOTE: This should be avoided.
    Returns:
    command ID (matches a response)
    See Also:
    setMode(int)
  • writeData

    public boolean writeData(java.lang.String data)
    Writes String data to the device. The device should be in stream mode.
    Parameters:
    data - data to send
    Returns:
    true if the write request was submitted successfully
  • writeData

    public boolean writeData(byte[] data)
    Writes binary data to the device. The device should be in stream mode.
    Parameters:
    data - data to send
    Returns:
    true if the write request was submitted successfully
  • readFirmwareVersion

    public boolean readFirmwareVersion()
    Reads the device firmware version (using the characteristic).
    Returns:
    true if the request was submitted successfully