]> sigrok.org Git - libsigrok.git/blobdiff - libsigrok.h
Fix output API receive() function
[libsigrok.git] / libsigrok.h
index 73af2d9db3ec7baed572cc63ca495fc287100881..6cda5543223d17cfceb225c0dce40ded25899feb 100644 (file)
@@ -454,7 +454,7 @@ struct sr_output_format {
         * <code>data_out</code> parameter, so the caller knows not to try
         * and g_free() it.
         *
-        * Note: This API call is obsolete, use recv() instead.
+        * Note: This API call is obsolete, use receive() instead.
         *
         * @param o Pointer to the respective 'struct sr_output'.
         * @param data_in Pointer to the input data buffer.
@@ -486,7 +486,7 @@ struct sr_output_format {
         * it stored in the <code>data_out</code> and <code>length_out</code>
         * parameters, or NULL if no output was generated.
         *
-        * Note: This API call is obsolete, use recv() instead.
+        * Note: This API call is obsolete, use receive() instead.
         *
         * @param o Pointer to the respective 'struct sr_output'.
         * @param event_type Type of event that occured.
@@ -496,11 +496,35 @@ struct sr_output_format {
         * @return SR_OK upon success, a negative error code otherwise.
         */
        int (*event) (struct sr_output *o, int event_type, uint8_t **data_out,
-                     uint64_t *length_out);
+                       uint64_t *length_out);
 
-       GString *(*recv) (struct sr_output *o, const struct sr_dev_inst *sdi,
-                       const struct sr_datafeed_packet *packet);
+       /**
+        * This function is passed a copy of every packed in the data feed.
+        * Any output generated by the output module in response to the
+        * packet should be returned in a newly allocated GString
+        * <code>out</code>, which will be freed by the caller.
+        *
+        * Packets not of interest to the output module can just be ignored,
+        * and the <code>out</code> parameter set to NULL.
+        *
+        * @param o Pointer to the respective 'struct sr_output'.
+        * @param sdi The device instance that generated the packet.
+        * @param packet The complete packet.
+        * @param out A pointer where a GString * should be stored if
+        * the module generates output, or NULL if not.
+        *
+        * @return SR_OK upon success, a negative error code otherwise.
+        */
+       int (*receive) (struct sr_output *o, const struct sr_dev_inst *sdi,
+                       const struct sr_datafeed_packet *packet, GString **out);
 
+       /**
+        * This function is called after the caller is finished using
+        * the output module, and can be used to free any internal
+        * resources the module may keep.
+        *
+        * @return SR_OK upon success, a negative error code otherwise.
+        */
        int (*cleanup) (struct sr_output *o);
 };