SR_DF_TRIGGER,
/** Payload is struct sr_datafeed_logic. */
SR_DF_LOGIC,
- /** DEPRECATED! Use SR_DF_ANALOG instead. */
- SR_DF_ANALOG_OLD,
/** Beginning of frame. No payload. */
SR_DF_FRAME_BEGIN,
/** End of frame. No payload. */
void *data;
};
-/** Analog datafeed payload for type SR_DF_ANALOG_OLD. */
-struct sr_datafeed_analog_old {
- /** The channels for which data is included in this packet. */
- GSList *channels;
- /** Number of samples in data */
- int num_samples;
- /** Measured quantity (voltage, current, temperature, and so on).
- * Use SR_MQ_VOLTAGE, ... */
- int mq;
- /** Unit in which the MQ is measured. Use SR_UNIT_VOLT, ... */
- int unit;
- /** Bitmap with extra information about the MQ. Use SR_MQFLAG_AC, ... */
- uint64_t mqflags;
- /** The analog value(s). The data is interleaved according to
- * the channels list. */
- float *data;
-};
-
/** Analog datafeed payload for type SR_DF_ANALOG. */
struct sr_datafeed_analog {
void *data;
static void datafeed_dump(const struct sr_datafeed_packet *packet)
{
const struct sr_datafeed_logic *logic;
- const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog *analog;
/* Please use the same order as in libsigrok.h. */
sr_dbg("bus: Received SR_DF_LOGIC packet (%" PRIu64 " bytes, "
"unitsize = %d).", logic->length, logic->unitsize);
break;
- case SR_DF_ANALOG_OLD:
- analog_old = packet->payload;
- sr_dbg("bus: Received SR_DF_ANALOG_OLD packet (%d samples).",
- analog_old->num_samples);
- break;
case SR_DF_FRAME_BEGIN:
sr_dbg("bus: Received SR_DF_FRAME_BEGIN packet.");
break;
return SR_ERR_BUG;
}
- if (packet->type == SR_DF_ANALOG_OLD) {
- /* Convert to SR_DF_ANALOG. */
- const struct sr_datafeed_analog_old *analog_old = packet->payload;
- struct sr_analog_encoding encoding;
- struct sr_analog_meaning meaning;
- struct sr_analog_spec spec;
- struct sr_datafeed_analog analog;
- struct sr_datafeed_packet new_packet;
- new_packet.type = SR_DF_ANALOG;
- new_packet.payload = &analog;
- analog.data = analog_old->data;
- analog.num_samples = analog_old->num_samples;
- analog.encoding = &encoding;
- analog.meaning = &meaning;
- analog.spec = &spec;
- 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;
- meaning.mq = analog_old->mq;
- meaning.unit = analog_old->unit;
- meaning.mqflags = analog_old->mqflags;
- meaning.channels = analog_old->channels;
- spec.spec_digits = 0;
- return sr_session_send(sdi, &new_packet);
- }
-
/*
* Pass the packet to the first transform module. If that returns
* another packet (instead of NULL), pass that packet to the next
struct sr_datafeed_meta *meta_copy;
const struct sr_datafeed_logic *logic;
struct sr_datafeed_logic *logic_copy;
- const struct sr_datafeed_analog_old *analog_old;
- struct sr_datafeed_analog_old *analog_old_copy;
const struct sr_datafeed_analog *analog;
struct sr_datafeed_analog *analog_copy;
uint8_t *payload;
memcpy(logic_copy->data, logic->data, logic->length * logic->unitsize);
(*copy)->payload = logic_copy;
break;
- case SR_DF_ANALOG_OLD:
- analog_old = packet->payload;
- analog_old_copy = g_malloc(sizeof(*analog_old_copy));
- analog_old_copy->channels = g_slist_copy(analog_old->channels);
- analog_old_copy->num_samples = analog_old->num_samples;
- analog_old_copy->mq = analog_old->mq;
- analog_old_copy->unit = analog_old->unit;
- analog_old_copy->mqflags = analog_old->mqflags;
- analog_old_copy->data = g_malloc(analog_old->num_samples * sizeof(float));
- memcpy(analog_old_copy->data, analog_old->data,
- analog_old->num_samples * sizeof(float));
- (*copy)->payload = analog_old_copy;
- break;
case SR_DF_ANALOG:
analog = packet->payload;
analog_copy = g_malloc(sizeof(*analog_copy));
{
const struct sr_datafeed_meta *meta;
const struct sr_datafeed_logic *logic;
- const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog *analog;
struct sr_config *src;
GSList *l;
g_free(logic->data);
g_free((void *)packet->payload);
break;
- case SR_DF_ANALOG_OLD:
- analog_old = packet->payload;
- g_slist_free(analog_old->channels);
- g_free(analog_old->data);
- g_free((void *)packet->payload);
- break;
case SR_DF_ANALOG:
analog = packet->payload;
g_free(analog->data);