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;
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());
}
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:
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)
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);
}
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);
friend class Channel;
friend class ChannelGroup;
friend class Output;
- friend class Analog;
+ friend class AnalogOld;
};
/** A real hardware device, connected via a driver */
friend class Header;
friend class Meta;
friend class Logic;
- friend class Analog;
+ friend class AnalogOld;
friend class Context;
};
};
/** 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:
/** 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;
};
%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"
{
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()
{
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
%}
/* 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;
}
}
-/* Return NumPy array from Analog::data(). */
-%extend sigrok::Analog
+/* Return NumPy array from AnalogOld::data(). */
+%extend sigrok::AnalogOld
{
PyObject * _data()
{
%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);
%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>
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. */
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 */
}
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;
}
}
-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)
{
/*
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
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 */
* @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
* '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;
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;
}
}
-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;
}
}
-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;
}
}
-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;
}
}
-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;
/* 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 */
* @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
* '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;
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;
}
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;
/* 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 */
* @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
* '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;
}
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;
}
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;
}
}
-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 */
}
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;
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)
{
/*
}
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;
{
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;
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);
{
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;
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;
*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);
{
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;
/* 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;
*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);
{
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;
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;
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");
}
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;
{
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;
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);
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);
}
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;
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;
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++;
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,
{
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;
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);
{
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;
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);
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;
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);
}
/* 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;
{
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;
}
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;
return;
}
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
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 */
};
unsigned int i;
devc = sdi->priv;
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &ag->packet;
if (!devc->avg) {
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;
#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;
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;
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])
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;
{
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")) {
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++;
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;
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++;
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;
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);
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;
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);
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;
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);
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;
{
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,
.data = data,
};
struct sr_datafeed_packet packet = {
- .type = SR_DF_ANALOG,
+ .type = SR_DF_ANALOG_OLD,
.payload = &analog,
};
float factor = devc->factor;
{
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);
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;
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++;
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;
};
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;
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;
{
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;
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)))
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;
{
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;
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;
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);
{
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;
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;
/* 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.
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);
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;
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);
{
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;
/* 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;
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;
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;
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++;
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;
};
{
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;
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);
{
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;
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;
};
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;
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);
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);
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. */
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);
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;
};
{
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;
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) {
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);
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;
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);
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;
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;
}
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 {
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;
frame = TRUE;
}
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
frame = TRUE;
}
- packet.type = SR_DF_ANALOG;
+ packet.type = SR_DF_ANALOG_OLD;
packet.payload = &analog;
sr_session_send(devc->cb_data, &packet);
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 -------------------------------------------------*/
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 -------------------------------------------------*/
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 --------------------------------------------------*/
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 ------------------------------------------------*/
#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 -------------------------------------------------*/
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 --------------------------------------------------*/
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 --------------------------------------------------*/
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 --------------------------------------------------*/
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 ------------------------------------------------*/
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 -------------------------------------------------*/
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
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;
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);
}
}
{
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;
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);
{
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;
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);
} 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;
}
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;
}
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);
/* 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;
* @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
* '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;
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. */
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.");
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;
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;
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);
}
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;
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;
{
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;
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:
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;
}
}
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];
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;
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;