]> sigrok.org Git - libsigrok.git/blobdiff - session.c
Add sr_session_append(): add captured data to an existing session file
[libsigrok.git] / session.c
index 720b5ae10819908b63018e1c8095cbfceed5bc49..b52c91a374540de5eadd41c2cf030666b08706eb 100644 (file)
--- a/session.c
+++ b/session.c
@@ -179,6 +179,31 @@ SR_API int sr_session_dev_add(const struct sr_dev_inst *sdi)
        return SR_OK;
 }
 
+/**
+ * List all device instances attached to the current session.
+ *
+ * @param devlist A pointer where the device instance list will be
+ *                stored on return. If no devices are in the session,
+ *                this will be NULL. Each element in the list points
+ *                to a struct sr_dev_inst *.
+ *                The list must be freed by the caller, but not the
+ *                elements pointed to.
+ *
+ * @return SR_OK upon success, SR_ERR upon invalid arguments.
+ */
+SR_API int sr_session_dev_list(GSList **devlist)
+{
+
+       *devlist = NULL;
+
+       if (!session)
+               return SR_ERR;
+
+       *devlist = g_slist_copy(session->devs);
+
+       return SR_OK;
+}
+
 /**
  * Remove all datafeed callbacks in the current session.
  *
@@ -239,9 +264,16 @@ SR_API int sr_session_datafeed_callback_add(sr_datafeed_callback_t cb, void *cb_
  * but driven by another scheduler, this can be used to poll the devices
  * from within that scheduler.
  *
+ * @param block If TRUE, this call will wait for any of the session's
+ *              sources to fire an event on the file descriptors, or
+ *              any of their timeouts to activate. In other words, this
+ *              can be used as a select loop.
+ *              If FALSE, all sources have their callback run, regardless
+ *              of file descriptor or timeout status.
+ *
  * @return SR_OK upon success, SR_ERR on errors.
  */
-SR_API int sr_session_iteration(gboolean block)
+static int sr_session_iteration(gboolean block)
 {
        unsigned int i;
        int ret;