SR_DF_ANALOG_OLD and sr_datafeed_analog_old renames.

Rename SR_DF_ANALOG to SR_DF_ANALOG_OLD, and 'struct sr_datafeed_analog'
to 'struct sr_datafeed_analog_old'.
This commit is contained in:
Uwe Hermann 2015-09-29 13:55:46 +02:00
parent ca79993bba
commit 5faebab290
64 changed files with 282 additions and 282 deletions

View File

@ -319,12 +319,12 @@ shared_ptr<Packet> Context::create_logic_packet(
return shared_ptr<Packet>(new Packet(nullptr, packet), Packet::Deleter());
}
shared_ptr<Packet> Context::create_analog_packet(
shared_ptr<Packet> Context::create_analog_old_packet(
vector<shared_ptr<Channel> > channels,
float *data_pointer, unsigned int num_samples, const Quantity *mq,
const Unit *unit, vector<const QuantityFlag *> mqflags)
{
auto analog = g_new0(struct sr_datafeed_analog, 1);
auto analog = g_new0(struct sr_datafeed_analog_old, 1);
for (auto channel : channels)
analog->channels = g_slist_append(analog->channels, channel->_structure);
analog->num_samples = num_samples;
@ -333,7 +333,7 @@ shared_ptr<Packet> Context::create_analog_packet(
analog->mqflags = QuantityFlag::mask_from_flags(mqflags);
analog->data = data_pointer;
auto packet = g_new(struct sr_datafeed_packet, 1);
packet->type = SR_DF_ANALOG;
packet->type = SR_DF_ANALOG_OLD;
packet->payload = analog;
return shared_ptr<Packet>(new Packet(nullptr, packet), Packet::Deleter());
}
@ -1068,9 +1068,9 @@ Packet::Packet(shared_ptr<Device> device,
static_cast<const struct sr_datafeed_logic *>(
structure->payload));
break;
case SR_DF_ANALOG:
_payload = new Analog(
static_cast<const struct sr_datafeed_analog *>(
case SR_DF_ANALOG_OLD:
_payload = new AnalogOld(
static_cast<const struct sr_datafeed_analog_old *>(
structure->payload));
break;
default:
@ -1192,33 +1192,33 @@ unsigned int Logic::unit_size()
return _structure->unitsize;
}
Analog::Analog(const struct sr_datafeed_analog *structure) :
AnalogOld::AnalogOld(const struct sr_datafeed_analog_old *structure) :
ParentOwned(structure),
PacketPayload()
{
}
Analog::~Analog()
AnalogOld::~AnalogOld()
{
}
shared_ptr<PacketPayload> Analog::get_shared_pointer(Packet *_parent)
shared_ptr<PacketPayload> AnalogOld::get_shared_pointer(Packet *_parent)
{
return static_pointer_cast<PacketPayload>(
ParentOwned::get_shared_pointer(_parent));
}
float *Analog::data_pointer()
float *AnalogOld::data_pointer()
{
return _structure->data;
}
unsigned int Analog::num_samples()
unsigned int AnalogOld::num_samples()
{
return _structure->num_samples;
}
vector<shared_ptr<Channel>> Analog::channels()
vector<shared_ptr<Channel>> AnalogOld::channels()
{
vector<shared_ptr<Channel>> result;
for (auto l = _structure->channels; l; l = l->next)
@ -1227,17 +1227,17 @@ vector<shared_ptr<Channel>> Analog::channels()
return result;
}
const Quantity *Analog::mq()
const Quantity *AnalogOld::mq()
{
return Quantity::get(_structure->mq);
}
const Unit *Analog::unit()
const Unit *AnalogOld::unit()
{
return Unit::get(_structure->unit);
}
vector<const QuantityFlag *> Analog::mq_flags()
vector<const QuantityFlag *> AnalogOld::mq_flags()
{
return QuantityFlag::flags_from_mask(_structure->mqflags);
}

View File

@ -297,7 +297,7 @@ public:
shared_ptr<Packet> create_logic_packet(
void *data_pointer, size_t data_length, unsigned int unit_size);
/** Create an analog packet. */
shared_ptr<Packet> create_analog_packet(
shared_ptr<Packet> create_analog_old_packet(
vector<shared_ptr<Channel> > channels,
float *data_pointer, unsigned int num_samples, const Quantity *mq,
const Unit *unit, vector<const QuantityFlag *> mqflags);
@ -428,7 +428,7 @@ protected:
friend class Channel;
friend class ChannelGroup;
friend class Output;
friend class Analog;
friend class AnalogOld;
};
/** A real hardware device, connected via a driver */
@ -702,7 +702,7 @@ protected:
friend class Header;
friend class Meta;
friend class Logic;
friend class Analog;
friend class AnalogOld;
friend class Context;
};
@ -777,8 +777,8 @@ protected:
};
/** Payload of a datafeed packet with analog data */
class SR_API Analog :
public ParentOwned<Analog, Packet, const struct sr_datafeed_analog>,
class SR_API AnalogOld :
public ParentOwned<AnalogOld, Packet, const struct sr_datafeed_analog_old>,
public PacketPayload
{
public:
@ -795,8 +795,8 @@ public:
/** Measurement flags associated with the samples in this packet. */
vector<const QuantityFlag *> mq_flags();
protected:
Analog(const struct sr_datafeed_analog *structure);
~Analog();
AnalogOld(const struct sr_datafeed_analog_old *structure);
~AnalogOld();
shared_ptr<PacketPayload> get_shared_pointer(Packet *parent);
friend class Packet;
};

View File

@ -385,7 +385,7 @@ typedef jobject jdatafeedcallback;
%enddef
/* Ignore this for now, needs a fix. */
%ignore sigrok::Context::create_analog_packet;
%ignore sigrok::Context::create_analog_old_packet;
%include "bindings/swig/classes.i"

View File

@ -250,9 +250,9 @@ typedef guint pyg_flags_type;
{
return dynamic_pointer_cast<sigrok::Meta>($self->payload());
}
std::shared_ptr<sigrok::Analog> _payload_analog()
std::shared_ptr<sigrok::AnalogOld> _payload_analog_old()
{
return dynamic_pointer_cast<sigrok::Analog>($self->payload());
return dynamic_pointer_cast<sigrok::AnalogOld>($self->payload());
}
std::shared_ptr<sigrok::Logic> _payload_logic()
{
@ -271,8 +271,8 @@ typedef guint pyg_flags_type;
return self._payload_meta()
elif self.type == PacketType.LOGIC:
return self._payload_logic()
elif self.type == PacketType.ANALOG:
return self._payload_analog()
elif self.type == PacketType.ANALOG_OLD:
return self._payload_analog_old()
else:
return None
@ -377,7 +377,7 @@ std::map<std::string, Glib::VariantBase> dict_to_map_options(PyObject *dict,
%}
/* Ignore these methods, we will override them below. */
%ignore sigrok::Analog::data;
%ignore sigrok::AnalogOld::data;
%ignore sigrok::Driver::scan;
%ignore sigrok::InputFormat::create_input;
%ignore sigrok::OutputFormat::create_output;
@ -506,8 +506,8 @@ std::map<std::string, Glib::VariantBase> dict_to_map_options(PyObject *dict,
}
}
/* Return NumPy array from Analog::data(). */
%extend sigrok::Analog
/* Return NumPy array from AnalogOld::data(). */
%extend sigrok::AnalogOld
{
PyObject * _data()
{

View File

@ -72,7 +72,7 @@ template< class T > class enable_shared_from_this;
%shared_ptr(sigrok::PacketPayload);
%shared_ptr(sigrok::Header);
%shared_ptr(sigrok::Meta);
%shared_ptr(sigrok::Analog);
%shared_ptr(sigrok::AnalogOld);
%shared_ptr(sigrok::Logic);
%shared_ptr(sigrok::InputFormat);
%shared_ptr(sigrok::Input);
@ -259,12 +259,12 @@ typedef std::map<const sigrok::ConfigKey *, Glib::VariantBase>
%attributemap(Meta, map_ConfigKey_Variant, config, config);
%attributevector(Analog,
%attributevector(AnalogOld,
std::vector<std::shared_ptr<sigrok::Channel> >, channels, channels);
%attribute(sigrok::Analog, int, num_samples, num_samples);
%attribute(sigrok::Analog, const sigrok::Quantity *, mq, mq);
%attribute(sigrok::Analog, const sigrok::Unit *, unit, unit);
%attributevector(Analog, std::vector<const sigrok::QuantityFlag *>, mq_flags, mq_flags);
%attribute(sigrok::AnalogOld, int, num_samples, num_samples);
%attribute(sigrok::AnalogOld, const sigrok::Quantity *, mq, mq);
%attribute(sigrok::AnalogOld, const sigrok::Unit *, unit, unit);
%attributevector(AnalogOld, std::vector<const sigrok::QuantityFlag *>, mq_flags, mq_flags);
%include <libsigrokcxx/libsigrokcxx.hpp>

View File

@ -162,8 +162,8 @@ enum sr_packettype {
SR_DF_TRIGGER,
/** Payload is struct sr_datafeed_logic. */
SR_DF_LOGIC,
/** Payload is struct sr_datafeed_analog. */
SR_DF_ANALOG,
/** Payload is struct sr_datafeed_analog_old. */
SR_DF_ANALOG_OLD,
/** Beginning of frame. No payload. */
SR_DF_FRAME_BEGIN,
/** End of frame. No payload. */
@ -494,8 +494,8 @@ struct sr_datafeed_logic {
void *data;
};
/** Analog datafeed payload for type SR_DF_ANALOG. */
struct sr_datafeed_analog {
/** 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 */

View File

@ -147,7 +147,7 @@ special:
}
SR_PRIV int sr_brymen_bm25x_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
float val;

View File

@ -444,7 +444,7 @@ static void parse_flags(const uint8_t *buf, struct es519xx_info *info)
}
}
static void handle_flags(struct sr_datafeed_analog *analog,
static void handle_flags(struct sr_datafeed_analog_old *analog,
float *floatval, const struct es519xx_info *info)
{
/*
@ -604,7 +604,7 @@ static gboolean sr_es519xx_packet_valid(const uint8_t *buf,
}
static int sr_es519xx_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog,
struct sr_datafeed_analog_old *analog,
struct es519xx_info *info)
{
int ret;
@ -640,7 +640,7 @@ SR_PRIV gboolean sr_es519xx_2400_11b_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_2400_11b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -669,7 +669,7 @@ SR_PRIV gboolean sr_es519xx_2400_11b_altfn_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_2400_11b_altfn_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info)
float *floatval, struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -699,7 +699,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_5digits_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_19200_11b_5digits_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info)
float *floatval, struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -729,7 +729,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_clamp_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_19200_11b_clamp_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info)
float *floatval, struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -758,7 +758,7 @@ SR_PRIV gboolean sr_es519xx_19200_11b_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_19200_11b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -786,7 +786,7 @@ SR_PRIV gboolean sr_es519xx_19200_14b_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_19200_14b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;
@ -815,7 +815,7 @@ SR_PRIV gboolean sr_es519xx_19200_14b_sel_lpf_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_es519xx_19200_14b_sel_lpf_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info)
float *floatval, struct sr_datafeed_analog_old *analog, void *info)
{
struct es519xx_info *info_local;

View File

@ -243,7 +243,7 @@ static void parse_flags(const uint8_t *buf, struct fs9721_info *info)
info->is_c2c1_00 = (buf[13] & (1 << 0)) != 0;
}
static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
const struct fs9721_info *info)
{
/* Factors */
@ -337,7 +337,7 @@ SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf)
* @param buf Buffer containing the 14-byte protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
* @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct fs9721_info. The struct will be filled
@ -347,7 +347,7 @@ SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf)
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct fs9721_info *info_local;
@ -365,7 +365,7 @@ SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
return SR_OK;
}
SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9721_info *info_local;
@ -378,7 +378,7 @@ SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info)
}
}
SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9721_info *info_local;
@ -391,7 +391,7 @@ SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info)
}
}
SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9721_info *info_local;
@ -404,7 +404,7 @@ SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info)
}
}
SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9721_info *info_local;
@ -423,7 +423,7 @@ SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *i
}
}
SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9721_info *info_local;

