-/* Send a packet of logic samples to the session bus. The payload is taken
- * from the acquisition state. The return value indicates whether to stop
- * reading more samples.
- */
-static gboolean send_logic_packet(const struct sr_dev_inst *sdi)
-{
- uint64_t samples;
- struct dev_context *devc;
- struct acquisition_state *acq;
- struct sr_datafeed_packet packet;
- struct sr_datafeed_logic logic;
- int last;
-
- devc = sdi->priv;
- acq = devc->acquisition;
-
- if (acq->samples_done >= acq->samples_max)
- return TRUE;
-
- packet.type = SR_DF_LOGIC;
- packet.payload = &logic;
- logic.unitsize = UNIT_SIZE;
- logic.data = acq->out_packet;
- logic.length = acq->out_offset;
-
- samples = acq->out_offset / UNIT_SIZE;
- last = FALSE;
-
- /* Cut the packet short if necessary. */
- if (acq->samples_done + samples >= acq->samples_max) {
- samples = acq->samples_max - acq->samples_done;
- logic.length = samples * UNIT_SIZE;
- last = TRUE;
- }
- acq->samples_done += samples;
- acq->out_offset = 0;
-
- /* Send off logic datafeed packet. */
- sr_session_send(sdi, &packet);
-
- return last;
-}
-