Output::Deleter());
}
+bool OutputFormat::test_flag(const OutputFlag *flag)
+{
+ return sr_output_test_flag(_structure, flag->id());
+}
+
Output::Output(shared_ptr<OutputFormat> format,
shared_ptr<Device> device, map<string, Glib::VariantBase> options) :
UserOwned(sr_output_new(format->_structure,
('sr_configkey', ('ConfigKey', 'Configuration key')),
('sr_datatype', ('DataType', 'Configuration data type')),
('sr_channeltype', ('ChannelType', 'Channel type')),
- ('sr_trigger_matches', ('TriggerMatchType', 'Trigger match type'))])
+ ('sr_trigger_matches', ('TriggerMatchType', 'Trigger match type')),
+ ('sr_output_flag', ('OutputFlag', 'Flag applied to output modules'))])
index = ElementTree.parse(index_file)
class SR_API ConfigKey;
class SR_API InputFormat;
class SR_API OutputFormat;
+class SR_API OutputFlag;
class SR_API LogLevel;
class SR_API ChannelGroup;
class SR_API Trigger;
shared_ptr<Device> device,
map<string, Glib::VariantBase> options =
map<string, Glib::VariantBase>());
+ /**
+ * Checks whether a given flag is set.
+ * @param flag Flag to check
+ * @return true if flag is set for this module
+ * @see sr_output_flags
+ */
+ bool test_flag(const OutputFlag *flag);
protected:
OutputFormat(const struct sr_output_module *structure);
~OutputFormat();
GSList *values;
};
+/** Output module flags. */
+enum sr_output_flag {
+ /** If set, this output module writes the output itself. */
+ SR_OUTPUT_INTERNAL_IO_HANDLING = 0x01,
+};
+
struct sr_input;
struct sr_input_module;
struct sr_output;
const struct sr_input_module *imod);
SR_API const struct sr_input_module *sr_input_find(char *id);
SR_API const struct sr_option **sr_input_options_get(const struct sr_input_module *imod);
+SR_API gboolean sr_output_test_flag(const struct sr_output_module *omod,
+ uint64_t flag);
SR_API void sr_input_options_free(const struct sr_option **options);
SR_API struct sr_input *sr_input_new(const struct sr_input_module *imod,
GHashTable *options);
*/
const char *const *exts;
+ /**
+ * Bitfield containing flags that describe certain properties
+ * this output module may or may not have.
+ * @see sr_output_flags
+ */
+ const uint64_t flags;
+
/**
* Returns a NULL-terminated list of options this module can take.
* Can be NULL, if the module has no options.
.name = "Analog",
.desc = "Analog data and types",
.exts = NULL,
+ .flags = 0,
.options = get_options,
.init = init,
.receive = receive,
.name = "ASCII",
.desc = "ASCII art",
.exts = (const char*[]){"txt", NULL},
+ .flags = 0,
.options = get_options,
.init = init,
.receive = receive,
.name = "Binary",
.desc = "Raw binary",
.exts = NULL,
+ .flags = 0,
.options = NULL,
.receive = receive,
};
.name = "Bits",
.desc = "0/1 digits",
.exts = (const char*[]){"txt", NULL},
+ .flags = 0,
.options = get_options,
.init = init,
.receive = receive,
.name = "ChronoVu LA8",
.desc = "ChronoVu LA8 native file format",
.exts = (const char*[]){"kdt", NULL},
+ .flags = 0,
.options = NULL,
.init = init,
.receive = receive,
.name = "CSV",
.desc = "Comma-separated values",
.exts = (const char*[]){"csv", NULL},
+ .flags = 0,
.options = NULL,
.init = init,
.receive = receive,
.name = "Gnuplot",
.desc = "Gnuplot data file format",
.exts = (const char*[]){"dat", NULL},
+ .flags = 0,
.options = NULL,
.init = init,
.receive = receive,
.name = "Hexadecimal",
.desc = "Hexadecimal digits",
.exts = (const char*[]){"txt", NULL},
+ .flags = 0,
.options = get_options,
.init = init,
.receive = receive,
.name = "OLS",
.desc = "OpenBench Logic Sniffer",
.exts = (const char*[]){"ols", NULL},
+ .flags = 0,
.options = NULL,
.init = init,
.receive = receive,
return omod->exts;
}
+/*
+ * Checks whether a given flag is set.
+ *
+ * @see sr_output_flag
+ * @since 0.4.0
+ */
+SR_API gboolean sr_output_test_flag(const struct sr_output_module *omod,
+ uint64_t flag)
+{
+ return (flag & omod->flags);
+}
+
/**
* Return the output module with the specified ID, or NULL if no module
* with that id is found.
.name = "srzip",
.desc = "srzip session file",
.exts = (const char*[]){"sr", NULL},
+ .flags = SR_OUTPUT_INTERNAL_IO_HANDLING,
.options = get_options,
.init = init,
.receive = receive,
.name = "VCD",
.desc = "Value Change Dump",
.exts = (const char*[]){"vcd", NULL},
+ .flags = 0,
.options = NULL,
.init = init,
.receive = receive,
.name = "WAV",
.desc = "Microsoft WAV file format",
.exts = (const char*[]){"wav", NULL},
+ .flags = 0,
.options = get_options,
.init = init,
.receive = receive,