/** * Copyright (C) 2013 Canonical, Ltd. * * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License version 3, as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranties of MERCHANTABILITY, * SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . * * Authors: Tiago Salem Herrmann */ #ifndef OFONOCONNECTION_H #define OFONOCONNECTION_H // telepathy-qt #include #include #include #include #include // ofono-qt #include #include #include #include #include #include #include #include // telepathy-ofono #include "ofonotextchannel.h" #include "ofonocallchannel.h" #include "emergencymodeiface.h" #include "voicemailiface.h" #include "mmsdmanager.h" #include "mmsdmessage.h" #include "dbustypes.h" #include "speakeriface.h" #include "ussdiface.h" class oFonoConnection; class oFonoTextChannel; class oFonoCallChannel; class oFonoConferenceCallChannel; class MMSDService; class oFonoConnection : public Tp::BaseConnection { Q_OBJECT Q_DISABLE_COPY(oFonoConnection) public: oFonoConnection(const QDBusConnection &dbusConnection, const QString &cmName, const QString &protocolName, const QVariantMap ¶meters); QStringList inspectHandles(uint handleType, const Tp::UIntList& handles, Tp::DBusError *error); Tp::UIntList requestHandles(uint handleType, const QStringList& identifiers, Tp::DBusError* error); Tp::BaseChannelPtr createChannel(const QString& channelType, uint targetHandleType, uint targetHandle, const QVariantMap &hints, Tp::DBusError *error); Tp::ContactAttributesMap getContactAttributes(const Tp::UIntList &handles, const QStringList &ifaces, Tp::DBusError *error); uint setPresence(const QString& status, const QString& statusMessage, Tp::DBusError *error); void connect(Tp::DBusError *error); void setOnline(bool online); void setSpeakerMode(bool active); bool speakerMode(); QStringList emergencyNumbers(Tp::DBusError *error); bool voicemailIndicator(Tp::DBusError *error); QString voicemailNumber(Tp::DBusError *error); uint voicemailCount(Tp::DBusError *error); void USSDInitiate(const QString &command, Tp::DBusError *error); void USSDRespond(const QString &reply, Tp::DBusError *error); void USSDCancel(Tp::DBusError *error); Tp::BaseConnectionRequestsInterfacePtr requestsIface; Tp::BaseConnectionSimplePresenceInterfacePtr simplePresenceIface; Tp::BaseConnectionContactsInterfacePtr contactsIface; BaseConnectionEmergencyModeInterfacePtr emergencyModeIface; BaseConnectionVoicemailInterfacePtr voicemailIface; BaseConnectionUSSDInterfacePtr supplementaryServicesIface; uint newHandle(const QString &identifier); OfonoMessageManager *messageManager(); OfonoVoiceCallManager *voiceCallManager(); OfonoCallVolume *callVolume(); QMap callChannels(); uint ensureHandle(const QString &phoneNumber); oFonoTextChannel* textChannelForMembers(const QStringList &members); Tp::BaseChannelPtr createTextChannel(uint targetHandleType, uint targetHandle, const QVariantMap &hints, Tp::DBusError *error); Tp::BaseChannelPtr createCallChannel(uint targetHandleType, uint targetHandle, const QVariantMap &hints, Tp::DBusError *error); Tp::BaseChannelPtr ensureChannel(const QString &channelType, uint targetHandleType, uint targetHandle, bool &yours, uint initiatorHandle, bool suppressHandler, const QVariantMap &hints, Tp::DBusError* error); QDBusObjectPath sendMMS(const QStringList &numbers, const OutgoingAttachmentList& attachments); ~oFonoConnection(); Q_SIGNALS: void speakerModeChanged(bool active); void channelMerged(const QDBusObjectPath &objPath); void channelSplitted(const QDBusObjectPath &objPath); void channelHangup(const QDBusObjectPath &objPath); public Q_SLOTS: void updateAudioRoute(); private Q_SLOTS: void onOfonoIncomingMessage(const QString &message, const QVariantMap &info); void onOfonoImmediateMessage(const QString &message, const QVariantMap &info); void onOfonoCallAdded(const QString &call, const QVariantMap &properties); void onOfonoNetworkRegistrationChanged(const QString &status); void onTextChannelClosed(); void onCallChannelClosed(); void onCallChannelDestroyed(); void onValidityChanged(bool valid); void onMMSDServiceAdded(const QString&); void onMMSDServiceRemoved(const QString&); void onMMSAdded(const QString &, const QVariantMap&); void onMMSRemoved(const QString &); void onCheckMMSServices(); void onMessageRead(const QString &id); void onDeliveryReportReceived(const QString &messageId, const QVariantMap &info); void onConferenceCallChannelClosed(); void onCallChannelMerged(); void onCallChannelSplitted(); void onMultipartyCallHeld(); void onMultipartyCallActive(); private: bool isNetworkRegistered(); bool isEmergencyNumber(const QString &number); void addMMSToService(const QString &path, const QVariantMap &properties, const QString &servicePath); void ensureTextChannel(const QString &message, const QVariantMap &info, bool flash); QMap mHandles; QList mTextChannels; QMap mCallChannels; QStringList mModems; OfonoModemManager *mOfonoModemManager; OfonoMessageManager *mOfonoMessageManager; OfonoVoiceCallManager *mOfonoVoiceCallManager; OfonoCallVolume *mOfonoCallVolume; OfonoNetworkRegistration *mOfonoNetworkRegistration; OfonoMessageWaiting *mOfonoMessageWaiting; OfonoSupplementaryServices *mOfonoSupplementaryServices; uint mHandleCount; Tp::SimplePresence mSelfPresence; Tp::SimplePresence mRequestedSelfPresence; MMSDManager *mMmsdManager; QMap mMmsdServices; QMap > mServiceMMSList; oFonoConferenceCallChannel *mConferenceCall; bool mSpeakerMode; }; #endif