session_driver.c: Convert to SR_DF_ANALOG.

This commit is contained in:
Uwe Hermann 2016-05-28 18:01:10 +02:00
parent 8c67724084
commit 6cdb1da6c9
1 changed files with 10 additions and 6 deletions

View File

@ -66,7 +66,10 @@ static gboolean stream_session_data(struct sr_dev_inst *sdi)
struct session_vdev *vdev;
struct sr_datafeed_packet packet;
struct sr_datafeed_logic logic;
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;
struct zip_stat zs;
int ret, got_data;
char capturefile[16];
@ -137,15 +140,16 @@ static gboolean stream_session_data(struct sr_dev_inst *sdi)
if (ret > 0) {
got_data = TRUE;
if (vdev->cur_analog_channel != 0) {
packet.type = SR_DF_ANALOG_OLD;
packet.type = SR_DF_ANALOG;
packet.payload = &analog;
analog.channels = g_slist_prepend(NULL,
sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
analog.meaning->channels = g_slist_prepend(NULL,
g_array_index(vdev->analog_channels,
struct sr_channel *, vdev->cur_analog_channel - 1));
analog.num_samples = ret / sizeof(float);
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = SR_MQFLAG_DC;
analog.meaning->mq = SR_MQ_VOLTAGE;
analog.meaning->unit = SR_UNIT_VOLT;
analog.meaning->mqflags = SR_MQFLAG_DC;
analog.data = (float *) buf;
} else {
if (ret % vdev->unitsize != 0)