mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
Code refactoring 21
This commit is contained in:
parent
cec8dade5e
commit
34cab3cf23
@ -31,9 +31,9 @@ set(DS_TITLE DSView)
|
||||
set(DS_DESCRIPTION "A GUI for instruments of DreamSourceLab")
|
||||
|
||||
set(DS_VERSION_MAJOR 1)
|
||||
set(DS_VERSION_MINOR 2)
|
||||
set(DS_VERSION_MICRO 1)
|
||||
set(DS_VERSION_STRING ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO} )
|
||||
set(DS_VERSION_MINOR 3)
|
||||
set(DS_VERSION_MICRO 0)
|
||||
set(DS_VERSION_STRING ${DS_VERSION_MAJOR}.${DS_VERSION_MINOR}.${DS_VERSION_MICRO}-dev )
|
||||
|
||||
configure_file (
|
||||
${PROJECT_SOURCE_DIR}/DSView/config.h.in
|
||||
|
@ -30,6 +30,6 @@
|
||||
#define DS_VERSION_MAJOR 1
|
||||
#define DS_VERSION_MINOR 2
|
||||
#define DS_VERSION_MICRO 1
|
||||
#define DS_VERSION_STRING "1.2.1"
|
||||
#define DS_VERSION_STRING "1.3.0-dev"
|
||||
|
||||
#endif
|
||||
|
@ -30,6 +30,7 @@ DeviceAgent::DeviceAgent()
|
||||
_di = NULL;
|
||||
_dev_type = 0;
|
||||
_callback = NULL;
|
||||
_is_new_device = false;
|
||||
}
|
||||
|
||||
void DeviceAgent::update()
|
||||
@ -48,6 +49,13 @@ void DeviceAgent::update()
|
||||
_di = info.di;
|
||||
_dev_name = QString::fromLocal8Bit(info.name);
|
||||
_driver_name = QString::fromLocal8Bit(info.driver_name);
|
||||
|
||||
if (is_in_history(_dev_handle) == false){
|
||||
_is_new_device = true;
|
||||
}
|
||||
else{
|
||||
_is_new_device = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,12 +67,14 @@ void DeviceAgent::update()
|
||||
|
||||
GVariant* DeviceAgent::get_config(const sr_channel *ch, const sr_channel_group *group, int key)
|
||||
{
|
||||
assert(_dev_handle);
|
||||
|
||||
assert(_dev_handle);
|
||||
GVariant *data = NULL;
|
||||
if (ds_get_actived_device_config(ch, group, key, &data) != SR_OK)
|
||||
{
|
||||
dsv_warn("%s%d", "WARNING: Failed to get value of config id:", key);
|
||||
if (is_hardware())
|
||||
dsv_warn("%s%d", "WARNING: Failed to get value of config id:", key);
|
||||
else
|
||||
dsv_detail("%s%d", "WARNING: Failed to get value of config id:", key);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -75,7 +85,10 @@ bool DeviceAgent::set_config(sr_channel *ch, sr_channel_group *group, int key, G
|
||||
|
||||
if (ds_set_actived_device_config(ch, group, key, data) != SR_OK)
|
||||
{
|
||||
dsv_warn("%s%d", "WARNING: Failed to set value of config id:", key);
|
||||
if (is_hardware())
|
||||
dsv_warn("%s%d", "WARNING: Failed to set value of config id:", key);
|
||||
else
|
||||
dsv_detail("%s%d", "WARNING: Failed to set value of config id:", key);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -244,6 +257,11 @@ bool DeviceAgent::stop()
|
||||
return false;
|
||||
}
|
||||
|
||||
void DeviceAgent::release()
|
||||
{
|
||||
ds_release_actived_device();
|
||||
}
|
||||
|
||||
bool DeviceAgent::have_enabled_channel()
|
||||
{
|
||||
assert(_dev_handle);
|
||||
@ -314,5 +332,16 @@ GSList *DeviceAgent::get_channels()
|
||||
return ds_get_actived_device_channels();
|
||||
}
|
||||
|
||||
bool DeviceAgent::is_in_history(ds_device_handle dev_handle)
|
||||
{
|
||||
for(ds_device_handle h : _history_handles){
|
||||
if (h == dev_handle){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
_history_handles.push_back(dev_handle);
|
||||
return false;
|
||||
}
|
||||
|
||||
//---------------device config end -----------/
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include <stdint.h>
|
||||
#include <libsigrok.h>
|
||||
#include <QString>
|
||||
#include <vector>
|
||||
|
||||
class IDeviceAgentCallback
|
||||
{
|
||||
@ -147,10 +148,20 @@ public:
|
||||
*/
|
||||
bool stop();
|
||||
|
||||
/**
|
||||
* Stop and close.
|
||||
*/
|
||||
void release();
|
||||
|
||||
bool is_collecting();
|
||||
|
||||
protected:
|
||||
inline bool is_new_device(){
|
||||
return _is_new_device;
|
||||
}
|
||||
|
||||
private:
|
||||
void config_changed();
|
||||
bool is_in_history(ds_device_handle dev_handle);
|
||||
|
||||
//---------------device config-----------/
|
||||
public:
|
||||
@ -172,7 +183,9 @@ private:
|
||||
int _dev_type;
|
||||
QString _dev_name;
|
||||
QString _driver_name;
|
||||
bool _is_new_device;
|
||||
struct sr_dev_inst *_di;
|
||||
std::vector<ds_device_handle> _history_handles;
|
||||
IDeviceAgentCallback *_callback;
|
||||
};
|
||||
|
||||
|
@ -30,6 +30,8 @@
|
||||
#include <QRadioButton>
|
||||
#include "../ui/msgbox.h"
|
||||
#include "../config/appconfig.h"
|
||||
#include "../interface/icallbacks.h"
|
||||
#include "../log.h"
|
||||
|
||||
namespace pv {
|
||||
namespace dialogs {
|
||||
@ -122,8 +124,10 @@ void StoreProgress::reject()
|
||||
{
|
||||
using namespace Qt;
|
||||
_store_session.cancel();
|
||||
save_done();
|
||||
_store_session.session()->set_saving(false);
|
||||
save_done();
|
||||
DSDialog::reject();
|
||||
_store_session.session()->broadcast_msg(DSV_MSG_SAVE_COMPLETE);
|
||||
}
|
||||
|
||||
void StoreProgress::accept()
|
||||
@ -157,7 +161,8 @@ void StoreProgress::accept()
|
||||
//start done
|
||||
if (_isExport){
|
||||
if (_store_session.export_start()){
|
||||
QTimer::singleShot(100, this, SLOT(timeout()));
|
||||
_store_session.session()->set_saving(true);
|
||||
QTimer::singleShot(100, this, SLOT(timeout()));
|
||||
}
|
||||
else{
|
||||
save_done();
|
||||
@ -167,7 +172,8 @@ void StoreProgress::accept()
|
||||
}
|
||||
else{
|
||||
if (_store_session.save_start()){
|
||||
QTimer::singleShot(100, this, SLOT(timeout()));
|
||||
_store_session.session()->set_saving(true);
|
||||
QTimer::singleShot(100, this, SLOT(timeout()));
|
||||
}
|
||||
else{
|
||||
save_done();
|
||||
@ -248,9 +254,11 @@ void StoreProgress::show_error()
|
||||
}
|
||||
|
||||
void StoreProgress::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
{
|
||||
_store_session.cancel();
|
||||
_store_session.session()->set_saving(false);
|
||||
DSDialog::closeEvent(e);
|
||||
_store_session.session()->broadcast_msg(DSV_MSG_SAVE_COMPLETE);
|
||||
}
|
||||
|
||||
void StoreProgress::on_progress_updated()
|
||||
|
@ -109,8 +109,8 @@ namespace pv
|
||||
_session->set_callback(this);
|
||||
_device_agent = _session->get_device();
|
||||
_session->add_msg_listener(this);
|
||||
|
||||
_bFirstLoad = true;
|
||||
|
||||
_is_auto_switch_device = false;
|
||||
|
||||
setup_ui();
|
||||
|
||||
@ -269,7 +269,10 @@ namespace pv
|
||||
|
||||
connect(_protocol_widget, SIGNAL(protocol_updated()), this, SLOT(on_signals_changed()));
|
||||
|
||||
// SamplingBar
|
||||
// SamplingBar
|
||||
connect(_sampling_bar, SIGNAL(sig_store_session_data()), this, SLOT(on_save()));
|
||||
|
||||
//
|
||||
connect(_dso_trigger_widget, SIGNAL(set_trig_pos(int)), _view, SLOT(set_trig_pos(int)));
|
||||
|
||||
_logo_bar->set_mainform_callback(this);
|
||||
@ -305,8 +308,8 @@ namespace pv
|
||||
{
|
||||
assert(_sampling_bar);
|
||||
if (!selected_device->name().contains("virtual")) {
|
||||
_file_bar->set_settings_en(true);
|
||||
_logo_bar->dsl_connected(true);
|
||||
|
||||
|
||||
#if QT_VERSION >= 0x050400
|
||||
QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
|
||||
#else
|
||||
@ -322,8 +325,8 @@ namespace pv
|
||||
on_load_session(ses_name);
|
||||
}
|
||||
} else {
|
||||
_file_bar->set_settings_en(false);
|
||||
_logo_bar->dsl_connected(false);
|
||||
|
||||
|
||||
|
||||
QDir dir(GetResourceDir());
|
||||
if (dir.exists()) {
|
||||
@ -340,8 +343,7 @@ namespace pv
|
||||
_trig_bar->restore_status();
|
||||
|
||||
//load specified file name from application startup param
|
||||
if (_bFirstLoad){
|
||||
_bFirstLoad = false;
|
||||
if (_bFirstLoad){
|
||||
|
||||
QString ldFileName(AppControl::Instance()->_open_file_name.c_str());
|
||||
|
||||
@ -1354,6 +1356,14 @@ namespace pv
|
||||
_measure_widget->reload();
|
||||
}
|
||||
|
||||
bool MainWindow::confirm_to_store_data()
|
||||
{
|
||||
if (_session->have_hardware_data()){
|
||||
return MsgBox::Confirm(tr("Save captured data?"));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void MainWindow::OnMessage(int msg)
|
||||
{
|
||||
switch (msg)
|
||||
@ -1380,24 +1390,25 @@ namespace pv
|
||||
_trig_bar->update_view_status();
|
||||
break;
|
||||
|
||||
case DSV_MSG_NEW_USB_DEVICE:
|
||||
check_usb_device_speed();
|
||||
case DSV_MSG_CURRENT_DEVICE_CHANGE_PREV:
|
||||
_protocol_widget->del_all_protocol();
|
||||
_view->reload();
|
||||
break;
|
||||
|
||||
case DSV_MSG_CURRENT_DEVICE_CHANGED:
|
||||
{
|
||||
if (_msg != NULL){
|
||||
_msg->close();
|
||||
_msg = NULL;
|
||||
}
|
||||
|
||||
_sampling_bar->update_device_list();
|
||||
reset_all_view();
|
||||
break;
|
||||
|
||||
case DSV_MSG_CURRENT_DEVICE_CHANGE_PREV:
|
||||
_protocol_widget->del_all_protocol();
|
||||
_view->reload();
|
||||
break;
|
||||
reset_all_view();
|
||||
bool is_hardware = _session->get_device()->is_hardware();
|
||||
_logo_bar->dsl_connected(is_hardware);
|
||||
_file_bar->update_view_status();
|
||||
}
|
||||
break;
|
||||
|
||||
case DSV_MSG_DEVICE_OPTIONS_UPDATED:
|
||||
_trigger_widget->device_updated();
|
||||
@ -1410,15 +1421,50 @@ namespace pv
|
||||
_view->timebase_changed();
|
||||
break;
|
||||
|
||||
case DSV_MSG_DEVICE_MODE_CHANGED:
|
||||
case DSV_MSG_DEVICE_MODE_CHANGED:
|
||||
_view->mode_changed();
|
||||
reset_all_view();
|
||||
break;
|
||||
|
||||
case DSV_MSG_NEW_USB_DEVICE:
|
||||
if (confirm_to_store_data()){
|
||||
_is_auto_switch_device = true;
|
||||
on_save();
|
||||
}
|
||||
else{
|
||||
_session->set_default_device();
|
||||
check_usb_device_speed();
|
||||
}
|
||||
break;
|
||||
|
||||
case DSV_MSG_CURRENT_DEVICE_DETACHED:
|
||||
// Save current config, and switch to the last device.
|
||||
_session->device_event_object()->device_updated();
|
||||
session_save();
|
||||
_view->hide_calibration();
|
||||
_view->hide_calibration();
|
||||
if (confirm_to_store_data()){
|
||||
_is_auto_switch_device = true;
|
||||
on_save();
|
||||
}
|
||||
else{
|
||||
_session->set_default_device();
|
||||
}
|
||||
break;
|
||||
|
||||
case DSV_MSG_SAVE_COMPLETE:
|
||||
if (_is_auto_switch_device){
|
||||
_is_auto_switch_device = false;
|
||||
_session->set_default_device();
|
||||
if (_session->get_device()->is_new_device())
|
||||
check_usb_device_speed();
|
||||
}
|
||||
else{
|
||||
ds_device_handle devh = _sampling_bar->get_next_device_handle();
|
||||
if (devh != NULL_HANDLE){
|
||||
dsv_info("%s", "Auto switch to the selected device.");
|
||||
_session->set_device(devh);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -144,6 +144,7 @@ public:
|
||||
private:
|
||||
void check_usb_device_speed();
|
||||
void reset_all_view();
|
||||
bool confirm_to_store_data();
|
||||
|
||||
private:
|
||||
//ISessionCallback
|
||||
@ -216,10 +217,10 @@ private:
|
||||
|
||||
QTranslator _qtTrans;
|
||||
QTranslator _myTrans;
|
||||
EventObject _event;
|
||||
bool _bFirstLoad;
|
||||
EventObject _event;
|
||||
SigSession *_session;
|
||||
DeviceAgent *_device_agent;
|
||||
bool _is_auto_switch_device;
|
||||
};
|
||||
|
||||
} // namespace pv
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -134,11 +134,11 @@ public:
|
||||
void Close();
|
||||
|
||||
bool set_default_device();
|
||||
bool set_device(ds_device_handle dev_handle);
|
||||
bool set_device(ds_device_handle dev_handle);
|
||||
bool set_file(QString name);
|
||||
void close_file(ds_device_handle dev_handle);
|
||||
bool start_capture(bool instant);
|
||||
void stop_capture();
|
||||
void stop_capture();
|
||||
|
||||
uint64_t cur_samplerate();
|
||||
uint64_t cur_snap_samplerate();
|
||||
@ -291,12 +291,11 @@ public:
|
||||
void check_update();
|
||||
void set_map_zoom(int index);
|
||||
void auto_end();
|
||||
void store_session_data();
|
||||
bool have_hardware_data();
|
||||
struct ds_device_info* get_device_list(int &out_count, int &actived_index);
|
||||
void add_msg_listener(IMessageListener *ln);
|
||||
void broadcast_msg(int msg);
|
||||
void on_work_mode_changed();
|
||||
bool switch_work_mode(int mode);
|
||||
|
||||
private:
|
||||
bool exec_capture();
|
||||
@ -329,7 +328,7 @@ private:
|
||||
void feed_timeout();
|
||||
void repeat_update();
|
||||
void container_init();
|
||||
void init_signals();
|
||||
void init_signals();
|
||||
|
||||
//IMessageListener
|
||||
void OnMessage(int msg);
|
||||
@ -411,8 +410,7 @@ private:
|
||||
int _map_zoom;
|
||||
bool _dso_feed;
|
||||
float _stop_scale;
|
||||
bool _bClose;
|
||||
bool _is_auto_sel_device;
|
||||
bool _bClose;
|
||||
|
||||
uint64_t _save_start;
|
||||
uint64_t _save_end;
|
||||
@ -422,8 +420,8 @@ private:
|
||||
int _repeat_hold_prg; // The time sleep progress
|
||||
bool _is_saving;
|
||||
bool _is_instant;
|
||||
bool _is_trig_new_device_msg;
|
||||
int _device_status;
|
||||
|
||||
|
||||
ISessionCallback *_callback;
|
||||
DeviceAgent _device_agent;
|
||||
|
@ -353,23 +353,22 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
struct sr_status status;
|
||||
const sr_dev_inst *sdi = NULL;
|
||||
char meta[300] = {0};
|
||||
|
||||
/*
|
||||
sdi = _session->get_device()->dev_inst();
|
||||
|
||||
sprintf(meta, "%s", "[version]\n"); str += meta;
|
||||
sprintf(meta, "version = %d\n", File_Version); str += meta;
|
||||
sprintf(meta, "%s", "[header]\n"); str += meta;
|
||||
|
||||
if (sdi->driver) {
|
||||
sprintf(meta, "driver = %s\n", sdi->driver->name); str += meta;
|
||||
sprintf(meta, "device mode = %d\n", sdi->mode); str += meta;
|
||||
int mode = _session->get_device()->get_work_mode();
|
||||
|
||||
if (true) {
|
||||
sprintf(meta, "driver = %s\n", _session->get_device()->driver_name().toLocal8Bit().data()); str += meta;
|
||||
sprintf(meta, "device mode = %d\n", mode); str += meta;
|
||||
}
|
||||
|
||||
sprintf(meta, "capturefile = data\n"); str += meta;
|
||||
sprintf(meta, "total samples = %" PRIu64 "\n", snapshot->get_sample_count()); str += meta;
|
||||
|
||||
if (sdi->mode != LOGIC) {
|
||||
if (mode != LOGIC) {
|
||||
sprintf(meta, "total probes = %d\n", snapshot->get_channel_num()); str += meta;
|
||||
sprintf(meta, "total blocks = %d\n", snapshot->get_block_num()); str += meta;
|
||||
}
|
||||
@ -377,7 +376,7 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
data::LogicSnapshot *logic_snapshot = NULL;
|
||||
if ((logic_snapshot = dynamic_cast<data::LogicSnapshot*>(snapshot))) {
|
||||
uint16_t to_save_probes = 0;
|
||||
for (l = sdi->channels; l; l = l->next) {
|
||||
for (l = _session->get_device()->get_channels(); l; l = l->next) {
|
||||
probe = (struct sr_channel *)l->data;
|
||||
if (probe->enabled && logic_snapshot->has_data(probe->index))
|
||||
to_save_probes++;
|
||||
@ -390,7 +389,7 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
|
||||
sprintf(meta, "samplerate = %s\n", s); str += meta;
|
||||
|
||||
if (sdi->mode == DSO) {
|
||||
if (mode == DSO) {
|
||||
gvar = _session->get_device()->get_config(NULL, NULL, SR_CONF_TIMEBASE);
|
||||
if (gvar != NULL) {
|
||||
uint64_t tmp_u64 = g_variant_get_uint64(gvar);
|
||||
@ -427,9 +426,11 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
sprintf(meta, "ref max = %d\n", tmp_u32); str += meta;
|
||||
g_variant_unref(gvar);
|
||||
}
|
||||
} else if (sdi->mode == LOGIC) {
|
||||
}
|
||||
else if (mode == LOGIC) {
|
||||
sprintf(meta, "trigger time = %lld\n", _session->get_session_time().toMSecsSinceEpoch()); str += meta;
|
||||
} else if (sdi->mode == ANALOG) {
|
||||
}
|
||||
else if (mode == ANALOG) {
|
||||
data::AnalogSnapshot *analog_snapshot = NULL;
|
||||
if ((analog_snapshot = dynamic_cast<data::AnalogSnapshot*>(snapshot))) {
|
||||
uint8_t tmp_u8 = analog_snapshot->get_unit_bytes();
|
||||
@ -452,17 +453,17 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
|
||||
probecnt = 0;
|
||||
|
||||
for (l = sdi->channels; l; l = l->next) {
|
||||
for (l = _session->get_device()->get_channels(); l; l = l->next) {
|
||||
|
||||
probe = (struct sr_channel *)l->data;
|
||||
if (!snapshot->has_data(probe->index))
|
||||
continue;
|
||||
if (sdi->mode == LOGIC && !probe->enabled)
|
||||
if (mode == LOGIC && !probe->enabled)
|
||||
continue;
|
||||
|
||||
if (probe->name)
|
||||
{
|
||||
int sigdex = (sdi->mode == LOGIC) ? probe->index : probecnt;
|
||||
int sigdex = (mode == LOGIC) ? probe->index : probecnt;
|
||||
sprintf(meta, "probe%d = %s\n", sigdex, probe->name);
|
||||
str += meta;
|
||||
}
|
||||
@ -472,7 +473,7 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
str += meta;
|
||||
}
|
||||
|
||||
if (sdi->mode == DSO)
|
||||
if (mode == DSO)
|
||||
{
|
||||
sprintf(meta, " enable%d = %d\n", probecnt, probe->enabled);
|
||||
str += meta;
|
||||
@ -487,7 +488,7 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
sprintf(meta, " vTrig%d = %d\n", probecnt, probe->trig_value);
|
||||
str += meta;
|
||||
|
||||
if (sr_status_get(sdi, &status, false) == SR_OK)
|
||||
if (_session->get_device()->get_device_status(status, false))
|
||||
{
|
||||
if (probe->index == 0)
|
||||
{
|
||||
@ -553,7 +554,7 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sdi->mode == ANALOG)
|
||||
else if (mode == ANALOG)
|
||||
{
|
||||
sprintf(meta, " enable%d = %d\n", probecnt, probe->enabled);
|
||||
str += meta;
|
||||
@ -572,7 +573,6 @@ bool StoreSession::meta_gen(data::Snapshot *snapshot, std::string &str)
|
||||
}
|
||||
probecnt++;
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -135,6 +135,13 @@ void FileBar::on_actionOpen_triggered()
|
||||
//open data file
|
||||
AppConfig &app = AppConfig::Instance();
|
||||
|
||||
if (_session->have_hardware_data()){
|
||||
if (MsgBox::Confirm(tr("Save captured data?"))){
|
||||
sig_save();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Show the dialog
|
||||
const QString file_name = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
@ -234,8 +241,9 @@ void FileBar::on_actionCapture_triggered()
|
||||
void FileBar::update_view_status()
|
||||
{
|
||||
bool bEnable = _session->is_working() == false;
|
||||
bool is_hardware = _session->get_device()->is_hardware();
|
||||
_file_button.setEnabled(bEnable);
|
||||
_menu_session->setEnabled(bEnable);
|
||||
_menu_session->setEnabled(bEnable && is_hardware);
|
||||
}
|
||||
|
||||
} // namespace toolbars
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "../dsvdef.h"
|
||||
#include "../log.h"
|
||||
#include "../deviceagent.h"
|
||||
#include "../ui/msgbox.h"
|
||||
|
||||
using std::map;
|
||||
using std::max;
|
||||
@ -68,6 +69,8 @@ namespace pv
|
||||
_is_run_as_instant = false;
|
||||
|
||||
_last_device_handle = NULL_HANDLE;
|
||||
_last_device_index = -1;
|
||||
_next_switch_device = NULL_HANDLE;
|
||||
|
||||
_session = session;
|
||||
_device_agent = _session->get_device();
|
||||
@ -959,7 +962,20 @@ namespace pv
|
||||
_session->session_save();
|
||||
|
||||
ds_device_handle devHandle = (ds_device_handle)_device_selector.currentData().toULongLong();
|
||||
if (_session->have_hardware_data()){
|
||||
if (MsgBox::Confirm(tr("Save captured data?")))
|
||||
{
|
||||
_updating_device_list = true;
|
||||
_device_selector.setCurrentIndex(_last_device_index);
|
||||
_updating_device_list = false;
|
||||
_next_switch_device = devHandle; // Save end, auto switch to this device.
|
||||
sig_store_session_data();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_session->set_device(devHandle);
|
||||
_last_device_index = _device_selector.currentIndex();
|
||||
}
|
||||
|
||||
void SamplingBar::enable_toggle(bool enable)
|
||||
@ -1098,8 +1114,8 @@ namespace pv
|
||||
update_sample_rate_selector();
|
||||
_last_device_handle = cur_dev_handle;
|
||||
}
|
||||
|
||||
|
||||
_last_device_index = select_index;
|
||||
int width = _device_selector.sizeHint().width();
|
||||
_device_selector.setFixedWidth(min(width + 15, _device_selector.maximumWidth()));
|
||||
_device_selector.view()->setMinimumWidth(width + 30);
|
||||
@ -1153,5 +1169,12 @@ namespace pv
|
||||
}
|
||||
}
|
||||
|
||||
ds_device_handle SamplingBar::get_next_device_handle()
|
||||
{
|
||||
ds_device_handle h = _next_switch_device;
|
||||
_next_switch_device = NULL_HANDLE;
|
||||
return h;
|
||||
}
|
||||
|
||||
} // namespace toolbars
|
||||
} // namespace pv
|
||||
|
@ -85,7 +85,11 @@ namespace pv
|
||||
void update_device_list();
|
||||
void reload();
|
||||
void update_view_status();
|
||||
void config_device();
|
||||
void config_device();
|
||||
ds_device_handle get_next_device_handle();
|
||||
|
||||
signals:
|
||||
void sig_store_session_data();
|
||||
|
||||
private:
|
||||
void changeEvent(QEvent *event);
|
||||
@ -137,6 +141,8 @@ namespace pv
|
||||
|
||||
DeviceAgent *_device_agent;
|
||||
ds_device_handle _last_device_handle;
|
||||
ds_device_handle _next_switch_device;
|
||||
int _last_device_index;
|
||||
|
||||
bool _is_run_as_instant;
|
||||
};
|
||||
|
@ -195,31 +195,30 @@ void DevMode::on_mode_change()
|
||||
|
||||
for(auto i = _mode_list.begin();i != _mode_list.end(); i++)
|
||||
{
|
||||
if ((*i).first == action) {
|
||||
if (_device_agent->get_work_mode() != (*i).second->mode) {
|
||||
_session->set_repeat_mode(false);
|
||||
_session->stop_capture();
|
||||
_session->session_save();
|
||||
_device_agent->set_config(NULL, NULL,
|
||||
SR_CONF_DEVICE_MODE,
|
||||
g_variant_new_int16((*i).second->mode));
|
||||
|
||||
_session->on_work_mode_changed();
|
||||
if ((*i).first == action){
|
||||
|
||||
auto *mode_name = get_mode_name((*i).second->mode);
|
||||
QString icon_fname = iconPath + "/" + QString::fromLocal8Bit(mode_name->_logo);
|
||||
|
||||
_mode_btn->setIcon(QIcon(icon_fname));
|
||||
if (lan == LAN_CN)
|
||||
_mode_btn->setText(mode_name->_name_cn);
|
||||
else
|
||||
_mode_btn->setText(mode_name->_name_en);
|
||||
|
||||
_session->broadcast_msg(DSV_MSG_DEVICE_MODE_CHANGED);
|
||||
int mode = (*i).second->mode;
|
||||
if (_device_agent->get_work_mode() == mode){
|
||||
dsv_info("%s", "Current mode is set.");
|
||||
break;
|
||||
}
|
||||
|
||||
_session->stop_capture();
|
||||
_session->set_repeat_mode(false);
|
||||
_session->session_save();
|
||||
_session->switch_work_mode(mode);
|
||||
|
||||
break;
|
||||
}
|
||||
auto *mode_name = get_mode_name(mode);
|
||||
QString icon_fname = iconPath + "/" + QString::fromLocal8Bit(mode_name->_logo);
|
||||
|
||||
_mode_btn->setIcon(QIcon(icon_fname));
|
||||
if (lan == LAN_CN)
|
||||
_mode_btn->setText(mode_name->_name_cn);
|
||||
else
|
||||
_mode_btn->setText(mode_name->_name_en);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,7 +228,7 @@ void DevMode::on_close()
|
||||
assert(false);
|
||||
}
|
||||
|
||||
if (_bFile && MsgBox::Confirm(tr("are you sure to close the device?"))){
|
||||
if (_bFile && MsgBox::Confirm(tr("Are you sure to close the device?"))){
|
||||
_session->close_file(_device_agent->handle());
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +101,8 @@ int Header::get_nameEditWidth()
|
||||
pv::view::Trace* Header::get_mTrace(int &action, const QPoint &pt)
|
||||
{
|
||||
const int w = width();
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
|
||||
for(auto &t : traces)
|
||||
{
|
||||
@ -124,7 +125,8 @@ void Header::paintEvent(QPaintEvent*)
|
||||
style()->drawPrimitive(QStyle::PE_Widget, &o, &painter, this);
|
||||
|
||||
const int w = width();
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
|
||||
const bool dragging = !_drag_traces.empty();
|
||||
QColor fore(QWidget::palette().color(QWidget::foregroundRole()));
|
||||
@ -143,7 +145,9 @@ void Header::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
assert(event);
|
||||
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
|
||||
if (event->button() & Qt::LeftButton) {
|
||||
_mouse_down_point = event->pos();
|
||||
@ -166,7 +170,8 @@ void Header::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
assert(event);
|
||||
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
int action;
|
||||
|
||||
const bool instant = _view.session().is_instant();
|
||||
@ -236,7 +241,8 @@ void Header::mouseReleaseEvent(QMouseEvent *event)
|
||||
_view.signals_changed();
|
||||
_view.set_all_update(true);
|
||||
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
|
||||
for(auto &t : traces){
|
||||
t->select(false);
|
||||
@ -288,7 +294,8 @@ void Header::wheelEvent(QWheelEvent *event)
|
||||
|
||||
if (isVertical)
|
||||
{
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
// Vertical scrolling
|
||||
double shift = 0;
|
||||
|
||||
|
@ -366,7 +366,7 @@ void View::set_preScale_preOffset()
|
||||
set_scale_offset(_preScale, _preOffset);
|
||||
}
|
||||
|
||||
std::vector<Trace*> View::get_traces(int type)
|
||||
void View::get_traces(int type, std::vector<Trace*> &traces)
|
||||
{
|
||||
assert(_session);
|
||||
|
||||
@ -376,8 +376,7 @@ std::vector<Trace*> View::get_traces(int type)
|
||||
const auto &decode_sigs = _session->get_decode_signals();
|
||||
|
||||
const auto &spectrums = _session->get_spectrum_traces();
|
||||
|
||||
std::vector<Trace*> traces;
|
||||
|
||||
for(auto &t : sigs) {
|
||||
if (type == ALL_VIEW || _trace_view_map[t->get_type()] == type)
|
||||
traces.push_back(t);
|
||||
@ -409,7 +408,6 @@ std::vector<Trace*> View::get_traces(int type)
|
||||
traces.push_back(math);
|
||||
|
||||
stable_sort(traces.begin(), traces.end(), compare_trace_v_offsets);
|
||||
return traces;
|
||||
}
|
||||
|
||||
bool View::compare_trace_v_offsets(const Trace *a,
|
||||
@ -576,8 +574,9 @@ const QPoint& View::hover_point()
|
||||
}
|
||||
|
||||
void View::normalize_layout()
|
||||
{
|
||||
auto traces = get_traces(ALL_VIEW);
|
||||
{
|
||||
std::vector<Trace*> traces;
|
||||
get_traces(ALL_VIEW, traces);
|
||||
|
||||
int v_min = INT_MAX;
|
||||
for(auto &t : traces){
|
||||
@ -686,7 +685,10 @@ void View::signals_changed()
|
||||
std::vector<Trace*> time_traces;
|
||||
std::vector<Trace*> fft_traces;
|
||||
|
||||
for(auto &t : get_traces(ALL_VIEW)) {
|
||||
std::vector<Trace*> traces;
|
||||
get_traces(ALL_VIEW, traces);
|
||||
|
||||
for(auto &t : traces) {
|
||||
if (_trace_view_map[t->get_type()] == TIME_VIEW)
|
||||
time_traces.push_back(t);
|
||||
else if (_trace_view_map[t->get_type()] == FFT_VIEW)
|
||||
@ -845,7 +847,9 @@ int View::headerWidth()
|
||||
{
|
||||
int headerWidth = _header->get_nameEditWidth();
|
||||
|
||||
const auto &traces = get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
get_traces(ALL_VIEW, traces);
|
||||
|
||||
if (!traces.empty()) {
|
||||
for(auto &t : traces)
|
||||
headerWidth = max(t->get_name_width() + t->get_leftWidth() + t->get_rightWidth(),
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
void set_scale_offset(double scale, int64_t offset);
|
||||
void set_preScale_preOffset();
|
||||
|
||||
std::vector<Trace*> get_traces(int type);
|
||||
void get_traces(int type, std::vector<Trace*> &traces);
|
||||
|
||||
/**
|
||||
* Returns true if cursors are displayed. false otherwise.
|
||||
@ -337,6 +337,9 @@ public:
|
||||
void set_device();
|
||||
void set_receive_len(uint64_t len);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
private:
|
||||
|
||||
SigSession *_session;
|
||||
|
@ -113,8 +113,9 @@ Viewport::Viewport(View &parent, View_type type) :
|
||||
int Viewport::get_total_height()
|
||||
{
|
||||
int h = 0;
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(_type, traces);
|
||||
|
||||
const auto &traces = _view.get_traces(_type);
|
||||
for(auto &t : traces) {
|
||||
assert(t);
|
||||
h += (int)(t->get_totalHeight());
|
||||
@ -152,8 +153,8 @@ void Viewport::paintEvent(QPaintEvent *event)
|
||||
QColor back(QWidget::palette().color(QWidget::backgroundRole()));
|
||||
fore.setAlpha(View::ForeAlpha);
|
||||
_view.set_back(false);
|
||||
|
||||
const auto &traces = _view.get_traces(_type);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(_type, traces);
|
||||
|
||||
for(auto &t : traces)
|
||||
{
|
||||
@ -200,7 +201,8 @@ void Viewport::paintEvent(QPaintEvent *event)
|
||||
|
||||
void Viewport::paintSignals(QPainter &p, QColor fore, QColor back)
|
||||
{
|
||||
const auto &traces = _view.get_traces(_type);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(_type, traces);
|
||||
|
||||
if (_view.session().get_device()->get_work_mode() == LOGIC) {
|
||||
|
||||
@ -867,7 +869,8 @@ void Viewport::mouseReleaseEvent(QMouseEvent *event)
|
||||
_action_type = NO_ACTION;
|
||||
_dso_trig_moved = false;
|
||||
|
||||
const auto &traces = _view.get_traces(ALL_VIEW);
|
||||
std::vector<Trace*> traces;
|
||||
_view.get_traces(ALL_VIEW, traces);
|
||||
|
||||
for(auto &t : traces){
|
||||
t->select(false);
|
||||
|
@ -433,7 +433,7 @@ static int config_set(int id, GVariant *data, struct sr_dev_inst *sdi,
|
||||
sr_dev_probes_free(sdi);
|
||||
setup_probes(sdi, num_probes);
|
||||
adjust_samplerate(devc);
|
||||
sr_dbg("%s: setting mode to %d", __func__, sdi->mode);
|
||||
sr_info("%s: setting mode to %d", __func__, sdi->mode);
|
||||
}
|
||||
else if (id == SR_CONF_PATTERN_MODE) {
|
||||
stropt = g_variant_get_string(data, NULL);
|
||||
|
@ -157,11 +157,7 @@ SR_API int ds_lib_exit()
|
||||
|
||||
sr_info("Uninit %s.", SR_LIB_NAME);
|
||||
|
||||
if (ds_is_collecting())
|
||||
{
|
||||
ds_stop_collect(); // stop collect.
|
||||
}
|
||||
|
||||
ds_release_actived_device();
|
||||
sr_close_hotplug(lib_ctx.sr_ctx);
|
||||
|
||||
lib_ctx.lib_exit_flag = 1; // all thread to exit
|
||||
@ -327,7 +323,7 @@ SR_API int ds_active_device(ds_device_handle handle)
|
||||
|
||||
if (ds_is_collecting())
|
||||
{
|
||||
sr_err("%s", "One device is collecting, switch device error.");
|
||||
sr_err("%s", "Error!The current device is collecting, can not switch it.");
|
||||
return SR_ERR_CALL_STATUS;
|
||||
}
|
||||
|
||||
@ -736,10 +732,7 @@ END:
|
||||
* Stop collect data
|
||||
*/
|
||||
SR_API int ds_stop_collect()
|
||||
{
|
||||
struct sr_dev_inst *di;
|
||||
di = lib_ctx.actived_device_instance;
|
||||
|
||||
{
|
||||
sr_info("%s", "Stop collect.");
|
||||
|
||||
if (!ds_is_collecting())
|
||||
@ -756,7 +749,33 @@ SR_API int ds_stop_collect()
|
||||
g_thread_join(lib_ctx.collect_thread);
|
||||
lib_ctx.collect_thread = NULL;
|
||||
|
||||
close_device_instance(di);
|
||||
return SR_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the device is collecting.
|
||||
*/
|
||||
SR_API int ds_is_collecting()
|
||||
{
|
||||
if (lib_ctx.collect_thread != NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SR_API int ds_release_actived_device()
|
||||
{
|
||||
if (lib_ctx.actived_device_instance == NULL){
|
||||
return SR_ERR_CALL_STATUS;
|
||||
}
|
||||
if (ds_is_collecting()){
|
||||
ds_stop_collect();
|
||||
}
|
||||
|
||||
sr_info("%s", "Release current actived device.");
|
||||
|
||||
close_device_instance(lib_ctx.actived_device_instance);
|
||||
|
||||
// Destroy current session.
|
||||
sr_session_destroy();
|
||||
@ -1027,18 +1046,6 @@ SR_PRIV int current_device_acquisition_stop()
|
||||
return SR_ERR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the device is collecting.
|
||||
*/
|
||||
SR_API int ds_is_collecting()
|
||||
{
|
||||
if (lib_ctx.collect_thread != NULL)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**--------------------internal function end-----------*/
|
||||
|
||||
/**-------------------private function ---------------*/
|
||||
@ -1152,11 +1159,13 @@ static void hotplug_event_listen_callback(struct libusb_context *ctx, struct lib
|
||||
lib_ctx.detach_device_handle);
|
||||
}
|
||||
|
||||
if (lib_ctx.actived_device_instance != NULL && lib_ctx.actived_device_instance->handle == (ds_device_handle)dev && ds_is_collecting())
|
||||
if (lib_ctx.actived_device_instance != NULL
|
||||
&& lib_ctx.actived_device_instance->handle == (ds_device_handle)dev
|
||||
&& ds_is_collecting())
|
||||
{
|
||||
sr_info("%s", "The actived device is detached, will stop collect thread.");
|
||||
lib_ctx.is_stop_by_detached = 1;
|
||||
ds_stop_collect();
|
||||
ds_release_actived_device();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -751,22 +751,22 @@ enum sr_config_option_id{
|
||||
SR_CONF_LOGIC_ANALYZER = 10000,
|
||||
|
||||
/** The device can act as an oscilloscope. */
|
||||
SR_CONF_OSCILLOSCOPE,
|
||||
SR_CONF_OSCILLOSCOPE = 10001,
|
||||
|
||||
/** The device can act as a multimeter. */
|
||||
SR_CONF_MULTIMETER,
|
||||
SR_CONF_MULTIMETER = 10002,
|
||||
|
||||
/** The device is a demo device. */
|
||||
SR_CONF_DEMO_DEV,
|
||||
SR_CONF_DEMO_DEV = 10003,
|
||||
|
||||
/** The device can act as a sound level meter. */
|
||||
SR_CONF_SOUNDLEVELMETER,
|
||||
SR_CONF_SOUNDLEVELMETER = 10004,
|
||||
|
||||
/** The device can measure temperature. */
|
||||
SR_CONF_THERMOMETER,
|
||||
SR_CONF_THERMOMETER = 10005,
|
||||
|
||||
/** The device can measure humidity. */
|
||||
SR_CONF_HYGROMETER,
|
||||
SR_CONF_HYGROMETER = 10006,
|
||||
|
||||
/*--- Driver scan options -------------------------------------------*/
|
||||
|
||||
@ -801,7 +801,7 @@ enum sr_config_option_id{
|
||||
* This is always an optional parameter, since a driver typically
|
||||
* knows the speed at which the device wants to communicate.
|
||||
*/
|
||||
SR_CONF_SERIALCOMM,
|
||||
SR_CONF_SERIALCOMM = 20001,
|
||||
|
||||
/*--- Device configuration ------------------------------------------*/
|
||||
|
||||
@ -809,222 +809,222 @@ enum sr_config_option_id{
|
||||
SR_CONF_SAMPLERATE = 30000,
|
||||
|
||||
/** The device supports setting a pre/post-trigger capture ratio. */
|
||||
SR_CONF_CAPTURE_RATIO,
|
||||
SR_CONF_CAPTURE_RATIO = 30001,
|
||||
|
||||
/** */
|
||||
SR_CONF_USB_SPEED,
|
||||
SR_CONF_USB30_SUPPORT,
|
||||
SR_CONF_DEVICE_MODE,
|
||||
SR_CONF_INSTANT,
|
||||
SR_CONF_STATUS,
|
||||
SR_CONF_USB_SPEED = 30002,
|
||||
SR_CONF_USB30_SUPPORT = 30003,
|
||||
SR_CONF_DEVICE_MODE = 30004,
|
||||
SR_CONF_INSTANT = 30005,
|
||||
SR_CONF_STATUS = 30006,
|
||||
|
||||
/** The device supports setting a pattern (pattern generator mode). */
|
||||
SR_CONF_PATTERN_MODE,
|
||||
SR_CONF_PATTERN_MODE = 30007,
|
||||
|
||||
/** The device supports Run Length Encoding. */
|
||||
SR_CONF_RLE,
|
||||
SR_CONF_RLE = 30008,
|
||||
|
||||
/** Need wait to uplad captured data */
|
||||
SR_CONF_WAIT_UPLOAD,
|
||||
SR_CONF_WAIT_UPLOAD = 30009,
|
||||
|
||||
/** The device supports setting trigger slope. */
|
||||
SR_CONF_TRIGGER_SLOPE,
|
||||
SR_CONF_TRIGGER_SLOPE = 30010,
|
||||
|
||||
/** Trigger source. */
|
||||
SR_CONF_TRIGGER_SOURCE,
|
||||
SR_CONF_TRIGGER_SOURCE = 30011,
|
||||
|
||||
/** Trigger channel */
|
||||
SR_CONF_TRIGGER_CHANNEL,
|
||||
SR_CONF_TRIGGER_CHANNEL = 30012,
|
||||
|
||||
/** Trigger Value. */
|
||||
SR_CONF_TRIGGER_VALUE,
|
||||
SR_CONF_TRIGGER_VALUE = 30013,
|
||||
|
||||
/** Horizontal trigger position. */
|
||||
SR_CONF_HORIZ_TRIGGERPOS,
|
||||
SR_CONF_HORIZ_TRIGGERPOS = 30014,
|
||||
|
||||
/** Trigger hold off time */
|
||||
SR_CONF_TRIGGER_HOLDOFF,
|
||||
SR_CONF_TRIGGER_HOLDOFF = 30015,
|
||||
|
||||
/** Trigger Margin */
|
||||
SR_CONF_TRIGGER_MARGIN,
|
||||
SR_CONF_TRIGGER_MARGIN = 30016,
|
||||
|
||||
/** Buffer size. */
|
||||
SR_CONF_BUFFERSIZE,
|
||||
SR_CONF_BUFFERSIZE = 30017,
|
||||
|
||||
/** Time base. */
|
||||
SR_CONF_MAX_TIMEBASE,
|
||||
SR_CONF_MIN_TIMEBASE,
|
||||
SR_CONF_TIMEBASE,
|
||||
SR_CONF_MAX_TIMEBASE = 30018,
|
||||
SR_CONF_MIN_TIMEBASE = 30019,
|
||||
SR_CONF_TIMEBASE = 30020,
|
||||
|
||||
/** Filter. */
|
||||
SR_CONF_FILTER,
|
||||
SR_CONF_FILTER = 30021,
|
||||
|
||||
/** DSO configure sync */
|
||||
SR_CONF_DSO_SYNC,
|
||||
SR_CONF_DSO_SYNC = 30022,
|
||||
|
||||
/** How many bits for each sample */
|
||||
SR_CONF_UNIT_BITS,
|
||||
SR_CONF_REF_MIN,
|
||||
SR_CONF_REF_MAX,
|
||||
SR_CONF_UNIT_BITS = 30023,
|
||||
SR_CONF_REF_MIN = 30024,
|
||||
SR_CONF_REF_MAX = 30025,
|
||||
|
||||
/** Valid channel number */
|
||||
SR_CONF_TOTAL_CH_NUM,
|
||||
SR_CONF_TOTAL_CH_NUM = 30026,
|
||||
|
||||
/** Valid channel number */
|
||||
SR_CONF_VLD_CH_NUM,
|
||||
SR_CONF_VLD_CH_NUM = 30027,
|
||||
|
||||
/** 32 channel support */
|
||||
SR_CONF_LA_CH32,
|
||||
SR_CONF_LA_CH32 = 30028,
|
||||
|
||||
/** Zero */
|
||||
SR_CONF_HAVE_ZERO,
|
||||
SR_CONF_ZERO,
|
||||
SR_CONF_ZERO_SET,
|
||||
SR_CONF_ZERO_LOAD,
|
||||
SR_CONF_ZERO_DEFAULT,
|
||||
SR_CONF_ZERO_COMB_FGAIN,
|
||||
SR_CONF_ZERO_COMB,
|
||||
SR_CONF_VOCM,
|
||||
SR_CONF_CALI,
|
||||
SR_CONF_HAVE_ZERO = 30029,
|
||||
SR_CONF_ZERO = 30030,
|
||||
SR_CONF_ZERO_SET = 30031,
|
||||
SR_CONF_ZERO_LOAD = 30032,
|
||||
SR_CONF_ZERO_DEFAULT = 30033,
|
||||
SR_CONF_ZERO_COMB_FGAIN = 30034,
|
||||
SR_CONF_ZERO_COMB = 30035,
|
||||
SR_CONF_VOCM = 30036,
|
||||
SR_CONF_CALI = 30037,
|
||||
|
||||
/** status for dso channel */
|
||||
SR_CONF_STATUS_PERIOD,
|
||||
SR_CONF_STATUS_PCNT,
|
||||
SR_CONF_STATUS_MAX,
|
||||
SR_CONF_STATUS_MIN,
|
||||
SR_CONF_STATUS_PLEN,
|
||||
SR_CONF_STATUS_LLEN,
|
||||
SR_CONF_STATUS_LEVEL,
|
||||
SR_CONF_STATUS_PLEVEL,
|
||||
SR_CONF_STATUS_LOW,
|
||||
SR_CONF_STATUS_HIGH,
|
||||
SR_CONF_STATUS_RLEN,
|
||||
SR_CONF_STATUS_FLEN,
|
||||
SR_CONF_STATUS_RMS,
|
||||
SR_CONF_STATUS_MEAN,
|
||||
SR_CONF_STATUS_PERIOD = 30038,
|
||||
SR_CONF_STATUS_PCNT = 30039,
|
||||
SR_CONF_STATUS_MAX = 30040,
|
||||
SR_CONF_STATUS_MIN = 30041,
|
||||
SR_CONF_STATUS_PLEN = 30042,
|
||||
SR_CONF_STATUS_LLEN = 30043,
|
||||
SR_CONF_STATUS_LEVEL = 30044,
|
||||
SR_CONF_STATUS_PLEVEL = 30045,
|
||||
SR_CONF_STATUS_LOW = 30046,
|
||||
SR_CONF_STATUS_HIGH = 30047,
|
||||
SR_CONF_STATUS_RLEN = 30048,
|
||||
SR_CONF_STATUS_FLEN = 30049,
|
||||
SR_CONF_STATUS_RMS = 30050,
|
||||
SR_CONF_STATUS_MEAN = 30051,
|
||||
|
||||
/** Stream */
|
||||
SR_CONF_STREAM,
|
||||
SR_CONF_STREAM = 30052,
|
||||
|
||||
/** DSO Roll */
|
||||
SR_CONF_ROLL,
|
||||
SR_CONF_ROLL = 30053,
|
||||
|
||||
/** Test */
|
||||
SR_CONF_TEST,
|
||||
SR_CONF_EEPROM,
|
||||
SR_CONF_TUNE,
|
||||
SR_CONF_TUNE_SEL,
|
||||
SR_CONF_EXTEND_ID,
|
||||
SR_CONF_EXTEND_DATA,
|
||||
SR_CONF_TEST = 30054,
|
||||
SR_CONF_EEPROM = 30055,
|
||||
SR_CONF_TUNE = 30056,
|
||||
SR_CONF_TUNE_SEL = 30057,
|
||||
SR_CONF_EXTEND_ID = 30058,
|
||||
SR_CONF_EXTEND_DATA = 30059,
|
||||
|
||||
/** The device supports setting its sample interval, in ms. */
|
||||
SR_CONF_SAMPLE_INTERVAL,
|
||||
SR_CONF_SAMPLE_INTERVAL = 30060,
|
||||
|
||||
/** Number of timebases, as related to SR_CONF_TIMEBASE. */
|
||||
SR_CONF_NUM_TIMEBASE,
|
||||
SR_CONF_NUM_TIMEBASE = 30061,
|
||||
|
||||
/** Number of vertical divisions, as related to SR_CONF_PROBE_VDIV. */
|
||||
SR_CONF_NUM_VDIV,
|
||||
SR_CONF_NUM_VDIV = 30062,
|
||||
|
||||
/** clock type (internal/external) */
|
||||
SR_CONF_CLOCK_TYPE,
|
||||
SR_CONF_CLOCK_TYPE = 30063,
|
||||
|
||||
/** clock edge (posedge/negedge) */
|
||||
SR_CONF_CLOCK_EDGE,
|
||||
SR_CONF_CLOCK_EDGE = 30064,
|
||||
|
||||
/** Device operation mode */
|
||||
SR_CONF_OPERATION_MODE,
|
||||
SR_CONF_OPERATION_MODE = 30065,
|
||||
|
||||
/** Device buffer options */
|
||||
SR_CONF_BUFFER_OPTIONS,
|
||||
SR_CONF_BUFFER_OPTIONS = 30066,
|
||||
|
||||
/** Device channel mode */
|
||||
SR_CONF_CHANNEL_MODE,
|
||||
SR_CONF_CHANNEL_MODE = 30067,
|
||||
|
||||
/** RLE compress support */
|
||||
SR_CONF_RLE_SUPPORT,
|
||||
SR_CONF_RLE_SUPPORT = 30068,
|
||||
|
||||
/** Signal max height **/
|
||||
SR_CONF_MAX_HEIGHT,
|
||||
SR_CONF_MAX_HEIGHT_VALUE,
|
||||
SR_CONF_MAX_HEIGHT = 30069,
|
||||
SR_CONF_MAX_HEIGHT_VALUE = 30070,
|
||||
|
||||
/** Device sample threshold */
|
||||
SR_CONF_THRESHOLD,
|
||||
SR_CONF_VTH,
|
||||
SR_CONF_THRESHOLD = 30071,
|
||||
SR_CONF_VTH = 30072,
|
||||
|
||||
/** Hardware capacity **/
|
||||
SR_CONF_MAX_DSO_SAMPLERATE,
|
||||
SR_CONF_MAX_DSO_SAMPLELIMITS,
|
||||
SR_CONF_HW_DEPTH,
|
||||
SR_CONF_MAX_DSO_SAMPLERATE = 30073,
|
||||
SR_CONF_MAX_DSO_SAMPLELIMITS = 30074,
|
||||
SR_CONF_HW_DEPTH = 30075,
|
||||
|
||||
/** bandwidth */
|
||||
SR_CONF_BANDWIDTH,
|
||||
SR_CONF_BANDWIDTH_LIMIT,
|
||||
SR_CONF_BANDWIDTH = 30076,
|
||||
SR_CONF_BANDWIDTH_LIMIT = 30077,
|
||||
|
||||
/*--- Probe configuration -------------------------------------------*/
|
||||
/** Probe options */
|
||||
SR_CONF_PROBE_CONFIGS,
|
||||
SR_CONF_PROBE_CONFIGS = 30078,
|
||||
|
||||
/** Probe options */
|
||||
SR_CONF_PROBE_SESSIONS,
|
||||
SR_CONF_PROBE_SESSIONS = 30079,
|
||||
|
||||
/** Enable */
|
||||
SR_CONF_PROBE_EN,
|
||||
SR_CONF_PROBE_EN = 30080,
|
||||
|
||||
/** Coupling */
|
||||
SR_CONF_PROBE_COUPLING,
|
||||
SR_CONF_PROBE_COUPLING = 30081,
|
||||
|
||||
/** Volts/div */
|
||||
SR_CONF_PROBE_VDIV,
|
||||
SR_CONF_PROBE_VDIV = 30082,
|
||||
|
||||
/** Factor */
|
||||
SR_CONF_PROBE_FACTOR,
|
||||
SR_CONF_PROBE_FACTOR = 30083,
|
||||
|
||||
/** Mapping */
|
||||
SR_CONF_PROBE_MAP_DEFAULT,
|
||||
SR_CONF_PROBE_MAP_UNIT,
|
||||
SR_CONF_PROBE_MAP_MIN,
|
||||
SR_CONF_PROBE_MAP_MAX,
|
||||
SR_CONF_PROBE_MAP_DEFAULT = 30084,
|
||||
SR_CONF_PROBE_MAP_UNIT = 30085,
|
||||
SR_CONF_PROBE_MAP_MIN = 30086,
|
||||
SR_CONF_PROBE_MAP_MAX = 30087,
|
||||
|
||||
/** Vertical offset */
|
||||
SR_CONF_PROBE_OFFSET,
|
||||
SR_CONF_PROBE_HW_OFFSET,
|
||||
SR_CONF_PROBE_PREOFF,
|
||||
SR_CONF_PROBE_PREOFF_DEFAULT,
|
||||
SR_CONF_PROBE_PREOFF_MARGIN,
|
||||
SR_CONF_PROBE_OFFSET = 30088,
|
||||
SR_CONF_PROBE_HW_OFFSET = 30089,
|
||||
SR_CONF_PROBE_PREOFF = 30090,
|
||||
SR_CONF_PROBE_PREOFF_DEFAULT = 30091,
|
||||
SR_CONF_PROBE_PREOFF_MARGIN = 30092,
|
||||
|
||||
/** VGain */
|
||||
SR_CONF_PROBE_VGAIN,
|
||||
SR_CONF_PROBE_VGAIN_DEFAULT,
|
||||
SR_CONF_PROBE_VGAIN_RANGE,
|
||||
SR_CONF_PROBE_COMB_COMP_EN,
|
||||
SR_CONF_PROBE_COMB_COMP,
|
||||
SR_CONF_PROBE_VGAIN = 30093,
|
||||
SR_CONF_PROBE_VGAIN_DEFAULT = 30094,
|
||||
SR_CONF_PROBE_VGAIN_RANGE = 30095,
|
||||
SR_CONF_PROBE_COMB_COMP_EN = 30096,
|
||||
SR_CONF_PROBE_COMB_COMP = 30097,
|
||||
|
||||
/*--- Special stuff -------------------------------------------------*/
|
||||
|
||||
/** Device options for a particular device. */
|
||||
SR_CONF_DEVICE_OPTIONS,
|
||||
SR_CONF_DEVICE_OPTIONS = 30098,
|
||||
|
||||
/** Sessions */
|
||||
SR_CONF_DEVICE_SESSIONS,
|
||||
SR_CONF_DEVICE_SESSIONS = 30099,
|
||||
|
||||
/** Session filename. */
|
||||
SR_CONF_SESSIONFILE,
|
||||
SR_CONF_SESSIONFILE = 30100,
|
||||
|
||||
/** The device supports specifying a capturefile to inject. */
|
||||
SR_CONF_CAPTUREFILE,
|
||||
SR_CONF_CAPTUREFILE = 30101,
|
||||
|
||||
/** Session file version */
|
||||
SR_CONF_FILE_VERSION,
|
||||
SR_CONF_FILE_VERSION = 30102,
|
||||
|
||||
/** The device supports setting the number of probes. */
|
||||
SR_CONF_CAPTURE_NUM_PROBES,
|
||||
SR_CONF_CAPTURE_NUM_PROBES = 30103,
|
||||
|
||||
/** The device supports setting the number of data blocks. */
|
||||
SR_CONF_NUM_BLOCKS,
|
||||
SR_CONF_NUM_BLOCKS = 30104,
|
||||
|
||||
/** language (string code) **/
|
||||
SR_CONF_LANGUAGE,
|
||||
SR_CONF_LANGUAGE = 30105,
|
||||
|
||||
/*--- Acquisition modes ---------------------------------------------*/
|
||||
|
||||
@ -1038,39 +1038,39 @@ enum sr_config_option_id{
|
||||
* The device supports setting a sample number limit (how many
|
||||
* samples should be acquired).
|
||||
*/
|
||||
SR_CONF_LIMIT_SAMPLES,
|
||||
SR_CONF_LIMIT_SAMPLES = 50001,
|
||||
|
||||
/**
|
||||
* Absolute time record for session driver
|
||||
*/
|
||||
SR_CONF_TRIGGER_TIME,
|
||||
SR_CONF_TRIGGER_TIME = 50002,
|
||||
|
||||
/**
|
||||
* Trigger position for session driver
|
||||
*/
|
||||
SR_CONF_TRIGGER_POS,
|
||||
SR_CONF_TRIGGER_POS = 50003,
|
||||
|
||||
/**
|
||||
* The actual sample count received
|
||||
*/
|
||||
SR_CONF_ACTUAL_SAMPLES,
|
||||
SR_CONF_ACTUAL_SAMPLES = 50004,
|
||||
|
||||
/**
|
||||
* The device supports setting a frame limit (how many
|
||||
* frames should be acquired).
|
||||
*/
|
||||
SR_CONF_LIMIT_FRAMES,
|
||||
SR_CONF_LIMIT_FRAMES = 50005,
|
||||
|
||||
/**
|
||||
* The device supports continuous sampling. Neither a time limit
|
||||
* nor a sample number limit has to be supplied, it will just acquire
|
||||
* samples continuously, until explicitly stopped by a certain command.
|
||||
*/
|
||||
SR_CONF_CONTINUOUS,
|
||||
SR_CONF_CONTINUOUS = 50006,
|
||||
|
||||
/** The device has internal storage, into which data is logged. This
|
||||
* starts or stops the internal logging. */
|
||||
SR_CONF_DATALOG,
|
||||
SR_CONF_DATALOG = 50007,
|
||||
};
|
||||
|
||||
/** Device instance status. */
|
||||
@ -1410,6 +1410,11 @@ SR_API int ds_stop_collect();
|
||||
*/
|
||||
SR_API int ds_is_collecting();
|
||||
|
||||
/**
|
||||
* Close the actived device.
|
||||
*/
|
||||
SR_API int ds_release_actived_device();
|
||||
|
||||
/*---config -----------------------------------------------*/
|
||||
SR_API int ds_get_actived_device_config(const struct sr_channel *ch,
|
||||
const struct sr_channel_group *cg,
|
||||
|
Loading…
x
Reference in New Issue
Block a user