C++ API
Loading...
Searching...
No Matches
Plux::SignalsDev Class Reference

Base class for PLUX signal-acquiring devices. More...

#include <plux.h>

Inheritance diagram for Plux::SignalsDev:
Plux::BaseDev Plux::BITalinoDev Plux::MemoryDev

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.
 
- Public Member Functions inherited from Plux::BaseDev
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

- Public Types inherited from Plux::BaseDev
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 Public Member Functions inherited from Plux::BaseDev
static DevInfos findDevices (const String &domain="")
 Finds PLUX devices within the given domain.
 

Detailed Description

Base class for PLUX signal-acquiring devices.

Constructor & Destructor Documentation

◆ SignalsDev() [1/2]

Plux::SignalsDev::SignalsDev ( const String path)

Connects to a PLUX device.

Parameters
pathPath to the PLUX device. It has the same meaning as in BaseDev::BaseDev().

◆ SignalsDev() [2/2]

Plux::SignalsDev::SignalsDev ( BaseDev baseDev)

Promotes a BaseDev instance to SignalsDev.

Parameters
baseDevInstance to be promoted. If promotion is successful, baseDev is no longer valid.

Member Function Documentation

◆ start() [1/3]

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.

Parameters
freqAcquisition sampling frequency in Hertz.
portMaskBitmask of the device ports to acquire. The least significant bit corresponds to port 1, the next bit to port 2, etc. See Source::port.
nBitsSampling resolution in bits. It can be 8 or 16. This parameter is ignored for BITalino devices.

◆ start() [2/3]

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.

Parameters
freqAcquisition sampling frequency in Hertz.
portsPorts to acquire. See Source::port.
nBitsSampling resolution in bits. It can be 8 or 16. This parameter is ignored for BITalino devices.

◆ start() [3/3]

void Plux::SignalsDev::start ( float  baseFreq,
const Sources sources 
)

Starts a real-time acquisition session.

Parameters
baseFreqAcquisition base sampling frequency in Hertz.
sourcesSignal sources to acquire. See Source.
Remarks
This method is not supported on BITalino devices.

◆ stop()

void Plux::SignalsDev::stop ( void  )

Stops a real-time acquisition session.

Remarks
Call MemoryDev::stopSessionAcq() to stop an internal acquisition session.

◆ getNumChannels()

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.

◆ setDOut()

void Plux::SignalsDev::setDOut ( bool  state)

Sets the digital output state.

Parameters
stateOutput state to assign. If true, output is set to High, otherwise it is set to Low.
Remarks
On BITalino devices, only the first output (O1) is assigned to the given state. The other outputs are set to Low. Call BITalinoDev::setDOut() to assign all digital outputs.

◆ onRawFrame()

virtual bool Plux::SignalsDev::onRawFrame ( int  nSeq,
const int  data[] 
)
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.

Parameters
nSeqSequence 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.
dataFrame 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().
Returns
Return true to exit message loop or false otherwise. Default callback returns false.

The documentation for this class was generated from the following file: