session: Drop SR_DF_ANALOG_OLD support completely.
This closes bug #728.
This commit is contained in:
parent
0f574e133c
commit
24f4a9d50b
|
@ -162,8 +162,6 @@ enum sr_packettype {
|
||||||
SR_DF_TRIGGER,
|
SR_DF_TRIGGER,
|
||||||
/** Payload is struct sr_datafeed_logic. */
|
/** Payload is struct sr_datafeed_logic. */
|
||||||
SR_DF_LOGIC,
|
SR_DF_LOGIC,
|
||||||
/** DEPRECATED! Use SR_DF_ANALOG instead. */
|
|
||||||
SR_DF_ANALOG_OLD,
|
|
||||||
/** Beginning of frame. No payload. */
|
/** Beginning of frame. No payload. */
|
||||||
SR_DF_FRAME_BEGIN,
|
SR_DF_FRAME_BEGIN,
|
||||||
/** End of frame. No payload. */
|
/** End of frame. No payload. */
|
||||||
|
@ -496,24 +494,6 @@ struct sr_datafeed_logic {
|
||||||
void *data;
|
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. */
|
/** Analog datafeed payload for type SR_DF_ANALOG. */
|
||||||
struct sr_datafeed_analog {
|
struct sr_datafeed_analog {
|
||||||
void *data;
|
void *data;
|
||||||
|
|
|
@ -1035,7 +1035,6 @@ SR_API int sr_session_stopped_callback_set(struct sr_session *session,
|
||||||
static void datafeed_dump(const struct sr_datafeed_packet *packet)
|
static void datafeed_dump(const struct sr_datafeed_packet *packet)
|
||||||
{
|
{
|
||||||
const struct sr_datafeed_logic *logic;
|
const struct sr_datafeed_logic *logic;
|
||||||
const struct sr_datafeed_analog_old *analog_old;
|
|
||||||
const struct sr_datafeed_analog *analog;
|
const struct sr_datafeed_analog *analog;
|
||||||
|
|
||||||
/* Please use the same order as in libsigrok.h. */
|
/* Please use the same order as in libsigrok.h. */
|
||||||
|
@ -1057,11 +1056,6 @@ static void datafeed_dump(const struct sr_datafeed_packet *packet)
|
||||||
sr_dbg("bus: Received SR_DF_LOGIC packet (%" PRIu64 " bytes, "
|
sr_dbg("bus: Received SR_DF_LOGIC packet (%" PRIu64 " bytes, "
|
||||||
"unitsize = %d).", logic->length, logic->unitsize);
|
"unitsize = %d).", logic->length, logic->unitsize);
|
||||||
break;
|
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:
|
case SR_DF_FRAME_BEGIN:
|
||||||
sr_dbg("bus: Received SR_DF_FRAME_BEGIN packet.");
|
sr_dbg("bus: Received SR_DF_FRAME_BEGIN packet.");
|
||||||
break;
|
break;
|
||||||
|
@ -1116,43 +1110,6 @@ SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
|
||||||
return SR_ERR_BUG;
|
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
|
* Pass the packet to the first transform module. If that returns
|
||||||
* another packet (instead of NULL), pass that packet to the next
|
* another packet (instead of NULL), pass that packet to the next
|
||||||
|
@ -1501,8 +1458,6 @@ SR_PRIV int sr_packet_copy(const struct sr_datafeed_packet *packet,
|
||||||
struct sr_datafeed_meta *meta_copy;
|
struct sr_datafeed_meta *meta_copy;
|
||||||
const struct sr_datafeed_logic *logic;
|
const struct sr_datafeed_logic *logic;
|
||||||
struct sr_datafeed_logic *logic_copy;
|
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;
|
const struct sr_datafeed_analog *analog;
|
||||||
struct sr_datafeed_analog *analog_copy;
|
struct sr_datafeed_analog *analog_copy;
|
||||||
uint8_t *payload;
|
uint8_t *payload;
|
||||||
|
@ -1534,19 +1489,6 @@ SR_PRIV int sr_packet_copy(const struct sr_datafeed_packet *packet,
|
||||||
memcpy(logic_copy->data, logic->data, logic->length * logic->unitsize);
|
memcpy(logic_copy->data, logic->data, logic->length * logic->unitsize);
|
||||||
(*copy)->payload = logic_copy;
|
(*copy)->payload = logic_copy;
|
||||||
break;
|
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:
|
case SR_DF_ANALOG:
|
||||||
analog = packet->payload;
|
analog = packet->payload;
|
||||||
analog_copy = g_malloc(sizeof(*analog_copy));
|
analog_copy = g_malloc(sizeof(*analog_copy));
|
||||||
|
@ -1577,7 +1519,6 @@ void sr_packet_free(struct sr_datafeed_packet *packet)
|
||||||
{
|
{
|
||||||
const struct sr_datafeed_meta *meta;
|
const struct sr_datafeed_meta *meta;
|
||||||
const struct sr_datafeed_logic *logic;
|
const struct sr_datafeed_logic *logic;
|
||||||
const struct sr_datafeed_analog_old *analog_old;
|
|
||||||
const struct sr_datafeed_analog *analog;
|
const struct sr_datafeed_analog *analog;
|
||||||
struct sr_config *src;
|
struct sr_config *src;
|
||||||
GSList *l;
|
GSList *l;
|
||||||
|
@ -1606,12 +1547,6 @@ void sr_packet_free(struct sr_datafeed_packet *packet)
|
||||||
g_free(logic->data);
|
g_free(logic->data);
|
||||||
g_free((void *)packet->payload);
|
g_free((void *)packet->payload);
|
||||||
break;
|
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:
|
case SR_DF_ANALOG:
|
||||||
analog = packet->payload;
|
analog = packet->payload;
|
||||||
g_free(analog->data);
|
g_free(analog->data);
|
||||||
|
|
Loading…
Reference in New Issue