Difference between revisions of "Device (Java)"

From Neurotech Software Development Kit
Jump to: navigation, search
(Method Detail)
(Method Detail)
Line 101: Line 101:
 
Disconnects from device. Check DeviceState parameter or subscribe parameterChanged event for operation result
 
Disconnects from device. Check DeviceState parameter or subscribe parameterChanged event for operation result
  
<h3>getState</h3>
+
<h3>channels</h3>
<code><span style="color:#0066FF;">'''public'''</span> [[NeuroDeviceState Enumeration|NeuroDeviceState]] getState()</code>
+
<code><span style="color:#0066FF;">'''public'''</span> [[ChannelInfo (Java)|ChannelInfo]][] channels()</code>
  
Returns NeuroDevice state
+
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.
 
<dl>
 
<dl>
 
<dt><span>Returns:</span></dt>
 
<dt><span>Returns:</span></dt>
<dd>Device state</dd>
+
<dd>Array of channel info objects</dd>
 
</dl>
 
</dl>
  
<h3>getError</h3>
+
<h3>commands</h3>
 
<code><span style="color:#0066FF;">'''public'''</span> [[NeuroDeviceError Enumeration|NeuroDeviceError]] getError()</code>
 
<code><span style="color:#0066FF;">'''public'''</span> [[NeuroDeviceError Enumeration|NeuroDeviceError]] getError()</code>
  
Line 119: Line 122:
 
</dl>
 
</dl>
  
<h3>getName</h3>
+
<h3>parameters</h3>
 
<code><span style="color:#0066FF;">'''public'''</span> java.lang.String getName()</code>
 
<code><span style="color:#0066FF;">'''public'''</span> java.lang.String getName()</code>
  

Revision as of 09:36, 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

DeviceFeature[] getFeature()

Returns supported device features

java.lang.String getName()

Returns name of BLE device

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 NeuroDeviceError getError()

Returns error type if device is in error state

Returns:
Error type for device error state

parameters

public java.lang.String getName()

Description copied from class: VisualizableDevice

Returns name of BLE device

Specified by:
VisualizableDevice.getName() in class VisualizableDevice
Returns:
BLE device name

getAddress

public java.lang.String getAddress()

Description copied from class: VisualizableDevice

Returns Bluetooth LE MAC address
Specified by:
VisualizableDevice.getAddress() in class VisualizableDevice
Returns:
device unique address

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