switch (id) {
case SR_CONF_LIMIT_MSEC:
- /* TODO: Not yet implemented. */
if (g_variant_get_uint64(data) == 0) {
sr_err("Time limit cannot be 0.");
return SR_ERR;
devc->cb_data = cb_data;
+ devc->starttime = g_get_monotonic_time();
+
/* Send header packet to the session bus. */
std_session_send_df_header(cb_data, LOG_PREFIX);
int ret;
struct sr_dev_inst *sdi;
struct dev_context *devc;
+ int64_t time_ms;
(void)fd;
(void)revents;
sdi->driver->dev_acquisition_stop(sdi, cb_data);
}
+ if (devc->limit_msec) {
+ time_ms = (g_get_monotonic_time() - devc->starttime) / 1000;
+ if (time_ms > (int64_t)devc->limit_msec) {
+ sr_info("Requested time limit reached.");
+ sdi->driver->dev_acquisition_stop(sdi, cb_data);
+ return TRUE;
+ }
+ }
+
return TRUE;
}