source_callbacks.erase(source);
}
+shared_ptr<Trigger> Session::get_trigger()
+{
+ return trigger;
+}
+
+void Session::set_trigger(shared_ptr<Trigger> trigger)
+{
+ check(sr_session_trigger_set(structure, trigger->structure));
+ this->trigger = trigger;
+}
+
Packet::Packet(const struct sr_datafeed_packet *structure) :
structure(structure)
{
void operator()(Trigger *trigger) { delete trigger; }
};
friend class Context;
+ friend class Session;
};
/** Trigger stage */
void begin_save(string filename);
/** Append a packet to the session file being saved. */
void append(shared_ptr<Device> device, shared_ptr<Packet> packet);
+ /** Get current trigger setting. */
+ shared_ptr<Trigger> get_trigger();
+ /** Set trigger setting. */
+ void set_trigger(shared_ptr<Trigger> trigger);
protected:
Session(shared_ptr<Context> context);
Session(shared_ptr<Context> context, string filename);
bool save_initialized;
string save_filename;
uint64_t save_samplerate;
+ shared_ptr<Trigger> trigger;
/** Deleter needed to allow shared_ptr use with protected destructor. */
class Deleter
{
std::vector<std::shared_ptr<sigrok::Device> >,
devices, get_devices);
+%attributestring(sigrok::Session,
+ std::shared_ptr<sigrok::Trigger>, trigger, get_trigger, set_trigger)
+
%attribute(sigrok::Packet, sigrok::PacketPayload *, payload, get_payload);
%attribute(sigrok::Analog, int, num_samples, get_num_samples);