- /* Get the next frame, starting with the first analog channel. */
- if (devc->enabled_analog_probes)
- devc->channel_entry = devc->enabled_analog_probes;
- else
- devc->channel_entry = devc->enabled_digital_probes;
-
- if (devc->model->series < RIGOL_DS1000Z)
- rigol_ds_channel_start(sdi);
- else
- rigol_ds_capture_start(sdi);
+ /* Done with this frame. */
+ packet.type = SR_DF_FRAME_END;
+ sr_session_send(cb_data, &packet);
+
+ if (++devc->num_frames == devc->limit_frames) {
+ /* Last frame, stop capture. */
+ sdi->driver->dev_acquisition_stop(sdi, cb_data);
+ } else {
+ /* Get the next frame, starting with the first analog channel. */
+ if (devc->enabled_analog_probes)
+ devc->channel_entry = devc->enabled_analog_probes;
+ else
+ devc->channel_entry = devc->enabled_digital_probes;
+
+ if (devc->model->series < RIGOL_DS1000Z)
+ rigol_ds_channel_start(sdi);
+ else
+ rigol_ds_capture_start(sdi);
+
+ /* Start of next frame. */
+ packet.type = SR_DF_FRAME_BEGIN;
+ sr_session_send(cb_data, &packet);
+ }