: QObject(parent),
m_path(path),
m_rtKey(new MGConfItem("/apps/dialer/defaultRingtone")),
- m_isconnected(FALSE)//,
- //m_ringtonefile("")
+ m_isconnected(FALSE)
{
- TRACE
-
- /* QString l_ringtoneFile = QString("%1/%2/stereo/%3")
- .arg(SOUNDS_DIR)
- .arg("tizen")
- .arg(DEFAULT_RINGTONE);
- */
-
+ TRACE;
QString l_ringtoneFile = QString("/usr/share/hfdialer/sounds/%1").arg(DEFAULT_RINGTONE);
QString l_rtKeyValue = m_rtKey->value(QVariant(l_ringtoneFile)).toString();
- if (QFileInfo(l_rtKeyValue).exists()) {
- /*
- m_ringtonefile = l_ringtoneFile;
- qDebug() << QString("CallItem: %1 using ringtone: %2")
- .arg(m_path)
- .arg(m_ringtonefile);
- */
- } else {
+ if (!QFileInfo(l_rtKeyValue).exists()) {
qWarning() << QString("CallItem: %1 ringtone not found: %2")
- .arg(m_path)
- .arg(l_rtKeyValue);
+ .arg(m_path)
+ .arg(l_rtKeyValue);
}
- //m_ringtone->setMedia(QMediaContent(QUrl::fromLocalFile(m_ringtonefile)));
- //m_ringtone->setVolume(100);
-
- if (isValid())
+ if (isValid()) {
init();
+ }
}
CallItem::~CallItem()
{
- TRACE
-/*
- if (m_ringtone) {
- disconnect(m_ringtone, SIGNAL(positionChanged(qint64)));
- m_ringtone->stop();
- delete m_ringtone;
- m_ringtone = 0;
- }
-*/
- PAControl::instance()->unrouteAudio();
+ TRACE;
+ PAControl::instance()->unrouteAudio();
- if (m_rtKey)
+ if (m_rtKey) {
delete m_rtKey;
+ }
m_rtKey = 0;
-/*
- if (m_peopleItem)
- delete m_peopleItem;
- m_peopleItem = 0;
-*/
+
// delete the callproxy object
if (callProxy())
delete callProxy();
void CallItem::init()
{
- TRACE
+ TRACE;
if (!m_path.isEmpty()) {
m_call = new CallProxy(m_path);
if (m_call->isValid()) {
- // dynamic_cast<CallItemModel*>(model())->setCall(call);
+ // dynamic_cast<CallItemModel*>(model())->setCall(call);
connect(m_call,SIGNAL(stateChanged()),this,SLOT(callStateChanged()));
connect(m_call,SIGNAL(dataChanged()),this,SLOT(callDataChanged()));
connect(m_call,SIGNAL(multipartyChanged()),this,SLOT(callMultipartyChanged()));
- } else
+ } else {
qCritical("Invalid CallProxy instance!");
- } else
- qCritical("Empty call path. Can not create CallProxy!");
-
- //populatePeopleItem();
-
- if (state() == STATE_INCOMING ||
- state() == STATE_WAITING)
- {
-
- /*
- // Start ringing
- if (!m_isconnected && m_ringtone) {
- connect(m_ringtone, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- SLOT(ringtoneStatusChanged(QMediaPlayer::MediaStatus)));
- m_isconnected = TRUE;
- m_ringtone->play();
}
-*/
+ } else {
+ qCritical("Empty call path. Can not create CallProxy!");
}
}
bool CallItem::isValid()
{
- TRACE
+ TRACE;
return (!path().isEmpty());
}
bool CallItem::isValid() const
{
- TRACE
+ TRACE;
return (!path().isEmpty());
}
QString CallItem::path() const
{
- TRACE
+ TRACE;
return m_path;
}
bool CallItem::setPath(QString path)
{
- TRACE
+ TRACE;
if (!m_path.isEmpty()) {
qCritical("Path already set and can not be changed once it is set");
return false;
void CallItem::setDirection(CallDirection direction)
{
- TRACE
- // dynamic_cast<CallItemModel*>(model())->setDirection(direction);
+ TRACE;
}
QString CallItem::lineID() const
{
- TRACE
+ TRACE;
return m_call->lineID();
}
QString CallItem::name() const
{
- TRACE
+ TRACE;
return m_call->name();
}
CallState CallItem::state() const
{
- TRACE
+ TRACE;
CallState cs = STATE_NONE;
QString state = m_call->state();
- if (state == "active")
- cs = STATE_ACTIVE;
+ if (state == "active")
+ cs = STATE_ACTIVE;
- else if (state == "held")
- cs = STATE_HELD;
- else if (state == "dialing")
- cs = STATE_DIALING;
- else if (state == "alerting")
- cs = STATE_ALERTING;
- else if (state == "incoming")
- cs = STATE_INCOMING;
- else if (state == "waiting")
- cs = STATE_WAITING;
- else if (state == "disconnected")
- cs = STATE_DISCONNECTED;
+ else if (state == "held")
+ cs = STATE_HELD;
+ else if (state == "dialing")
+ cs = STATE_DIALING;
+ else if (state == "alerting")
+ cs = STATE_ALERTING;
+ else if (state == "incoming")
+ cs = STATE_INCOMING;
+ else if (state == "waiting")
+ cs = STATE_WAITING;
+ else if (state == "disconnected")
+ cs = STATE_DISCONNECTED;
return cs;
}
CallDirection CallItem::direction() const
{
- TRACE
+ TRACE;
return DIRECTION_NONE;
- //return dynamic_cast<const CallItemModel*>(model())->direction();
}
CallDisconnectReason CallItem::reason() const
{
- TRACE
+ TRACE;
return DISCONNECT_NONE;
- //return dynamic_cast<const CallItemModel*>(model())->reasonType();
}
int CallItem::duration() const
{
- TRACE
+ TRACE;
return m_call->duration();
}
QDateTime CallItem::startTime() const
{
- TRACE
+ TRACE;
return m_call->startTime();
}
-/*
-PeopleItem * CallItem::peopleItem() const
-{
- TRACE
- return m_peopleItem;
-}
-*/
+
CallProxy* CallItem::callProxy() const
{
- TRACE
- /*
- if (model())
- return dynamic_cast<const CallItemModel*>(model())->call();
- else
- return NULL;
-*/
-return m_call;
+ TRACE;
+ return m_call;
}
-/*
-void CallItem::setPeopleItem(PeopleItem *person)
-{
- TRACE
- if (m_peopleItem)
- delete m_peopleItem;
- m_peopleItem = person;
-}
-*/
+
void CallItem::click()
{
- TRACE
+ TRACE;
emit clicked();
}
void CallItem::silenceRingtone()
{
- TRACE
-/*
- if(m_ringtone)
- {
- m_ringtone->stop();
- }
-*/
+ TRACE;
}
void CallItem::callStateChanged()
{
- TRACE
- /*
- if (state() == STATE_INCOMING ||
- state() == STATE_WAITING)
- {
- // Start ringing
- if (!m_isconnected && m_ringtone) {
- connect(m_ringtone, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- SLOT(ringtoneStatusChanged(QMediaPlayer::MediaStatus)));
- m_isconnected = TRUE;
- m_ringtone->play();
- }
- } else {
- // Stop ringing
- if (m_ringtone) {
- disconnect(m_ringtone, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- m_isconnected = FALSE;
- m_ringtone->stop();
- }
- }*/
+ TRACE;
emit stateChanged();
}
void CallItem::callDataChanged()
{
- TRACE
- // populatePeopleItem();
+ TRACE;
}
void CallItem::callDisconnected(const QString &reason)
{
- TRACE
+ TRACE;
Q_UNUSED(reason);
}
-/*
-QVariant CallItem::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &val)
-{
- TRACE
- if (change == QGraphicsItem::ItemSelectedHasChanged)
- dynamic_cast<const CallItemModel*>(model())->setSelected(val.toBool());
- return QGraphicsItem::itemChange(change, val);
-}
-*/
-/*
-void CallItem::populatePeopleItem()
-{
- TRACE
-
- QModelIndexList matches;
- matches.clear();
- int role = Seaside::SearchRole;
- int hits = -1;
-
- //% "Unknown Caller"
- QString pi_name = qtTrId("xx_unknown_caller");
- QString pi_photo = "icon-m-content-avatar-placeholder";
- //% "Private"
- QString pi_lineid = qtTrId("xx_private");
-
- if (!lineID().isEmpty()) {
- pi_lineid = stripLineID(lineID());
- SeasideSyncModel *contacts = DA_SEASIDEMODEL;
- QModelIndex first = contacts->index(0,Seaside::ColumnPhoneNumbers);
- matches = contacts->match(first, role, QVariant(pi_lineid), hits);
-
- QString firstName = QString();
- QString lastName = QString();
-
- if (!matches.isEmpty()) {
- QModelIndex person = matches.at(0); //First match is all we look at
- SEASIDE_SHORTCUTS
- SEASIDE_SET_MODEL_AND_ROW(person.model(), person.row());
-
- firstName = SEASIDE_FIELD(FirstName, String);
- lastName = SEASIDE_FIELD(LastName, String);
- pi_photo = SEASIDE_FIELD(Avatar, String);
- } else if (!name().isEmpty()) {
- // We don't have a contact, but we have a callerid name, let's use it
- firstName = name();
- }
-
- if (lastName.isEmpty() && !firstName.isEmpty())
- // Contacts first (common) name
- //% "%1"
- pi_name = qtTrId("xx_first_name").arg(firstName);
- else if (firstName.isEmpty() && !lastName.isEmpty())
- // BMC# 8079 - NW
- // Contacts last (sur) name
- //% "%1"
- pi_name = qtTrId("xx_last_name").arg(lastName);
- else if (!firstName.isEmpty() && !lastName.isEmpty())
- // Contacts full, sortable name, is "Firstname Lastname"
- //% "%1 %2"
- pi_name = qtTrId("xx_first_last_name").arg(firstName)
- .arg(lastName);
- } else {
- //% "Unavailable"
- pi_lineid = qtTrId("xx_unavailable");
- }
-
- if (m_peopleItem != NULL)
- delete m_peopleItem;
- m_peopleItem = new PeopleItem();
-
- m_peopleItem->setName(pi_name);
- m_peopleItem->setPhoto(pi_photo);
- m_peopleItem->setPhone(pi_lineid);
-}
-*/
-/*
-void CallItem::ringtoneStatusChanged(QMediaPlayer::MediaStatus status)
-{
- TRACE
- if (status == QMediaPlayer::EndOfMedia)
- {
- m_ringtone->setMedia(QMediaContent(QUrl::fromLocalFile(m_ringtonefile)));
- m_ringtone->play();
- }
-}
-*/
bool CallItem::multiparty()
{
- TRACE
+ TRACE;
return false;
- // return (isValid())?dynamic_cast<const CallItemModel*>(model())->multiparty():false;
}
void CallItem::callMultipartyChanged()
{
- TRACE
+ TRACE;
emit multipartyChanged();
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
#include <QString>
#include <QDateTime>
#include <QtDBus>
-//#include <QMediaPlayer>
#include <MGConfItem>
#include "callproxy.h"
- enum CallState {
- STATE_NONE = 0,
- STATE_ACTIVE,
- STATE_HELD,
- STATE_DIALING,
- STATE_ALERTING,
- STATE_INCOMING,
- STATE_WAITING,
- STATE_DISCONNECTED,
- STATE_LAST,
- };
-
- enum CallDirection {
- DIRECTION_NONE = 0,
- DIRECTION_IN,
- DIRECTION_OUT,
- DIRECTION_MISSED,
- DIRECTION_LAST,
- };
-
- enum CallDisconnectReason {
- DISCONNECT_NONE = 0,
- DISCONNECT_LOCAL,
- DISCONNECT_REMOTE,
- DISCONNECT_NETWORK,
- DISCONNECT_LAST,
- };
+enum CallState {
+ STATE_NONE = 0,
+ STATE_ACTIVE,
+ STATE_HELD,
+ STATE_DIALING,
+ STATE_ALERTING,
+ STATE_INCOMING,
+ STATE_WAITING,
+ STATE_DISCONNECTED,
+ STATE_LAST,
+};
+
+enum CallDirection {
+ DIRECTION_NONE = 0,
+ DIRECTION_IN,
+ DIRECTION_OUT,
+ DIRECTION_MISSED,
+ DIRECTION_LAST,
+};
+
+enum CallDisconnectReason {
+ DISCONNECT_NONE = 0,
+ DISCONNECT_LOCAL,
+ DISCONNECT_REMOTE,
+ DISCONNECT_NETWORK,
+ DISCONNECT_LAST,
+};
class CallItem: public QObject
{
Q_OBJECT
Q_PROPERTY(QString path READ path WRITE setPath)
- Q_PROPERTY(QString lineID READ lineID)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(CallState state READ state)
- Q_PROPERTY(CallDirection direction READ direction WRITE setDirection)
- Q_PROPERTY(CallDisconnectReason reason READ reason)
- Q_PROPERTY(int duration READ duration)
- Q_PROPERTY(QDateTime startTime READ startTime)
- Q_PROPERTY(bool multiparty READ multiparty)
-
- //Q_PROPERTY(PeopleItem* peopleItem READ peopleItem WRITE setPeopleItem)
- Q_PROPERTY(CallProxy* callProxy READ callProxy)
-
-public:
- CallItem(const QString path = QString(), QObject *parent = 0);
+ Q_PROPERTY(QString lineID READ lineID)
+ Q_PROPERTY(QString name READ name)
+ Q_PROPERTY(CallState state READ state)
+ Q_PROPERTY(CallDirection direction READ direction WRITE setDirection)
+ Q_PROPERTY(CallDisconnectReason reason READ reason)
+ Q_PROPERTY(int duration READ duration)
+ Q_PROPERTY(QDateTime startTime READ startTime)
+ Q_PROPERTY(bool multiparty READ multiparty)
+ Q_PROPERTY(CallProxy* callProxy READ callProxy)
+
+ public:
+ CallItem(const QString path = QString(), QObject *parent = 0);
virtual ~CallItem();
QString path() const;
CallDisconnectReason reason() const;
int duration() const;
QDateTime startTime() const;
- //PeopleItem *peopleItem() const;
CallProxy *callProxy() const;
bool isValid();
bool isValid() const;
public Q_SLOTS:
void init();
- //void setPeopleItem(PeopleItem *person);
bool setPath(QString path); // Setting this will create the CallProxy
void setDirection(CallDirection direction);
void click();
void callStateChanged();
void callDataChanged();
void callDisconnected(const QString &reason);
-// void ringtoneStatusChanged(QMediaPlayer::MediaStatus status);
void callMultipartyChanged();
private:
- //QVariant itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &val);
- // void populatePeopleItem();
-
QString m_path;
- //PeopleItem *m_peopleItem;
- //QMediaPlayer *m_ringtone;
MGConfItem *m_rtKey;
bool m_isconnected;
QString m_ringtonefile;
};
#endif // CALLITEM_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
#include "common.h"
#include "callmanager.h"
-//#include "resourceproxy.h"
class CallManagerPrivate
{
: OfonoVoiceCallManager(OfonoModem::AutomaticSelect, modemPath, parent),
d(new CallManagerPrivate)
{
- TRACE
-
-// d->resource = ResourceProxy::instance();
-
- // Resource proxy binding
-// if (d->resource) {
-// connect(d->resource, SIGNAL(incomingResourceAcquired(CallItem *)),
-// SLOT(proceedIncomingCall(CallItem *)));
-// connect(d->resource, SIGNAL(incomingResourceDenied(CallItem *)),
-// SLOT(deniedIncomingCall(CallItem *)));
-// connect(d->resource, SIGNAL(incomingResourceLost(CallItem *)),
-// SLOT(lostIncomingCall(CallItem *)));
-
-// connect(d->resource, SIGNAL(dialResourceAcquired(const QString)),
-// SLOT(proceedCallDial(const QString)));
-// connect(d->resource, SIGNAL(dialResourceDenied()),
-// SLOT(deniedCallDial()));
-// connect(d->resource, SIGNAL(callResourceLost()),
-// SLOT(lostCallDial()));
- // }
+ TRACE;
// Transform existing calls list, into list of CallItems
updateCallItems();
CallManager::~CallManager()
{
- TRACE
+ TRACE;
// FIXME: Do something here!!!
qDebug() << QString("Destroying VoiceCallManager");
qDebug() << QString("Purging all CallItems");
delete item;
}
if (d->callItems.size() > 0)
- emit callsChanged();
+ emit callsChanged();
d->callItems.clear();
}
QList<CallItem *> CallManager::getCallItems() const
{
- TRACE
+ TRACE;
return d->callItems.values();
}
int CallManager::callCount() const
{
- TRACE
+ TRACE;
qDebug()<<"call count is currently = "<<d->callItems.size();
return d->callItems.size();
}
int CallManager::multipartyCallCount() const
{
- TRACE
+ TRACE;
int call_count = 0;
foreach (CallItem *c, d->callItems) {
if(c->multiparty()) {
CallItem *CallManager::activeCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_ACTIVE)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_ACTIVE)
+ return c;
return NULL;
}
CallItem *CallManager::heldCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_HELD)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_HELD)
+ return c;
return NULL;
}
CallItem *CallManager::dialingCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_DIALING)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_DIALING)
+ return c;
return NULL;
}
CallItem *CallManager::incomingCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_INCOMING)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_INCOMING)
+ return c;
return NULL;
}
CallItem *CallManager::waitingCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_WAITING)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_WAITING)
+ return c;
return NULL;
}
CallItem *CallManager::alertingCall() const
{
- TRACE
+ TRACE;
if (d->callItems.size())
- foreach (CallItem *c, d->callItems)
- if (c->state() == STATE_ALERTING)
- return c;
+ foreach (CallItem *c, d->callItems)
+ if (c->state() == STATE_ALERTING)
+ return c;
return NULL;
}
void CallManager::setActiveCall(const CallItem &call)
{
- TRACE
- //if (!call.isActive())
- swapCalls();
-}
-/*
-void CallManager::dial(const PeopleItem *person)
-{
- TRACE
- dial(person->phone());
+ TRACE;
+ swapCalls();
}
-*/
+
void CallManager::dial(const QString &number)
{
- TRACE
+ TRACE;
// Nothing to do if the modem is not powered up
if(!modem()->powered()) {
- emit callsChanged();
+ emit callsChanged();
return;
}
}
}
-// if (d->resource)
-// d->resource->acquireDialResource(number);
- proceedCallDial(number);
+ proceedCallDial(number);
}
void CallManager::privateChat(const CallItem &call)
{
- //TRACE
- //OfonoVoiceCallManager::privateChat(call.path());
+ TRACE;
}
/*
*/
void CallManager::deniedCallDial()
{
- TRACE
+ TRACE;
qCritical() << QString("Denied: Dial resource");
}
void CallManager::lostCallDial()
{
- TRACE
+ TRACE;
qCritical() << QString("Lost: Dial resource");
hangupAll();
}
void CallManager::proceedCallDial(const QString number)
{
- TRACE
+ TRACE;
OfonoVoiceCallManager::dial(stripLineID(number), QString());
}
void CallManager::deniedCallAnswer()
{
- TRACE
+ TRACE;
qCritical() << QString("Denied: Call resource");
hangupAll();
}
void CallManager::deniedIncomingCall(CallItem *call)
{
- TRACE
+ TRACE;
qCritical() << QString("Denied: Incoming Call resource");
qDebug() << QString("Insert new CallItem %1").arg(call->path());
void CallManager::lostIncomingCall(CallItem *call)
{
- TRACE
+ TRACE;
Q_UNUSED(call)
- qCritical() << QString("Lost: Incoming Call resource");
+ qCritical() << QString("Lost: Incoming Call resource");
}
void CallManager::proceedIncomingCall(CallItem *call)
{
- TRACE
+ TRACE;
qDebug() << QString("Acquired: Incoming Call resource");
qDebug() << QString("Insert new CallItem %1").arg(call->path());
emit callsChanged();
void CallManager::updateCallItems()
{
- TRACE
+ TRACE;
bool changed = false;
// If ofono call list is empty (no calls), empty our CallItem list too.
delete item;
d->callItems.clear();
emit callsChanged();
-
-// if (d->resource)
-// d->resource->releaseResources();
-
return;
}
// Insert new CallItems for paths in the ofono "calls" list we are missing
foreach (QString path, getCalls()) {
// Insert a new CallItem
- if (!d->callItems.contains(path)) {
+ if (!d->callItems.contains(path)) {
qDebug() << QString("Inserting new CallItem %1").arg(path);
CallItem *call = new CallItem(path);
connect (call, SIGNAL(stateChanged()),
// timeout
if ((call->state() == STATE_INCOMING) ||
(call->state() == STATE_WAITING)) {
-// if (d->resource)
-// d->resource->acquireIncomingResource(call);
- proceedIncomingCall(call);
+ proceedIncomingCall(call);
} else {
changed = true;
}
void CallManager::addCall(const QString &path)
{
- TRACE
+ TRACE;
qDebug() << QString("CallAdded: \"%1\"").arg(path);
- qDebug() <<"Call number is now "<< callCount();
+ qDebug() <<"Call number is now "<< callCount();
updateCallItems();
emit callCountChanged(callCount());
}
void CallManager::removeCall(const QString &path)
{
- TRACE
+ TRACE;
qDebug() << QString("CallRemoved: \"%1\"").arg(path);
qDebug() <<"Call number is now "<< callCount();
updateCallItems();
void CallManager::dialFinished(const bool status)
{
- TRACE
+ TRACE;
qDebug() <<"Call number is now "<< callCount();
if (!status) {
qCritical() << QString("dial() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
// Fix BMC#10848:
// Notify that state of the call has changed when the dialing fails
emit callsChanged();
void CallManager::hangupAllFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("hangupAll() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
-
- //If there are still calls for some reason, delete them.
- if (callCount() > 0)
- {
- foreach (CallItem *item, d->callItems) {
- disconnect(item, SIGNAL(stateChanged()));
- disconnect(item, SIGNAL(dataChanged()));
- delete item;
- }
+ .arg(errorName())
+ .arg(errorMessage());
+
+ //If there are still calls for some reason, delete them.
+ if (callCount() > 0)
+ {
+ foreach (CallItem *item, d->callItems) {
+ disconnect(item, SIGNAL(stateChanged()));
+ disconnect(item, SIGNAL(dataChanged()));
+ delete item;
+ }
- d->callItems.clear();
+ d->callItems.clear();
+ callCount();
+ emit callsChanged();
+ }
callCount();
- emit callsChanged();
- }
-callCount();
}
void CallManager::swapFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("swapCalls() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::holdAndAnswerFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("HoldAndAnswer() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::transferFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("Transfer() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::releaseAndAnswerFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("ReleaseAndAnswer() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::privateChatFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("PrivateChat() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::createMultipartyFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("CreateMultiparty() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::hangupMultipartyFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("HangupMultiparty() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::sendTonesFinished(const bool status)
{
- TRACE
+ TRACE;
if (!status)
qCritical() << QString("SendTones() Failed: %1 - %2")
- .arg(errorName())
- .arg(errorMessage());
+ .arg(errorName())
+ .arg(errorMessage());
}
void CallManager::callStateChanged()
{
CallItem *call = dynamic_cast<CallItem *>(sender());
qDebug() << QString("%1 (%2) state has changed to %3")
- .arg(call->path())
- .arg(call->lineID())
- .arg(call->state());
+ .arg(call->path())
+ .arg(call->lineID())
+ .arg(call->state());
qDebug() << "number of calls "<< callCount();
emit callsChanged();
}
void CallManager::callMultipartyChanged()
{
- TRACE
+ TRACE;
emit callsChanged();
emit multipartyCallCountChanged(multipartyCallCount());
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class CallManager: public OfonoVoiceCallManager
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(int multipartyCallCount READ multipartyCallCount NOTIFY multipartyCallCountChanged)
- Q_PROPERTY(int callCount READ callCount NOTIFY callCountChanged)
+ Q_PROPERTY(int multipartyCallCount READ multipartyCallCount NOTIFY multipartyCallCountChanged);
+ Q_PROPERTY(int callCount READ callCount NOTIFY callCountChanged);
public:
explicit CallManager(const QString &modemPath="", QObject *parent=0);
void setActiveCall(const CallItem &call);
// Overloaded version of OfonoVoiceCallManager::dial() that
- // takes a PeopleItem rather than number string and uses default
- // as CLIR value
- // void dial(const PeopleItem *person);
-
- // Overloaded version of OfonoVoiceCallManager::dial() that
// assumes CLIR == default
void dial(const QString &number);
private:
class CallManagerPrivate *d;
- Q_DISABLE_COPY(CallManager)
+ Q_DISABLE_COPY(CallManager);
};
#endif // CALLMANAGER_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
// will be !isValid()
static QDateTime qDateTimeFromOfono(const QString &val)
{
- TRACE
+ TRACE;
QDateTime result;
if (val.isEmpty())
result = QDateTime::fromString(val,Qt::ISODate);
#ifdef VERBOSE
qDebug() << QString("Converted %1 with Qt::ISODate: %2")
- .arg(val)
- .arg(result.toString());
+ .arg(val)
+ .arg(result.toString());
#endif
if (!result.isValid()) {
- // ISODate conversion has failed, fallback to manual method
- // NOTE: QDateTime::fromString(val, Qt::ISODate) Fails since the date
- // format from Ofono is in RFC 822 form, but QDateTime can't parse it
+ // ISODate conversion has failed, fallback to manual method
+ // NOTE: QDateTime::fromString(val, Qt::ISODate) Fails since the date
+ // format from Ofono is in RFC 822 form, but QDateTime can't parse it
struct tm time_tm;
QByteArray bytes = val.toAscii();
const char *str = bytes.constData();
result.setTime_t(t);
#ifdef VERBOSE
qDebug() << QString("Converted %1 with strptime: %2")
- .arg(val)
- .arg(result.toString());
+ .arg(val)
+ .arg(result.toString());
#endif
}
}
if (!result.isValid())
qCritical() << QString("Format error, unknown date/time: %1")
- .arg(str);
+ .arg(str);
}
return result;
m_connected(false),
m_multiparty(false)
{
- TRACE
-
- if (!org::ofono::VoiceCall::isValid())
- {
- qCritical() << QString("Failed to connect to %1 for call %2:\n\t%3")
- .arg(staticInterfaceName())
- .arg(callPath)
- .arg(lastError().message());
- }
- else {
+ TRACE;
+
+ if (!org::ofono::VoiceCall::isValid()) {
+ qCritical() << QString("Failed to connect to %1 for call %2:\n\t%3")
+ .arg(staticInterfaceName())
+ .arg(callPath)
+ .arg(lastError().message());
+ } else {
QDBusPendingReply<QVariantMap> reply;
QDBusPendingCallWatcher *watcher;
reply = GetProperties();
watcher = new QDBusPendingCallWatcher(reply);
-/*
- connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(getPropertiesFinished(QDBusPendingCallWatcher*)));
-*/
-
// Force this to be sync to ensure we have initial properties
watcher->waitForFinished();
getPropertiesFinished(watcher);
SIGNAL(PropertyChanged(const QString&,const QDBusVariant&)),
SLOT(propertyChanged(const QString&,const QDBusVariant&)));
connect(this, SIGNAL(DisconnectReason(const QString&)),
- SLOT(disconnectReason(const QString&)));
- } else
+ SLOT(disconnectReason(const QString&)));
+ } else {
qCritical() << QString("Invalid CallProxy instance: state == %1")
- .arg(m_state);
+ .arg(m_state);
+ }
}
}
CallProxy::~CallProxy()
{
- TRACE
+ TRACE;
// FIXME: Do something here!!!
}
bool CallProxy::isValid()
{
- TRACE
+ TRACE;
return (org::ofono::VoiceCall::isValid() &&
m_connected &&
(m_state != "disconnected"));
QString CallProxy::lineID() const
{
- TRACE
+ TRACE;
return m_lineid;
}
QString CallProxy::name() const
{
- TRACE
+ TRACE;
return m_name;
}
QString CallProxy::state() const
{
- TRACE
+ TRACE;
return m_state;
}
QDateTime CallProxy::startTime() const
{
- TRACE
+ TRACE;
return m_startTime;
}
int CallProxy::duration() const
{
- TRACE
+ TRACE;
if (m_startTime.isValid())
return m_startTime.secsTo(QDateTime::currentDateTime());
else
QString CallProxy::reason() const
{
- TRACE
+ TRACE;
return m_reason;
}
bool CallProxy::multiparty() const
{
- TRACE
+ TRACE;
return m_multiparty;
}
void CallProxy::answer()
{
- TRACE
-
-// ResourceProxy *resource = ResourceProxy::instance();
-
-// connect(resource, SIGNAL(answerResourceAcquired()), SLOT(proceedCallAnswer()));
-// connect(resource, SIGNAL(answerResourceDenied()), SLOT(deniedCallAnswer()));
-
-// resource->acquireAnswerResource();
-
-proceedCallAnswer();
+ TRACE;
+ proceedCallAnswer();
}
void CallProxy::proceedCallAnswer()
{
- TRACE
+ TRACE;
-// ResourceProxy *resource = ResourceProxy::instance();
QDBusPendingReply<QDBusObjectPath> reply;
QDBusPendingCallWatcher *watcher;
- // disconnect(resource, SIGNAL(answerResourceAcquired()));
- // disconnect(resource, SIGNAL(answerResourceDenied()));
-
reply = Answer();
watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(answerFinished(QDBusPendingCallWatcher*)));
+ SLOT(answerFinished(QDBusPendingCallWatcher*)));
}
void CallProxy::deniedCallAnswer()
{
- TRACE
-
-// ResourceProxy *resource = ResourceProxy::instance();
-
-// disconnect(resource, SIGNAL(answerResourceAcquired()));
-// disconnect(resource, SIGNAL(answerResourceDenied()));
+ TRACE;
// Hang up the incoming call, if resources to accept it are inavailabe
hangup();
void CallProxy::deflect(const QString toNumber)
{
- TRACE
+ TRACE;
QDBusPendingReply<QDBusObjectPath> reply;
QDBusPendingCallWatcher *watcher;
watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(deflectFinished(QDBusPendingCallWatcher*)));
+ SLOT(deflectFinished(QDBusPendingCallWatcher*)));
}
void CallProxy::hangup()
{
- TRACE
+ TRACE;
QDBusPendingReply<> reply;
QDBusPendingCallWatcher *watcher;
watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
- SLOT(hangupFinished(QDBusPendingCallWatcher*)));
+ SLOT(hangupFinished(QDBusPendingCallWatcher*)));
}
void CallProxy::getPropertiesFinished(QDBusPendingCallWatcher *watcher)
{
- TRACE
+ TRACE;
QDBusPendingReply<QVariantMap> reply = *watcher;
if (reply.isError()) {
qCritical() << QString("Failed to connect to %1 for call %2:\n\t%3")
- .arg(staticInterfaceName())
- .arg(path())
- .arg(lastError().message());
+ .arg(staticInterfaceName())
+ .arg(path())
+ .arg(lastError().message());
return;
}
void CallProxy::answerFinished(QDBusPendingCallWatcher *watcher)
{
- TRACE
+ TRACE;
QDBusPendingReply<QDBusObjectPath> reply = *watcher;
if (reply.isError())
qCritical() << QString("Answer() Failed: %1 - %2")
- .arg(reply.error().name())
- .arg(reply.error().message());
+ .arg(reply.error().name())
+ .arg(reply.error().message());
}
void CallProxy::deflectFinished(QDBusPendingCallWatcher *watcher)
{
- TRACE
+ TRACE;
QDBusPendingReply<QDBusObjectPath> reply = *watcher;
if (reply.isError())
qCritical() << QString("Deflect() Failed: %1 - %2")
- .arg(reply.error().name())
- .arg(reply.error().message());
+ .arg(reply.error().name())
+ .arg(reply.error().message());
}
void CallProxy::hangupFinished(QDBusPendingCallWatcher *watcher)
{
- TRACE
+ TRACE;
QDBusPendingReply<> reply = *watcher;
if (reply.isError())
qCritical() << QString("Hangup() Failed: %1 - %2")
- .arg(reply.error().name())
- .arg(reply.error().message());
+ .arg(reply.error().name())
+ .arg(reply.error().message());
}
void CallProxy::propertyChanged(const QString &in0, const QDBusVariant &in1)
{
- TRACE
+ TRACE;
if (in0 == "LineIdentification") {
m_lineid = qdbus_cast<QString>(in1.variant());
void CallProxy::disconnectReason(const QString &in0)
{
- TRACE
+ TRACE;
m_reason = in0;
emit callDisconnected(in0);
}
void CallProxy::setStartTimeFromString(const QString &val)
{
- TRACE
+ TRACE;
if (val.isEmpty())
return;
m_startTime = QDateTime::QDateTime::currentDateTime();
}
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class CallProxy: public org::ofono::VoiceCall
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(QString lineID READ lineID)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(QString state READ state)
- Q_PROPERTY(QDateTime startTime READ startTime)
- Q_PROPERTY(int duration READ duration)
- Q_PROPERTY(QString reason READ reason)
- Q_PROPERTY(bool multiparty READ multiparty)
+ Q_PROPERTY(QString lineID READ lineID);
+ Q_PROPERTY(QString name READ name);
+ Q_PROPERTY(QString state READ state);
+ Q_PROPERTY(QDateTime startTime READ startTime);
+ Q_PROPERTY(int duration READ duration);
+ Q_PROPERTY(QString reason READ reason);
+ Q_PROPERTY(bool multiparty READ multiparty);
public:
CallProxy(const QString &callPath);
bool m_connected;
bool m_multiparty;
- Q_DISABLE_COPY(CallProxy)
+ Q_DISABLE_COPY(CallProxy);
};
#endif // CALLPROXY_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
QString stripLineID(QString lineid);
#endif // COMMON_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
DBusDialerAdapter::DBusDialerAdapter(DialerApplication *application)
: QDBusAbstractAdaptor(application)
{
- TRACE
+ TRACE;
}
DBusDialerAdapter::~DBusDialerAdapter()
{
- TRACE
+ TRACE;
}
void DBusDialerAdapter::call(const QString &msisdn)
{
- TRACE
+ TRACE;
if(!ManagerProxy::instance()->callManager()) return;
ManagerProxy::instance()->callManager()->dial(msisdn);
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class DBusDialerAdapter : public QDBusAbstractAdaptor
{
- Q_OBJECT
- Q_CLASSINFO("D-Bus Interface", "com.tizen.hfdialer")
+ Q_OBJECT;
+ Q_CLASSINFO("D-Bus Interface", "com.tizen.hfdialer");
public:
explicit DBusDialerAdapter(DialerApplication *application);
- ~DBusDialerAdapter();
+ ~DBusDialerAdapter();
Q_SIGNALS:
};
#endif // DBUSDIALERADAPTER_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
argument.endStructure();
return argument;
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
}
#endif //DIALERDBUSTYPES_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
DialerApplication::DialerApplication(int &argc, char **argv)
: QApplication(argc, argv)
{
- TRACE
+ TRACE;
init();
}
void DialerApplication::releasePrestart()
{
- TRACE
+ TRACE;
// Now is the time for set up and display of information
// that needs to be done to allow the dialeror other
// pages to display correctly when opened. GenericPage has a
void DialerApplication::restorePrestart()
{
- TRACE
+ TRACE;
// Now is the time for clean up and resetting an information
// that needs to be done to allow the dialer pages to display
// correctly when reopened. GenericPage has a
void DialerApplication::connectAll()
{
- TRACE
+ TRACE;
ManagerProxy *m_manager = ManagerProxy::instance();
if (m_manager->modem() &&
m_manager->modem()->isValid() &&
!m_manager->modem()->path().isEmpty())
- {
- qDebug() << QString("Connecting to CallManager....");
- m_manager->setNetwork(m_manager->modem()->path());
- m_manager->setCallManager(m_manager->modem()->path());
- m_manager->setVolumeManager(m_manager->modem()->path());
- m_manager->setVoicemail(m_manager->modem()->path());
-
- connect(m_manager->network(), SIGNAL(connected()), this,
- SLOT(networkConnected()));
- connect(m_manager->network(), SIGNAL(disconnected()), this,
- SLOT(networkDisconnected()));
- connect(m_manager->callManager(), SIGNAL(connected()), this,
- SLOT(callManagerConnected()));
- connect(m_manager->callManager(), SIGNAL(disconnected()), this,
- SLOT(callManagerDisconnected()));
- connect(m_manager->callManager(), SIGNAL(callsChanged()), this,
- SLOT(onCallsChanged()));
- connect(m_manager->voicemail(), SIGNAL(messagesWaitingChanged()), this,
- SLOT(messagesWaitingChanged()));
- PAControl* paControl = PAControl::instance();
- connect(m_manager->callManager(), SIGNAL(callsChanged()), paControl,
- SLOT(onCallsChanged()));
- }
+ {
+ qDebug() << QString("Connecting to CallManager....");
+ m_manager->setNetwork(m_manager->modem()->path());
+ m_manager->setCallManager(m_manager->modem()->path());
+ m_manager->setVolumeManager(m_manager->modem()->path());
+ m_manager->setVoicemail(m_manager->modem()->path());
+
+ connect(m_manager->network(), SIGNAL(connected()), this,
+ SLOT(networkConnected()));
+ connect(m_manager->network(), SIGNAL(disconnected()), this,
+ SLOT(networkDisconnected()));
+ connect(m_manager->callManager(), SIGNAL(connected()), this,
+ SLOT(callManagerConnected()));
+ connect(m_manager->callManager(), SIGNAL(disconnected()), this,
+ SLOT(callManagerDisconnected()));
+ connect(m_manager->callManager(), SIGNAL(callsChanged()), this,
+ SLOT(onCallsChanged()));
+ connect(m_manager->voicemail(), SIGNAL(messagesWaitingChanged()), this,
+ SLOT(messagesWaitingChanged()));
+ PAControl* paControl = PAControl::instance();
+ connect(m_manager->callManager(), SIGNAL(callsChanged()), paControl,
+ SLOT(onCallsChanged()));
+ }
}
bool DialerApplication::isConnected()
{
- TRACE
+ TRACE;
return m_connected;
}
bool DialerApplication::hasError() const
{
- TRACE
+ TRACE;
return !m_lastError.isEmpty();
}
QString DialerApplication::lastError() const
{
- TRACE
+ TRACE;
return m_lastError;
}
void DialerApplication::setError(const QString msg)
{
- TRACE
+ TRACE;
m_lastError.clear();
m_lastError = QString(msg);
}
DialerApplication *DialerApplication::instance()
{
- TRACE
+ TRACE;
return qobject_cast<DialerApplication *>(QApplication::instance());
}
-/*
-SeasideSyncModel *DialerApplication::seasideModel()
-{
- TRACE
- return m_seasideModel;
-}
-SeasideProxyModel *DialerApplication::seasideProxy()
-{
- TRACE
- return m_seasideProxy;
-}
-*/
-/*
-HistoryTableModel *DialerApplication::historyModel()
-{
- TRACE
- // return m_historyModel;
-}
-
-QSortFilterProxyModel *DialerApplication::historyProxy()
-{
- TRACE
- return m_historyProxy;
-}
-*/
void DialerApplication::init()
{
- TRACE
+ TRACE;
m_connected = false;
m_lastError = QString();
DBusDialerAdapter *adapter = new DBusDialerAdapter(this);
if(!adapter)
- {
- qWarning() << "DBus adapter instantiation failed.";
- }
+ {
+ qWarning() << "DBus adapter instantiation failed.";
+ }
if(!QDBusConnection::sessionBus().registerObject(DBUS_SERVICE_PATH, this))
- {
- qCritical() << "Error registering dbus object:" <<
- QDBusConnection::sessionBus().lastError().message();
- }
- connect(m_manager, SIGNAL(modemChanged()),
- SLOT(modemChanged()));
+ {
+ qCritical() << "Error registering dbus object:" <<
+ QDBusConnection::sessionBus().lastError().message();
+ }
+ connect(m_manager, SIGNAL(modemChanged()),
+ SLOT(modemChanged()));
}
void DialerApplication::modemChanged()
{
- TRACE
+ TRACE;
if (m_manager->modem() != NULL)
- {
- connect(m_manager->modem(), SIGNAL(connected()),
- SLOT(modemConnected()));
- connect(m_manager->modem(), SIGNAL(disconnected()),
- SLOT(modemDisconnected()));
- }
+ {
+ connect(m_manager->modem(), SIGNAL(connected()),
+ SLOT(modemConnected()));
+ connect(m_manager->modem(), SIGNAL(disconnected()),
+ SLOT(modemDisconnected()));
+ }
}
void DialerApplication::modemConnected()
{
- TRACE
+ TRACE;
//TODO: Handle multiple modems
if (m_manager->modem() && m_manager->modem()->isValid())
- {
- m_modem = m_manager->modem();
+ {
+ m_modem = m_manager->modem();
- m_modem->setPowered(true);
+ m_modem->setPowered(true);
- qDebug() << QString("Modem connected");
- connect(m_modem, SIGNAL(interfacesChanged(QStringList)), this,
- SLOT(modemInterfacesChanged(QStringList)));
- connect(m_modem, SIGNAL(poweredChanged(bool)), this,
- SLOT(modemPowered(bool)));
-
- if (m_modem->powered() &&
- m_modem->interfaces().contains(OFONO_VOICECALLMANAGER_INTERFACE))
- {
- /* connect all now, modem is enabled */
- this->connectAll();
+ qDebug() << QString("Modem connected");
+ connect(m_modem, SIGNAL(interfacesChanged(QStringList)), this,
+ SLOT(modemInterfacesChanged(QStringList)));
+ connect(m_modem, SIGNAL(poweredChanged(bool)), this,
+ SLOT(modemPowered(bool)));
+
+ if (m_modem->powered() &&
+ m_modem->interfaces().contains(OFONO_VOICECALLMANAGER_INTERFACE))
+ {
+ /* connect all now, modem is enabled */
+ this->connectAll();
+ }
}
- }
}
void DialerApplication::modemDisconnected()
{
- TRACE
+ TRACE;
//TODO: Handle multiple modems
}
void DialerApplication::modemInterfacesChanged(QStringList interfaces)
{
- TRACE
+ TRACE;
qDebug() << QString("Modem Interfaces: ") << interfaces;
if (interfaces.contains(OFONO_VOICECALLMANAGER_INTERFACE) &&
m_manager->modem()->powered())
- {
- this->connectAll();
- }
+ {
+ this->connectAll();
+ }
}
void DialerApplication::modemPowered(bool isPowered)
{
- TRACE
+ TRACE;
qDebug() << QString("Modem Powered: ") << isPowered;
if (isPowered &&
m_manager->modem()->interfaces().contains(OFONO_VOICECALLMANAGER_INTERFACE))
- {
- this->connectAll();
- }
+ {
+ this->connectAll();
+ }
}
void DialerApplication::networkConnected()
{
- TRACE
+ TRACE;
if (m_manager->network() && m_manager->network()->isValid())
m_network = m_manager->network();
}
void DialerApplication::networkDisconnected()
{
- TRACE
+ TRACE;
}
void DialerApplication::callManagerConnected()
{
- TRACE
+ TRACE;
if (m_manager->callManager() && m_manager->callManager()->isValid())
m_callManager = m_manager->callManager();
void DialerApplication::callManagerDisconnected()
{
- TRACE
+ TRACE;
qDebug() << QString("CallMgr disconnected");
}
void DialerApplication::messagesWaitingChanged()
{
- TRACE
-/*
- static MNotification *vmail = NULL;
-
- if (!m_manager->voicemail() || !m_manager->voicemail()->isValid()) {
- qDebug() << QString("Voicemail proxy is invalid, ignoring");
- return;
- }
-
-
- if (!vmail) {
- bool found = false;
- foreach (MNotification *notice, MNotification::notifications()) {
- if (notice->eventType() == MNotification::MessageArrivedEvent) {
- // If we've already found a MessageArrived notification,
- // we must delete others since we only want one
- if (found) {
- qDebug() << QString("Removing duplicate voicemail notice");
- notice->remove();
- delete notice;
- }
- else {
- vmail = notice;
- found = true;
- }
- }
- else {
- // We're only interested in MessageArrived events, all others
- // can need to be deleted here since they are copies
- delete notice;
- }
- }
-
- if (!found) {
- if (!m_manager->voicemail()->waiting()) {
- qDebug() << QString("No waiting Voicemail messages");
- return;
- }
- else {
- // This is the first instance of a MessageArrived event
- qDebug() << QString("Creating new voicemail notice instance");
- vmail = new MNotification(MNotification::MessageArrivedEvent);
- vmail->setCount(0);
- }
- }
- else {
- if (!m_manager->voicemail()->waiting()) {
- qDebug() << QString("No waiting Voicemail messages");
- vmail->remove();
- return;
- }
- }
- }
-
- // We've got a valid notification and we have messages waiting...
- int vCount = m_manager->voicemail()->count();
- int nCount = vmail->count();
-
- if (vCount < 0) vCount = 0;
- if (nCount < 0) nCount = 0;
-
- qDebug() << QString("Voicemails: %1").arg(QString::number(vCount));
- qDebug() << QString("Notices: %1").arg(QString::number(nCount));
-
- // No more Voicemail messages waiting, remove notification
- if (vCount <= 0) {
- qDebug() << QString("No Voicemails waiting, removing notification");
- vmail->remove();
- return;
- }
-
- // The waiting voicemail count has changed, update and [re]publish it
- //% "You have %1 voice messages"
- vmail->setSummary(qtTrId("xx_messages_waiting").arg(vCount));
- vmail->setImage("icon-m-telephony-voicemail");
- vmail->setCount(vCount);
- qDebug() << QString("Voicemail count changed, publishing notification");
- vmail->publish();
-*/
+ TRACE;
}
void DialerApplication::onCallsChanged()
{
- TRACE
+ TRACE;
QMLMainWindow::instance()->tryToShow();
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class DialerApplication: public QApplication
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(bool isConnected READ isConnected)
- Q_PROPERTY(bool hasError READ hasError)
- Q_PROPERTY(QString lastError READ lastError)
+ Q_PROPERTY(bool isConnected READ isConnected);
+ Q_PROPERTY(bool hasError READ hasError);
+ Q_PROPERTY(QString lastError READ lastError);
public:
DialerApplication(int &argc, char **argv);
void setError(const QString msg);
bool isConnected();
-
-// SeasideSyncModel *seasideModel();
-// SeasideProxyModel *seasideProxy();
- // HistoryTableModel *historyModel();
- // QSortFilterProxyModel *historyProxy();
Q_SIGNALS:
void showUi();
bool m_connected;
QString m_lastError;
- //SeasideSyncModel *m_seasideModel;
- //SeasideProxyModel *m_seasideProxy;
-
- //HistoryTableModel *m_historyModel;
- // QSortFilterProxyModel *m_historyProxy;
-
Q_DISABLE_COPY(DialerApplication);
};
#endif // DIALERAPPLICATION_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
OfonoCallVolume *volumeManager;
OfonoMessageWaiting *voicemailManager;
CallManager *callManager;
-// ResourceProxy *policyManager;
QStringList modes;
MGConfItem modesKey;
};
// OfonoModemManager signals to monitor
connect(d->modemManager, SIGNAL(modemAdded(const QString&)),
- SLOT(onModemAdded(const QString&)));
+ SLOT(onModemAdded(const QString&)));
connect(d->modemManager, SIGNAL(modemRemoved(const QString&)),
- SLOT(onModemRemoved(const QString&)));
+ SLOT(onModemRemoved(const QString&)));
// CallManager signals to monitor
connect(d->callManager, SIGNAL(validityChanged(bool)),
- SLOT(onCallManagerValidityChanged(bool)));
+ SLOT(onCallManagerValidityChanged(bool)));
connect(d->callManager, SIGNAL(callsChanged()), SLOT(onCallsChanged()));
// OfonoCallVolume signals to monitor
connect(d->volumeManager, SIGNAL(validityChanged(bool)),
- SLOT(onCallVolumeValidityChanged(bool)));
+ SLOT(onCallVolumeValidityChanged(bool)));
// OfonoMessageWaiting signals to monitor
connect(d->voicemailManager, SIGNAL(validityChanged(bool)),
- SLOT(onVoicemailValidityChanged(bool)));
+ SLOT(onVoicemailValidityChanged(bool)));
connect(d->voicemailManager, SIGNAL(voicemailWaitingChanged(bool)),
- SLOT(onVoicemailWaitingChanged(bool)));
+ SLOT(onVoicemailWaitingChanged(bool)));
connect(d->voicemailManager, SIGNAL(voicemailMessageCountChanged(int)),
- SLOT(onVoicemailCountChanged(int)));
+ SLOT(onVoicemailCountChanged(int)));
// GConf Key change signals to monitor
connect(&d->modesKey, SIGNAL(valueChanged()), SLOT(onModesChanged()));
- // ResourceProxy is a singleton, probably don't need to store this...
- //d->policyManager = ResourceProxy::instance();
-
if (d->callManager)
qDebug() << __func__ << ": Using modem - "
<< d->callManager->modem()->path();
return d->callManager;
}
-/*
-ResourceProxy* DialerContext::policyManager() const
-{
- return d->policyManager;
-}
-*/
-
QStringList DialerContext::modes() const
{
return d->modes;
}
/*
-OfonoModem* DialerContext::modem() const
-{
- if (d->callManager)
- return d->callManager->modem();
- return NULL;
-}
-*/
-
-/*
* Private methods/slots
*/
void DialerContext::onModemAdded(const QString &path)
{
- TRACE
+ TRACE;
// TODO: Handle modem additions, maybe...
qWarning() << __func__ << ": Unhandled ModemAdded - " << path;
}
void DialerContext::onModemRemoved(const QString &path)
{
- TRACE
+ TRACE;
// TODO: Handle modem removals, currently active for sure, others, maybe...
qWarning() << __func__ << ": Unhandled ModemAdded - " << path;
}
void DialerContext::onCallVolumeValidityChanged(bool valid)
{
- TRACE
+ TRACE;
// TODO: Reset the volumeManager service reference
qWarning() << __func__ << ": valid? " << ((valid)?"true":"false");
}
void DialerContext::onVoicemailValidityChanged(bool valid)
{
- TRACE
+ TRACE;
// TODO: Reset the voicemailManager service reference
qWarning() << __func__ << ": valid? " << ((valid)?"true":"false");
}
void DialerContext::onVoicemailWaitingChanged(bool waiting)
{
- TRACE
+ TRACE;
// TODO: Send notifications (or bubble this up for UI to handle?)
qDebug() << __func__ << ": Messages? " << ((waiting)?"true":"false");
}
void DialerContext::onVoicemailCountChanged(int count)
{
- TRACE
+ TRACE;
// TODO: Send notifications (or bubble this up for UI to handle?)
qDebug() << __func__ << ": Message count == " << count;
}
void DialerContext::onCallManagerValidityChanged(bool valid)
{
- TRACE
+ TRACE;
// TODO: Reset the callManager service reference
qWarning() << __func__ << ": valid? " << ((valid)?"true":"false");
}
void DialerContext::onCallsChanged()
{
- TRACE
+ TRACE;
// TODO: Send notifications (or bubble this up for UI to handle?)
qDebug() << __func__ << ": Calls count == "
<< d->callManager->getCalls().count();
void DialerContext::onModesChanged()
{
- TRACE
+ TRACE;
setModes(d->modesKey.value().toStringList());
// Send notification of change
emit modesChanged();
qDebug() << __func__ << ": New modes == " << d->modes.join(", ");
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
// local headers
#include "callmanager.h"
-//#include "resourceproxy.h"
// Convienence Macro for access to Class instance
#define DC DialerContext::instance()
class DialerContext: public QObject
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(OfonoModemManager* modemManager READ modemManager)
- Q_PROPERTY(OfonoCallVolume* volumeManager READ volumeManager)
- Q_PROPERTY(OfonoMessageWaiting* voicemailManager READ voicemailManager)
- Q_PROPERTY(CallManager* callManager READ callManager)
-// Q_PROPERTY(ResourceProxy* policyManager READ policyManager)
- Q_PROPERTY(QStringList modes READ modes WRITE setModes)
+ Q_PROPERTY(OfonoModemManager* modemManager READ modemManager);
+ Q_PROPERTY(OfonoCallVolume* volumeManager READ volumeManager);
+ Q_PROPERTY(OfonoMessageWaiting* voicemailManager READ voicemailManager);
+ Q_PROPERTY(CallManager* callManager READ callManager);
+ Q_PROPERTY(QStringList modes READ modes WRITE setModes);
public:
virtual ~DialerContext();
OfonoCallVolume* volumeManager() const;
OfonoMessageWaiting* voicemailManager() const;
CallManager* callManager() const;
- //ResourceProxy* policyManager() const;
QStringList modes() const;
public slots:
};
#endif // DIALERCONTEXT_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
int main(int argc, char *argv[])
{
- TRACE
+ TRACE;
DialerApplication app(argc, argv);
QMLMainWindow *qmw = QMLMainWindow::instance();
QString stripLineID(QString lineid)
{
- TRACE
+ TRACE;
static QRegExp rx = QRegExp("([^0-9*#])");
if (lineid.indexOf('+') == 0) {
lineid.replace(rx, "");
return lineid.insert(0,"+");
- }
- else
+ } else {
return lineid.replace(rx, "");
+ }
}
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
m_volumeManager(0),
m_voicemail(0)
{
-TRACE
+ TRACE;
if (gManager)
qFatal("ManagerProxy: There can be only one!");
ManagerProxy::~ManagerProxy()
{
- TRACE
+ TRACE;
if (m_volumeManager)
delete m_volumeManager;
m_volumeManager = 0;
void ManagerProxy::managerDBusGetModemsDone(QDBusPendingCallWatcher *call)
{
QDBusPendingReply<QArrayOfPathProperties> reply = *call;
-TRACE
+ TRACE;
if (reply.isError()) {
// TODO: Handle this properly, by setting states, or disabling features
qWarning() << "org.ofono.Manager.GetModems() failed: " <<
- reply.error().message();
+ reply.error().message();
} else {
QArrayOfPathProperties modems = reply.value();
if (modems.count() >= 1) {
// FIXME: Handle multiple modems...
foreach (OfonoPathProperties p, modems)
- {
- qDebug() << "modem: " << p.path.path();
- m_modemList << QString(p.path.path());
- }
+ {
+ qDebug() << "modem: " << p.path.path();
+ m_modemList << QString(p.path.path());
+ }
OfonoPathProperties p = modems[0];
if (m_modemPath.isNull() || m_modemPath.isEmpty()) {
setCallManager(m_modemPath);
setVolumeManager(m_modemPath);
setVoicemail(m_modemPath);
- // TODO: Connect to service proxies as available/needed here
+ // TODO: Connect to service proxies as available/needed here
}
}
}
void ManagerProxy::modemAdded(const QDBusObjectPath &in0,const QVariantMap &in1)
{
Q_UNUSED(in1)
- TRACE
+ TRACE;
// TODO: Handle modem additions, maybe...
qWarning() << QString("Unhandled ModemAdded event: \"%1\"")
- .arg(in0.path());
+ .arg(in0.path());
qDebug() << QString("modem added: %1").arg(in0.path());
m_modemList << QString(in0.path());
void ManagerProxy::modemRemoved(const QDBusObjectPath &in0)
{
- TRACE
+ TRACE;
// TODO: Handle modem removals, currently active for sure, others, maybe...
qWarning() << QString("Unhandled ModemRemoved event: \"%1\"")
- .arg(in0.path());
+ .arg(in0.path());
qDebug() << QString("modem removed: ").arg(in0.path());
m_modemList.removeOne(QString(in0.path()));
return;
if (m_modem)
- {
- if (m_modemList.contains(m_modem->path()))
- {
- m_modemList.removeAll(m_modem->path());
- }
- delete m_modem;
- m_modem = NULL;
- }
+ {
+ if (m_modemList.contains(m_modem->path()))
+ {
+ m_modemList.removeAll(m_modem->path());
+ }
+ delete m_modem;
+ m_modem = NULL;
+ }
if (m_modemList.contains(modemPath)) {
m_modem = new ModemProxy(modemPath);
}
}
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
#include "modemproxy.h"
#include "networkproxy.h"
#include "callmanager.h"
-//#include "resourceproxy.h"
#include "common.h"
#include <QtDBus>
#include <QDebug>
class ManagerProxy: public org::ofono::Manager
{
- Q_OBJECT
- Q_PROPERTY(ModemProxy* modem READ modem)
- Q_PROPERTY(NetworkProxy* network READ network)
+ Q_OBJECT;
+ Q_PROPERTY(ModemProxy* modem READ modem);
+ Q_PROPERTY(NetworkProxy* network READ network);
public:
virtual ~ManagerProxy();
};
#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
QDBusConnection::systemBus()),
m_interfaces(0)
{
-TRACE
+ TRACE;
if (!isValid()) {
qDebug() << "Failed to connect to Ofono: \n\t" << lastError().message();
} else {
ModemProxy::~ModemProxy()
{
-TRACE
+ TRACE;
}
QStringList ModemProxy::interfaces() const { return m_interfaces; }
void ModemProxy::setPowered(bool is_powered)
{
-TRACE
+ TRACE;
if (m_powered == is_powered)
return;
void ModemProxy::setOnline(bool is_online)
{
-TRACE
+ TRACE;
if (m_online == is_online)
return;
void ModemProxy::modemDBusGetPropDone(QDBusPendingCallWatcher *call)
{
-TRACE
+ TRACE;
QDBusPendingReply<QVariantMap> reply = *call;
if (reply.isError()) {
- // TODO: Handle this properly, by setting states, or disabling features...
- qDebug() << "org.ofono.ModemProxy.getProperties() failed: " <<
- reply.error().message();
+ // TODO: Handle this properly, by setting states, or disabling features...
+ qDebug() << "org.ofono.ModemProxy.getProperties() failed: " <<
+ reply.error().message();
} else {
- QVariantMap properties = reply.value();
- m_interfaces = qdbus_cast<QStringList >(properties["Interfaces"]);
- m_manufacturer = qdbus_cast<QString>(properties["Manufacturer"]);
- m_model = qdbus_cast<QString>(properties["Model"]);
- m_powered = qdbus_cast<bool>(properties["Powered"]);
- m_revision = qdbus_cast<QString>(properties["Revision"]);
- m_serial = qdbus_cast<QString>(properties["Serial"]);
- m_online = qdbus_cast<bool>(properties["Online"]);
-
- // First sucessfull GetProperties == connected
- if (!m_connected) {
- m_connected = true;
- emit connected();
- }
+ QVariantMap properties = reply.value();
+ m_interfaces = qdbus_cast<QStringList >(properties["Interfaces"]);
+ m_manufacturer = qdbus_cast<QString>(properties["Manufacturer"]);
+ m_model = qdbus_cast<QString>(properties["Model"]);
+ m_powered = qdbus_cast<bool>(properties["Powered"]);
+ m_revision = qdbus_cast<QString>(properties["Revision"]);
+ m_serial = qdbus_cast<QString>(properties["Serial"]);
+ m_online = qdbus_cast<bool>(properties["Online"]);
+
+ // First sucessfull GetProperties == connected
+ if (!m_connected) {
+ m_connected = true;
+ emit connected();
+ }
}
}
void ModemProxy::propertyChanged(const QString &in0, const QDBusVariant &in1)
{
-TRACE
+ TRACE;
qDebug() << "org.ofono.ModemProxy.propertyChanged()"
<< in0 << ": " << in1.variant();
if (in0 == "Interfaces") {
: org::ofono::MessageWaiting(OFONO_SERVICE,
objectPath,
QDBusConnection::systemBus()),
- m_connected(false)
+ m_connected(false)
{
-TRACE
+ TRACE;
if (!isValid()) {
qDebug() << "Failed to connect to Ofono: \n\t" << lastError().message();
} else {
VoicemailProxy::~VoicemailProxy()
{
-TRACE
+ TRACE;
}
bool VoicemailProxy::isConnected() const { return m_connected; }
void VoicemailProxy::setMailbox(QString lineid)
{
-TRACE
+ TRACE;
if (lineid.isEmpty() || (m_mailbox == lineid))
return;
if (reply.isError())
qCritical() << "SetProperty \"VoicemailMailboxNumber\" failed: " <<
- reply.error().message();
+ reply.error().message();
else
m_mailbox = lineid;
}
void VoicemailProxy::voicemailDBusGetPropDone(QDBusPendingCallWatcher *call)
{
-TRACE
+ TRACE;
QDBusPendingReply<QVariantMap> reply = *call;
if (reply.isError()) {
- // TODO: Handle this properly, by setting states, or disabling features...
- qDebug() << "org.ofono.MessageWaiting.getProperties() failed: " <<
- reply.error().message();
+ // TODO: Handle this properly, by setting states, or disabling features...
+ qDebug() << "org.ofono.MessageWaiting.getProperties() failed: " <<
+ reply.error().message();
} else {
- QVariantMap properties = reply.value();
- bool waiting = qdbus_cast<bool>(properties["VoicemailWaiting"]);
- int count = qdbus_cast<int>(properties["VoicemailMessageCount"]);
- QString mailbox = qdbus_cast<QString>(properties["VoicemailMailboxNumber"]);
-
- if (count != m_count) {
- m_count = count;
- emit messagesWaitingChanged();
- }
- if (waiting != m_waiting) {
- m_waiting = waiting;
- emit messagesWaitingChanged();
- }
- if (!mailbox.isEmpty() && (mailbox != m_mailbox)) {
- m_mailbox = mailbox;
- emit mailboxChanged();
- }
-
- // First sucessfull GetProperties == connected
- if (!m_connected) {
- m_connected = true;
- emit connected();
- }
+ QVariantMap properties = reply.value();
+ bool waiting = qdbus_cast<bool>(properties["VoicemailWaiting"]);
+ int count = qdbus_cast<int>(properties["VoicemailMessageCount"]);
+ QString mailbox = qdbus_cast<QString>(properties["VoicemailMailboxNumber"]);
+
+ if (count != m_count) {
+ m_count = count;
+ emit messagesWaitingChanged();
+ }
+ if (waiting != m_waiting) {
+ m_waiting = waiting;
+ emit messagesWaitingChanged();
+ }
+ if (!mailbox.isEmpty() && (mailbox != m_mailbox)) {
+ m_mailbox = mailbox;
+ emit mailboxChanged();
+ }
+
+ // First sucessfull GetProperties == connected
+ if (!m_connected) {
+ m_connected = true;
+ emit connected();
+ }
}
}
void VoicemailProxy::voicemailPropertyChanged(const QString &in0, const QDBusVariant &in1)
{
-TRACE
+ TRACE;
qDebug() << QString("Property \"%1\" changed...").arg(in0);
bool waiting;
int count;
objectPath,
QDBusConnection::systemBus())
{
-TRACE
+ TRACE;
if (!isValid()) {
qDebug() << "Failed to connect to Ofono: \n\t" << lastError().message();
} else {
VolumeManager::~VolumeManager()
{
-TRACE
+ TRACE;
}
QString VolumeManager::path() const { return m_path; }
void VolumeManager::setSpeakerVolume(int volume)
{
-TRACE
+ TRACE;
if (m_speakerVolume == volume)
return;
if (reply.isError())
qCritical() << "SetProperty \"SpeakerVolume\" failed: " <<
- reply.error().message();
+ reply.error().message();
else
m_speakerVolume = volume;
}
void VolumeManager::setMicVolume(int volume)
{
-TRACE
+ TRACE;
if (m_micVolume == volume)
return;
if (reply.isError())
qCritical() << "SetProperty \"MicrophoneVolume\" failed: " <<
- reply.error().message();
+ reply.error().message();
else
m_micVolume = volume;
}
void VolumeManager::setMuted(bool is_muted)
{
-TRACE
+ TRACE;
if (m_muted == is_muted)
return;
if (reply.isError())
qCritical() << "SetProperty \"Muted\" failed: " <<
- reply.error().message();
+ reply.error().message();
else
m_muted = is_muted;
}
void VolumeManager::volumeDBusGetPropDone(QDBusPendingCallWatcher *call)
{
-TRACE
+ TRACE;
QDBusPendingReply<QVariantMap> reply = *call;
if (reply.isError()) {
- // TODO: Handle this properly, by setting states, or disabling features...
- qDebug() << "org.ofono.CallVolume.getProperties() failed: " <<
- reply.error().message();
+ // TODO: Handle this properly, by setting states, or disabling features...
+ qDebug() << "org.ofono.CallVolume.getProperties() failed: " <<
+ reply.error().message();
} else {
- QVariantMap properties = reply.value();
- m_speakerVolume = qdbus_cast<int>(properties["SpeakerVolume"]);
- m_micVolume = qdbus_cast<int>(properties["MicrophoneVolume"]);
- m_muted = qdbus_cast<bool>(properties["Muted"]);
-
- // First sucessfull GetProperties == connected
- if (!m_connected) {
- m_connected = true;
- emit connected();
- }
+ QVariantMap properties = reply.value();
+ m_speakerVolume = qdbus_cast<int>(properties["SpeakerVolume"]);
+ m_micVolume = qdbus_cast<int>(properties["MicrophoneVolume"]);
+ m_muted = qdbus_cast<bool>(properties["Muted"]);
+
+ // First sucessfull GetProperties == connected
+ if (!m_connected) {
+ m_connected = true;
+ emit connected();
+ }
}
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class ModemProxy: public org::ofono::Modem
{
- Q_OBJECT
- Q_PROPERTY(QStringList interfaces READ interfaces)
- Q_PROPERTY(QString path READ path)
- Q_PROPERTY(QString manufacturer READ manufacturer)
- Q_PROPERTY(QString model READ model)
- Q_PROPERTY(QString revision READ revision)
- Q_PROPERTY(QString serial READ serial)
- Q_PROPERTY(bool powered READ powered WRITE setPowered)
- Q_PROPERTY(bool online READ online WRITE setOnline)
+ Q_OBJECT;
+ Q_PROPERTY(QStringList interfaces READ interfaces);
+ Q_PROPERTY(QString path READ path);
+ Q_PROPERTY(QString manufacturer READ manufacturer);
+ Q_PROPERTY(QString model READ model);
+ Q_PROPERTY(QString revision READ revision);
+ Q_PROPERTY(QString serial READ serial);
+ Q_PROPERTY(bool powered READ powered WRITE setPowered);
+ Q_PROPERTY(bool online READ online WRITE setOnline);
public:
ModemProxy(const QString &objectPath);
class VoicemailProxy: public org::ofono::MessageWaiting
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(bool isConnected READ isConnected NOTIFY connected)
- Q_PROPERTY(bool waiting READ waiting)
- Q_PROPERTY(int count READ count)
- Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox)
+ Q_PROPERTY(bool isConnected READ isConnected NOTIFY connected);
+ Q_PROPERTY(bool waiting READ waiting);
+ Q_PROPERTY(int count READ count);
+ Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox);
public:
VoicemailProxy(const QString &objectPath);
class VolumeManager: public org::ofono::CallVolume
{
- Q_OBJECT
- Q_PROPERTY(int speakerVolume READ speakerVolume WRITE setSpeakerVolume)
- Q_PROPERTY(int micVolume READ micVolume WRITE setMicVolume)
- Q_PROPERTY(bool muted READ muted WRITE setMuted)
- Q_PROPERTY(bool isConnected READ isConnected)
+ Q_OBJECT;
+ Q_PROPERTY(int speakerVolume READ speakerVolume WRITE setSpeakerVolume);
+ Q_PROPERTY(int micVolume READ micVolume WRITE setMicVolume);
+ Q_PROPERTY(bool muted READ muted WRITE setMuted);
+ Q_PROPERTY(bool isConnected READ isConnected);
public:
VolumeManager(const QString &objectPath);
};
#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
/* **************************************************************
* Network Operator Class
* **************************************************************/
-/* TODO: make property reference/storage more generic
-
-typedef struct {
- unsigned int id;
- const char *name;
-} OperatorProperty;
-
-enum OperatorPropertyID {
- CountryCode = 0,
- NetworkCode,
- Name,
- Status,
- Technologies,
-};
-
-static OperatorProperty operatorProperty[] = {
- { CountryCode, "MobileCountryCode", },
- { NetworkCode, "MobileNetworkCode", },
- { Name, "Name", },
- { Status, "Status", },
- { Technologies, "Technologies", },
-};
-*/
OperatorProxy::OperatorProxy(const QString &operatorPath)
: org::ofono::NetworkOperator(OFONO_SERVICE,
{
if (!isValid()) {
qCritical() << org::ofono::NetworkOperator::staticInterfaceName() <<
- " connection failed: " << lastError().message();
+ " connection failed: " << lastError().message();
} else {
QDBusPendingReply<QVariantMap> reply;
QDBusPendingCallWatcher * watcher;
if (reply.isError()) {
// TODO: Handle this properly
qCritical() << org::ofono::NetworkOperator::staticInterfaceName() <<
- ".GetProperties() failed: " << reply.error().message();
+ ".GetProperties() failed: " << reply.error().message();
} else {
QVariantMap properties = reply.value();
m_countryCode = qdbus_cast<QString>(properties["MobileCountryCode"]);
{
if (!isValid()) {
qCritical() << org::ofono::NetworkRegistration::staticInterfaceName() <<
- " connection failed: " << lastError().message();
+ " connection failed: " << lastError().message();
} else {
QDBusPendingReply<QVariantMap> reply;
QDBusPendingCallWatcher * watcher;
if (reply.isError()) {
// TODO: Handle this properly
qCritical() << org::ofono::NetworkRegistration::staticInterfaceName() <<
- ".GetProperties() failed: " << reply.error().message();
+ ".GetProperties() failed: " << reply.error().message();
} else {
QVariantMap properties = reply.value();
QList<QDBusObjectPath> paths =
- qdbus_cast<QList<QDBusObjectPath> >(properties["AvailableOperators"]);
+ qdbus_cast<QList<QDBusObjectPath> >(properties["AvailableOperators"]);
foreach (QDBusObjectPath p, paths) {
QString path = QString(p.path());
m_operatorPaths.append(path);
m_operators.append(op);
- // GetProperties() has probably not completed yet, so this
- // test will be unlikely to work.
- // TODO: connect to the propertyChanged() signal and do this there
-/*
- if (op->status() == "current") {
- m_currentOperator = op;
- qDebug() << "Current network operator is " <<
- m_currentOperator->name() << " (" <<
- m_currentOperator->path() << ")";
- }
-*/
}
m_mode = qdbus_cast<QString>(properties["Mode"]);
m_name = qdbus_cast<QString>(properties["Operator"]);
}
}
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
* **************************************************************/
class OperatorProxy: public org::ofono::NetworkOperator
{
- Q_OBJECT
- Q_PROPERTY(QString path READ path)
- Q_PROPERTY(QString countryCode READ countryCode)
- Q_PROPERTY(QString networkCode READ networkCode)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(QString status READ status)
- Q_PROPERTY(QStringList technologies READ technologies)
+ Q_OBJECT;
+ Q_PROPERTY(QString path READ path);
+ Q_PROPERTY(QString countryCode READ countryCode);
+ Q_PROPERTY(QString networkCode READ networkCode);
+ Q_PROPERTY(QString name READ name);
+ Q_PROPERTY(QString status READ status);
+ Q_PROPERTY(QStringList technologies READ technologies);
public:
OperatorProxy(const QString &objectPath);
* **************************************************************/
class NetworkProxy: public org::ofono::NetworkRegistration
{
- Q_OBJECT
- Q_PROPERTY(QList<OperatorProxy*> operators READ operators)
- Q_PROPERTY(OperatorProxy currentOperator READ currentOperator)
- Q_PROPERTY(QString mode READ mode)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(QString status READ status)
+ Q_OBJECT;
+ Q_PROPERTY(QList<OperatorProxy*> operators READ operators);
+ Q_PROPERTY(OperatorProxy currentOperator READ currentOperator);
+ Q_PROPERTY(QString mode READ mode);
+ Q_PROPERTY(QString name READ name);
+ Q_PROPERTY(QString status READ status);
public:
NetworkProxy(const QString &objectPath);
};
#endif
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
source = new PADevice();
source->index = l->index;
if(l->name != NULL)
- source->name = l->name;
+ source->name = l->name;
if(l->description != NULL)
- source->description = l->description;
+ source->description = l->description;
paControl->addSource(source);
}
return;
}
- //qDebug() << "pa_sinklist_cb() Sink added: " << l->name;
sink = new PADevice();
sink->index = l->index;
if(l->name != NULL)
- sink->name = l->name;
+ sink->name = l->name;
if(l->description != NULL)
- sink->description = l->description;
+ sink->description = l->description;
paControl->addSink(sink);
}
return;
}
- //qDebug() << "pa_modulelist_cb() Module added: " << i->name;
module = new PAModule();
module->index = i->index;
if(i->name != NULL)
- module->name = i->name;
+ module->name = i->name;
if(i->argument != NULL)
- module->argument = i->argument;
+ module->argument = i->argument;
paControl->addModule(module);
}
pa_context_state_t state = pa_context_get_state(c);
if(state == PA_CONTEXT_READY)
- {
- paControl->setState(true);
- pa_context_set_subscribe_callback(c, pa_subscribed_events_cb, NULL);
- pa_operation *o;
- if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
- (PA_SUBSCRIPTION_MASK_MODULE|
- PA_SUBSCRIPTION_MASK_SINK|
- PA_SUBSCRIPTION_MASK_SOURCE|
- PA_SUBSCRIPTION_MASK_SINK_INPUT|
- PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT), NULL, NULL))) {
+ {
+ paControl->setState(true);
+ pa_context_set_subscribe_callback(c, pa_subscribed_events_cb, NULL);
+ pa_operation *o;
+ if (!(o = pa_context_subscribe(c, (pa_subscription_mask_t)
+ (PA_SUBSCRIPTION_MASK_MODULE|
+ PA_SUBSCRIPTION_MASK_SINK|
+ PA_SUBSCRIPTION_MASK_SOURCE|
+ PA_SUBSCRIPTION_MASK_SINK_INPUT|
+ PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT), NULL, NULL))) {
qWarning("pa_context_subscribe() failed");
}
- if(o) pa_operation_unref(o);
- ///Get an initial list of sinks, sources and modules.
- paControl->addRef();
- pa_context_get_sink_info_list(c, pa_sinklist_cb, NULL);
- paControl->addRef();
- pa_context_get_source_info_list(c, pa_sourcelist_cb, NULL);
- paControl->addRef();
- pa_context_get_module_info_list(c, pa_modulelist_cb, NULL);
- }
+ if(o) pa_operation_unref(o);
+ ///Get an initial list of sinks, sources and modules.
+ paControl->addRef();
+ pa_context_get_sink_info_list(c, pa_sinklist_cb, NULL);
+ paControl->addRef();
+ pa_context_get_source_info_list(c, pa_sourcelist_cb, NULL);
+ paControl->addRef();
+ pa_context_get_module_info_list(c, pa_modulelist_cb, NULL);
+ }
else if(state == PA_CONTEXT_FAILED)
- {
- ///Pulseaudio crashed?
- paControl->setState(false);
- }
+ {
+ ///Pulseaudio crashed?
+ paControl->setState(false);
+ }
else
- {
- qDebug()<<"PA state: "<<(int) state;
- }
+ {
+ qDebug()<<"PA state: "<<(int) state;
+ }
}
static void pa_subscribed_events_cb(pa_context *c, enum pa_subscription_event_type t, uint32_t , void *)
{
switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK)
- {
+ {
case PA_SUBSCRIPTION_EVENT_SINK:
qDebug("PA_SUBSCRIPTION_EVENT_SINK event triggered");
foreach(PADevice* dev, paControl->sinkList)
- {
- delete dev;
- }
+ {
+ delete dev;
+ }
paControl->sinkList.clear();
paControl->addRef();
pa_context_get_sink_info_list(c, pa_sinklist_cb, NULL);
case PA_SUBSCRIPTION_EVENT_SOURCE:
qDebug("PA_SUBSCRIPTION_EVENT_SOURCE event triggered");
foreach(PADevice* dev, paControl->sourceList)
- {
- delete dev;
- }
+ {
+ delete dev;
+ }
paControl->sourceList.clear();
paControl->addRef();
pa_context_get_source_info_list(c, pa_sourcelist_cb, NULL);
case PA_SUBSCRIPTION_EVENT_MODULE:
qDebug("PA_SUBSCRIPTION_EVENT_MODULE event triggered");
foreach(PAModule* dev, paControl->moduleList)
- {
- delete dev;
- }
+ {
+ delete dev;
+ }
paControl->moduleList.clear();
paControl->addRef();
pa_context_get_module_info_list(c, pa_modulelist_cb, NULL);
break;
- }
+ }
}
PAControl::PAControl(QObject *parent)
if(!pa_ml)
pa_ml = pa_glib_mainloop_new(NULL);
pa_ctx = pa_context_new(
- pa_glib_mainloop_get_api(pa_ml),
- "com.tizen.hfp");
+ pa_glib_mainloop_get_api(pa_ml),
+ "com.tizen.hfp");
// This function connects to the pulse server
if (pa_context_connect(pa_ctx,
NULL,
PA_CONTEXT_NOFAIL, NULL) < 0)
- {
- qCritical("PulseAudioService: pa_context_connect() failed");
- paCleanup();
- return;
- }
+ {
+ qCritical("PulseAudioService: pa_context_connect() failed");
+ paCleanup();
+ return;
+ }
m_refCounter = 0;
m_connected = false;
void PAControl::setState(bool state)
{
- m_paState = state;
- if(state == false)
- {
- emit paFailed();
- }
+ m_paState = state;
+ if(state == false)
+ {
+ emit paFailed();
+ }
}
void PAControl::addRef()
PADevice* PAControl::findBluezSource() {
if (sourceList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_source_info_list(pa_ctx, pa_sourcelist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
+ {
+ addRef();
+ pa_op = pa_context_get_source_info_list(pa_ctx, pa_sourcelist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
- return NULL;
- }
+ return NULL;
+ }
foreach (PADevice *source, sourceList) {
QString name = source->name;
PADevice* PAControl::findBluezSink() {
if (sinkList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_sink_info_list(pa_ctx, pa_sinklist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
+ {
+ addRef();
+ pa_op = pa_context_get_sink_info_list(pa_ctx, pa_sinklist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
- return NULL;
- }
+ return NULL;
+ }
foreach (PADevice *sink, sinkList) {
- QString name = sink->name;
+ QString name = sink->name;
if (name.startsWith(QString("bluez_sink."), Qt::CaseSensitive)) {
qDebug() << QString(" Matched Bluez sink: ") << name;
PADevice* PAControl::findAlsaSource(QString alsasource) {
if (sourceList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_source_info_list(pa_ctx, pa_sourcelist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
+ {
+ addRef();
+ pa_op = pa_context_get_source_info_list(pa_ctx, pa_sourcelist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
- return NULL;
- }
+ return NULL;
+ }
foreach (PADevice *source, sourceList) {
qDebug() << QString("Alsa source: ") << source->name;
QString name = source->name;
if (!alsasource.isNull() && !alsasource.isEmpty())
- {
- // if alsa source name is provided
- if (alsasource == name)
{
- qDebug() << QString(" Matched Alsa source: ") << name;
- return source;
- }
- } else if (name.startsWith(QString("alsa_input."), Qt::CaseSensitive) &&
- name.endsWith(QString("analog-stereo"), Qt::CaseSensitive) &&
- !name.contains(QString("timb"))) {
+ // if alsa source name is provided
+ if (alsasource == name)
+ {
+ qDebug() << QString(" Matched Alsa source: ") << name;
+ return source;
+ }
+ } else if (name.startsWith(QString("alsa_input."), Qt::CaseSensitive) &&
+ name.endsWith(QString("analog-stereo"), Qt::CaseSensitive) &&
+ !name.contains(QString("timb"))) {
// this is default behavior, it will try to look up one
qDebug() << QString(" Matched Alsa source: ") << name;
return source;
PADevice* PAControl::findAlsaSink(QString alsasink) {
if (sinkList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_sink_info_list(pa_ctx, pa_sinklist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
+ {
+ addRef();
+ pa_op = pa_context_get_sink_info_list(pa_ctx, pa_sinklist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
- return NULL;
- }
+ return NULL;
+ }
foreach (PADevice *sink, sinkList) {
qDebug() << QString("Alsa sink: ") << sink->name;
QString name = sink->name;
if (!alsasink.isNull() && !alsasink.isEmpty())
- {
- // if alsa sink name is provided
- if (alsasink == name)
{
- qDebug() << QString(" Matched Alsa sink: ") << name;
- return sink;
- }
- } else if (name.startsWith(QString("alsa_output."), Qt::CaseSensitive) &&
- name.endsWith(QString("analog-stereo"), Qt::CaseSensitive) &&
- !name.contains(QString("timb"))) {
+ // if alsa sink name is provided
+ if (alsasink == name)
+ {
+ qDebug() << QString(" Matched Alsa sink: ") << name;
+ return sink;
+ }
+ } else if (name.startsWith(QString("alsa_output."), Qt::CaseSensitive) &&
+ name.endsWith(QString("analog-stereo"), Qt::CaseSensitive) &&
+ !name.contains(QString("timb"))) {
// this is default behavior, it will try to look up one
qDebug() << QString(" Matched Alsa sink: ") << name;
return sink;
PAModule* PAControl::findModule(QString name, QString pattern) {
if (moduleList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_module_info_list(pa_ctx, pa_modulelist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
+ {
+ addRef();
+ pa_op = pa_context_get_module_info_list(pa_ctx, pa_modulelist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
- return NULL;
- }
+ return NULL;
+ }
foreach (PAModule *module, moduleList) {
if (module->name.contains(name) && module->argument.contains(pattern)) {
QList<PAModule*> PAControl::getAllModules()
{
if (moduleList.size() == 0)
- {
- addRef();
- pa_op = pa_context_get_module_info_list(pa_ctx, pa_modulelist_cb, NULL);
- if(pa_op) pa_operation_unref(pa_op);
- }
+ {
+ addRef();
+ pa_op = pa_context_get_module_info_list(pa_ctx, pa_modulelist_cb, NULL);
+ if(pa_op) pa_operation_unref(pa_op);
+ }
return moduleList;
}
void PAControl::addSource(PADevice* device)
{
foreach(PADevice* dev, sourceList)
- {
- if(dev->name == device->name)
{
- delete device;
- return; /// already exists
+ if(dev->name == device->name)
+ {
+ delete device;
+ return; /// already exists
+ }
}
- }
sourceList.append(device);
emit sourceAppeared(device);
void PAControl::addSink(PADevice* device)
{
foreach(PADevice* dev, sinkList)
- {
- if(dev->name == device->name)
{
- delete device;
- return; /// already exists
+ if(dev->name == device->name)
+ {
+ delete device;
+ return; /// already exists
+ }
}
- }
sinkList.append(device);
emit sinkAppeared(device);
void PAControl::addModule(PAModule *module)
{
foreach(PAModule* dev, moduleList)
- {
- if(dev->name == module->name && dev->index == module->index)
{
- delete module;
- return; /// already exists
+ if(dev->name == module->name && dev->index == module->index)
+ {
+ delete module;
+ return; /// already exists
+ }
}
- }
moduleList.append(module);
emit moduleAppeared(module);
void PAControl::setErrorMsg(QString msg) {
if (msg != NULL)
- {
- this->status = ERROR;
- this->errorMsg = msg;
- }
+ {
+ this->status = ERROR;
+ this->errorMsg = msg;
+ }
}
QString PAControl::getErrorMsg() {
return;
if(cm->callCount() == 0)
- {
- qDebug() << "no calls active, ignore";
- return;
- }
+ {
+ qDebug() << "no calls active, ignore";
+ return;
+ }
if(device->name.contains("bluez_source"))
- {
- m_btSourceReady = true;
- }
+ {
+ m_btSourceReady = true;
+ }
if(!m_audioRouted && m_btSourceReady && m_btSinkReady)
- {
- qDebug() << QString("Route microphone and speakers");
- routeAudio();
- }
+ {
+ qDebug() << QString("Route microphone and speakers");
+ routeAudio();
+ }
}
void PAControl::onSinkAppeared(PADevice* device) {
return;
if(cm->callCount() == 0)
- {
- qDebug() << "no calls active, ignore";
- return;
- }
+ {
+ qDebug() << "no calls active, ignore";
+ return;
+ }
if((device)->name.contains("bluez_sink"))
- {
- m_btSinkReady = true;
- }
+ {
+ m_btSinkReady = true;
+ }
if(!m_audioRouted && m_btSourceReady && m_btSinkReady)
- {
- qDebug() << QString("Route microphone and speakers");
- routeAudio();
- }
+ {
+ qDebug() << QString("Route microphone and speakers");
+ routeAudio();
+ }
}
void PAControl::routeAudio()
PADevice* speaker;
if (m_audioRouted)
- {
- qDebug() << QString("Audio already routed");
- return;
- }
+ {
+ qDebug() << QString("Audio already routed");
+ return;
+ }
if (m_refCounter > 0)
- {
- qDebug() << "PA callback not finished, retry";
- QTimer::singleShot(1000, this, SLOT(routeAudio()));
- return;
- }
+ {
+ qDebug() << "PA callback not finished, retry";
+ QTimer::singleShot(1000, this, SLOT(routeAudio()));
+ return;
+ }
qDebug() << QString("Route audio");
source = paControl->findBluezSource();
speaker = paControl->findAlsaSink(alsaSinkName);
if (mic != NULL and speaker != NULL)
- {
- paControl->routeSourceWithSink(source, speaker);
- paControl->routeSourceWithSink(mic, sink);
- qDebug() << QString("Create loopback modules successful");
- }
+ {
+ paControl->routeSourceWithSink(source, speaker);
+ paControl->routeSourceWithSink(mic, sink);
+ qDebug() << QString("Create loopback modules successful");
+ }
else {
qDebug() << QString("Alsa source and speaker not found");
}
QList<PAModule*> mlist = paControl->getAllModules();
foreach(PAModule *module, mlist)
- {
- if (module->name.contains("module-loopback") &&
- module->argument.contains("bluez") &&
- module->argument.contains("alsa")) {
- qDebug() << QString("Found loopback module, index: ") << module->index;
- paControl->unloadModule(module);
- qDebug() << QString("Remove loopback module successful");
+ {
+ if (module->name.contains("module-loopback") &&
+ module->argument.contains("bluez") &&
+ module->argument.contains("alsa")) {
+ qDebug() << QString("Found loopback module, index: ") << module->index;
+ paControl->unloadModule(module);
+ qDebug() << QString("Remove loopback module successful");
+ }
}
- }
m_audioRouted = false;
m_btSourceReady = false;
void PAControl::onCallsChanged()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (!cm || !cm->isValid())
- {
- return;
- }
-
- if (cm->dialingCall() || cm->activeCall() || cm->callCount() > 1)
- {
- // new call is dialing or phone is picked up
- qDebug() << "PAControl: new call in progress";
-
- if(m_audioRouted)
{
- qDebug() << QString("Audio already routed");
return;
}
- if(m_btSourceReady && m_btSinkReady)
- {
- qDebug() << QString("Route microphone and speakers");
- routeAudio();
- }
- else
+ if (cm->dialingCall() || cm->activeCall() || cm->callCount() > 1)
{
- if(this->findBluezSource() != NULL && this->findBluezSink() != NULL)
- {
- // bt source and sink exists
- m_btSourceReady = true;
- m_btSinkReady = true;
- qDebug() << QString("Route microphone and speakers");
- routeAudio();
- }
+ // new call is dialing or phone is picked up
+ qDebug() << "PAControl: new call in progress";
+
+ if(m_audioRouted)
+ {
+ qDebug() << QString("Audio already routed");
+ return;
+ }
+
+ if(m_btSourceReady && m_btSinkReady)
+ {
+ qDebug() << QString("Route microphone and speakers");
+ routeAudio();
+ }
else
- {
- //no bt source or sink yet, let's wait until source and sink appears
- m_btSourceReady = false;
- m_btSinkReady = false;
- connect(this, SIGNAL(sourceAppeared(PADevice*)), this, SLOT(onSourceAppeared(PADevice*)));
- connect(this, SIGNAL(sinkAppeared(PADevice*)), this, SLOT(onSinkAppeared(PADevice*)));
- qDebug() << QString("Audio not routed yet, wait for bt source and sinks");
- }
+ {
+ if(this->findBluezSource() != NULL && this->findBluezSink() != NULL)
+ {
+ // bt source and sink exists
+ m_btSourceReady = true;
+ m_btSinkReady = true;
+ qDebug() << QString("Route microphone and speakers");
+ routeAudio();
+ }
+ else
+ {
+ //no bt source or sink yet, let's wait until source and sink appears
+ m_btSourceReady = false;
+ m_btSinkReady = false;
+ connect(this, SIGNAL(sourceAppeared(PADevice*)), this, SLOT(onSourceAppeared(PADevice*)));
+ connect(this, SIGNAL(sinkAppeared(PADevice*)), this, SLOT(onSinkAppeared(PADevice*)));
+ qDebug() << QString("Audio not routed yet, wait for bt source and sinks");
+ }
+ }
}
- }
else if (cm->callCount() <= 0)
- {
- qDebug() << QString("no more ofono calls");
- if(m_audioRouted)
{
- qDebug() << QString("Unroute microphone and speakers");
- unrouteAudio();
+ qDebug() << QString("no more ofono calls");
+ if(m_audioRouted)
+ {
+ qDebug() << QString("Unroute microphone and speakers");
+ unrouteAudio();
+ }
}
- }
}
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
+
class PAControl : public QObject
{
- Q_OBJECT
+ Q_OBJECT;
public:
PAControl(QObject *parent = 0);
~PAControl();
};
#endif // PACONTROL_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
QMLCallItem::QMLCallItem(CallItem *proxy, QObject *parent)
: QObject(parent), d(new QMLCallItemPrivate)
{
- TRACE
+ TRACE;
d->proxy = proxy;
QObject::connect(proxy->callProxy(), SIGNAL(stateChanged()), SLOT(onStateChanged()));
QMLCallItem::~QMLCallItem()
{
- TRACE
+ TRACE;
delete this->d;
}
CallItem* QMLCallItem::proxy() const
{
- TRACE
+ TRACE;
return d->proxy;
}
QString QMLCallItem::msisdn() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
- return d->proxy->callProxy()->lineID();
+ return d->proxy->callProxy()->lineID();
return QString();
}
int QMLCallItem::numberLen() const
{
- TRACE
+ TRACE;
QString number = msisdn();
return number.size();
}
QString QMLCallItem::name() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
return d->proxy->callProxy()->name();
return QString();
QString QMLCallItem::state() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
return d->proxy->callProxy()->state();
return QString();
QString QMLCallItem::reason() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
return d->proxy->callProxy()->reason();
return QString();
QDateTime QMLCallItem::startedAt() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
return d->proxy->callProxy()->startTime();
return QDateTime();
int QMLCallItem::duration() const
{
- TRACE
- return 32;
+ TRACE;
+ return 32;
if (d->proxy->callProxy())
return d->proxy->callProxy()->duration();
bool QMLCallItem::isMultiparty() const
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
return d->proxy->callProxy()->multiparty();
return false;
void QMLCallItem::answer()
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
d->proxy->callProxy()->answer();
}
void QMLCallItem::deflect(const QString &msisdn)
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
d->proxy->callProxy()->deflect(msisdn);
}
void QMLCallItem::hangup()
{
- TRACE
+ TRACE;
if (d->proxy->callProxy())
d->proxy->callProxy()->hangup();
}
void QMLCallItem::onStateChanged()
{
- TRACE
+ TRACE;
emit this->stateChanged(d->proxy->callProxy()->state());
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class QMLCallItem : public QObject
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(QString msisdn READ msisdn)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(QString state READ state NOTIFY stateChanged)
- Q_PROPERTY(QString reason READ reason)
- Q_PROPERTY(int numberLen READ numberLen)
- Q_PROPERTY(QDateTime startedAt READ startedAt)
- Q_PROPERTY(int duration READ duration)
-
- Q_PROPERTY(bool isMultiparty READ isMultiparty)
+ Q_PROPERTY(QString msisdn READ msisdn);
+ Q_PROPERTY(QString name READ name);
+ Q_PROPERTY(QString state READ state NOTIFY stateChanged);
+ Q_PROPERTY(QString reason READ reason);
+ Q_PROPERTY(int numberLen READ numberLen);
+ Q_PROPERTY(QDateTime startedAt READ startedAt);
+ Q_PROPERTY(int duration READ duration);
+ Q_PROPERTY(bool isMultiparty READ isMultiparty);
public:
explicit QMLCallItem(CallItem *proxy, QObject *parent = 0);
- ~QMLCallItem();
+ ~QMLCallItem();
QString msisdn () const;
int numberLen () const;
private:
class QMLCallItemPrivate *d;
- Q_DISABLE_COPY(QMLCallItem)
+ Q_DISABLE_COPY(QMLCallItem);
};
#endif // QMLCALLITEM_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
public:
QMLDialerPrivate()
: currentCall(NULL)
- { TRACE }
+ { TRACE; }
QMLCallItem *currentCall;
};
QMLDialer::QMLDialer(QObject *parent)
: QObject(parent), d(new QMLDialerPrivate)
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
this->connectAll();
QMLDialer::~QMLDialer()
{
- TRACE
+ TRACE;
delete this->d;
}
QString QMLDialer::mailbox() const
{
- TRACE
+ TRACE;
if(ManagerProxy::instance()->voicemail()->isConnected())
- {
- return ManagerProxy::instance()->voicemail()->mailbox();
- }
+ {
+ return ManagerProxy::instance()->voicemail()->mailbox();
+ }
// Fall back to GConf voicemail setting.
return MGConfItem(CONFIG_KEY_VOICEMAIL_NUMBER).value().toString();
{
if(ManagerProxy::instance()->modem() &&
ManagerProxy::instance()->modem()->isValid())
- {
- return ManagerProxy::instance()->modem()->powered();
- }
+ {
+ return ManagerProxy::instance()->modem()->powered();
+ }
return false;
}
void QMLDialer::setMailbox(const QString &number)
{
- TRACE
+ TRACE;
if(ManagerProxy::instance()->voicemail()->isConnected())
- {
- ManagerProxy::instance()->voicemail()->setMailbox(number);
- return;
- }
+ {
+ ManagerProxy::instance()->voicemail()->setMailbox(number);
+ return;
+ }
// Fall back to GConf voicemail setting.
MGConfItem(CONFIG_KEY_VOICEMAIL_NUMBER).set(number);
void QMLDialer::setModemOnline(bool online)
{
- if (ManagerProxy::instance() && ManagerProxy::instance()->modem())
- {
- if(ManagerProxy::instance()->modem()->isValid())
- {
- ManagerProxy::instance()->modem()->setPowered(online);
- return;
- }
- }
+ if (ManagerProxy::instance() && ManagerProxy::instance()->modem())
+ {
+ if(ManagerProxy::instance()->modem()->isValid())
+ {
+ ManagerProxy::instance()->modem()->setPowered(online);
+ return;
+ }
+ }
}
QString QMLDialer::speedDial(int index) const
{
- TRACE
+ TRACE;
return MGConfItem(QString("/apps/dialer/speeddial/%1").arg(index)).value().toString();
}
void QMLDialer::setSpeedDial(int index, const QString &number)
{
- TRACE
+ TRACE;
MGConfItem(QString("/apps/dialer/speeddial/%1").arg(index)).set(number);
}
QMLCallItem* QMLDialer::currentCall() const
{
- TRACE
+ TRACE;
return d->currentCall;
}
void QMLDialer::dial(const QString &msisdn)
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
- {
- cm->dial(msisdn);
- }
+ {
+ cm->dial(msisdn);
+ }
}
void QMLDialer::hangupAll()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if ((cm && cm->isValid()))
- {
- cm->hangupAll();
- }
+ {
+ cm->hangupAll();
+ }
}
void QMLDialer::silenceRingtone()
{
if(ManagerProxy::instance()->volumeManager()->isConnected())
- {
- qDebug() << "Attempting to mute call with volume manager.";
- ManagerProxy::instance()->volumeManager()->setMuted(true);
- }
+ {
+ qDebug() << "Attempting to mute call with volume manager.";
+ ManagerProxy::instance()->volumeManager()->setMuted(true);
+ }
else if(d->currentCall)
- {
- qDebug() << "Attempting to mute call with call item signaller.";
- d->currentCall->proxy()->silenceRingtone();
- }
+ {
+ qDebug() << "Attempting to mute call with call item signaller.";
+ d->currentCall->proxy()->silenceRingtone();
+ }
else
- {
- qDebug() << "Couldn't decide how to mute ringtone!";
- }
+ {
+ qDebug() << "Couldn't decide how to mute ringtone!";
+ }
}
void QMLDialer::sendTones(const QString &tones)
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->sendTones(tones);
void QMLDialer::transfer()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->transfer();
void QMLDialer::swapCalls()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->swapCalls();
void QMLDialer::releaseAndAnswer()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->releaseAndAnswer();
void QMLDialer::holdAndAnswer()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->holdAndAnswer();
void QMLDialer::createMultiparty()
{
- /* TRACE
- CallManager *cm = ManagerProxy::instance()->callManager();
- if (cm && cm->isValid())
- cm->createMultiparty();
-*/
}
void QMLDialer::hangupMultiparty()
{
-/*
- TRACE
- CallManager *cm = ManagerProxy::instance()->callManager();
- if (cm && cm->isValid())
- cm->hangupMultiparty();
-*/
}
void QMLDialer::privateChat(const QMLCallItem &call)
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
cm->privateChat(*call.proxy());
void QMLDialer::onCallsChanged()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if(cm->activeCall())
- {
- this->onIncomingCall(cm->activeCall());
- }
+ {
+ this->onIncomingCall(cm->activeCall());
+ }
else
- {
- delete d->currentCall;
- d->currentCall = NULL;
- }
+ {
+ delete d->currentCall;
+ d->currentCall = NULL;
+ }
}
void QMLDialer::onIncomingCall(CallItem *callitem)
{
- TRACE
+ TRACE;
d->currentCall = new QMLCallItem(callitem, this);
emit this->incomingCall();
void QMLDialer::connectAll()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
if (cm && cm->isValid())
- {
- disconnect(cm, SIGNAL(callsChanged()));
- disconnect(cm, SIGNAL(incomingCall(CallItem*)));
- connect(cm, SIGNAL(callsChanged()), this, SLOT(onCallsChanged()));
- connect(cm, SIGNAL(incomingCall(CallItem*)), SLOT(onIncomingCall(CallItem*)));
- qDebug() << QString("CallMgr is connected");
- }
+ {
+ disconnect(cm, SIGNAL(callsChanged()));
+ disconnect(cm, SIGNAL(incomingCall(CallItem*)));
+ connect(cm, SIGNAL(callsChanged()), this, SLOT(onCallsChanged()));
+ connect(cm, SIGNAL(incomingCall(CallItem*)), SLOT(onIncomingCall(CallItem*)));
+ qDebug() << QString("CallMgr is connected");
+ }
else if (cm)
- {
- disconnect(cm, SIGNAL(connected()));
- connect(cm, SIGNAL(connected()), this, SLOT(connectAll()));
- qDebug() << QString("CallMgr is not yet valid");
- }
+ {
+ disconnect(cm, SIGNAL(connected()));
+ connect(cm, SIGNAL(connected()), this, SLOT(connectAll()));
+ qDebug() << QString("CallMgr is not yet valid");
+ }
}
void QMLDialer::onCallManagerChanged()
{
- TRACE
+ TRACE;
CallManager *cm = ManagerProxy::instance()->callManager();
this->connectAll();
if(cm && cm->activeCall()) d->currentCall = new QMLCallItem(cm->activeCall(), this);
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class QMLDialer : public QObject
{
- Q_OBJECT
+ Q_OBJECT;
- Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox)
- Q_PROPERTY(QMLCallItem* currentCall READ currentCall)
- Q_PROPERTY(bool modemOnline READ modemOnline WRITE setModemOnline)
+ Q_PROPERTY(QString mailbox READ mailbox WRITE setMailbox);
+ Q_PROPERTY(QMLCallItem* currentCall READ currentCall);
+ Q_PROPERTY(bool modemOnline READ modemOnline WRITE setModemOnline);
public:
explicit QMLDialer(QObject *parent = 0);
- ~QMLDialer();
+ ~QMLDialer();
QString mailbox () const;
QMLCallItem* currentCall () const;
};
#endif // QMLDIALER_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
engine(NULL),
component(NULL),
item(NULL)
- { TRACE }
+ { TRACE; }
QMLDialer *adapter;
QDeclarativeEngine *engine;
static void registerDataTypes()
{
- TRACE
+ TRACE;
qmlRegisterType<QMLDialer>("com.tizen.hfdialer", 1, 0, "Dialer");
qmlRegisterUncreatableType<QMLCallItem>("com.tizen.hfdialer", 1, 0, "CallItem", "");
: QDeclarativeView(parent),
d(new QMLMainWindowPrivate)
{
- TRACE
+ TRACE;
DialerApplication *da = DialerApplication::instance();
CallManager *cm = ManagerProxy::instance()->callManager();
QMLMainWindow::~QMLMainWindow()
{
- TRACE
+ TRACE;
delete this->d;
}
QMLMainWindow* QMLMainWindow::instance()
{
- TRACE
+ TRACE;
static QMLMainWindow *_instance = NULL;
if(_instance == NULL)
- {
- registerDataTypes();
- _instance = new QMLMainWindow;
- }
+ {
+ registerDataTypes();
+ _instance = new QMLMainWindow;
+ }
return _instance;
}
QMLMainWindow* QMLMainWindow::instanceP(QWidget* parent)
{
- TRACE
+ TRACE;
static QMLMainWindow *_instance = NULL;
if(_instance == NULL)
- {
- registerDataTypes();
- _instance = new QMLMainWindow(parent);
- }
+ {
+ registerDataTypes();
+ _instance = new QMLMainWindow(parent);
+ }
return _instance;
}
void QMLMainWindow::setupUi()
{
- TRACE
+ TRACE;
MGConfItem qmlUrl(CONFIG_KEY_QML_LOAD_URL);
d->engine = new QDeclarativeEngine(this);
d->engine->addImportPath("/usr/share/hfdialer/qml/base");
d->engine->rootContext()->setContextProperty("controller", this); //TODO: Remove
- // d->engine->rootContext()->setContextProperty("History", DialerApplication::instance()->historyProxy());
this->setSource(QUrl::fromLocalFile("/usr/share/hfdialer/qml/main.qml"));
- //this->setResizeMode(QDeclarativeView::SizeRootObjectToView);
- //this->setSize(this->geometry);
d->component = new QDeclarativeComponent(d->engine, this);
d->component->loadUrl(qmlUrl.value(DEFAULT_QML_LOAD_URL).toString());
if(d->component->isError())
- {
- qCritical() << "Failed to load QML Component:" << d->component->errorString();
- return;
- }
+ {
+ qCritical() << "Failed to load QML Component:" << d->component->errorString();
+ return;
+ }
d->item = qobject_cast<QDeclarativeItem*>(d->component->create());
if(!d->item)
- {
- qCritical() << "Failed to create item from component!";
- return;
- }
+ {
+ qCritical() << "Failed to create item from component!";
+ return;
+ }
}
void QMLMainWindow::tryToShow()
{
- TRACE
+ TRACE;
- if (d->component->isReady())
- {
- DialerApplication *da = DialerApplication::instance();
- da->setActiveWindow(this);
- da->activeWindow()->show();
- da->activeWindow()->activateWindow();
- da->activeWindow()->raise();
- this->show();
- }
+ if (d->component->isReady())
+ {
+ DialerApplication *da = DialerApplication::instance();
+ da->setActiveWindow(this);
+ da->activeWindow()->show();
+ da->activeWindow()->activateWindow();
+ da->activeWindow()->raise();
+ this->show();
+ }
}
void QMLMainWindow::hide()
{
- TRACE
+ TRACE;
QGraphicsView::hide();
}
void QMLMainWindow::closeEvent(QCloseEvent *event)
{
- TRACE
-/* if(this->closeOnLazyShutdown())
- {
- this->setCloseOnLazyShutdown(false);
- }
-*/
+ TRACE;
event->accept();
}
void QMLMainWindow::onGeometryChanged()
{
- TRACE
- // d->item->setSize(d->widget->size());
+ TRACE;
}
void QMLMainWindow::setAdapter(QMLDialer *adapter)
{
- TRACE
+ TRACE;
d->adapter = adapter;
}
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */
class QMLMainWindow : public QDeclarativeView
{
- Q_OBJECT
+ Q_OBJECT;
public:
static QMLMainWindow* instance();
static QMLMainWindow* instanceP(QWidget* parent);
- ~QMLMainWindow();
+ ~QMLMainWindow();
public Q_SLOTS:
void hide();
};
#endif // QMLMAINWINDOW_H
+
+/* Local Variables: */
+/* mode:c++ */
+/* c-basic-offset:4 */
+/* indent-tabs-mode: nil */
+/* End: */