diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2012-02-11 22:38:17 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2012-02-11 22:41:33 +0100 |
commit | ae53d0a5971121e03a07c469e39ff3cfa34a2111 (patch) | |
tree | 80f978fc2a0f6ca630409cc0ba08f9101d60fa21 /sigrokdecode.h | |
parent | 56bf4c20afc2785f8cdf75e386159e23fa2c1acf (diff) | |
download | libsigrokdecode-ae53d0a5971121e03a07c469e39ff3cfa34a2111.tar.gz libsigrokdecode-ae53d0a5971121e03a07c469e39ff3cfa34a2111.zip |
srd: Every callback should have a 'void *' parameter.
This is required in various situations and for various lib users,
especially so GUIs which might want to pass specific info via this
mechanism.
Diffstat (limited to 'sigrokdecode.h')
-rw-r--r-- | sigrokdecode.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sigrokdecode.h b/sigrokdecode.h index 4768b4c..18ab513 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -173,9 +173,13 @@ struct srd_proto_data { void *data; }; +typedef void (*srd_pd_output_callback_t)(struct srd_proto_data *pdata, + void *data); + struct srd_pd_callback { int output_type; - void (*callback)(struct srd_proto_data *); + srd_pd_output_callback_t callback; + void *data; }; /* custom python types */ @@ -220,8 +224,8 @@ SRD_API int srd_session_start(int num_probes, int unitsize, SRD_API int srd_session_feed(uint64_t start_samplenum, uint8_t *inbuf, uint64_t inbuflen); SRD_API struct srd_decoder_inst *get_di_by_decobject(void *decobject); -typedef void (*srd_pd_output_callback_t)(struct srd_proto_data *pdata); -SRD_API int srd_register_callback(int output_type, srd_pd_output_callback_t cb); +SRD_API int srd_register_callback(int output_type, + srd_pd_output_callback_t cb, void *data); SRD_API void *srd_find_callback(int output_type); /*--- decoder.c -------------------------------------------------------------*/ |