Exemplo n.º 1
0
struct ofono_modem* ofono_modem_create(const gchar *path)
{
	struct ofono_modem *modem;
	GError *error = NULL;

	modem = g_try_new0(struct ofono_modem, 1);
	if (!modem)
		return NULL;

	modem->remote = ofono_interface_modem_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
							G_DBUS_PROXY_FLAGS_NONE, "org.ofono", path, NULL, &error);
	if (error) {
		g_critical("Unable to initialize proxy for the org.ofono.modem interface");
		g_error_free(error);
		g_free(modem);
		return NULL;
	}

	modem->path = g_strdup(path);

	modem->powered = FALSE;
	modem->online = FALSE;
	modem->lockdown = FALSE;
	modem->emergency = FALSE;
	modem->name = NULL;
	memset(modem->interfaces, 0, sizeof(modem->interfaces));

	modem->base = ofono_base_create(&modem_base_funcs, modem->remote, modem);

	return modem;
}
Exemplo n.º 2
0
struct ofono_sim_manager* ofono_sim_manager_create(const gchar *path)
{
	struct ofono_sim_manager *sim;
	GError *error = NULL;

	sim = g_try_new0(struct ofono_sim_manager, 1);
	if (!sim)
		return NULL;

	sim->remote = ofono_interface_sim_manager_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
							G_DBUS_PROXY_FLAGS_NONE, "org.ofono", path, NULL, &error);
	if (error) {
		g_error("Unable to initialize proxy for the org.ofono.SimManager interface");
		g_error_free(error);
		g_free(sim);
		return NULL;
	}

	sim->path = g_strdup(path);
	sim->base = ofono_base_create(&sim_base_funcs, sim->remote, sim);
	memset(sim->pin_retries, 0, sizeof(sim->pin_retries));
	memset(sim->locked_pins, 0, sizeof(sim->locked_pins));
	sim->fixed_dialing = false;

	return sim;
}
struct ofono_connection_manager* ofono_connection_manager_create(const gchar *path)
{
	struct ofono_connection_manager *cm;
	GError *error = NULL;

	cm = g_try_new0(struct ofono_connection_manager, 1);
	if (!cm)
		return NULL;

	cm->remote = ofono_interface_connection_manager_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
							G_DBUS_PROXY_FLAGS_NONE, "org.ofono", path, NULL, &error);
	if (error) {
		g_critical("Unable to initialize proxy for the org.ofono.ConnectionManager interface");
		g_error_free(error);
		g_free(cm);
		return NULL;
	}

	cm->path = g_strdup(path);
	cm->base = ofono_base_create(&cm_base_funcs, cm->remote, cm);

	return cm;
}