The DsoControl abstraction layer for Hantek USB DSOs. TODO Please anyone, refactor this class into smaller pieces (Separation of Concerns!).
More...
#include <hantekdsocontrol.h>
|
| void | enableSampling (bool enabled) |
| | If sampling is disabled, no samplesAvailable() signals are send anymore, no samples are fetched from the device and no processing takes place. More...
|
| |
| Dso::ErrorCode | setRecordLength (unsigned size) |
| | Sets the size of the oscilloscopes sample buffer. More...
|
| |
| Dso::ErrorCode | setSamplerate (double samplerate=0.0) |
| | Sets the samplerate of the oscilloscope. More...
|
| |
| Dso::ErrorCode | setRecordTime (double duration=0.0) |
| | Sets the time duration of one aquisition by adapting the samplerate. More...
|
| |
| Dso::ErrorCode | setChannelUsed (ChannelID channel, bool used) |
| | Enables/disables filtering of the given channel. More...
|
| |
| Dso::ErrorCode | setCoupling (ChannelID channel, Dso::Coupling coupling) |
| | Set the coupling for the given channel. More...
|
| |
| Dso::ErrorCode | setGain (ChannelID channel, double gain) |
| | Sets the gain for the given channel. Get the actual gain by specification.gainSteps[gainId]. More...
|
| |
| Dso::ErrorCode | setOffset (ChannelID channel, const double offset) |
| | Set the offset for the given channel. Get the actual offset for the channel from controlsettings.voltage[channel].offsetReal. More...
|
| |
| Dso::ErrorCode | setTriggerMode (Dso::TriggerMode mode) |
| | Set the trigger mode. More...
|
| |
| Dso::ErrorCode | setTriggerSource (bool special, unsigned id) |
| | Set the trigger source. More...
|
| |
| Dso::ErrorCode | setTriggerLevel (ChannelID channel, double level) |
| | Set the trigger level. More...
|
| |
| Dso::ErrorCode | setTriggerSlope (Dso::Slope slope) |
| | Set the trigger slope. More...
|
| |
| Dso::ErrorCode | setPretriggerPosition (double position) |
| | Set the trigger position. More...
|
| |
|
void | forceTrigger () |
| |
The DsoControl abstraction layer for Hantek USB DSOs. TODO Please anyone, refactor this class into smaller pieces (Separation of Concerns!).
◆ HantekDsoControl()
| HantekDsoControl::HantekDsoControl |
( |
USBDevice * |
device | ) |
|
Creates a dsoControl object. The actual event loop / timer is not started. You can optionally create a thread and move the created object to the thread. You need to call updateInterval() to start the timer. This is done implicitly if run() is called.
- Parameters
-
| device | The usb device. This object does not take ownership. |
◆ availableRecordLengthsChanged
| void HantekDsoControl::availableRecordLengthsChanged |
( |
const std::vector< unsigned > & |
recordLengths | ) |
|
|
signal |
The available record lengths, empty list for
◆ enableSampling
| void HantekDsoControl::enableSampling |
( |
bool |
enabled | ) |
|
|
slot |
If sampling is disabled, no samplesAvailable() signals are send anymore, no samples are fetched from the device and no processing takes place.
Start sampling process.
- Parameters
-
| enabled | Enables/Disables sampling |
◆ getAvailableRecordLengths()
| const std::vector< unsigned > & HantekDsoControl::getAvailableRecordLengths |
( |
| ) |
const |
Get available record lengths for this oscilloscope.
- Returns
- The number of physical channels, empty list for continuous.
◆ getChannelCount()
| unsigned HantekDsoControl::getChannelCount |
( |
| ) |
const |
Gets the physical channel count for this oscilloscope.
- Returns
- The number of physical channels.
◆ getConnectionSpeed()
| int HantekDsoControl::getConnectionSpeed |
( |
| ) |
const |
Gets the speed of the connection.
- Returns
- The ::ConnectionSpeed of the USB connection.
◆ getDeviceSettings()
Return the read-only device control settings. Use the set- Methods to change device settings.
◆ getMaxSamplerate()
| double HantekDsoControl::getMaxSamplerate |
( |
| ) |
const |
Get maximum samplerate for this oscilloscope.
- Returns
- The maximum samplerate for the current configuration in S/s.
◆ getMinSamplerate()
| double HantekDsoControl::getMinSamplerate |
( |
| ) |
const |
Get minimum samplerate for this oscilloscope.
- Returns
- The minimum samplerate for the current configuration in S/s.
◆ getPacketSize()
| int HantekDsoControl::getPacketSize |
( |
| ) |
const |
Gets the maximum size of one packet transmitted via bulk transfer.
- Returns
- The maximum packet size in bytes, negative libusb error code on error.
◆ run()
| void HantekDsoControl::run |
( |
| ) |
|
Call this to start the processing. This method will call itself periodically from there on. It is wise to move this class object to an own thread and call run from there.
◆ setChannelUsed
| Dso::ErrorCode HantekDsoControl::setChannelUsed |
( |
ChannelID |
channel, |
|
|
bool |
used |
|
) |
| |
|
slot |
Enables/disables filtering of the given channel.
- Parameters
-
| channel | The channel that should be set. |
| used | true if the channel should be sampled. |
- Returns
- See ::Dso::ErrorCode.
◆ setCoupling
| Dso::ErrorCode HantekDsoControl::setCoupling |
( |
ChannelID |
channel, |
|
|
Dso::Coupling |
coupling |
|
) |
| |
|
slot |
Set the coupling for the given channel.
- Parameters
-
| channel | The channel that should be set. |
| coupling | The new coupling for the channel. |
- Returns
- See ::Dso::ErrorCode.
◆ setGain
| Dso::ErrorCode HantekDsoControl::setGain |
( |
ChannelID |
channel, |
|
|
double |
gain |
|
) |
| |
|
slot |
Sets the gain for the given channel. Get the actual gain by specification.gainSteps[gainId].
- Parameters
-
| channel | The channel that should be set. |
| gain | The gain that should be met (V/div). |
- Returns
- The gain that has been set, ::Dso::ErrorCode on error.
◆ setOffset
| Dso::ErrorCode HantekDsoControl::setOffset |
( |
ChannelID |
channel, |
|
|
const double |
offset |
|
) |
| |
|
slot |
Set the offset for the given channel. Get the actual offset for the channel from controlsettings.voltage[channel].offsetReal.
- Parameters
-
| channel | The channel that should be set. |
| offset | The new offset value (0.0 - 1.0). |
◆ setPretriggerPosition
| Dso::ErrorCode HantekDsoControl::setPretriggerPosition |
( |
double |
position | ) |
|
|
slot |
Set the trigger position.
- Parameters
-
| position | The new trigger position (in s). |
- Returns
- The trigger position that has been set.
◆ setRecordLength
| Dso::ErrorCode HantekDsoControl::setRecordLength |
( |
unsigned |
size | ) |
|
|
slot |
Sets the size of the oscilloscopes sample buffer.
- Parameters
-
| index | The record length index that should be set. |
- Returns
- The record length that has been set, 0 on error.
◆ setRecordTime
| Dso::ErrorCode HantekDsoControl::setRecordTime |
( |
double |
duration = 0.0 | ) |
|
|
slot |
Sets the time duration of one aquisition by adapting the samplerate.
- Parameters
-
| duration | The record time duration that should be met (s), 0.0 to restore current record time. |
- Returns
- The record time duration that has been set, 0.0 on error.
◆ setSamplerate
| Dso::ErrorCode HantekDsoControl::setSamplerate |
( |
double |
samplerate = 0.0 | ) |
|
|
slot |
Sets the samplerate of the oscilloscope.
- Parameters
-
| samplerate | The samplerate that should be met (S/s), 0.0 to restore current samplerate. |
- Returns
- The samplerate that has been set, 0.0 on error.
◆ setTriggerLevel
| Dso::ErrorCode HantekDsoControl::setTriggerLevel |
( |
ChannelID |
channel, |
|
|
double |
level |
|
) |
| |
|
slot |
Set the trigger level.
- Parameters
-
| channel | The channel that should be set. |
| level | The new trigger level (V). |
- Returns
- The trigger level that has been set, ::Dso::ErrorCode on error.
- Todo:
- Get alternating trigger in here
◆ setTriggerMode
| Dso::ErrorCode HantekDsoControl::setTriggerMode |
( |
Dso::TriggerMode |
mode | ) |
|
|
slot |
Set the trigger mode.
- Returns
- See ::Dso::ErrorCode.
◆ setTriggerSlope
| Dso::ErrorCode HantekDsoControl::setTriggerSlope |
( |
Dso::Slope |
slope | ) |
|
|
slot |
Set the trigger slope.
- Parameters
-
| slope | The Slope that should cause a trigger. |
- Returns
- See ::Dso::ErrorCode.
◆ setTriggerSource
| Dso::ErrorCode HantekDsoControl::setTriggerSource |
( |
bool |
special, |
|
|
unsigned |
id |
|
) |
| |
|
slot |
Set the trigger source.
- Parameters
-
| special | true for a special channel (EXT, ...) as trigger source. |
| id | The number of the channel, that should be used as trigger. |
- Returns
- See ::Dso::ErrorCode.
◆ stringCommand()
| Dso::ErrorCode HantekDsoControl::stringCommand |
( |
const QString & |
commandString | ) |
|
Sends bulk/control commands directly.
Syntax:
Bulk command:
send bulk [hex data]
Control command:
send control [hex code] [hex data]
- Parameters
-
| command | The command as string (Has to be parsed). |
- Returns
- See ::Dso::ErrorCode.
The documentation for this class was generated from the following files: