phoneplugins/infowidgetplugin/infowidget/src/infowidgetsathandler.cpp
branchRCL_3
changeset 61 41a7f70b3818
equal deleted inserted replaced
58:40a3f856b14d 61:41a7f70b3818
       
     1 /*
       
     2  * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved.
       
     4  * This component and the accompanying materials are made available
       
     5  * under the terms of "Eclipse Public License v1.0"
       
     6  * which accompanies this distribution, and is available
       
     7  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8  *
       
     9  * Initial Contributors:
       
    10  * Nokia Corporation - initial contribution.
       
    11  *
       
    12  * Contributors:
       
    13  *
       
    14  * Description:
       
    15  *
       
    16  */
       
    17 
       
    18 
       
    19 #include "infowidgetsathandler.h"
       
    20 #include "infowidgetlogging.h"
       
    21 #include <rsatservice.h>
       
    22 
       
    23 /*!
       
    24   \class InfoWidgetSatHandler
       
    25   \brief Handles SIM Application Toolkit specific functionality of 
       
    26          Operator info widget
       
    27 */
       
    28 
       
    29 /*!
       
    30    InfoWidgetSatHandler::InfoWidgetSatHandler
       
    31  */
       
    32 InfoWidgetSatHandler::InfoWidgetSatHandler(QObject *parent):
       
    33     QObject(parent),
       
    34     m_satHandlerPrivate(NULL), 
       
    35     m_connected(false)
       
    36 {
       
    37     DPRINT << ": IN";
       
    38     m_satHandlerPrivate.reset(
       
    39             new InfoWidgetSatHandlerPrivate(this, m_satService));
       
    40     DPRINT << ": OUT";
       
    41 }
       
    42 
       
    43 /*!
       
    44    InfoWidgetSatHandler::~InfoWidgetSatHandler
       
    45  */
       
    46 InfoWidgetSatHandler::~InfoWidgetSatHandler()
       
    47 {
       
    48     DPRINT; 
       
    49 }
       
    50 
       
    51 /*!
       
    52    InfoWidgetSatHandler::connect
       
    53  */
       
    54 void InfoWidgetSatHandler::connect(bool connect)
       
    55 {
       
    56     DPRINT; 
       
    57     if (connect && !m_connected) {
       
    58         DPRINT << "connect and startObserving() ";
       
    59         m_connected = m_satHandlerPrivate->connect();
       
    60         if (m_connected) {
       
    61             m_satHandlerPrivate->startObserving();
       
    62         }
       
    63     } else if (!connect && m_connected) {
       
    64         DPRINT << "disconnect and stopObserving() ";
       
    65         m_satHandlerPrivate->disconnect();
       
    66         m_connected = false; 
       
    67     }
       
    68     DPRINT << ": connected = " << m_connected;
       
    69 }
       
    70 
       
    71 /*!
       
    72    InfoWidgetSatHandler::satDisplayText
       
    73  */
       
    74 const QString& InfoWidgetSatHandler::satDisplayText() const
       
    75 {
       
    76     DPRINT << ": text: " << m_displayText; 
       
    77     return m_displayText;
       
    78 }
       
    79 
       
    80 /*!
       
    81    InfoWidgetSatHandler::setSatDisplayText
       
    82  */
       
    83 void InfoWidgetSatHandler::setSatDisplayText(
       
    84         const QString& displayText)
       
    85 {
       
    86     DPRINT << ": display text: " << displayText;
       
    87     m_displayText = displayText;
       
    88 }
       
    89 
       
    90 /*!
       
    91    InfoWidgetSatHandler::handleIdleModeTxtMessage
       
    92  */
       
    93 void InfoWidgetSatHandler::handleIdleModeTxtMessage(int idleResult)
       
    94 {
       
    95     DPRINT << ": handleIdleModeTxtMessage: " << idleResult;
       
    96     if (m_connected) {
       
    97         m_satService.SetIdleModeTextResponse(
       
    98                 static_cast<RSatService::TSATIdleResult>(idleResult));
       
    99     } else {
       
   100         m_satService.SetIdleModeTextResponse( 
       
   101                 RSatService::ESATIdleCmdBeyondMeCapabilities );
       
   102     }
       
   103  
       
   104     // Emit the result
       
   105     emit handleMessage(idleResult);
       
   106 }
       
   107 
       
   108 /*!
       
   109    InfoWidgetSatHandler::handleSatError
       
   110  */
       
   111 void InfoWidgetSatHandler::handleSatError(
       
   112         int operation, int errorCode)
       
   113 {
       
   114     DWARNING << ": satError : operation: " << 
       
   115             operation << ": errorCode: "<<errorCode;
       
   116     m_satService.SetIdleModeTextResponse( 
       
   117             RSatService::ESATIdleMeUnableToProcessCmd);
       
   118     emit handleError(operation, errorCode);
       
   119 }
       
   120 
       
   121 // End of File. 
       
   122