#include "sigsession.h"
#include "devicemanager.h"
-#include "devinst.h"
+#include "device/devinst.h"
#include "data/analog.h"
#include "data/analogsnapshot.h"
{
stop_capture();
- _sampling_thread.join();
+ if (_sampling_thread.joinable())
+ _sampling_thread.join();
if (_dev_inst)
_device_manager.release_device(_dev_inst);
_session = NULL;
}
-shared_ptr<DevInst> SigSession::get_device() const
+shared_ptr<device::DevInst> SigSession::get_device() const
{
return _dev_inst;
}
-void SigSession::set_device(shared_ptr<DevInst> dev_inst)
+void SigSession::set_device(shared_ptr<device::DevInst> dev_inst)
{
// Ensure we are not capturing before setting the device
stop_capture();
update_signals(dev_inst);
}
-void SigSession::release_device(shared_ptr<DevInst> dev_inst)
+void SigSession::release_device(shared_ptr<device::DevInst> dev_inst)
{
(void)dev_inst;
assert(_capture_state == Stopped);
- _dev_inst = shared_ptr<DevInst>();
+ _dev_inst = shared_ptr<device::DevInst>();
}
void SigSession::load_file(const string &name,
return;
}
- shared_ptr<DevInst> dev_inst(
- new DevInst((sr_dev_inst*)devlist->data));
+ shared_ptr<device::DevInst> dev_inst(
+ new device::DevInst((sr_dev_inst*)devlist->data));
g_slist_free(devlist);
_decode_traces.clear();
return;
_decode_traces.clear();
- update_signals(shared_ptr<DevInst>(new DevInst(in->sdi)));
+ update_signals(shared_ptr<device::DevInst>(
+ new device::DevInst(in->sdi)));
read_sample_rate(in->sdi);
_sampling_thread = boost::thread(
sr_session_stop();
// Check that sampling stopped
- _sampling_thread.join();
+ if (_sampling_thread.joinable())
+ _sampling_thread.join();
}
set< shared_ptr<data::SignalData> > SigSession::get_data() const
return in;
}
-void SigSession::update_signals(shared_ptr<DevInst> dev_inst)
+void SigSession::update_signals(shared_ptr<device::DevInst> dev_inst)
{
assert(dev_inst);
assert(_capture_state == Stopped);
delete in;
}
-void SigSession::sample_thread_proc(shared_ptr<DevInst> dev_inst,
+void SigSession::sample_thread_proc(shared_ptr<device::DevInst> dev_inst,
function<void (const QString)> error_handler)
{
assert(dev_inst);
// Create a new data snapshot
_cur_logic_snapshot = shared_ptr<data::LogicSnapshot>(
- new data::LogicSnapshot(logic));
+ new data::LogicSnapshot(logic, _dev_inst->get_sample_limit()));
_logic_data->push_snapshot(_cur_logic_snapshot);
}
else
// Create a snapshot, keep it in the maps of probes
snapshot = shared_ptr<data::AnalogSnapshot>(
- new data::AnalogSnapshot());
+ new data::AnalogSnapshot(_dev_inst->get_sample_limit()));
_cur_analog_snapshots[probe] = snapshot;
// Find the annalog data associated with the probe