From: Martin Ling Date: Thu, 27 Dec 2018 19:38:30 +0000 (+0100) Subject: bindings: Add new Context::create_end_packet() method. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=a9ed2eb06953eb34fb019ae9a80e213c75790fab;p=libsigrok.git bindings: Add new Context::create_end_packet() method. --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 925a557a..12ab2c29 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -377,6 +377,14 @@ shared_ptr Context::create_analog_packet( return shared_ptr{new Packet{nullptr, packet}, default_delete{}}; } +shared_ptr Context::create_end_packet() +{ + auto packet = g_new(struct sr_datafeed_packet, 1); + packet->type = SR_DF_END; + return shared_ptr{new Packet{nullptr, packet}, + default_delete{}}; +} + shared_ptr Context::load_session(string filename) { return shared_ptr{ diff --git a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp index 80888af6..b8cae545 100644 --- a/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp +++ b/bindings/cxx/include/libsigrokcxx/libsigrokcxx.hpp @@ -287,6 +287,8 @@ public: vector > channels, const float *data_pointer, unsigned int num_samples, const Quantity *mq, const Unit *unit, vector mqflags); + /** Create an end packet. */ + shared_ptr create_end_packet(); /** Load a saved session. * @param filename File name string. */ shared_ptr load_session(string filename);