namespace sigrok
{
+using namespace std;
+
/** Helper function to translate C errors to C++ exceptions. */
static void check(int result)
{
shared_ptr<Packet> Context::create_analog_packet(
vector<shared_ptr<Channel> > channels,
- const float *data_pointer, unsigned int num_samples, const Quantity *mq,
+ float *data_pointer, unsigned int num_samples, const Quantity *mq,
const Unit *unit, vector<const QuantityFlag *> mqflags)
{
auto analog = g_new0(struct sr_datafeed_analog, 1);
spec->spec_digits = 0;
analog->num_samples = num_samples;
- analog->data = (float*)data_pointer;
+ analog->data = data_pointer;
auto packet = g_new(struct sr_datafeed_packet, 1);
packet->type = SR_DF_ANALOG;
packet->payload = analog;
return shared_ptr<Packet>{new Packet{nullptr, packet}, default_delete<Packet>{}};
}
+shared_ptr<Packet> Context::create_end_packet()
+{
+ auto packet = g_new(struct sr_datafeed_packet, 1);
+ packet->type = SR_DF_END;
+ return shared_ptr<Packet>{new Packet{nullptr, packet},
+ default_delete<Packet>{}};
+}
+
shared_ptr<Session> Context::load_session(string filename)
{
return shared_ptr<Session>{
_owned_devices.emplace(sdi, move(device));
}
_context->_session = this;
+ g_slist_free(dev_list);
}
Session::~Session()
auto *const sdi = static_cast<struct sr_dev_inst *>(dev->data);
result.push_back(get_device(sdi));
}
+ g_slist_free(dev_list);
return result;
}
check(sr_output_free(_structure));
}
+shared_ptr<OutputFormat> Output::format()
+{
+ return _format;
+}
+
string Output::receive(shared_ptr<Packet> packet)
{
GString *out;