From: Bert Vermeulen Date: Sun, 8 Jan 2012 23:12:19 +0000 (+0100) Subject: srd: change output_new() API call to add() X-Git-Tag: libsigrokdecode-0.1.0~189 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f9a3947a7a8d884de6c55693b216f89b1d27d979;p=libsigrokdecode.git srd: change output_new() API call to add() --- diff --git a/controller.c b/controller.c index f7ffb25..1ed852b 100644 --- a/controller.c +++ b/controller.c @@ -293,7 +293,7 @@ int srd_session_feed(uint64_t timeoffset, uint64_t duration, uint8_t *inbuf, } -int pd_output_new(struct srd_decoder_instance *di, int output_type, +int pd_add(struct srd_decoder_instance *di, int output_type, char *protocol_id) { struct srd_pd_output *pdo; diff --git a/decoders/i2c.py b/decoders/i2c.py index abe4d7e..f098aff 100644 --- a/decoders/i2c.py +++ b/decoders/i2c.py @@ -180,8 +180,8 @@ class Decoder(sigrokdecode.Decoder): self.oldsda = None def start(self, metadata): - self.output_protocol = self.output_new(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'i2c') - self.output_annotation = self.output_new(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'i2c') + self.output_protocol = self.add(sigrokdecode.SRD_OUTPUT_PROTOCOL, 'i2c') + self.output_annotation = self.add(sigrokdecode.SRD_OUTPUT_ANNOTATION, 'i2c') def report(self): pass diff --git a/module_sigrokdecode.c b/module_sigrokdecode.c index e92c9e7..69bd17e 100644 --- a/module_sigrokdecode.c +++ b/module_sigrokdecode.c @@ -148,7 +148,7 @@ static PyObject *Decoder_put(PyObject *self, PyObject *args) } -static PyObject *Decoder_output_new(PyObject *self, PyObject *args) +static PyObject *Decoder_add(PyObject *self, PyObject *args) { PyObject *ret; struct srd_decoder_instance *di; @@ -163,7 +163,7 @@ static PyObject *Decoder_output_new(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "is", &output_type, &protocol_id)) return NULL; - pdo_id = pd_output_new(di, output_type, protocol_id); + pdo_id = pd_add(di, output_type, protocol_id); if (pdo_id < 0) Py_RETURN_NONE; else @@ -176,8 +176,7 @@ static PyMethodDef no_methods[] = { {NULL, NULL, 0, NULL} }; static PyMethodDef Decoder_methods[] = { {"put", Decoder_put, METH_VARARGS, "Accepts a dictionary with the following keys: time, duration, data"}, - {"output_new", Decoder_output_new, METH_VARARGS, - "Create a new output stream"}, + {"add", Decoder_add, METH_VARARGS, "Create a new output stream"}, {NULL, NULL, 0, NULL} }; diff --git a/sigrokdecode.h b/sigrokdecode.h index 85845c9..1473969 100644 --- a/sigrokdecode.h +++ b/sigrokdecode.h @@ -175,7 +175,7 @@ int srd_run_decoder(uint64_t timeoffset, uint64_t duration, struct srd_decoder_instance *dec, uint8_t *inbuf, uint64_t inbuflen); int srd_session_feed(uint64_t timeoffset, uint64_t duration, uint8_t *inbuf, uint64_t inbuflen); -int pd_output_new(struct srd_decoder_instance *di, int output_type, +int pd_add(struct srd_decoder_instance *di, int output_type, char *output_id); struct srd_decoder_instance *get_di_by_decobject(void *decobject); int srd_register_callback(int output_type, void *cb);