![]() |
Python API
|
Base class for PLUX signal-acquiring devices. More...
Public Member Functions | |
__init__ (self, path) | |
Connects to a PLUX device. | |
__init__ (self, baseDev) | |
Promotes a BaseDev instance to SignalsDev. | |
getSensors (self) | |
Returns information about attached sensors and internal sensors. | |
start (self, baseFreq, sources) | |
Starts a real-time acquisition session. | |
start (self, freq, portMask, nBits) | |
Starts a real-time acquisition session. | |
start (self, freq, ports, nBits) | |
Starts a real-time acquisition session. | |
stop (self) | |
Stops a real-time acquisition session. | |
getNumChannels (self) | |
Returns the total number of acquisition channels. | |
setDOut (self, state) | |
Sets the digital output state. | |
onRawFrame (self, nSeq, data) | |
Raw frames callback. | |
![]() | |
getProperties (self) | |
Returns the device properties. | |
setParameter (self, port, index, data) | |
Sets a system or sensor parameter value. | |
getBattery (self) | |
Returns a float number with the remaining battery charge as a percentage of full capacity. | |
setTimeout (self, timeout=-1) | |
Sets the receiving timeout value for loop(). | |
loop (self) | |
Runs the device message loop. | |
interrupt (self, param=None) | |
Sends an interrupt signal to loop(). | |
onEvent (self, event) | |
Event callback. | |
onTimeout (self) | |
Timeout callback. | |
onInterrupt (self, param) | |
Interrupt signal callback. | |
close () | |
Disconnects from the device. | |
Additional Inherited Members | |
![]() | |
findDevices (domain='') | |
Finds PLUX devices within the given domain. | |
Base class for PLUX signal-acquiring devices.
plux.SignalsDev.__init__ | ( | self, | |
path | |||
) |
Connects to a PLUX device.
path | A string with the path to the PLUX device. It has the same meaning as in BaseDev.__init__(). |
Reimplemented from plux.BaseDev.
Reimplemented in plux.MemoryDev, plux.BITalinoDev, plux.MemoryDev, and plux.BITalinoDev.
plux.SignalsDev.__init__ | ( | self, | |
baseDev | |||
) |
Promotes a BaseDev instance to SignalsDev.
baseDev | The BaseDev instance to be promoted. If promotion is successful, baseDev is no longer valid. |
Reimplemented from plux.BaseDev.
Reimplemented in plux.MemoryDev, plux.BITalinoDev, plux.MemoryDev, and plux.BITalinoDev.
plux.SignalsDev.getSensors | ( | self | ) |
Returns information about attached sensors and internal sensors.
The data is returned as a dictionary of Sensor objects indexed by each sensor port.
plux.SignalsDev.start | ( | self, | |
baseFreq, | |||
sources | |||
) |
Starts a real-time acquisition session.
baseFreq | Acquisition base sampling frequency in Hertz. |
sources | A sequence of Source objects, or a single Source object. Each Source object represents a signal source to acquire. |
plux.SignalsDev.start | ( | self, | |
freq, | |||
portMask, | |||
nBits | |||
) |
Starts a real-time acquisition session.
This method is a shortcut to start(self, baseFreq, 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 | An integer representing a 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. |
plux.SignalsDev.start | ( | self, | |
freq, | |||
ports, | |||
nBits | |||
) |
Starts a real-time acquisition session.
This method is a shortcut to start(self, baseFreq, 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 | A sequence of integers representing the ports to acquire. See Source.port. |
nBits | Sampling resolution in bits. It can be 8 or 16. This parameter is ignored for BITalino devices. |
plux.SignalsDev.stop | ( | self | ) |
Stops a real-time acquisition session.
plux.SignalsDev.getNumChannels | ( | self | ) |
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 tuple passed to the onRawFrame() callback.
plux.SignalsDev.setDOut | ( | self, | |
state | |||
) |
Sets the digital output state.
state | A boolean to define output state. If True, output is set to High, otherwise it is set to Low. |
Reimplemented in plux.BITalinoDev.
plux.SignalsDev.onRawFrame | ( | self, | |
nSeq, | |||
data | |||
) |
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 | The 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 | The frame sampling data as a tuple of integers. Each value is acquired from a channel of each requested source, in the same source order as given in start(self, baseFreq, sources), or in the same port order as given in start(self, freq, ports, nBits), or from lower ports to higher ports in start(self, freq, portMask, 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 tuple can be obtained by calling getNumChannels(). |