MCPcopy Create free account
hub / github.com/DreamSourceLab/DSView / srd_pd_output_callback_add

Function srd_pd_output_callback_add

libsigrokdecode4DSL/session.c:380–404  ·  view source on GitHub ↗

* Register/add a decoder output callback function. * * The function will be called when a protocol decoder sends output back * to the PD controller (except for Python objects, which only go up the * stack). * * @param sess The output session in which to register the callback. * Must not be NULL. * @param output_type The output type this callback will receive. Only one *

Source from the content-addressed store, hash-verified

378 * @since 0.3.0
379 */
380SRD_API int srd_pd_output_callback_add(struct srd_session *sess,
381 int output_type, srd_pd_output_callback cb, void *cb_data)
382{
383 struct srd_pd_callback *pd_cb;
384
385 if (!sess)
386 return SRD_ERR_ARG;
387
388 srd_dbg("Registering new callback for output type %s.",
389 output_type_name(output_type));
390
391 pd_cb = malloc(sizeof(struct srd_pd_callback));
392 if (pd_cb == NULL){
393 srd_err("%s,ERROR:failed to alloc memory.", __func__);
394 return SRD_ERR;
395 }
396 memset(pd_cb, 0, sizeof(struct srd_pd_callback));
397
398 pd_cb->output_type = output_type;
399 pd_cb->cb = cb;
400 pd_cb->cb_data = cb_data;
401 sess->callbacks = g_slist_append(sess->callbacks, pd_cb);
402
403 return SRD_OK;
404}
405
406/** @private */
407SRD_PRIV struct srd_pd_callback *srd_pd_output_callback_find(

Callers 1

execute_decode_stackMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected