Difference between revisions of "Device (Java)"

From Neurotech Software Development Kit
Jump to: navigation, search
(Methods Summary)
(Method Detail)
Line 123: Line 123:
 
</dl>
 
</dl>
  
<h3>getAddress</h3>
+
<h3>execute</h3>
<code><span style="color:#0066FF;">'''public'''</span>&nbsp;java.lang.String&nbsp;getAddress()</code>
+
<code><span style="color:#0066FF;">'''public boolean'''</span>&nbsp;execute([[Command (Java)|Command]] cmd)</code>
  
<span>'''Description copied from class:''' [[VisualizableDevice Class|VisualizableDevice]]</span>
+
Tries to execute command and returns value indicating operations success.
  
<div class="block">Returns Bluetooth LE MAC address
+
Will throw if device does not support specified command. To get supported commands call commands() method.
 
<dl>
 
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
+
<dt><span>Parameters:</span></dt>
<dd><code>[[VisualizableDevice Class#getDeviceAddress|VisualizableDevice.getAddress()]]</code> in class VisualizableDevice</dd>
+
<dd>cmd - Command to execute</dd>
 
<dt><span>Returns:</span></dt>
 
<dt><span>Returns:</span></dt>
<dd>device unique address</dd>
+
<dd>Operation success indicator</dd>
 +
<dt><span>Throws:</span></dt>
 +
<dd>java.lang.UnsupportedOperationException</dd>
 
</dl>
 
</dl>
  

Revision as of 10:56, 28 April 2018

ru.neuromd.neurosdk

Class Device

Related Classes

ru.neuromd.neurosdk.DeviceScanner

Classes hierarchy

  • java.lang.Object
    • ru.neuromd.neurosdk.Device

Class definition

public class Device

The Device class is an abstraction for NeuroMD BLE devices. This abstraction provides functions for changing of device state by executing commands and setting parameters. Each device have different sets of supported commands and parameters, Device class has functions designed to get information about these sets. Callibri and Braibit devices has different parameters sets and provides different ways to access them. Device class hides all differences behind its interface and provides universal way to read and write parameters, execute commands and receive biopotential signals.

Fields Summary

Modifier and Type Field and Description
SubscribersNotifier<ParameterName> parameterChanged

Subscribe this event to receive notifications about changes of device parameters

Constructor Summary

You are not able to create Device directly. Use DeviceScanner to find and create devices

Methods Summary

Modifier and Type Method and Description
void connect()

Establishes connection with device services

void disconnect()

Disconnects from device

ChannelInfo[] channels()

Returns information about supported channels. Check this information before creation of channel. If device does not support channel, channel object won't be initialized.

Command[] commands()

Returns supported commands of a device

Parameter[] parameters()

Returns all available parameters of device, their types and access rights

boolean execute()

Tries to execute command and returns value indicating operation success.

boolean setParam()

Sets value for specified parameter and returns value indicating success of operation.

<ParamType>

ParamType

readParam()

Return value of specified parameter of device.

Field Detail

parameterChanged

public final SubscribersNotifier<ParameterName> parameterChanged

Subscribe this event to receive notifications about changes of device parameters

Method Detail

connect

public void connect()

Tries to establish connection with device. Check DeviceState parameter or subscribe parameterChanged event for operation result.

disconnect

public void disconnect()

Disconnects from device. Check DeviceState parameter or subscribe parameterChanged event for operation result

channels

public ChannelInfo[] channels()

Returns information about supported channels.

Check this information before creation of channel. If device does not support channel, channel object won't be initialized with it.

Returns:
Array of channel info objects

commands

public Command[] commands()

Returns supported commands of device

Returns:
Array of supported commands

parameters

public Parameter[] parameters()

Returns all available parameters of device, their types and access rights

Returns:
Array of available parameters

execute

public boolean execute(Command cmd)

Tries to execute command and returns value indicating operations success.

Will throw if device does not support specified command. To get supported commands call commands() method.

Parameters:
cmd - Command to execute
Returns:
Operation success indicator
Throws:
java.lang.UnsupportedOperationException

getBatteryLevel

public int getBatteryLevel()

Description copied from class: VisualizableDevice

Returns battery state

Specified by:
VisualizableDevice.getBatteryLevel() in class VisualizableDevice
Returns:
battery charge level in percents

getNeuroDevice

public NeuroDevice getNeuroDevice()

Description copied from class: VisualizableDevice Returns this object. This method is for comapatability with VisualizableDevice class interface, inherited to use NeuroDevice in scopes where VisualizableDevice is needed

Specified by:
VisualizableDevice.getNeuroDevice() in class VisualizableDevice
Returns:
This NeuroDevice object


getSignalSubsystem

public SignalSubsystem getSignalSubsystem()

Returns subsystem for SIGNAL device feature

Returns:
Signal subsystem of device. Null if is not supported

getStimulationSubsystem

public StimulationSubsystem getStimulationSubsystem()

Returns subsystem for STIMUL device feature

Returns:
Stimulation subsystem of device. Null if is not supported

getFeatures

public DeviceFeature[] getFeatures()

Returns supported device features

Returns:
Device features