#include <unistd.h>
#include <string.h>
#include <glib.h>
-#include <sigrok.h>
-#include <sigrok-internal.h>
+#include "sigrok.h"
+#include "sigrok-internal.h"
/* demo.c */
extern GIOChannel channels[2];
};
/* There can only be one session at a time. */
+/* 'session' is not static, it's used elsewhere (via 'extern'). */
struct sr_session *session;
-int num_sources = 0;
-
-struct source *sources = NULL;
-int source_timeout = -1;
+static int num_sources = 0;
+static struct source *sources = NULL;
+static int source_timeout = -1;
struct sr_session *sr_session_new(void)
{
void sr_session_destroy(void)
{
-
g_slist_free(session->devices);
/* TODO: Loop over protocol decoders and free them. */
}
}
free(fds);
-
}
int sr_session_start(void)
void sr_session_run(void)
{
-
sr_info("session: running");
session->running = TRUE;
else
/* real sources, use g_poll() main loop */
sr_session_run_poll();
-
}
void sr_session_halt(void)
{
-
sr_info("session: halting");
session->running = FALSE;
-
}
void sr_session_stop(void)
if (device->plugin && device->plugin->stop_acquisition)
device->plugin->stop_acquisition(device->plugin_index, device);
}
-
}
static void datafeed_dump(struct sr_datafeed_packet *packet)
default:
sr_dbg("bus: received unknown packet type %d", packet->type);
}
-
}
void sr_session_bus(struct sr_device *device, struct sr_datafeed_packet *packet)
free(new_sources);
}
}
-