X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fbrymen-dmm%2Fprotocol.c;h=3dd8dd3137a3074ea2bbb397963f09cb1e991874;hb=09c650d5e910d841c49e7b1e86e4126cecd7e060;hp=3e1b84c421834030b777fe1b9fd7ee347bbd5e2f;hpb=dcba0c41f5345a4c5316128aac44732625faff6e;p=libsigrok.git diff --git a/src/hardware/brymen-dmm/protocol.c b/src/hardware/brymen-dmm/protocol.c index 3e1b84c4..3dd8dd31 100644 --- a/src/hardware/brymen-dmm/protocol.c +++ b/src/hardware/brymen-dmm/protocol.c @@ -25,22 +25,28 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi) float floatval; struct dev_context *devc; struct sr_datafeed_packet packet; - struct sr_datafeed_analog_old analog; + struct sr_datafeed_analog analog; + struct sr_analog_encoding encoding; + struct sr_analog_meaning meaning; + struct sr_analog_spec spec; devc = sdi->priv; + /* TODO: Use proper 'digits' value for this device (and its modes). */ + sr_analog_init(&analog, &encoding, &meaning, &spec, 2); + analog.num_samples = 1; - analog.mq = -1; + analog.meaning->mq = 0; if (brymen_parse(buf, &floatval, &analog, NULL) != SR_OK) return; analog.data = &floatval; - analog.channels = sdi->channels; + analog.meaning->channels = sdi->channels; - if (analog.mq != -1) { + if (analog.meaning->mq != 0) { /* Got a measurement. */ - packet.type = SR_DF_ANALOG_OLD; + packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(sdi, &packet); sr_sw_limits_update_samples_read(&devc->sw_limits, 1); @@ -137,7 +143,7 @@ SR_PRIV int brymen_dmm_receive_data(int fd, int revents, void *cb_data) } if (sr_sw_limits_check(&devc->sw_limits)) - sdi->driver->dev_acquisition_stop(sdi); + sr_dev_acquisition_stop(sdi); return TRUE; }