Example #1
0
File: sms.c Project: AndriusA/ofono
/*
 * Indicate oFono that a SMS driver is ready for operation
 *
 * This is called after ofono_sms_create() was done and the modem
 * driver determined that a modem supports SMS correctly. Once this
 * call succeeds, the D-BUS interface for SMS goes live.
 */
void ofono_sms_register(struct ofono_sms *sms)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(sms->atom);
	const char *path = __ofono_atom_get_path(sms->atom);
	struct ofono_sim *sim;

	if (!g_dbus_register_interface(conn, path,
					OFONO_MESSAGE_MANAGER_INTERFACE,
					sms_manager_methods,
					sms_manager_signals,
					NULL, sms, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_MESSAGE_MANAGER_INTERFACE);
		return;
	}

	ofono_modem_add_interface(modem, OFONO_MESSAGE_MANAGER_INTERFACE);

	sms->mw_watch = __ofono_modem_add_atom_watch(modem,
					OFONO_ATOM_TYPE_MESSAGE_WAITING,
					mw_watch, sms, NULL);

	sms->netreg_watch = __ofono_modem_add_atom_watch(modem,
					OFONO_ATOM_TYPE_NETREG,
					netreg_watch, sms, NULL);

	sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);

	/*
	 * If we have a sim atom, we can uniquely identify the SIM,
	 * otherwise create an sms assembly which doesn't backup the fragment
	 * store.
	 */
	if (sim) {
		const char *imsi;

		imsi = ofono_sim_get_imsi(sim);
		sms->assembly = sms_assembly_new(imsi);

		sms->sr_assembly = status_report_assembly_new(imsi);

		sms_load_settings(sms, imsi);
	} else {
		sms->assembly = sms_assembly_new(NULL);
		sms->sr_assembly = status_report_assembly_new(NULL);
		sms->bearer = 3; /* Default to CS then PS */
	}

	if (sms->driver->bearer_set)
		sms->driver->bearer_set(sms, sms->bearer,
						bearer_init_callback, sms);

	sms_restore_tx_queue(sms);

	sms->text_handlers = __ofono_watchlist_new(g_free);
	sms->datagram_handlers = __ofono_watchlist_new(g_free);

	__ofono_atom_register(sms->atom, sms_unregister);
}
Example #2
0
void ofono_devinfo_register(struct ofono_devinfo *info)
{
	struct ofono_modem *modem = __ofono_atom_get_modem(info->atom);

	__ofono_atom_register(info->atom, devinfo_unregister);

	info->dun_watch = __ofono_modem_add_atom_watch(modem,
						OFONO_ATOM_TYPE_EMULATOR_DUN,
						dun_watch, info, NULL);

	query_manufacturer(info);
}
Example #3
0
void ofono_call_meter_register(struct ofono_call_meter *cm)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	const char *path = __ofono_atom_get_path(cm->atom);
	struct ofono_modem *modem = __ofono_atom_get_modem(cm->atom);

	if (!g_dbus_register_interface(conn, path, OFONO_CALL_METER_INTERFACE,
					cm_methods, cm_signals, NULL, cm,
					NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_CALL_METER_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_CALL_METER_INTERFACE);

	__ofono_atom_register(cm->atom, call_meter_unregister);
}
Example #4
0
void ofono_audio_settings_register(struct ofono_audio_settings *as)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(as->atom);
	const char *path = __ofono_atom_get_path(as->atom);

	if (!g_dbus_register_interface(conn, path,
					OFONO_AUDIO_SETTINGS_INTERFACE,
					audio_methods, audio_signals,
					NULL, as, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_AUDIO_SETTINGS_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_AUDIO_SETTINGS_INTERFACE);
	__ofono_atom_register(as->atom, audio_settings_unregister);
}
Example #5
0
void ofono_handsfree_register(struct ofono_handsfree *hf)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(hf->atom);
	const char *path = __ofono_atom_get_path(hf->atom);

	if (!g_dbus_register_interface(conn, path,
					OFONO_HANDSFREE_INTERFACE,
					handsfree_methods, handsfree_signals,
					NULL, hf, NULL)) {
		ofono_error("Could not create %s interface",
					OFONO_HANDSFREE_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_HANDSFREE_INTERFACE);

	__ofono_atom_register(hf->atom, handsfree_unregister);
}
Example #6
0
void ofono_gnss_register(struct ofono_gnss *gnss)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(gnss->atom);
	const char *path = __ofono_atom_get_path(gnss->atom);

	if (!g_dbus_register_interface(conn, path,
					OFONO_GNSS_INTERFACE,
					gnss_methods, NULL, NULL,
					gnss, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_GNSS_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_GNSS_INTERFACE);

	__ofono_atom_register(gnss->atom, gnss_unregister);
}
Example #7
0
void ofono_location_reporting_register(struct ofono_location_reporting *lr)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(lr->atom);
	const char *path = __ofono_atom_get_path(lr->atom);

	if (!g_dbus_register_interface(conn, path,
					OFONO_LOCATION_REPORTING_INTERFACE,
					location_reporting_methods,
					location_reporting_signals,
					NULL, lr, NULL)) {
		ofono_error("Could not create %s interface",
					OFONO_LOCATION_REPORTING_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_LOCATION_REPORTING_INTERFACE);
	__ofono_atom_register(lr->atom, location_reporting_unregister);
}
Example #8
0
void ofono_oem_raw_dbus_register(struct ofono_oem_raw *oemraw)
{
	DBusConnection *conn;
	DBG("");
	conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(oemraw->atom);
	const char *path = __ofono_atom_get_path(oemraw->atom);

	if (!g_dbus_register_interface(conn, path,
						OFONO_OEM_RAW_INTERFACE,
						oem_raw_methods,
						oem_raw_signals,
						NULL, oemraw, NULL)) {
		ofono_error("Could not create interface %s",
				OFONO_OEM_RAW_INTERFACE);
		return;
	}

	ofono_modem_add_interface(modem, OFONO_OEM_RAW_INTERFACE);
	__ofono_atom_register(oemraw->atom, oem_raw_dbus_unregister);
}
Example #9
0
void ofono_ussd_register(struct ofono_ussd *ussd)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(ussd->atom);
	const char *path = __ofono_atom_get_path(ussd->atom);

	if (!g_dbus_register_interface(conn, path,
					OFONO_SUPPLEMENTARY_SERVICES_INTERFACE,
					ussd_methods, ussd_signals, NULL,
					ussd, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_SUPPLEMENTARY_SERVICES_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem,
				OFONO_SUPPLEMENTARY_SERVICES_INTERFACE);

	__ofono_atom_register(ussd->atom, ussd_unregister);
}
Example #10
0
void ofono_cdma_netreg_register(struct ofono_cdma_netreg *cdma_netreg)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(cdma_netreg->atom);
	const char *path = __ofono_atom_get_path(cdma_netreg->atom);

	if (!g_dbus_register_interface(conn, path,
				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE,
				cdma_netreg_manager_methods,
				cdma_netreg_manager_signals,
				NULL, cdma_netreg, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);
		return;
	}

	ofono_modem_add_interface(modem,
				OFONO_CDMA_NETWORK_REGISTRATION_INTERFACE);

	__ofono_atom_register(cdma_netreg->atom, cdma_netreg_unregister);
}
Example #11
0
File: stk.c Project: yongsu/oFono
void ofono_stk_register(struct ofono_stk *stk)
{
	DBusConnection *conn = ofono_dbus_get_connection();
	struct ofono_modem *modem = __ofono_atom_get_modem(stk->atom);
	const char *path = __ofono_atom_get_path(stk->atom);

	if (!g_dbus_register_interface(conn, path, OFONO_STK_INTERFACE,
					stk_methods, stk_signals, NULL,
					stk, NULL)) {
		ofono_error("Could not create %s interface",
				OFONO_STK_INTERFACE);

		return;
	}

	ofono_modem_add_interface(modem, OFONO_STK_INTERFACE);

	__ofono_atom_register(stk->atom, stk_unregister);

	stk->timeout = 600; /* 10 minutes */
	stk->short_timeout = 20; /* 20 seconds */
	stk->envelope_q = g_queue_new();
}