cellular/telephonysettings/xqbindings/psetwrapper/src/psetcallwaitingwrapper_p.cpp
branchRCL_3
changeset 20 987c9837762f
parent 19 7d48bed6ce0c
child 21 0a6dd2dc9970
equal deleted inserted replaced
19:7d48bed6ce0c 20:987c9837762f
     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 #include <rsssettings.h>
       
    19 #include <psetcontainer.h>
       
    20 #include <psetcallwaiting.h>
       
    21 #include "psetcallwaitingwrapper.h"
       
    22 #include "psetcallwaitingwrapper_p.h"
       
    23 #include "logging.h"
       
    24 
       
    25 /*!
       
    26   ConvertToQtType
       
    27  */
       
    28 PSetCallWaitingWrapper::PsCallWaitingStatus ConvertToQtType(
       
    29     const MPsetCallWaiting::TGetCallWaitingStatus& status)
       
    30 {
       
    31     PSetCallWaitingWrapper::PsCallWaitingStatus convertedType =
       
    32         PSetCallWaitingWrapper::StatusUnknown;
       
    33     
       
    34     switch (status) {
       
    35         case MPsetCallWaiting::EStatusActive:
       
    36             convertedType = PSetCallWaitingWrapper::StatusActive;
       
    37             break;
       
    38         case MPsetCallWaiting::EStatusDisabled:
       
    39             convertedType = PSetCallWaitingWrapper::StatusDisabled;
       
    40             break;
       
    41         case MPsetCallWaiting::EStatusNotAvailable:
       
    42             convertedType = PSetCallWaitingWrapper::StatusNotAvailable;
       
    43             break;
       
    44         case MPsetCallWaiting::EStatusNotProvisioned:
       
    45             convertedType = PSetCallWaitingWrapper::StatusNotProvisioned;
       
    46             break;
       
    47         case MPsetCallWaiting::EStatusUnknown:
       
    48             convertedType = PSetCallWaitingWrapper::StatusUnknown;
       
    49             break;
       
    50         default:
       
    51             Q_ASSERT_X(false, "switch default", "unknown enumerator");
       
    52             break;
       
    53     }
       
    54     
       
    55     return convertedType;
       
    56 }
       
    57 
       
    58 /*!
       
    59   ConvertToQtType
       
    60  */
       
    61 PSetCallWaitingWrapper::PsCallWaitingCommand ConvertToQtType(
       
    62     const MPsetCallWaiting::TSetCallWaiting& callWaitingCommand)
       
    63 {
       
    64     PSetCallWaitingWrapper::PsCallWaitingCommand convertedType =
       
    65         PSetCallWaitingWrapper::ActivateCallWaiting;
       
    66     
       
    67     switch (callWaitingCommand) {
       
    68         case MPsetCallWaiting::EActivateCallWaiting:
       
    69             convertedType = PSetCallWaitingWrapper::ActivateCallWaiting;
       
    70             break;
       
    71         case MPsetCallWaiting::EDeactivateCallWaiting:
       
    72             convertedType = PSetCallWaitingWrapper::DeactivateCallWaiting;
       
    73             break;
       
    74         default:
       
    75             Q_ASSERT_X(false, "switch default", "unknown enumerator");
       
    76             break;
       
    77     }
       
    78     
       
    79     return convertedType;
       
    80 }
       
    81     
       
    82 /*!
       
    83   PSetCallWaitingWrapperPrivate::PSetCallWaitingWrapperPrivate
       
    84  */
       
    85 PSetCallWaitingWrapperPrivate::PSetCallWaitingWrapperPrivate( 
       
    86         PSetCallWaitingWrapper &owner ) : m_Owner(owner)
       
    87 {
       
    88     DPRINT;
       
    89 }
       
    90 
       
    91 /*!
       
    92   PSetCallWaitingWrapperPrivate::~PSetCallWaitingWrapperPrivate
       
    93  */
       
    94 PSetCallWaitingWrapperPrivate::~PSetCallWaitingWrapperPrivate()
       
    95 {
       
    96     DPRINT;
       
    97 }
       
    98 
       
    99 // --------  Observer interface  --------- // 
       
   100 /*!
       
   101   PSetCallWaitingWrapperPrivate::HandleCallWaitingGetStatusL
       
   102  */
       
   103 void PSetCallWaitingWrapperPrivate::HandleCallWaitingGetStatusL( 
       
   104         const MPsetCallWaiting::TGetCallWaitingStatus aStatus, 
       
   105         TUint8 aBsc[KPSetNumberOfBsc] )
       
   106 {
       
   107     DPRINT << "aStatus:" << aStatus;
       
   108     
       
   109     QT_TRYCATCH_LEAVING(
       
   110         QList<unsigned char> basicServiceGroupIds;
       
   111         int index = 0;
       
   112         unsigned char groupIdCandidate = aBsc[index];
       
   113         while (groupIdCandidate != KPSetUnusedValue) {
       
   114             basicServiceGroupIds << groupIdCandidate;
       
   115             groupIdCandidate = aBsc[++index];
       
   116         }
       
   117         
       
   118         emit m_Owner.handleCallWaitingGetStatus(
       
   119             ConvertToQtType(aStatus), basicServiceGroupIds );
       
   120     )
       
   121 }
       
   122 
       
   123 /*!
       
   124   PSetCallWaitingWrapperPrivate::HandleCallWaitingChangedL
       
   125  */
       
   126 void PSetCallWaitingWrapperPrivate::HandleCallWaitingChangedL( 
       
   127         const MPsetCallWaiting::TSetCallWaiting aSetting, 
       
   128         const int aResult )
       
   129 {
       
   130     DPRINT << "aSetting: " << aSetting
       
   131             << "aResult" << aResult;
       
   132     
       
   133     QT_TRYCATCH_LEAVING(
       
   134         emit m_Owner.handleCallWaitingChanged(
       
   135             ConvertToQtType(aSetting), 
       
   136             static_cast<int>(aResult) );
       
   137     )
       
   138 }
       
   139 
       
   140 /*!
       
   141   PSetCallWaitingWrapperPrivate::HandleCWRequestingL
       
   142  */
       
   143 void PSetCallWaitingWrapperPrivate::HandleCWRequestingL( TBool aOngoing, 
       
   144         TBool aInterrupted )   
       
   145 {
       
   146     DPRINT << "aOngoing: " << aOngoing
       
   147             << " aInterrupted: " << aInterrupted;
       
   148     
       
   149     QT_TRYCATCH_LEAVING(
       
   150         emit m_Owner.handleCallWaitingRequesting( 
       
   151             static_cast<bool>(aOngoing), 
       
   152             static_cast<bool>(aInterrupted) );
       
   153     )
       
   154 }
       
   155 
       
   156 /*!
       
   157   PSetCallWaitingWrapperPrivate::HandleCWErrorL
       
   158  */
       
   159 void PSetCallWaitingWrapperPrivate::HandleCWErrorL( TInt aError )
       
   160 {
       
   161     DPRINT << "aError: " << aError;
       
   162     
       
   163     QT_TRYCATCH_LEAVING(
       
   164         emit m_Owner.handleCallWaitingError( aError );
       
   165     )
       
   166 }
       
   167 
       
   168 /*!
       
   169   PSetCallWaitingWrapperPrivate::SetEngineContact
       
   170  */
       
   171 void PSetCallWaitingWrapperPrivate::SetEngineContact(
       
   172         MPsetCallWaiting& aEngineContact )
       
   173 {   
       
   174     DPRINT << "aEngineContact: " << &aEngineContact;
       
   175 }
       
   176 
       
   177 // End of File.