phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/src/infowidgetsathandler.cpp
changeset 27 2f8f8080a020
parent 22 6bb1b21d2484
--- a/phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/src/infowidgetsathandler.cpp	Fri Apr 16 14:58:25 2010 +0300
+++ b/phoneplugins/infowidgetplugin/infowidgetprovider/infowidget/src/infowidgetsathandler.cpp	Mon May 03 12:31:11 2010 +0300
@@ -17,19 +17,24 @@
 
 
 #include "infowidgetsathandler.h"
+#include "infowidgetsathandlerprivate.h"
 #include "infowidgetlogging.h"
+#include <rsatservice.h>
 
+/*!
+  \class InfoWidgetSatHandler
+  \brief Handles SIM Application Toolkit specific functionality of 
+         Operator info widget
+*/
 
 /*!
  */
 InfoWidgetSatHandler::InfoWidgetSatHandler(QObject *parent):
-    QObject(parent)
+    QObject(parent) , m_connected(false)
 {
     DPRINT << ": IN";
-    
-    // ToDo: remove when SAT implemented / releasing 
-    DPRINT << ": setting DUMMY DATA to sat display text";
-    m_displayText = "SAT DISPLAY TEXT"; 
+   
+    d_ptr = new InfoWidgetSatHandlerPrivate(this, m_satService);
     
     DPRINT << ": OUT";
 }
@@ -39,19 +44,41 @@
 InfoWidgetSatHandler::~InfoWidgetSatHandler()
 {
     DPRINT << ": IN";
+    delete d_ptr;
     DPRINT << ": OUT";
-}    
+} 
 
 /*!
+   InfoWidgetSatHandler::connect
+ */
+void InfoWidgetSatHandler::connect(bool connect)
+{
+    DPRINT << ": IN : connected = " << m_connected << " : connect = " << connect;
+    if(connect && !m_connected){
+        DPRINT << "connect and startObserving() ";
+        m_connected = d_ptr->connect();
+        if(m_connected){
+            d_ptr->startObserving();
+        }
+    }else if (!connect && m_connected){
+        DPRINT << "disconnect and stopObserving() ";
+        m_connected = d_ptr->disconnect();
+    }
+    DPRINT << ": OUT : connected = " << m_connected;
+}
+
+/*!
+   InfoWidgetSatHandler::logCurrentInfo
  */
 void InfoWidgetSatHandler::logCurrentInfo()
 {
     DPRINT << ": IN"; 
-    DPRINT << ": OUT";
-    
+    DPRINT << "SAT IdleModeText: " << m_displayText;
+    DPRINT << ": OUT";    
 } 
 
 /*!
+   InfoWidgetSatHandler::satDisplayText
  */
 const QString& InfoWidgetSatHandler::satDisplayText() const
 {
@@ -60,6 +87,7 @@
 }
 
 /*!
+   InfoWidgetSatHandler::setSatDisplayText
  */
 void InfoWidgetSatHandler::setSatDisplayText(const QString& displayText)
 {
@@ -67,5 +95,33 @@
     m_displayText = displayText;
 }
 
+/*!
+   InfoWidgetSatHandler::handleIdleModeTxtMessage
+ */
+void InfoWidgetSatHandler::handleIdleModeTxtMessage( int idleResult )
+{
+    DPRINT << ": handleIdleModeTxtMessage: " << idleResult;
+    if(m_connected){
+        m_satService.SetIdleModeTextResponse((RSatService::TSATIdleResult)idleResult);
+    }
+    else{
+        //TODO: What's correct response if widget isn't visible? For now it's permanen problem
+        m_satService.SetIdleModeTextResponse( RSatService::ESATIdleCmdBeyondMeCapabilities );
+    }
+ 
+    //Pass the result
+    emit handleMessage(idleResult);
+}
+
+/*!
+   InfoWidgetSatHandler::handleSatError
+ */
+void InfoWidgetSatHandler::handleSatError( int operation, int errorCode )
+{
+    DPRINT << ": satError : operation: " << operation << ": errorCode: "<<errorCode;
+    m_satService.SetIdleModeTextResponse( RSatService::ESATIdleMeUnableToProcessCmd );
+    emit handleError(operation, errorCode);
+}
+
 // End of File.