View File

@ -223,7 +223,7 @@ static void parse_flags(const uint8_t *buf, struct fs9922_info *info)
/* Byte 13: Always '\n' (newline, 0x0a, 10) */
}
static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
const struct fs9922_info *info)
{
/* Factors */
@ -344,7 +344,7 @@ SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf)
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
* @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct fs9922_info. The struct will be filled
@ -354,7 +354,7 @@ SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf)
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct fs9922_info *info_local;
@ -372,7 +372,7 @@ SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
return SR_OK;
}
SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog *analog, void *info)
SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog_old *analog, void *info)
{
struct fs9922_info *info_local;

View File

@ -51,7 +51,7 @@ SR_PRIV gboolean sr_m2110_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_m2110_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
float val;

View File

@ -170,7 +170,7 @@ static void parse_flags(const char *buf, struct metex14_info *info)
/* Byte 13: Always '\r' (carriage return, 0x0d, 13) */
}
static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
const struct metex14_info *info)
{
/* Factors */
@ -311,7 +311,7 @@ SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf)
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will be modified
* in-place depending on the protocol packet. Must not be NULL.
* @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct metex14_info. The struct will be filled
@ -321,7 +321,7 @@ SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf)
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct metex14_info *info_local;

View File

@ -318,7 +318,7 @@ static gboolean is_logic_high(const struct rs9lcd_packet *rs_packet)
}
SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
const struct rs9lcd_packet *rs_packet = (void *)buf;
double rawval;

