X-Git-Url: http://git.maemo.org/git/?p=jenirok;a=blobdiff_plain;f=src%2Fdaemon%2Fcalllistener.h;h=5e1d18b54de51f5739f890ba72db22795b0d7fef;hp=41ea53ec062a422f4a15c1fb824e32e7f65730e1;hb=311f8d8c00ac52bcb59c1f3aa8523f905584f1bf;hpb=f47fcb3ca78e8b27cace31fb18becd9dfa35d3d8 diff --git a/src/daemon/calllistener.h b/src/daemon/calllistener.h index 41ea53e..5e1d18b 100644 --- a/src/daemon/calllistener.h +++ b/src/daemon/calllistener.h @@ -25,41 +25,71 @@ #include #include #include "informationbox.h" -#include "eniro.h" -#include "contactmanager.h" +#include "source.h" class CallListener: public QObject { - Q_OBJECT public: CallListener(); ~CallListener(); - void begin(); + bool begin(); void end(); - static const int REQUEST_TIMEOUT = 15000; - static const int BANNER_DELAY = 400; + static const int REQUEST_TIMEOUT = 10000; + static const int BANNER_DELAY = 350; + static const int SEARCH_RETRIES = 2; + static const int CONNECT_RETRIES = 2; + static const int CONNECTION_LOOKUP_RETRIES = 10; + static const int GPRS_SCANS = 2; + static const int WLAN_SCANS = 5; + static const int WAIT_BETWEEN_RETRIES = 500; + static const int ERROR_BANNER_TIMEOUT = 4500; + +protected: + virtual void timerEvent(QTimerEvent* event); private slots: - void requestFinished(QVector const& results, Eniro::SearchDetails const& details, bool error); + void requestFinished(QVector const& results, Source::SearchDetails const& details, bool error); void incomingCall(QDBusObjectPath path, QString numbe); void callTerminate(); void showTimedMessage(); + void handleAnswer(); private: Q_DISABLE_COPY(CallListener); - void search(Eniro::SearchDetails const& details); + struct CallDetails + { + QString number; + Source::Result result; + bool answered; + unsigned int time; + }; + + void search(Source::SearchDetails const& details); void showResult(QString const& text); - void showDelayedResult(QString const& text); + void showDelayedResult(QString const& text, int delay); + void searchInit(); + void searchClose(); + bool handleConnection(); + void showError(QString const& msg, int delay = 0); + bool is3g(); + void sleep(int ms); + void sendRetrySignal(QString const& iap, bool retry); QString createResult(QString const& name, QString const& street, QString const& city); QString timedMessage_; - Eniro* eniro_; - ContactManager* contactManager_; + Source* source_; + Source::SourceId sourceId_; + QMap sourceConfig_; + bool closeConnection_; + bool initialized_; InformationBox* box_; QLabel* label_; static QDBusConnection systemBus_; + int retries_; + int timer_; + CallDetails* currentCall_; }; #endif // CALLLISTENER_H