]> sigrok.org Git - libsigrok.git/commitdiff
Use std_session_send_df_frame_begin()/_end() where possible.
authorUwe Hermann <redacted>
Wed, 8 Apr 2020 21:49:38 +0000 (23:49 +0200)
committerUwe Hermann <redacted>
Wed, 8 Apr 2020 21:54:25 +0000 (23:54 +0200)
17 files changed:
src/hardware/arachnid-labs-re-load-pro/protocol.c
src/hardware/baylibre-acme/protocol.c
src/hardware/gwinstek-gds-800/api.c
src/hardware/gwinstek-gds-800/protocol.c
src/hardware/hameg-hmo/protocol.c
src/hardware/hantek-dso/api.c
src/hardware/hung-chang-dso-2100/protocol.c
src/hardware/lecroy-xstream/protocol.c
src/hardware/maynuo-m97/protocol.c
src/hardware/rdtech-dps/protocol.c
src/hardware/rigol-ds/api.c
src/hardware/rigol-ds/protocol.c
src/hardware/serial-lcr/protocol.c
src/hardware/siglent-sds/api.c
src/hardware/siglent-sds/protocol.c
src/hardware/yokogawa-dlm/protocol.c
src/hardware/zketech-ebd-usb/protocol.c

index 3d7a014606de4c5746c214e1cbc9253ea147fd40..2c1031a2c42961cb224cae02582120d3d9eb3ff2 100644 (file)
@@ -338,9 +338,7 @@ static void handle_packet(const struct sr_dev_inst *sdi)
        g_strfreev(tokens);
 
        /* Begin frame. */
-       packet.type = SR_DF_FRAME_BEGIN;
-       packet.payload = NULL;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 
        sr_analog_init(&analog, &encoding, &meaning, &spec, 4);
 
@@ -373,9 +371,7 @@ static void handle_packet(const struct sr_dev_inst *sdi)
        g_slist_free(l);
 
        /* End frame. */
-       packet.type = SR_DF_FRAME_END;
-       packet.payload = NULL;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        sr_sw_limits_update_samples_read(&devc->limits, 1);
 }
