devc->scale *= pow(10.0, range - 13);
break;
/* TODO: 29S Mains measurements. */
+ default:
+ /* Avoid certain compiler warnings due to (-Wswitch). */
+ break;
}
}
devc->scale *= pow(10.0, range - 13);
break;
/* TODO: 29S Mains measurements. */
+ default:
+ /* Avoid certain compiler warnings due to (-Wswitch). */
+ break;
}
}
static void send_value(struct sr_dev_inst *sdi)
{
struct dev_context *devc;
- struct sr_datafeed_analog_old analog;
+ struct sr_datafeed_analog analog;
+ struct sr_analog_encoding encoding;
+ struct sr_analog_meaning meaning;
+ struct sr_analog_spec spec;
struct sr_datafeed_packet packet;
devc = sdi->priv;
- memset(&analog, 0, sizeof(struct sr_datafeed_analog_old));
- analog.channels = sdi->channels;
+ sr_analog_init(&analog, &encoding, &meaning, &spec, 0);
+ analog.meaning->channels = sdi->channels;
analog.num_samples = 1;
- analog.mq = devc->mq;
- analog.unit = devc->unit;
- analog.mqflags = devc->mqflags;
+ analog.meaning->mq = devc->mq;
+ analog.meaning->unit = devc->unit;
+ analog.meaning->mqflags = devc->mqflags;
analog.data = &devc->value;
memset(&packet, 0, sizeof(struct sr_datafeed_packet));
- packet.type = SR_DF_ANALOG_OLD;
+ packet.type = SR_DF_ANALOG;
packet.payload = &analog;
sr_session_send(sdi, &packet);
}
sr_spew("process_msg_inf_13() value=%f scale=%f scale1000=%d mq=%d "
"unit=%d mqflags=0x%02" PRIx64, devc->value, devc->scale,
- devc->scale1000, devc->mq, devc->unit, devc->mqflags);
+ devc->scale1000, devc->mq, devc->unit, (uint64_t)devc->mqflags);
if (devc->value != NAN)
devc->value *= devc->scale * pow(1000.0, devc->scale1000);
}
sr_spew("process_msg14() value=%f scale=%f scale1000=%d mq=%d "
"unit=%d mqflags=0x%02" PRIx64, devc->value, devc->scale,
- devc->scale1000, devc->mq, devc->unit, devc->mqflags);
+ devc->scale1000, devc->mq, devc->unit, (uint64_t)devc->mqflags);
if (devc->value != NAN)
devc->value *= devc->scale * pow(1000.0, devc->scale1000);
gboolean settings_ok; /**< Settings msg received yet. */
int msg_type; /**< Message type (MSGID_INF, ...). */
int msg_len; /**< Message length (valid when msg, curr. type known).*/
- int mq; /**< Measured quantity */
- int unit; /**< Measured unit */
- uint64_t mqflags; /**< Measured quantity flags */
+ enum sr_mq mq; /**< Measured quantity */
+ enum sr_unit unit; /**< Measured unit */
+ enum sr_mqflag mqflags; /**< Measured quantity flags */
float value; /**< Measured value */
float scale; /**< Scale for value. */
int8_t scale1000; /**< Additional scale factor 1000x. */