/* * 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); }
static void sms_watch(struct ofono_atom *atom, enum ofono_atom_watch_condition cond, void *data) { struct push_notification *pn = data; DBusConnection *conn = ofono_dbus_get_connection(); if (cond == OFONO_ATOM_WATCH_CONDITION_UNREGISTERED) { g_dbus_unregister_interface(conn, ofono_modem_get_path(pn->modem), PUSH_NOTIFICATION_INTERFACE); return; } DBG("registered"); pn->sms = __ofono_atom_get_data(atom); if (!g_dbus_register_interface(conn, ofono_modem_get_path(pn->modem), PUSH_NOTIFICATION_INTERFACE, push_notification_methods, NULL, NULL, pn, push_notification_cleanup)) { ofono_error("Could not create %s interface", PUSH_NOTIFICATION_INTERFACE); return; } ofono_modem_add_interface(pn->modem, PUSH_NOTIFICATION_INTERFACE); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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(); }
static void get_rf_power_status_cb(struct ril_msg *message, gpointer user_data) { struct ofono_modem *modem = user_data; struct ril_data *rd = ofono_modem_get_data(modem); struct ril_thermal_management *tm; DBusConnection *conn = ofono_dbus_get_connection(); struct parcel rilp; gint numstr; gchar *power_status; char *endptr; int enabled; const char *path = ofono_modem_get_path(modem); DBG(""); if (message->error != RIL_E_SUCCESS) { ofono_error("%s RILD reply failure: %s", g_ril_request_id_to_string(rd->ril, message->req), ril_error_to_string(message->error)); return; } g_ril_init_parcel(message, &rilp); numstr = parcel_r_int32(&rilp); if (numstr < 1) { ofono_error("RILD reply empty !"); return; } power_status = parcel_r_string(&rilp); if (power_status == NULL || power_status == '\0') return; enabled = strtol(power_status, &endptr, 10); /* * power_status == endptr => conversion error * *endptr != '\0' => partial conversion */ if (power_status == endptr || *endptr != '\0') return; tm = g_try_new0(struct ril_thermal_management, 1); if (tm == NULL) return; tm->modem = modem; tm->throttling = (enabled > 0) ? true : false; if (!g_dbus_register_interface(conn, path, THERMAL_MANAGEMENT_INTERFACE, thermal_management_methods, thermal_management_signals, NULL, tm, thermal_management_cleanup)) { ofono_error("Could not register %s interface under %s", THERMAL_MANAGEMENT_INTERFACE, path); g_free(tm); return; } ofono_modem_add_interface(modem, THERMAL_MANAGEMENT_INTERFACE); }