index 17ae5b90859e764eb852439dadeab9314823cd64..89391d5482286e541873910e457be935b6e7818b 100644 (file)
@@ -703,7 +703,7 @@ SR_PRIV void bl_acme_close_channel(struct sr_channel *ch)
 SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
 {
        uint64_t nrexpiration;
-       struct sr_datafeed_packet packet, framep;
+       struct sr_datafeed_packet packet;
        struct sr_datafeed_analog analog;
        struct sr_analog_encoding encoding;
        struct sr_analog_meaning meaning;
@@ -759,8 +759,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
         * accuracy.
         */
        for (i = 0; i < nrexpiration; i++) {
-               framep.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &framep);
+               std_session_send_df_frame_begin(sdi);
 
                /*
                 * Due to different units used in each channel we're sending
@@ -788,8 +787,7 @@ SR_PRIV int bl_acme_receive_data(int fd, int revents, void *cb_data)
                        sr_session_send(sdi, &packet);
                }
 
-               framep.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &framep);
+               std_session_send_df_frame_end(sdi);
        }
 
        sr_sw_limits_update_samples_read(&devc->limits, 1);
index 2926bf074d91f83ea7192ce67bb45313e893b997..9d45266e9c616b619323718943e9d15fa27a6218 100644 (file)
@@ -189,17 +189,13 @@ static int dev_acquisition_stop(struct sr_dev_inst *sdi)
 {
        struct sr_scpi_dev_inst *scpi;
        struct dev_context *devc;
-       struct sr_datafeed_packet packet;
 
        scpi = sdi->conn;
        devc = sdi->priv;
 
        if (devc->df_started) {
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
-
+               std_session_send_df_frame_end(sdi);
                std_session_send_df_end(sdi);
-
                devc->df_started = FALSE;
        }
 
index ce9e8d416aae0d1862b689c3fdf9d579f76cf41f..5feb25b140d716d336bb87e0d09fb721515a8674 100644 (file)
@@ -141,11 +141,8 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
                                } else {
                                        /* Start acquiring next frame. */
                                        if (devc->df_started) {
-                                               packet.type = SR_DF_FRAME_END;
-                                               sr_session_send(sdi, &packet);
-
-                                               packet.type = SR_DF_FRAME_BEGIN;
-                                               sr_session_send(sdi, &packet);
+                                               std_session_send_df_frame_end(sdi);
+                                               std_session_send_df_frame_begin(sdi);
                                        }
 
                                        devc->cur_acq_frame++;
@@ -202,10 +199,7 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
 
                if (!devc->df_started) {
                        std_session_send_df_header(sdi);
-
-                       packet.type = SR_DF_FRAME_BEGIN;
-                       sr_session_send(sdi, &packet);
-
+                       std_session_send_df_frame_begin(sdi);
                        devc->df_started = TRUE;
                }
                break;
@@ -271,11 +265,8 @@ SR_PRIV int gwinstek_gds_800_receive_data(int fd, int revents, void *cb_data)
                        } else {
                                /* Start acquiring next frame. */
                                if (devc->df_started) {
-                                       packet.type = SR_DF_FRAME_END;
-                                       sr_session_send(sdi, &packet);
-
-                                       packet.type = SR_DF_FRAME_BEGIN;
-                                       sr_session_send(sdi, &packet);
+                                       std_session_send_df_frame_end(sdi);
+                                       std_session_send_df_frame_begin(sdi);
                                }
                                devc->cur_acq_frame++;
                                devc->state = START_ACQUISITION;
index 457fb86bc28011f6238c9f2a846e0cf62b017f75..d15d7a8924346ed5cf0d46d85daeaace078c0963 100644 (file)
@@ -1402,10 +1402,8 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
         * Send "frame begin" packet upon reception of data for the
         * first enabled channel.
         */
-       if (devc->current_channel == devc->enabled_channels) {
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
-       }
+       if (devc->current_channel == devc->enabled_channels)
+               std_session_send_df_frame_begin(sdi);
 
        /*
         * Pass on the received data of the channel(s).
@@ -1526,8 +1524,7 @@ SR_PRIV int hmo_receive_data(int fd, int revents, void *cb_data)
         */
        hmo_cleanup_logic_data(devc);
 
-       packet.type = SR_DF_FRAME_END;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        /*
         * End of frame was reached. Stop acquisition after the specified
index c1b18ea9ca660a52ec8b2e4113d637b3b8a1e88c..b0726e98c86f62ca653a27d388ab9f2ec46176fa 100644 (file)
@@ -704,7 +704,6 @@ static void send_chunk(struct sr_dev_inst *sdi, unsigned char *buf,
  */
 static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
 {
-       struct sr_datafeed_packet packet;
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
        int num_samples, pre;
@@ -782,8 +781,7 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
                devc->framebuf = NULL;
 
                /* Mark the end of this frame. */
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
 
                if (devc->limit_frames && ++devc->num_frames >= devc->limit_frames) {
                        /* Terminate session */
@@ -797,7 +795,6 @@ static void LIBUSB_CALL receive_transfer(struct libusb_transfer *transfer)
 static int handle_event(int fd, int revents, void *cb_data)
 {
        const struct sr_dev_inst *sdi;
-       struct sr_datafeed_packet packet;
        struct timeval tv;
        struct sr_dev_driver *di;
        struct dev_context *devc;
@@ -889,8 +886,7 @@ static int handle_event(int fd, int revents, void *cb_data)
                devc->dev_state = FETCH_DATA;
 
                /* Tell the frontend a new frame is on the way. */
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_begin(sdi);
                break;
        case CAPTURE_READY_9BIT:
                /* TODO */
index 3df5b3f291a2422ad1ddcd3996275b43358f8907..92d52c35e9a26d11401f330847f6310eb7bacd95 100644 (file)
@@ -415,7 +415,6 @@ static int read_subframe(const struct sr_dev_inst *sdi, uint8_t *buf)
 
 SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
 {
-       struct sr_datafeed_packet packet = { .type = SR_DF_FRAME_BEGIN };
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
        uint8_t state, buf[1000];
@@ -443,7 +442,7 @@ SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
                return FALSE;
        }
 
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 
        if (devc->channel) {
                while (read_subframe(sdi, buf)) {
@@ -456,8 +455,7 @@ SR_PRIV int hung_chang_dso_2100_poll(int fd, int revents, void *cb_data)
                }
        }
 
-       packet.type = SR_DF_FRAME_END;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        if (++devc->frame >= devc->frame_limit)
                sr_dev_acquisition_stop(sdi);
index 802cda32efe38f147387457c81ae1ee387eeeff9..9693c6d3404546c27ec4a216197cfb1f78e08146 100644 (file)
@@ -679,10 +679,8 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
         * Send "frame begin" packet upon reception of data for the
         * first enabled channel.
         */
-       if (devc->current_channel == devc->enabled_channels) {
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
-       }
+       if (devc->current_channel == devc->enabled_channels)
+               std_session_send_df_frame_begin(sdi);
 
        meaning.channels = g_slist_append(NULL, ch);
        packet.payload = &analog;
@@ -706,8 +704,7 @@ SR_PRIV int lecroy_xstream_receive_data(int fd, int revents, void *cb_data)
                return TRUE;
        }
 
-       packet.type = SR_DF_FRAME_END;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        /*
         * End of frame was reached. Stop acquisition after the specified
index c369fa6ceab689532a253239ebc784a3257c2a8a..3a4c2d4631473ce4692e774232257dcdb37a8107 100644 (file)
@@ -166,7 +166,6 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data)
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
        struct sr_modbus_dev_inst *modbus;
-       struct sr_datafeed_packet packet;
        uint16_t registers[4];
 
        (void)fd;
@@ -180,8 +179,7 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data)
 
        devc->expecting_registers = 0;
        if (sr_modbus_read_holding_registers(modbus, -1, 4, registers) == SR_OK) {
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_begin(sdi);
 
                maynuo_m97_session_send_value(sdi, sdi->channels->data,
                                              RBFL(registers + 0),
@@ -190,8 +188,7 @@ SR_PRIV int maynuo_m97_receive_data(int fd, int revents, void *cb_data)
                                              RBFL(registers + 2),
                                              SR_MQ_CURRENT, SR_UNIT_AMPERE, 4);
 
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
                sr_sw_limits_update_samples_read(&devc->limits, 1);
        }
 
index 77cc0a0851070608dd847dc02dd9640647a38ebf..65f40ab9297ad681117a06d9f99f2c489bf7c750 100644 (file)
@@ -120,7 +120,6 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data)
        struct sr_dev_inst *sdi;
        struct dev_context *devc;
        struct sr_modbus_dev_inst *modbus;
-       struct sr_datafeed_packet packet;
        uint16_t registers[8];
        int ret;
 
@@ -143,8 +142,7 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data)
 
        if (ret == SR_OK) {
                /* Send channel values */
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_begin(sdi);
 
                send_value(sdi, sdi->channels->data,
                        RB16(registers + 0) / devc->voltage_multiplier,
@@ -158,8 +156,7 @@ SR_PRIV int rdtech_dps_receive_data(int fd, int revents, void *cb_data)
                        RB16(registers + 2) / 100.0f,
                        SR_MQ_POWER, 0, SR_UNIT_WATT, 2);
 
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
 
                /* Check for state changes */
                if (devc->actual_ovp_state != (RB16(registers + 5) == STATE_OVP)) {
index 0146f3a0b3bcaa63e748092bfa08663e8bb6d2e3..10c579ce296d6d15eac29a4398ab575997274198 100644 (file)
@@ -878,7 +878,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        struct dev_context *devc;
        struct sr_channel *ch;
-       struct sr_datafeed_packet packet;
        gboolean some_digital;
        GSList *l;
        char *cmd;
@@ -994,8 +993,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                return SR_ERR;
 
        /* Start of first frame. */
-       packet.type = SR_DF_FRAME_BEGIN;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 
        return SR_OK;
 }
index 3ea0cea8984a799b24cc47f00a4e31db1dc23e78..688dcc3998750909bbbe228c79590407faef8251 100644 (file)
@@ -666,8 +666,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                                return TRUE;
                        if (len == -1) {
                                sr_err("Error while reading block header, aborting capture.");
-                               packet.type = SR_DF_FRAME_END;
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_frame_end(sdi);
                                sr_dev_acquisition_stop(sdi);
                                return TRUE;
                        }
@@ -699,8 +698,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
 
        if (len == -1) {
                sr_err("Error while reading block data, aborting capture.");
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
                sr_dev_acquisition_stop(sdi);
                return TRUE;
        }
@@ -761,8 +759,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                /* End acquisition when data for all channels is acquired. */
                if (!sr_scpi_read_complete(scpi) && !devc->channel_entry->next) {
                        sr_err("Read should have been completed");
-                       packet.type = SR_DF_FRAME_END;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_frame_end(sdi);
                        sr_dev_acquisition_stop(sdi);
                        return TRUE;
                }
@@ -796,8 +793,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                rigol_ds_channel_start(sdi);
        } else {
                /* Done with this frame. */
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
 
                if (++devc->num_frames == devc->limit_frames) {
                        /* Last frame, stop capture. */
@@ -809,8 +805,7 @@ SR_PRIV int rigol_ds_receive(int fd, int revents, void *cb_data)
                        rigol_ds_capture_start(sdi);
 
                        /* Start of next frame. */
-                       packet.type = SR_DF_FRAME_BEGIN;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_frame_begin(sdi);
                }
        }
 
index e5b89dc5dde1f4a3d084dfecc89c6bcde3ec33cd..f0e997317de3d9d4fcabe11f56eb412ddf80243f 100644 (file)
@@ -31,7 +31,6 @@ static void send_frame_start(struct sr_dev_inst *sdi)
        struct lcr_parse_info *info;
        uint64_t freq;
        const char *model;
-       struct sr_datafeed_packet packet;
 
        devc = sdi->priv;
        info = &devc->parse_info;
@@ -51,8 +50,7 @@ static void send_frame_start(struct sr_dev_inst *sdi)
        }
 
        /* Data is about to get sent. Start a new frame. */
-       packet.type = SR_DF_FRAME_BEGIN;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 }
 
 static int handle_packet(struct sr_dev_inst *sdi, const uint8_t *pkt)
