From 7ee0c40b4ac605c68a8ec2008ef4ab61a1872475 Mon Sep 17 00:00:00 2001 From: Bert Vermeulen Date: Thu, 14 Nov 2013 00:19:28 +0100 Subject: Implement OUTPUT_META This replaces the Decoder.add() method with Decoder.register(). The first argument is still output type, but all arguments are now optional: Decoder.register(output_type, id='someid', meta=(object-type, 'Name', 'Description')) 'id' defaults to the protocol decoder instance id, and only needs changing if a decoder chain needs to fork. 'object-type' refers to a Python object, such as int or str. After registering, the PD submits data as usual with Decoder.put(), with the only argument a value of the registered object-type. --- libsigrokdecode.h.in | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'libsigrokdecode.h.in') diff --git a/libsigrokdecode.h.in b/libsigrokdecode.h.in index 3beff35..a654373 100644 --- a/libsigrokdecode.h.in +++ b/libsigrokdecode.h.in @@ -162,6 +162,7 @@ enum { SRD_OUTPUT_ANN, SRD_OUTPUT_PYTHON, SRD_OUTPUT_BINARY, + SRD_OUTPUT_META, }; #define SRD_MAX_NUM_PROBES 64 @@ -249,6 +250,10 @@ struct srd_pd_output { int output_type; struct srd_decoder_inst *di; char *proto_id; + /* Only used for OUTPUT_META. */ + const GVariantType *meta_type; + char *meta_name; + char *meta_descr; }; struct srd_proto_data { -- cgit v1.2.3-70-g09d2