9#include <QDBusConnection>
10#include <QDBusMessage>
12ModemCdma::ModemCdma(
QObject *parent)
14 , m_enabledNotifications(false)
15 , m_activationState(0)
16 , m_cdma1xRegistrationState(0)
17 , m_evdoRegistrationState(0)
23ModemCdma::~ModemCdma()
27uint ModemCdma::activationState()
const
29 return m_activationState;
32uint ModemCdma::cdma1xRegistrationState()
const
34 return m_cdma1xRegistrationState;
42uint ModemCdma::evdoRegistrationState()
const
44 return m_evdoRegistrationState;
52uint ModemCdma::nid()
const
57uint ModemCdma::sid()
const
62void ModemCdma::Activate(
const QString &carrier_code)
64 Q_UNUSED(carrier_code);
67void ModemCdma::ActivateManual(
const QVariantMap &properties)
72void ModemCdma::setModemPath(
const QString &path)
77void ModemCdma::setEnableNotifications(
bool enable)
79 m_enabledNotifications = enable;
82void ModemCdma::setActivationState(uint state)
84 m_activationState = state;
86 if (m_enabledNotifications) {
87 Q_EMIT ActivationStateChanged(state, MM_CDMA_ACTIVATION_ERROR_NONE, QVariantMap());
91void ModemCdma::setCdma1xRegistrationState(uint state)
93 m_cdma1xRegistrationState = state;
95 if (m_enabledNotifications) {
97 map.insert(QLatin1String(
"Cdma1xRegistrationState"), m_cdma1xRegistrationState);
98 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
99 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
104void ModemCdma::setEsn(
const QString &esn)
108 if (m_enabledNotifications) {
110 map.insert(QLatin1String(
"Esn"), m_esn);
111 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
112 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
117void ModemCdma::setEvdoRegistrationState(uint state)
119 m_evdoRegistrationState = state;
121 if (m_enabledNotifications) {
123 map.insert(QLatin1String(
"EvdoRegistrationState"), m_evdoRegistrationState);
124 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
125 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
130void ModemCdma::setMeid(
const QString &meid)
134 if (m_enabledNotifications) {
136 map.insert(QLatin1String(
"Meid"), m_meid);
137 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
138 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
143void ModemCdma::setNid(uint nid)
147 if (m_enabledNotifications) {
149 map.insert(QLatin1String(
"Nid"), m_nid);
150 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
151 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
156void ModemCdma::setSid(uint sid)
160 if (m_enabledNotifications) {
162 map.insert(QLatin1String(
"Sid"), m_sid);
163 QDBusMessage message =
QDBusMessage::createSignal(m_modemPath, QLatin1String(
"org.freedesktop.DBus.Properties"), QLatin1String(
"PropertiesChanged"));
164 message << QLatin1String(
"org.kde.fakemodem.Modem.ModemCdma") <<
map << QStringList();
169QVariantMap ModemCdma::toMap()
const
172 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_ACTIVATIONSTATE), m_activationState);
173 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_MEID), m_meid);
174 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_ESN), m_esn);
175 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_SID), m_sid);
176 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_NID), m_nid);
177 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_CDMA1XREGISTRATIONSTATE), m_cdma1xRegistrationState);
178 map.insert(QLatin1String(MM_MODEM_MODEMCDMA_PROPERTY_EVDOREGISTRATIONSTATE), m_evdoRegistrationState);
182#include "moc_modemcdma.cpp"
QString path(const QString &relativePath)
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)