index 76af671249cee157fb4f711eb6fe6c477f657db2..172c8af2faa414967a10100ff2679c8b8d75ffc4 100644 (file)
@@ -799,7 +799,6 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
        struct sr_scpi_dev_inst *scpi;
        struct dev_context *devc;
        struct sr_channel *ch;
-       struct sr_datafeed_packet packet;
        gboolean some_digital;
        GSList *l, *d;
 
@@ -900,8 +899,7 @@ static int dev_acquisition_start(const struct sr_dev_inst *sdi)
                return SR_ERR;
 
        /* Start of first frame. */
-       packet.type = SR_DF_FRAME_BEGIN;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 
        return SR_OK;
 }
index af2f2d9b0b9a1c00f028e7b33013da4fbabf56d7..69c07db5c9e2151907a5043e59af8cdccf05d5c1 100644 (file)
@@ -539,8 +539,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                                return TRUE;
                        if (len == -1) {
                                sr_err("Read error, aborting capture.");
-                               packet.type = SR_DF_FRAME_END;
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_frame_end(sdi);
                                sdi->driver->dev_acquisition_stop(sdi);
                                return TRUE;
                        }
@@ -549,8 +548,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
 
                        if (len == -1) {
                                sr_err("Read error, aborting capture.");
-                               packet.type = SR_DF_FRAME_END;
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_frame_end(sdi);
                                sdi->driver->dev_acquisition_stop(sdi);
                                return TRUE;
                        }
