]> sigrok.org Git - libsigrokflow.git/blobdiff - include/libsigrokflow/libsigrokflow.hpp
Implement LegacyCaptureDevice.
[libsigrokflow.git] / include / libsigrokflow / libsigrokflow.hpp
index 5cc17b52b108daec484333c1f4dbf3c3a63ebdd9..e800be0d45cc38248fc55fd8a0ae92d3195b096a 100644 (file)
 #ifndef LIBSIGROKFLOW_LIBSIGROKFLOW_HPP
 #define LIBSIGROKFLOW_LIBSIGROKFLOW_HPP
 
+#include <gstreamermm.h>
+#include <libsigrokcxx/libsigrokcxx.hpp>
+
+namespace Srf
+{
+
+using namespace std;
+
+void init();
+
+class Block
+{
+        /* Config API etc goes here */
+};
+
+class GstBlock :
+        public Gst::Element
+{
+        /* Operations specific to sigrok GStreamer blocks go here. */
+};
+
+class Device :
+        public GstBlock
+{
+        /* Operations specific to hardware devices go here */
+};
+
+class CaptureDevice :
+        public Device
+{
+        /* Operations specific to capture (source) devices go here */
+protected :
+        CaptureDevice();
+};
+
+class LegacyCaptureDevice :
+        public CaptureDevice
+{
+public:
+        /* Construct from libsigrok device object */
+        LegacyCaptureDevice(shared_ptr<sigrok::HardwareDevice>);
+
+        /* Retrieve libsigrok device object */
+        shared_ptr<sigrok::HardwareDevice> libsigrok_device();
+
+        /* Override state change */
+        Gst::StateChangeReturn change_state_vfunc(Gst::StateChange transition);
+private:
+        shared_ptr<sigrok::HardwareDevice> _device;
+        Glib::RefPtr<Gst::Pad> _src_pad;
+        Glib::Threads::RecMutex _mutex;
+        Glib::RefPtr<Gst::Task> _task;
+        shared_ptr<sigrok::Session> _session;
+
+        void _datafeed_callback(shared_ptr<sigrok::Device> device,
+                        shared_ptr<sigrok::Packet> packet);
+        void _run();
+};
+
+
+}
 #endif