static DBusMessage *generate_get_properties_reply(struct ofono_sms *sms, DBusMessage *msg) { DBusMessage *reply; DBusMessageIter iter; DBusMessageIter dict; const char *sca; const char *bearer; reply = dbus_message_new_method_return(msg); if (!reply) return NULL; dbus_message_iter_init_append(reply, &iter); dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, OFONO_PROPERTIES_ARRAY_SIGNATURE, &dict); sca = phone_number_to_string(&sms->sca); ofono_dbus_dict_append(&dict, "ServiceCenterAddress", DBUS_TYPE_STRING, &sca); ofono_dbus_dict_append(&dict, "UseDeliveryReports", DBUS_TYPE_BOOLEAN, &sms->use_delivery_reports); bearer = sms_bearer_to_string(sms->bearer); ofono_dbus_dict_append(&dict, "Bearer", DBUS_TYPE_STRING, &bearer); dbus_message_iter_close_container(&iter, &dict); return reply; }
static void sms_load_settings(struct ofono_sms *sms, const char *imsi) { GError *error; sms->settings = storage_open(imsi, SETTINGS_STORE); if (sms->settings == NULL) return; sms->imsi = g_strdup(imsi); error = NULL; sms->ref = g_key_file_get_integer(sms->settings, SETTINGS_GROUP, "NextReference", &error); if (error || sms->ref > 65536) { g_error_free(error); sms->ref = 1; g_key_file_set_integer(sms->settings, SETTINGS_GROUP, "NextReference", sms->ref); } error = NULL; sms->use_delivery_reports = g_key_file_get_boolean(sms->settings, SETTINGS_GROUP, "UseDeliveryReports", &error); if (error) { g_error_free(error); g_key_file_set_boolean(sms->settings, SETTINGS_GROUP, "UseDeliveryReports", sms->use_delivery_reports); } error = NULL; sms->bearer = g_key_file_get_integer(sms->settings, SETTINGS_GROUP, "Bearer", &error); if (error || sms_bearer_to_string(sms->bearer) == NULL) { g_error_free(error); sms->bearer = 3; /* Default to CS then PS */ g_key_file_set_integer(sms->settings, SETTINGS_GROUP, "Bearer", sms->bearer); } error = NULL; sms->alphabet = g_key_file_get_integer(sms->settings, SETTINGS_GROUP, "Alphabet", &error); if (error || sms_alphabet_to_string(sms->alphabet) == NULL) { g_error_free(error); sms->alphabet = SMS_ALPHABET_DEFAULT; g_key_file_set_integer(sms->settings, SETTINGS_GROUP, "Alphabet", sms->alphabet); } }
static void set_bearer(struct ofono_sms *sms, int bearer) { DBusConnection *conn = ofono_dbus_get_connection(); const char *path = __ofono_atom_get_path(sms->atom); const char *value; if (sms->bearer == bearer) return; sms->bearer = bearer; value = sms_bearer_to_string(sms->bearer); ofono_dbus_signal_property_changed(conn, path, OFONO_MESSAGE_MANAGER_INTERFACE, "Bearer", DBUS_TYPE_STRING, &value); }