예제 #1
0
파일: mcaptest.c 프로젝트: ghent360/bluez
static void mcl_connected(struct mcap_mcl *mcap_mcl, gpointer data)
{
	printf("%s\n", __func__);

	if (mcl) {
		mcap_sync_stop(mcl);
		mcap_mcl_unref(mcl);
	}

	mcl = mcap_mcl_ref(mcap_mcl);
	trigger_mdl_action(data_mode);
}
예제 #2
0
파일: mcaptest.c 프로젝트: ghent360/bluez
static void create_mcl_cb(struct mcap_mcl *mcap_mcl, GError *err, gpointer data)
{
	printf("%s\n", __func__);

	if (err) {
		printf("Could not connect MCL: %s\n", err->message);

		if (!no_close)
			g_main_loop_quit(mloop);

		return;
	}

	if (mcl) {
		mcap_sync_stop(mcl);
		mcap_mcl_unref(mcl);
	}

	mcl = mcap_mcl_ref(mcap_mcl);
	trigger_mdl_action(data_mode);
}
예제 #3
0
static void close_mcl(struct mcap_mcl *mcl, gboolean cache_requested)
{
	gboolean save = ((!(mcl->ctrl & MCAP_CTRL_FREE)) && cache_requested);

	RELEASE_TIMER(mcl);

	if (mcl->cc) {
		g_io_channel_shutdown(mcl->cc, TRUE, NULL);
		g_io_channel_unref(mcl->cc);
		mcl->cc = NULL;
	}

	if (mcl->wid) {
		g_source_remove(mcl->wid);
		mcl->wid = 0;
	}

	if (mcl->lcmd) {
		g_free(mcl->lcmd);
		mcl->lcmd = NULL;
	}

	if (mcl->priv_data)
		free_mcl_priv_data(mcl);

	g_slist_foreach(mcl->mdls, (GFunc) shutdown_mdl, NULL);

	mcap_sync_stop(mcl);

	mcl->state = MCL_IDLE;

	if (save)
		return;

	g_slist_foreach(mcl->mdls, (GFunc) mcap_mdl_unref, NULL);
	g_slist_free(mcl->mdls);
	mcl->mdls = NULL;
}