From: Soeren Apel Date: Tue, 22 Mar 2016 07:25:08 +0000 (+0100) Subject: Bindings: Update create_analog_packet() to the new analog format X-Git-Tag: libsigrok-0.5.0~543 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=d9d57ceb283dc43f5f80619d24e5233666644dfb;p=libsigrok.git Bindings: Update create_analog_packet() to the new analog format --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 4b4de2d3..f7b1dcba 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -317,15 +317,39 @@ shared_ptr Context::create_analog_packet( { auto analog = g_new0(struct sr_datafeed_analog, 1); auto meaning = g_new0(struct sr_analog_meaning, 1); + auto encoding = g_new0(struct sr_analog_encoding, 1); + auto spec = g_new0(struct sr_analog_spec, 1); analog->meaning = meaning; for (const auto &channel : channels) meaning->channels = g_slist_append(meaning->channels, channel->_structure); - analog->num_samples = num_samples; meaning->mq = static_cast(mq->id()); meaning->unit = static_cast(unit->id()); meaning->mqflags = static_cast(QuantityFlag::mask_from_flags(move(mqflags))); + + analog->encoding = encoding; + + encoding->unitsize = sizeof(float); + encoding->is_signed = TRUE; + encoding->is_float = TRUE; +#ifdef WORDS_BIGENDIAN + encoding->is_bigendian = TRUE; +#else + encoding->is_bigendian = FALSE; +#endif + encoding->digits = 0; + encoding->is_digits_decimal = FALSE; + encoding->scale.p = 1; + encoding->scale.q = 1; + encoding->offset.p = 0; + encoding->offset.q = 1; + + analog->spec = spec; + + spec->spec_digits = 0; + + analog->num_samples = num_samples; analog->data = data_pointer; auto packet = g_new(struct sr_datafeed_packet, 1); packet->type = SR_DF_ANALOG;