View File

@ -88,7 +88,7 @@ SR_PRIV gboolean sr_ut372_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
unsigned int i, j, value, divisor;
uint8_t segments, flags1, flags2;

View File

@ -212,7 +212,7 @@ static void parse_flags(const uint8_t *buf, struct ut71x_info *info)
}
}
static void handle_flags(struct sr_datafeed_analog *analog,
static void handle_flags(struct sr_datafeed_analog_old *analog,
float *floatval, const struct ut71x_info *info)
{
/* Measurement modes */
@ -325,7 +325,7 @@ SR_PRIV gboolean sr_ut71x_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_ut71x_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct ut71x_info *info_local;

View File

@ -280,7 +280,7 @@ static void parse_flags(const uint8_t *buf, struct vc870_info *info)
info->is_rms = TRUE;
}
static void handle_flags(struct sr_datafeed_analog *analog,
static void handle_flags(struct sr_datafeed_analog_old *analog,
float *floatval, const struct vc870_info *info)
{
/*
@ -402,7 +402,7 @@ SR_PRIV gboolean sr_vc870_packet_valid(const uint8_t *buf)
}
SR_PRIV int sr_vc870_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct vc870_info *info_local;

View File

@ -264,7 +264,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
float fvalue;
const char *s;
char *mstr;
@ -296,14 +296,14 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
fvalue /= devc->cur_divider;
}
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = devc->cur_mq;
analog.unit = devc->cur_unit;
analog.mqflags = devc->cur_mqflags;
analog.channels = sdi->channels;
analog.num_samples = 1;
analog.data = &fvalue;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -92,7 +92,7 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_channel *ch;
float values[APPA_55II_NUM_CHANNELS], *val_ptr;
int i;
@ -103,7 +103,7 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf)
return;
val_ptr = values;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.num_samples = 1;
analog.mq = SR_MQ_TEMPERATURE;
analog.unit = SR_UNIT_CELSIUS;
@ -118,7 +118,7 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf)
*val_ptr++ = appa_55ii_temp(buf, i);
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->session_cb_data, &packet);
g_slist_free(analog.channels);
@ -138,7 +138,7 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_channel *ch;
float values[APPA_55II_NUM_CHANNELS], *val_ptr;
const uint8_t *buf;
@ -155,7 +155,7 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi)
/* FIXME: Timestamp should be sent in the packet. */
sr_dbg("Timestamp: %02d:%02d:%02d", buf[2], buf[3], buf[4]);
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.num_samples = 1;
analog.mq = SR_MQ_TEMPERATURE;
analog.unit = SR_UNIT_CELSIUS;
@ -170,7 +170,7 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi)
*val_ptr++ = temp == 0x7FFF ? INFINITY : (float)temp / 10;
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->session_cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -37,13 +37,13 @@ static void handle_packet(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
float value, data[MAX_CHANNELS];
int offset, i;
devc = sdi->priv;
dump_packet("received", devc->packet);
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = sdi->channels;
analog.num_samples = 1;

View File

@ -696,7 +696,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
uint32_t cur_time, elapsed_time;
uint64_t nrexpiration;
struct sr_datafeed_packet packet, framep;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_dev_inst *sdi;
struct sr_channel *ch;
struct channel_priv *chp;
@ -715,9 +715,9 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
if (!devc)
return TRUE;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
if (read(devc->timer_fd, &nrexpiration, sizeof(nrexpiration)) < 0) {
sr_warn("Failed to read timer information");

View File

@ -73,7 +73,7 @@ static int brymen_bm86x_parse_digits(const unsigned char *buf, int length,
}
static void brymen_bm86x_parse(unsigned char *buf, float *floatval,
struct sr_datafeed_analog *analog)
struct sr_datafeed_analog_old *analog)
{
char str[16], temp_unit;
int ret1, ret2, over_limit;
@ -195,7 +195,7 @@ static void brymen_bm86x_handle_packet(const struct sr_dev_inst *sdi,
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog[2];
struct sr_datafeed_analog_old analog[2];
float floatval[2];
devc = sdi->priv;
@ -213,7 +213,7 @@ static void brymen_bm86x_handle_packet(const struct sr_dev_inst *sdi,
analog[0].num_samples = 1;
analog[0].data = &floatval[0];
analog[0].channels = g_slist_append(NULL, sdi->channels->data);
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog[0];
sr_session_send(sdi, &packet);
g_slist_free(analog[0].channels);
@ -224,7 +224,7 @@ static void brymen_bm86x_handle_packet(const struct sr_dev_inst *sdi,
analog[1].num_samples = 1;
analog[1].data = &floatval[1];
analog[1].channels = g_slist_append(NULL, sdi->channels->next->data);
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog[1];
sr_session_send(sdi, &packet);
g_slist_free(analog[1].channels);

View File

@ -192,7 +192,7 @@ static void parse_flags(const uint8_t *buf, struct brymen_flags *info)
}
SR_PRIV int brymen_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
struct brymen_flags flags;
struct brymen_header *hdr;

View File

@ -25,7 +25,7 @@ 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 analog;
struct sr_datafeed_analog_old analog;
devc = sdi->priv;
@ -40,7 +40,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi)
if (analog.mq != -1) {
/* Got a measurement. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;

View File

@ -77,7 +77,7 @@ SR_PRIV int brymen_packet_length(const uint8_t *buf, int *len);
SR_PRIV gboolean brymen_packet_is_valid(const uint8_t *buf);
SR_PRIV int brymen_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV int brymen_stream_detect(struct sr_serial_dev_inst *serial,
uint8_t *buf, size_t *buflen,

View File

@ -66,7 +66,7 @@ static void process_mset(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
GString *dbg;
float fvalue;
int i;
@ -131,14 +131,14 @@ static void process_mset(const struct sr_dev_inst *sdi)
break;
}
}
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL;
analog.mqflags = devc->cur_mqflags;
analog.unit = SR_UNIT_DECIBEL_SPL;
analog.channels = sdi->channels;
analog.num_samples = 1;
analog.data = &devc->last_spl;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
@ -178,7 +178,7 @@ static void send_data(const struct sr_dev_inst *sdi, unsigned char *data,
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
float fbuf[SAMPLES_PER_PACKET];
unsigned int i;
@ -190,14 +190,14 @@ static void send_data(const struct sr_dev_inst *sdi, unsigned char *data,
fbuf[i] += ((data[i * 2 + 1] & 0xf0) >> 4);
fbuf[i] += (data[i * 2 + 1] & 0x0f) / 10.0;
}
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL;
analog.mqflags = devc->cur_mqflags;
analog.unit = SR_UNIT_DECIBEL_SPL;
analog.channels = sdi->channels;
analog.num_samples = num_samples;
analog.data = fbuf;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -123,7 +123,7 @@ static int packet_parse(const uint8_t *buf, int idx, struct center_info *info)
static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
struct center_info info;
GSList *l;
@ -131,7 +131,7 @@ static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx)
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
memset(&info, 0, sizeof(struct center_info));
ret = packet_parse(buf, idx, &info);
@ -141,7 +141,7 @@ static int handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi, int idx)
}
/* Common values for all 4 channels. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.mq = SR_MQ_TEMPERATURE;
analog.unit = (info.celsius) ? SR_UNIT_CELSIUS : SR_UNIT_FAHRENHEIT;

View File

@ -29,7 +29,7 @@ static void process_packet(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
GString *dbg;
float fvalue;
int checksum, mode, i;
@ -71,7 +71,7 @@ static void process_packet(const struct sr_dev_inst *sdi)
}
fvalue /= 10;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL;
analog.unit = SR_UNIT_DECIBEL_SPL;
analog.channels = sdi->channels;
@ -167,7 +167,7 @@ static void process_packet(const struct sr_dev_inst *sdi)
return;
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -98,7 +98,7 @@ struct analog_gen {
float amplitude;
float pattern_data[ANALOG_BUFSIZE];
unsigned int num_samples;
struct sr_datafeed_analog packet;
struct sr_datafeed_analog_old packet;
float avg_val; /* Average value */
unsigned num_avgs; /* Number of samples averaged */
};
@ -687,7 +687,7 @@ static void send_analog_packet(struct analog_gen *ag,
unsigned int i;
devc = sdi->priv;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &ag->packet;
if (!devc->avg) {
@ -833,7 +833,7 @@ static int prepare_data(int fd, int revents, void *cb_data)
g_hash_table_iter_init(&iter, devc->ch_ag);
while (g_hash_table_iter_next(&iter, NULL, &value)) {
ag = value;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &ag->packet;
ag->packet.data = &ag->avg_val;
ag->packet.num_samples = 1;

View File

@ -26,10 +26,10 @@
#include "libsigrok-internal.h"
#include "fluke-dmm.h"
static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
static struct sr_datafeed_analog_old *handle_qm_18x(const struct sr_dev_inst *sdi,
char **tokens)
{
struct sr_datafeed_analog *analog;
struct sr_datafeed_analog_old *analog;
float fvalue;
char *e, *u;
gboolean is_oor;
@ -59,7 +59,7 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
while (*e && *e == ' ')
e++;
analog = g_malloc0(sizeof(struct sr_datafeed_analog));
analog = g_malloc0(sizeof(struct sr_datafeed_analog_old));
analog->data = g_malloc(sizeof(float));
analog->channels = sdi->channels;
analog->num_samples = 1;
@ -154,10 +154,10 @@ static struct sr_datafeed_analog *handle_qm_18x(const struct sr_dev_inst *sdi,
return analog;
}
static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi,
static struct sr_datafeed_analog_old *handle_qm_28x(const struct sr_dev_inst *sdi,
char **tokens)
{
struct sr_datafeed_analog *analog;
struct sr_datafeed_analog_old *analog;
float fvalue;
if (!tokens[1])
@ -168,7 +168,7 @@ static struct sr_datafeed_analog *handle_qm_28x(const struct sr_dev_inst *sdi,
return NULL;
}
analog = g_malloc0(sizeof(struct sr_datafeed_analog));
analog = g_malloc0(sizeof(struct sr_datafeed_analog_old));
analog->data = g_malloc(sizeof(float));
analog->channels = sdi->channels;
analog->num_samples = 1;
@ -362,7 +362,7 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
float fvalue;
if (!strcmp(tokens[0], "9.9E+37")) {
@ -397,7 +397,7 @@ static void handle_qm_19x_data(const struct sr_dev_inst *sdi, char **tokens)
analog.mq = devc->mq;
analog.unit = devc->unit;
analog.mqflags = 0;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;
@ -409,7 +409,7 @@ static void handle_line(const struct sr_dev_inst *sdi)
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog *analog;
struct sr_datafeed_analog_old *analog;
int num_tokens, n, i;
char cmd[16], **tokens;
@ -465,7 +465,7 @@ static void handle_line(const struct sr_dev_inst *sdi)
if (analog) {
/* Got a measurement. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;

View File

@ -652,12 +652,12 @@ static void clean_ctmv_rs_v(struct dev_context *devc)
static void send_value(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_datafeed_packet packet;
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.channels = sdi->channels;
analog.num_samples = 1;
analog.mq = devc->mq;
@ -666,7 +666,7 @@ static void send_value(struct sr_dev_inst *sdi)
analog.data = &devc->value;
memset(&packet, 0, sizeof(struct sr_datafeed_packet));
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -66,7 +66,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
struct sr_scpi_dev_inst *scpi;
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
char command[32];
char *response;
float volts_per_division;
@ -243,7 +243,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = 0;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -649,7 +649,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
struct dev_context *devc;
struct sr_datafeed_packet packet;
GArray *data;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_datafeed_logic logic;
(void)fd;
@ -685,7 +685,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = 0;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -708,14 +708,14 @@ static void send_chunk(struct sr_dev_inst *sdi, unsigned char *buf,
int num_samples)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
float ch1, ch2, range;
int num_channels, data_offset, i;
devc = sdi->priv;
num_channels = (devc->ch1_enabled && devc->ch2_enabled) ? 2 : 1;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
/* TODO: support for 5xxx series 9-bit samples */
analog.channels = devc->enabled_channels;

View File

@ -331,7 +331,7 @@ static void push_samples(const struct sr_dev_inst *sdi, uint8_t *buf, size_t num
{
struct dev_context *devc = sdi->priv;
float *data = devc->samples;
struct sr_datafeed_analog analog = {
struct sr_datafeed_analog_old analog = {
.channels = devc->enabled_channel,
.num_samples = num,
.mq = SR_MQ_VOLTAGE,
@ -340,7 +340,7 @@ static void push_samples(const struct sr_dev_inst *sdi, uint8_t *buf, size_t num
.data = data,
};
struct sr_datafeed_packet packet = {
.type = SR_DF_ANALOG,
.type = SR_DF_ANALOG_OLD,
.payload = &analog,
};
float factor = devc->factor;

View File

@ -108,18 +108,18 @@ static void send_data(const struct sr_dev_inst *sdi, void *buf, unsigned int buf
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_SOUND_PRESSURE_LEVEL;
analog.mqflags = devc->mqflags;
analog.unit = SR_UNIT_DECIBEL_SPL;
analog.channels = sdi->channels;
analog.num_samples = buf_len;
analog.data = buf;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -33,14 +33,14 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
struct scale_info *scale;
float floatval;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
scale = (struct scale_info *)sdi->driver;
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.channels = sdi->channels;
analog.num_samples = 1;
@ -51,7 +51,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
if (analog.mq != -1) {
/* Got a measurement. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;

View File

@ -40,7 +40,7 @@ struct scale_info {
gboolean (*packet_valid)(const uint8_t *);
/** Packet parsing function. */
int (*packet_parse)(const uint8_t *, float *,
struct sr_datafeed_analog *, void *);
struct sr_datafeed_analog_old *, void *);
/** Size of chipset info struct. */
gsize info_size;
};

View File

@ -307,7 +307,7 @@ SR_PRIV int korad_kdxxxxp_receive_data(int fd, int revents, void *cb_data)
struct dev_context *devc;
struct sr_serial_dev_inst *serial;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
int64_t t, elapsed_us;
(void)fd;
@ -325,7 +325,7 @@ SR_PRIV int korad_kdxxxxp_receive_data(int fd, int revents, void *cb_data)
korad_kdxxxxp_get_reply(serial, devc);
/* Send the value forward. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = sdi->channels;
analog.num_samples = 1;

View File

@ -383,7 +383,7 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf,
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_channel *ch;
float *temp, *rh;
uint16_t s;
@ -397,7 +397,7 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf,
samples = samples_left;
switch (devc->profile->logformat) {
case LOG_TEMP_RH:
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.mqflags = 0;
if (!(temp = g_try_malloc(sizeof(float) * samples)))
@ -448,7 +448,7 @@ static void lascar_el_usb_dispatch(struct sr_dev_inst *sdi, unsigned char *buf,
g_free(rh);
break;
case LOG_CO:
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = sdi->channels;
analog.num_samples = samples;

View File

@ -123,11 +123,11 @@ static void send_sample(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
devc = sdi->priv;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = sdi->channels;
analog.num_samples = 1;

View File

@ -128,7 +128,7 @@ SR_PRIV const char *maynuo_m97_mode_to_str(enum maynuo_m97_mode mode)
static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct sr_channel *ch, float value, enum sr_mq mq, enum sr_unit unit)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
analog.channels = g_slist_append(NULL, ch);
analog.num_samples = 1;
@ -137,7 +137,7 @@ static void maynuo_m97_session_send_value(const struct sr_dev_inst *sdi, struct
analog.unit = unit;
analog.mqflags = SR_MQFLAG_DC;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(sdi, &packet);
g_slist_free(analog.channels);

View File

@ -33,12 +33,12 @@ static void send_data(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
int i;
float data[MAX_CHANNELS];
devc = sdi->priv;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = sdi->channels;
analog.num_samples = 1;

View File

@ -91,7 +91,7 @@ static void nma_process_line(const struct sr_dev_inst *sdi)
int mmode, devstat; /* Measuring mode, device status */
float value; /* Measured value */
float scale; /* Scaling factor depending on range and function */
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_datafeed_packet packet;
devc = sdi->priv;
@ -120,7 +120,7 @@ static void nma_process_line(const struct sr_dev_inst *sdi)
/* Start decoding. */
value = 0.0;
scale = 1.0;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
/*
* The numbers are hex digits, starting from 0.
@ -364,7 +364,7 @@ static void nma_process_line(const struct sr_dev_inst *sdi)
analog.data = &value;
memset(&packet, 0, sizeof(struct sr_datafeed_packet));
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -539,7 +539,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
struct sr_scpi_dev_inst *scpi;
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_datafeed_logic logic;
double vdiv, offset;
int len, i, vref;
@ -675,7 +675,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = 0;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -58,7 +58,7 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
const struct sr_dev_inst *sdi;
struct sr_channel *next_channel;
struct sr_scpi_dev_inst *scpi;
@ -80,7 +80,7 @@ SR_PRIV int scpi_pps_receive_data(int fd, int revents, void *cb_data)
/* Retrieve requested value for this state. */
if (sr_scpi_get_float(scpi, NULL, &f) == SR_OK) {
pch = devc->cur_channel->priv;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = g_slist_append(NULL, devc->cur_channel);
analog.num_samples = 1;

View File

@ -44,7 +44,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
struct dmm_info *dmm;
float floatval;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
dmm = (struct dmm_info *)sdi->driver;
@ -52,7 +52,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
log_dmm_packet(buf);
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.channels = sdi->channels;
analog.num_samples = 1;
@ -67,7 +67,7 @@ static void handle_packet(const uint8_t *buf, struct sr_dev_inst *sdi,
if (analog.mq != -1) {
/* Got a measurement. */
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
devc->num_samples++;

View File

@ -47,9 +47,9 @@ struct dmm_info {
gboolean (*packet_valid)(const uint8_t *);
/** Packet parsing function. */
int (*packet_parse)(const uint8_t *, float *,
struct sr_datafeed_analog *, void *);
struct sr_datafeed_analog_old *, void *);
/** */
void (*dmm_details)(struct sr_datafeed_analog *, void *);
void (*dmm_details)(struct sr_datafeed_analog_old *, void *);
/** Size of chipset info struct. */
gsize info_size;
};

View File

@ -60,7 +60,7 @@ static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *channel_nam
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_channel *ch;
devc = sdi->priv;
@ -69,14 +69,14 @@ static void teleinfo_send_value(struct sr_dev_inst *sdi, const char *channel_nam
if (!ch || !ch->enabled)
return;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.channels = g_slist_append(analog.channels, ch);
analog.num_samples = 1;
analog.mq = mq;
analog.unit = unit;
analog.data = &value;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->session_cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -223,7 +223,7 @@ SR_PRIV void testo_receive_packet(const struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_channel *ch;
GString *dbg;
float value;
@ -242,7 +242,7 @@ SR_PRIV void testo_receive_packet(const struct sr_dev_inst *sdi)
g_string_free(dbg, TRUE);
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.num_samples = 1;
analog.mqflags = 0;

View File

@ -34,7 +34,7 @@ enum {
};
static void parse_packet(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog)
struct sr_datafeed_analog_old *analog)
{
gboolean is_a, is_fast;
uint16_t intval;
@ -89,12 +89,12 @@ static void parse_packet(const uint8_t *buf, float *floatval,
static void decode_packet(struct sr_dev_inst *sdi)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
float floatval;
devc = sdi->priv;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
parse_packet(devc->buf, &floatval, &analog);
@ -102,7 +102,7 @@ static void decode_packet(struct sr_dev_inst *sdi)
analog.channels = sdi->channels;
analog.num_samples = 1;
analog.data = &floatval;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -57,14 +57,14 @@ static void decode_packet(struct sr_dev_inst *sdi, const uint8_t *buf)
struct dev_context *devc;
struct dmm_info *dmm;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
float floatval;
void *info;
int ret;
devc = sdi->priv;
dmm = (struct dmm_info *)sdi->driver;
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
info = g_malloc(dmm->info_size);
/* Parse the protocol packet. */
@ -85,7 +85,7 @@ static void decode_packet(struct sr_dev_inst *sdi, const uint8_t *buf)
analog.channels = sdi->channels;
analog.num_samples = 1;
analog.data = &floatval;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -37,8 +37,8 @@ struct dmm_info {
int packet_size;
gboolean (*packet_valid)(const uint8_t *);
int (*packet_parse)(const uint8_t *, float *,
struct sr_datafeed_analog *, void *);
void (*dmm_details)(struct sr_datafeed_analog *, void *);
struct sr_datafeed_analog_old *, void *);
void (*dmm_details)(struct sr_datafeed_analog_old *, void *);
gsize info_size;
};

View File

@ -62,7 +62,7 @@ static void process_packet(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
GString *spew;
float temp;
int i;
@ -89,7 +89,7 @@ static void process_packet(struct sr_dev_inst *sdi)
is_valid = FALSE;
if (is_valid) {
memset(&analog, 0, sizeof(struct sr_datafeed_analog));
memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
analog.mq = SR_MQ_TEMPERATURE;
analog.mqflags = 0;
switch (devc->packet[5] - 0x30) {
@ -128,7 +128,7 @@ static void process_packet(struct sr_dev_inst *sdi)
if (is_valid) {
analog.num_samples = 1;
analog.data = &temp;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
g_slist_free(analog.channels);

View File

@ -953,7 +953,7 @@ static int dlm_analog_samples_send(GArray *data,
struct dev_context *devc;
struct scope_state *model_state;
struct sr_channel *ch;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct sr_datafeed_packet packet;
devc = sdi->priv;
@ -987,7 +987,7 @@ static int dlm_analog_samples_send(GArray *data,
analog.mq = SR_MQ_VOLTAGE;
analog.unit = SR_UNIT_VOLT;
analog.mqflags = 0;
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(sdi, &packet);
g_slist_free(analog.channels);

View File

@ -181,7 +181,7 @@ static int find_data_chunk(GString *buf, int initial_offset)
static void send_chunk(const struct sr_input *in, int offset, int num_samples)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct context *inc;
float fdata[CHUNK_SIZE];
uint64_t sample;
@ -223,7 +223,7 @@ static void send_chunk(const struct sr_input *in, int offset, int num_samples)
s += inc->unitsize;
d += inc->unitsize;
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
analog.channels = in->sdi->channels;
analog.num_samples = num_samples;

View File

@ -485,7 +485,7 @@ static float parse_value(const uint8_t *buf)
}
static void parse_measurement(const uint8_t *pkt, float *floatval,
struct sr_datafeed_analog *analog,
struct sr_datafeed_analog_old *analog,
int is_secondary)
{
static const struct {
@ -617,7 +617,7 @@ static int send_model_update(struct sr_dev_inst *sdi, unsigned int model)
static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
{
struct sr_datafeed_packet packet;
struct sr_datafeed_analog analog;
struct sr_datafeed_analog_old analog;
struct dev_context *devc;
unsigned int val;
float floatval;
@ -658,7 +658,7 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
frame = TRUE;
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
@ -675,7 +675,7 @@ static void handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
frame = TRUE;
}
packet.type = SR_DF_ANALOG;
packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);

View File

@ -975,25 +975,25 @@ struct es519xx_info {
SR_PRIV gboolean sr_es519xx_2400_11b_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_2400_11b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_2400_11b_altfn_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_2400_11b_altfn_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info);
float *floatval, struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_19200_11b_5digits_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_19200_11b_5digits_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info);
float *floatval, struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_19200_11b_clamp_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_19200_11b_clamp_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info);
float *floatval, struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_19200_11b_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_19200_11b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_19200_14b_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_19200_14b_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV gboolean sr_es519xx_19200_14b_sel_lpf_packet_valid(const uint8_t *buf);
SR_PRIV int sr_es519xx_19200_14b_sel_lpf_parse(const uint8_t *buf,
float *floatval, struct sr_datafeed_analog *analog, void *info);
float *floatval, struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/fs9922.c -------------------------------------------------*/
@ -1010,8 +1010,8 @@ struct fs9922_info {
SR_PRIV gboolean sr_fs9922_packet_valid(const uint8_t *buf);
SR_PRIV int sr_fs9922_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9922_z1_diode(struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/fs9721.c -------------------------------------------------*/
@ -1026,12 +1026,12 @@ struct fs9721_info {
SR_PRIV gboolean sr_fs9721_packet_valid(const uint8_t *buf);
SR_PRIV int sr_fs9721_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog *analog, void *info);
SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9721_00_temp_c(struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9721_01_temp_c(struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9721_10_temp_c(struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9721_01_10_temp_f_c(struct sr_datafeed_analog_old *analog, void *info);
SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/m2110.c --------------------------------------------------*/
@ -1039,7 +1039,7 @@ SR_PRIV void sr_fs9721_max_c_min(struct sr_datafeed_analog *analog, void *info);
SR_PRIV gboolean sr_m2110_packet_valid(const uint8_t *buf);
SR_PRIV int sr_m2110_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/metex14.c ------------------------------------------------*/
@ -1058,7 +1058,7 @@ SR_PRIV int sr_metex14_packet_request(struct sr_serial_dev_inst *serial);
#endif
SR_PRIV gboolean sr_metex14_packet_valid(const uint8_t *buf);
SR_PRIV int sr_metex14_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/rs9lcd.c -------------------------------------------------*/
@ -1069,7 +1069,7 @@ struct rs9lcd_info { int dummy; };
SR_PRIV gboolean sr_rs9lcd_packet_valid(const uint8_t *buf);
SR_PRIV int sr_rs9lcd_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/bm25x.c --------------------------------------------------*/
@ -1080,7 +1080,7 @@ struct bm25x_info { int dummy; };
SR_PRIV gboolean sr_brymen_bm25x_packet_valid(const uint8_t *buf);
SR_PRIV int sr_brymen_bm25x_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/ut71x.c --------------------------------------------------*/
@ -1095,7 +1095,7 @@ struct ut71x_info {
SR_PRIV gboolean sr_ut71x_packet_valid(const uint8_t *buf);
SR_PRIV int sr_ut71x_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/dmm/vc870.c --------------------------------------------------*/
@ -1116,7 +1116,7 @@ struct vc870_info {
SR_PRIV gboolean sr_vc870_packet_valid(const uint8_t *buf);
SR_PRIV int sr_vc870_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/lcr/es51919.c ------------------------------------------------*/
@ -1148,7 +1148,7 @@ struct ut372_info {
SR_PRIV gboolean sr_ut372_packet_valid(const uint8_t *buf);
SR_PRIV int sr_ut372_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
/*--- hardware/scale/kern.c -------------------------------------------------*/
@ -1161,6 +1161,6 @@ struct kern_info {
SR_PRIV gboolean sr_kern_packet_valid(const uint8_t *buf);
SR_PRIV int sr_kern_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info);
struct sr_datafeed_analog_old *analog, void *info);
#endif

View File

@ -278,7 +278,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
GString **out)
{
struct context *ctx;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
struct sr_channel *ch;
GSList *l;
@ -299,16 +299,16 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
case SR_DF_FRAME_END:
*out = g_string_new("FRAME-END\n");
break;
case SR_DF_ANALOG:
analog = packet->payload;
fdata = (float *)analog->data;
case SR_DF_ANALOG_OLD:
analog_old = packet->payload;
fdata = (float *)analog_old->data;
*out = g_string_sized_new(512);
num_channels = g_slist_length(analog->channels);
for (si = 0; si < analog->num_samples; si++) {
for (l = analog->channels, c = 0; l; l = l->next, c++) {
num_channels = g_slist_length(analog_old->channels);
for (si = 0; si < analog_old->num_samples; si++) {
for (l = analog_old->channels, c = 0; l; l = l->next, c++) {
ch = l->data;
g_string_append_printf(*out, "%s: ", ch->name);
fancyprint(analog->unit, analog->mqflags,
fancyprint(analog_old->unit, analog_old->mqflags,
fdata[si * num_channels + c], *out);
}
}

View File

@ -192,7 +192,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
{
const struct sr_datafeed_meta *meta;
const struct sr_datafeed_logic *logic;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
const struct sr_config *src;
unsigned int num_samples;
@ -268,16 +268,16 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
g_string_append_printf(*out, "\n");
}
break;
case SR_DF_ANALOG:
case SR_DF_ANALOG_OLD:
case SR_DF_ANALOG2:
analog = packet->payload;
analog_old = packet->payload;
analog2 = packet->payload;
if (packet->type == SR_DF_ANALOG) {
channels = analog->channels;
if (packet->type == SR_DF_ANALOG_OLD) {
channels = analog_old->channels;
numch = g_slist_length(channels);
num_samples = analog->num_samples;
data = analog->data;
num_samples = analog_old->num_samples;
data = analog_old->data;
} else {
channels = analog2->meaning->channels;
numch = g_slist_length(channels);

View File

@ -236,7 +236,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
{
struct out_context *outc;
const struct sr_datafeed_meta *meta;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
const struct sr_config *src;
struct sr_channel *ch;
@ -261,7 +261,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
outc->samplerate = g_variant_get_uint64(src->data);
}
break;
case SR_DF_ANALOG:
case SR_DF_ANALOG_OLD:
case SR_DF_ANALOG2:
if (!outc->header_done) {
*out = gen_header(o);
@ -269,14 +269,14 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
} else
*out = g_string_sized_new(512);
analog = packet->payload;
analog_old = packet->payload;
analog2 = packet->payload;
if (packet->type == SR_DF_ANALOG) {
num_samples = analog->num_samples;
channels = analog->channels;
num_channels = g_slist_length(analog->channels);
data = analog->data;
if (packet->type == SR_DF_ANALOG_OLD) {
num_samples = analog_old->num_samples;
channels = analog_old->channels;
num_channels = g_slist_length(analog_old->channels);
data = analog_old->data;
} else {
num_samples = analog2->num_samples;
channels = analog2->meaning->channels;
@ -297,7 +297,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
}
if (num_samples > outc->chanbuf_size) {
if (realloc_chanbufs(o, analog->num_samples) != SR_OK)
if (realloc_chanbufs(o, analog_old->num_samples) != SR_OK)
return SR_ERR_MALLOC;
}
@ -312,7 +312,7 @@ static int receive(const struct sr_output *o, const struct sr_datafeed_packet *p
for (j = 0; j < num_channels; j++) {
idx = chan_idx[j];
buf = outc->chanbuf[idx] + outc->chanbuf_used[idx]++ * 4;
f = analog->data[i * num_channels + j];
f = analog_old->data[i * num_channels + j];
if (outc->scale != 0.0)
f /= outc->scale;
float_to_le(buf, f);

View File

@ -110,7 +110,7 @@ static void parse_flags(const uint8_t *buf, struct kern_info *info)
/* Byte LF: Always '\n' (newline, 0x0a, 10) */
}
static void handle_flags(struct sr_datafeed_analog *analog, float *floatval,
static void handle_flags(struct sr_datafeed_analog_old *analog, float *floatval,
const struct kern_info *info)
{
(void)floatval;
@ -187,7 +187,7 @@ SR_PRIV gboolean sr_kern_packet_valid(const uint8_t *buf)
* @param buf Buffer containing the protocol packet. Must not be NULL.
* @param floatval Pointer to a float variable. That variable will contain the
* result value upon parsing success. Must not be NULL.
* @param analog Pointer to a struct sr_datafeed_analog. The struct will be
* @param analog Pointer to a struct sr_datafeed_analog_old. The struct will be
* filled with data according to the protocol packet.
* Must not be NULL.
* @param info Pointer to a struct kern_info. The struct will be filled
@ -197,7 +197,7 @@ SR_PRIV gboolean sr_kern_packet_valid(const uint8_t *buf)
* 'analog' variable contents are undefined and should not be used.
*/
SR_PRIV int sr_kern_parse(const uint8_t *buf, float *floatval,
struct sr_datafeed_analog *analog, void *info)
struct sr_datafeed_analog_old *analog, void *info)
{
int ret;
struct kern_info *info_local;

View File

@ -1000,7 +1000,7 @@ SR_API int sr_session_stopped_callback_set(struct sr_session *session,
static void datafeed_dump(const struct sr_datafeed_packet *packet)
{
const struct sr_datafeed_logic *logic;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
/* Please use the same order as in libsigrok.h. */
@ -1022,10 +1022,10 @@ static void datafeed_dump(const struct sr_datafeed_packet *packet)
sr_dbg("bus: Received SR_DF_LOGIC packet (%" PRIu64 " bytes, "
"unitsize = %d).", logic->length, logic->unitsize);
break;
case SR_DF_ANALOG:
analog = packet->payload;
sr_dbg("bus: Received SR_DF_ANALOG packet (%d samples).",
analog->num_samples);
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.");
@ -1081,9 +1081,9 @@ SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
return SR_ERR_BUG;
}
if (packet->type == SR_DF_ANALOG) {
if (packet->type == SR_DF_ANALOG_OLD) {
/* Convert to SR_DF_ANALOG2. */
const struct sr_datafeed_analog *analog = packet->payload;
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;
@ -1091,8 +1091,8 @@ SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
struct sr_datafeed_packet a2_packet;
a2_packet.type = SR_DF_ANALOG2;
a2_packet.payload = &analog2;
analog2.data = analog->data;
analog2.num_samples = analog->num_samples;
analog2.data = analog_old->data;
analog2.num_samples = analog_old->num_samples;
analog2.encoding = &encoding;
analog2.meaning = &meaning;
analog2.spec = &spec;
@ -1110,10 +1110,10 @@ SR_PRIV int sr_session_send(const struct sr_dev_inst *sdi,
encoding.scale.q = 1;
encoding.offset.p = 0;
encoding.offset.q = 1;
meaning.mq = analog->mq;
meaning.unit = analog->unit;
meaning.mqflags = analog->mqflags;
meaning.channels = analog->channels;
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, &a2_packet);
}
@ -1466,8 +1466,8 @@ SR_PRIV int sr_packet_copy(const struct sr_datafeed_packet *packet,
struct sr_datafeed_meta *meta_copy;
const struct sr_datafeed_logic *logic;
struct sr_datafeed_logic *logic_copy;
const struct sr_datafeed_analog *analog;
struct sr_datafeed_analog *analog_copy;
const struct sr_datafeed_analog_old *analog_old;
struct sr_datafeed_analog_old *analog_old_copy;
const struct sr_datafeed_analog2 *analog2;
struct sr_datafeed_analog2 *analog2_copy;
uint8_t *payload;
@ -1499,18 +1499,18 @@ SR_PRIV int sr_packet_copy(const struct sr_datafeed_packet *packet,
memcpy(logic_copy->data, logic->data, logic->length * logic->unitsize);
(*copy)->payload = logic_copy;
break;
case SR_DF_ANALOG:
analog = packet->payload;
analog_copy = g_malloc(sizeof(analog));
analog_copy->channels = g_slist_copy(analog->channels);
analog_copy->num_samples = analog->num_samples;
analog_copy->mq = analog->mq;
analog_copy->unit = analog->unit;
analog_copy->mqflags = analog->mqflags;
analog_copy->data = g_malloc(analog->num_samples * sizeof(float));
memcpy(analog_copy->data, analog->data,
analog->num_samples * sizeof(float));
(*copy)->payload = analog_copy;
case SR_DF_ANALOG_OLD:
analog_old = packet->payload;
analog_old_copy = g_malloc(sizeof(analog_old));
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_ANALOG2:
analog2 = packet->payload;
@ -1542,7 +1542,7 @@ void sr_packet_free(struct sr_datafeed_packet *packet)
{
const struct sr_datafeed_meta *meta;
const struct sr_datafeed_logic *logic;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
struct sr_config *src;
GSList *l;
@ -1571,10 +1571,10 @@ void sr_packet_free(struct sr_datafeed_packet *packet)
g_free(logic->data);
g_free((void *)packet->payload);
break;
case SR_DF_ANALOG:
analog = packet->payload;
g_slist_free(analog->channels);
g_free(analog->data);
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_ANALOG2:

View File

@ -30,7 +30,7 @@ static int receive(const struct sr_transform *t,
struct sr_datafeed_packet **packet_out)
{
const struct sr_datafeed_logic *logic;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
struct sr_channel *ch;
GSList *l;
@ -54,13 +54,13 @@ static int receive(const struct sr_transform *t,
}
}
break;
case SR_DF_ANALOG:
analog = packet_in->payload;
fdata = (float *)analog->data;
num_channels = g_slist_length(analog->channels);
for (si = 0; si < analog->num_samples; si++) {
case SR_DF_ANALOG_OLD:
analog_old = packet_in->payload;
fdata = (float *)analog_old->data;
num_channels = g_slist_length(analog_old->channels);
for (si = 0; si < analog_old->num_samples; si++) {
/* For now invert all values in all channels. */
for (l = analog->channels, c = 0; l; l = l->next, c++) {
for (l = analog_old->channels, c = 0; l; l = l->next, c++) {
ch = l->data;
(void)ch;
f = &fdata[si * num_channels + c];

View File

@ -49,7 +49,7 @@ static int receive(const struct sr_transform *t,
struct sr_datafeed_packet **packet_out)
{
struct context *ctx;
const struct sr_datafeed_analog *analog;
const struct sr_datafeed_analog_old *analog_old;
const struct sr_datafeed_analog2 *analog2;
struct sr_channel *ch;
GSList *l;
@ -62,14 +62,14 @@ static int receive(const struct sr_transform *t,
ctx = t->priv;
switch (packet_in->type) {
case SR_DF_ANALOG:
analog = packet_in->payload;
fdata = (float *)analog->data;
num_channels = g_slist_length(analog->channels);
case SR_DF_ANALOG_OLD:
analog_old = packet_in->payload;
fdata = (float *)analog_old->data;
num_channels = g_slist_length(analog_old->channels);
factor = (float) ctx->factor.p / ctx->factor.q;
for (i = 0; i < analog->num_samples; i++) {
for (i = 0; i < analog_old->num_samples; i++) {
/* For now scale all values in all channels. */
for (l = analog->channels, c = 0; l; l = l->next, c++) {
for (l = analog_old->channels, c = 0; l; l = l->next, c++) {
ch = l->data;
(void)ch;
fdata[i * num_channels + c] *= factor;