@@ -567,8 +565,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                                        len = sr_scpi_read_data(scpi, (char *)devc->buffer, devc->num_samples-devc->num_block_bytes);
                                        if (len == -1) {
                                                sr_err("Read error, aborting capture.");
-                                               packet.type = SR_DF_FRAME_END;
-                                               sr_session_send(sdi, &packet);
+                                               std_session_send_df_frame_end(sdi);
                                                sdi->driver->dev_acquisition_stop(sdi);
                                                return TRUE;
                                        }
@@ -615,8 +612,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                                        read_complete = TRUE;
                                        if (!sr_scpi_read_complete(scpi)) {
                                                sr_err("Read should have been completed.");
-                                               packet.type = SR_DF_FRAME_END;
-                                               sr_session_send(sdi, &packet);
+                                               std_session_send_df_frame_end(sdi);
                                                sdi->driver->dev_acquisition_stop(sdi);
                                                return TRUE;
                                        }
@@ -633,8 +629,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                                siglent_sds_channel_start(sdi);
                        } else {
                                /* Done with this frame. */
-                               packet.type = SR_DF_FRAME_END;
-                               sr_session_send(sdi, &packet);
+                               std_session_send_df_frame_end(sdi);
                                if (++devc->num_frames == devc->limit_frames) {
                                        /* Last frame, stop capture. */
                                        sdi->driver->dev_acquisition_stop(sdi);
@@ -644,8 +639,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                                        siglent_sds_capture_start(sdi);
 
                                        /* Start of next frame. */
-                                       packet.type = SR_DF_FRAME_BEGIN;
-                                       sr_session_send(sdi, &packet);
+                                       std_session_send_df_frame_begin(sdi);
                                }
                        }
                }
