![]() |
C++ API
|
Base class for PLUX signal-acquiring devices. More...
#include <plux.h>
Public Member Functions | |
SignalsDev (const String &path) | |
Connects to a PLUX device. | |
SignalsDev (BaseDev &baseDev) | |
Promotes a BaseDev instance to SignalsDev. | |
void | getSensors (Sensors &sensors) |
Returns information about attached sensors and internal sensors. | |
void | start (float freq, int portMask, int nBits) |
Starts a real-time acquisition session. | |
void | start (float freq, const Ints &ports, int nBits) |
Starts a real-time acquisition session. | |
void | start (float baseFreq, const Sources &sources) |
Starts a real-time acquisition session. | |
void | stop (void) |
Stops a real-time acquisition session. | |
int | getNumChannels (void) |
Returns the total number of acquisition channels. | |
void | setDOut (bool state) |
Sets the digital output state. | |
virtual bool | onRawFrame (int nSeq, const int data[]) |
Raw frames callback. | |
![]() | |
virtual void | onFoundDevice (const char *path, const char *description) |
DevInfos | findDevicesWithCallback (void) |
BaseDev (const String &path) | |
Connects to a PLUX device. | |
virtual | ~BaseDev (void) |
Disconnects from the device. | |
Properties | getProperties (void) |
Returns the device properties. | |
void | setParameter (int port, int index, const void *data, int dataLen) |
Sets a system or sensor parameter value. | |
float | getBattery (void) |
Returns the remaining battery charge as a percentage of full capacity. | |
void | setTimeout (int timeout=-1) |
Sets the receiving timeout value for loop(). | |
void | loop (void) |
Runs the device message loop. | |
void | interrupt (void *param=NULL) |
Sends an interrupt signal to loop(). | |
virtual bool | onEvent (const Event &evt) |
Event callback. | |
virtual bool | onTimeout (void) |
Timeout callback. | |
virtual bool | onInterrupt (void *param) |
Interrupt signal callback. | |
Additional Inherited Members | |
![]() | |
enum | ProductId { PID_BioPlux = 0x0101 , PID_BiosignalsPlux = 0x0201 , PID_BiosignalsPluxPRO = 0x0205 , PID_MotionPlux = 0x020A , PID_OpenBan = 0x0214 , PID_OpenBanV2_DDME = 0x0215 , PID_OpenBanV2 = 0x0216 , PID_fNIRS = 0x021E , PID_StimPlux = 0x0301 , PID_MuscleBan = 0x0502 , PID_BITalino = 0x0601 , PID_BITalinoRev = 0x0602 , PID_scoliosis = 0x0701 , PID_MuscleBanWearable = 0x0801 , PID_CardioBanWearable = 0x0802 , PID_RespiBanWearable = 0x0803 } |
Product ID enumeration. More... | |
![]() | |
static DevInfos | findDevices (const String &domain="") |
Finds PLUX devices within the given domain. | |
Base class for PLUX signal-acquiring devices.
Plux::SignalsDev::SignalsDev | ( | const String & | path | ) |
Connects to a PLUX device.
path | Path to the PLUX device. It has the same meaning as in BaseDev::BaseDev(). |
Plux::SignalsDev::SignalsDev | ( | BaseDev & | baseDev | ) |
Promotes a BaseDev instance to SignalsDev.
baseDev | Instance to be promoted. If promotion is successful, baseDev is no longer valid. |
void Plux::SignalsDev::start | ( | float | freq, |
int | portMask, | ||
int | nBits | ||
) |
Starts a real-time acquisition session.
This method is a shortcut to start(float baseFreq, const Sources &sources). It can be called if all requested sources are to be sampled at the same frequency and resolution, and at their channel 0 only.
freq | Acquisition sampling frequency in Hertz. |
portMask | Bitmask of the device ports to acquire. The least significant bit corresponds to port 1, the next bit to port 2, etc. See Source::port. |
nBits | Sampling resolution in bits. It can be 8 or 16. This parameter is ignored for BITalino devices. |
void Plux::SignalsDev::start | ( | float | freq, |
const Ints & | ports, | ||
int | nBits | ||
) |
Starts a real-time acquisition session.
This method is a shortcut to start(float baseFreq, const Sources &sources). It can be called if all requested sources are to be sampled at the same frequency and resolution, and at their channel 0 only.
freq | Acquisition sampling frequency in Hertz. |
ports | Ports to acquire. See Source::port. |
nBits | Sampling resolution in bits. It can be 8 or 16. This parameter is ignored for BITalino devices. |
void Plux::SignalsDev::start | ( | float | baseFreq, |
const Sources & | sources | ||
) |
Starts a real-time acquisition session.
baseFreq | Acquisition base sampling frequency in Hertz. |
sources | Signal sources to acquire. See Source. |
void Plux::SignalsDev::stop | ( | void | ) |
Stops a real-time acquisition session.
int Plux::SignalsDev::getNumChannels | ( | void | ) |
Returns the total number of acquisition channels.
The returned value is the total number of channels across all the acquisition sources, or zero if the device is stopped. This value is the number of elements of the data array passed to the onRawFrame() callback.
void Plux::SignalsDev::setDOut | ( | bool | state | ) |
Sets the digital output state.
state | Output state to assign. If true, output is set to High, otherwise it is set to Low. |
|
inlinevirtual |
Raw frames callback.
This callback is called by message loop when a real-time data acquisition frame is received from the device. In order to receive data frames, an application must derive SignalsDev class (or any of its derived classes) to a new class and override this method in the new class.
nSeq | Sequence number of the frame. This number is zero for the first frame of the acquisition session, and then incremented by one for every subsequent frame. If this number differs more than one between consecutive frames, it means that data frames for the missing sequence numbers were lost, possibly due to connection problems. |
data | Frame sampling data. Each value is acquired from a channel of each requested source, in the same source order as given in start(float baseFreq, const Sources &sources), or in the same port order as given in start(float freq, const Ints &ports, int nBits), or from lower ports to higher ports as given in start(float freq, int portMask, int nBits). For each multi-channel source, the values are presented from lower channels to higher channels. The values range for 16-bit samples is 0...65535 and for 8-bit samples is 0...255 . The values for a source with a frequency divisor greater than one are updated only in the frames with a sequence number multiple of the frequency divisor value. The number of elements of this array can be obtained by calling getNumChannels(). |