]> sigrok.org Git - libsigrok.git/blobdiff - hwdriver.c
Revise session API to allow for multiple sessions in future.
[libsigrok.git] / hwdriver.c
index 2435a28f10e5da0b84c3d459805cd831c72b45e9..ec0afbac4051d84c9d3ec6b017eff03fce276570 100644 (file)
@@ -127,6 +127,8 @@ static struct sr_config_info sr_config_info_data[] = {
        {0, 0, NULL, NULL, NULL},
 };
 
+extern struct sr_session *sr_current_session;
+
 /**
  * Return the list of supported hardware drivers.
  *
@@ -472,7 +474,23 @@ SR_API const struct sr_config_info *sr_config_info_name_get(const char *optname)
  */
 SR_PRIV int sr_source_remove(int fd)
 {
-       return sr_session_source_remove(fd);
+       return sr_session_source_remove(sr_current_session, fd);
+}
+
+/** @private
+ *  @see sr_session_source_remove_pollfd()
+ */
+SR_PRIV int sr_source_remove_pollfd(GPollFD *pollfd)
+{
+       return sr_session_source_remove_pollfd(sr_current_session, pollfd);
+}
+
+/** @private
+ *  @see sr_session_source_remove_channel()
+ */
+SR_PRIV int sr_source_remove_channel(GIOChannel *channel)
+{
+       return sr_session_source_remove_channel(sr_current_session, channel);
 }
 
 /** @private
@@ -481,7 +499,28 @@ SR_PRIV int sr_source_remove(int fd)
 SR_PRIV int sr_source_add(int fd, int events, int timeout,
                          sr_receive_data_callback cb, void *cb_data)
 {
-       return sr_session_source_add(fd, events, timeout, cb, cb_data);
+       return sr_session_source_add(sr_current_session,
+                       fd, events, timeout, cb, cb_data);
+}
+
+/** @private
+ *  @see sr_session_source_add_pollfd()
+ */
+SR_PRIV int sr_source_add_pollfd(GPollFD *pollfd, int timeout,
+                         sr_receive_data_callback cb, void *cb_data)
+{
+       return sr_session_source_add_pollfd(sr_current_session,
+                       pollfd, timeout, cb, cb_data);
+}
+
+/** @private
+ *  @see sr_session_source_add_channel()
+ */
+SR_PRIV int sr_source_add_channel(GIOChannel *channel, int events, 
+                         int timeout, sr_receive_data_callback cb, void *cb_data)
+{
+       return sr_session_source_add_channel(sr_current_session,
+                       channel, events, timeout, cb, cb_data);
 }
 
 /** @} */