@@ -658,8 +652,7 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                packet.type = SR_DF_LOGIC;
                packet.payload = &logic;
                sr_session_send(sdi, &packet);
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
                sdi->driver->dev_acquisition_stop(sdi);
 
                if (++devc->num_frames == devc->limit_frames) {
@@ -671,14 +664,12 @@ SR_PRIV int siglent_sds_receive(int fd, int revents, void *cb_data)
                        siglent_sds_capture_start(sdi);
 
                        /* Start of next frame. */
-                       packet.type = SR_DF_FRAME_BEGIN;
-                       sr_session_send(sdi, &packet);
+                       std_session_send_df_frame_begin(sdi);
                }
        }
 
        // sr_session_send(sdi, &packet);
-       // packet.type = SR_DF_FRAME_END;
-       // sr_session_send(sdi, &packet);
+       // std_session_send_df_frame_end(sdi);
        // sdi->driver->dev_acquisition_stop(sdi);
 
        return TRUE;
index 1bd863ee1545a645139111eaa78993657172758d..d2c51cdac6d4f5ebfebaf61c02c66dfef262d9cb 100644 (file)
@@ -1018,7 +1018,6 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data)
        struct scope_state *model_state;
        struct dev_context *devc;
        struct sr_channel *ch;
-       struct sr_datafeed_packet packet;
        int chunk_len, num_bytes;
        static GArray *data = NULL;
 
@@ -1065,10 +1064,8 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data)
        devc->data_pending = FALSE;
 
        /* Signal the beginning of a new frame if this is the first channel. */
-       if (devc->current_channel == devc->enabled_channels) {
-               packet.type = SR_DF_FRAME_BEGIN;
-               sr_session_send(sdi, &packet);
-       }
+       if (devc->current_channel == devc->enabled_channels)
+               std_session_send_df_frame_begin(sdi);
 
        if (dlm_block_data_header_process(data, &num_bytes) != SR_OK) {
                sr_err("Encountered malformed block data header.");
@@ -1111,8 +1108,7 @@ SR_PRIV int dlm_data_receive(int fd, int revents, void *cb_data)
         * and set the next enabled channel. Then, request its data.
         */
        if (!devc->current_channel->next) {
-               packet.type = SR_DF_FRAME_END;
-               sr_session_send(sdi, &packet);
+               std_session_send_df_frame_end(sdi);
                devc->current_channel = devc->enabled_channels;
 
                /*
index 0c99ea5034b5d70344a95244e78ab3aba275e9d5..b3098c5d529d607936fbf94048e73e24accc485e 100644 (file)
@@ -224,9 +224,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data)
        sr_dbg("Current limit %f", current_limit);
 
        /* Begin frame. */
-       packet.type = SR_DF_FRAME_BEGIN;
-       packet.payload = NULL;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_begin(sdi);
 
        sr_analog_init(&analog, &encoding, &meaning, &spec, 4);
 
@@ -257,9 +255,7 @@ SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data)
        g_slist_free(l);
 
        /* End frame. */
-       packet.type = SR_DF_FRAME_END;
-       packet.payload = NULL;
-       sr_session_send(sdi, &packet);
+       std_session_send_df_frame_end(sdi);
 
        sr_sw_limits_update_samples_read(&devc->limits, 1);
        if (sr_sw_limits_check(&devc->limits))