callcontinuity/vcchotrigger/src/vcchopolicyreader.cpp
changeset 0 a4daefaec16c
equal deleted inserted replaced
-1:000000000000 0:a4daefaec16c
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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 
       
    20 #include "vcchopolicyreader.h"
       
    21 #include "vccspsettings.h"
       
    22 #include "rubydebug.h"
       
    23 
       
    24 _LIT( KVccServiceName,               "VCC" );
       
    25 
       
    26 // ======== MEMBER FUNCTIONS ========
       
    27 // ---------------------------------------------------------------------------
       
    28 // C++ constructor
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 CVccHoPolicyReader::CVccHoPolicyReader()
       
    32     : iPolicy()
       
    33     {
       
    34     }
       
    35 
       
    36 // ---------------------------------------------------------------------------
       
    37 // Symbian 2nd phase constructor
       
    38 // ---------------------------------------------------------------------------
       
    39 //
       
    40 void CVccHoPolicyReader::ConstructL()
       
    41     {
       
    42     RUBY_DEBUG_BLOCKL( "ConstructL" );
       
    43 
       
    44     iSpSettings = CVccSPSettings::NewL();
       
    45     }
       
    46     
       
    47 // ---------------------------------------------------------------------------
       
    48 // Constructor
       
    49 // ---------------------------------------------------------------------------
       
    50 //          
       
    51 CVccHoPolicyReader* CVccHoPolicyReader::NewL()
       
    52     {
       
    53     RUBY_DEBUG_BLOCKL( "NewL" );
       
    54 
       
    55     CVccHoPolicyReader* self = CVccHoPolicyReader::NewLC();
       
    56     CleanupStack::Pop( self );
       
    57 
       
    58     return self;
       
    59     }
       
    60     
       
    61 // ---------------------------------------------------------------------------
       
    62 // Constructor
       
    63 // ---------------------------------------------------------------------------
       
    64 //  
       
    65 CVccHoPolicyReader* CVccHoPolicyReader::NewLC()
       
    66     {
       
    67     CVccHoPolicyReader* self = new( ELeave ) CVccHoPolicyReader();
       
    68     CleanupStack::PushL( self );
       
    69     self->ConstructL();
       
    70 
       
    71     return self;
       
    72     }
       
    73     
       
    74 // ---------------------------------------------------------------------------
       
    75 // Destructor
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 CVccHoPolicyReader::~CVccHoPolicyReader()
       
    79     {
       
    80     RUBY_DEBUG0( "~CVccHoPolicyReader START" );
       
    81 
       
    82     delete iSpSettings;
       
    83 
       
    84     RUBY_DEBUG0( "~CVccHoPolicyReader STOP" ); 
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // Returns ho policy 
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 TVccHoPolicy CVccHoPolicyReader::HoPolicy() const
       
    92     {
       
    93     return iPolicy;
       
    94     }  
       
    95       
       
    96 // ---------------------------------------------------------------------------
       
    97 // Reads current settings which define when Ho can occur 
       
    98 // from Sp table and user modifiable repositories.
       
    99 // ---------------------------------------------------------------------------
       
   100 //      
       
   101 void CVccHoPolicyReader::ReadSettingsL()
       
   102     {
       
   103     RUBY_DEBUG_BLOCK( "ReadSettingsL" );
       
   104 
       
   105     iSpSettings->ReadSettingsL( KVccServiceName );
       
   106     //read user settings
       
   107     
       
   108     ResolvePreferredDomainL();
       
   109     ResolveImmediateHoL();
       
   110     ResolveHoDirectionL();
       
   111     ResolveHoInHeldWaitingCallsL();   
       
   112     ResolveSignalLevelParametersL();
       
   113     ResolveDtAllowedWhenCsOriginatedL();
       
   114     }
       
   115 
       
   116 // ---------------------------------------------------------------------------
       
   117 // Defines what is the preferred domain the user should use for MO calls.
       
   118 // 3GPP 24.216-720 defines operator preference:
       
   119 // 0 - Indicates the preference for CS domain.
       
   120 // 1 - Indicates the preference for IM CN subsystem.
       
   121 // 2 - Indicates the preference for CS domain only.
       
   122 // 3 - Indicates the preference for IM CN subsystem only.
       
   123 //
       
   124 // User preferred domain overrides operator preference.
       
   125 // User preference modes: CS/PS 
       
   126 // ---------------------------------------------------------------------------
       
   127 //     
       
   128 void CVccHoPolicyReader::ResolvePreferredDomainL()
       
   129     {
       
   130     RUBY_DEBUG_BLOCK( "ResolvePreferredDomainL" );
       
   131 
       
   132     TVccHoPolicyPreferredDomain val = 
       
   133     static_cast<TVccHoPolicyPreferredDomain>( iSpSettings->PreferredDomainL() );
       
   134     
       
   135     iPolicy.SetPreferredDomain( val );
       
   136     }
       
   137     
       
   138 // ---------------------------------------------------------------------------
       
   139 // Defines should handover occur immediately when preferred network becomes
       
   140 // available
       
   141 // 3GPP 24.216-720 defines operator preference: 
       
   142 //  0 - Indicates the preference to not initiate domain transfer immediately 
       
   143 //      to the preferred domain when that domain becomes available.
       
   144 //  1 - Indicates the preference to initiate domain transfer immediately to 
       
   145 //      the preferred domain when that domain becomes available.
       
   146 //
       
   147 // ---------------------------------------------------------------------------
       
   148 //  
       
   149 void  CVccHoPolicyReader::ResolveImmediateHoL()
       
   150     {
       
   151     RUBY_DEBUG_BLOCK( "ResolveImmediateHoL" );
       
   152 
       
   153     TBool val( iSpSettings->ImmediateDtL() );
       
   154     
       
   155     iPolicy.SetDoImmediateHo( val );
       
   156     }
       
   157     
       
   158 // ---------------------------------------------------------------------------
       
   159 // Resolves into which domain hanover can occur 
       
   160 // 3GPP 24.216-720 defines operator preference:
       
   161 // 0 - Indicates that the network operator prefers the domain transfer in the
       
   162 //     CS to IM CN/IM CN to CS subsystem direction can occur.
       
   163 // 1 - Indicates that the network operator prefers the domain transfer in the 
       
   164 //     CS to IM CN/IM CN to CS subsystem direction cannot occur.
       
   165 //
       
   166 // ---------------------------------------------------------------------------
       
   167 //   
       
   168 void CVccHoPolicyReader::ResolveHoDirectionL()
       
   169     {
       
   170     RUBY_DEBUG_BLOCK( "ResolveHoDirectionL" );
       
   171 
       
   172     TInt val( 0 );
       
   173     
       
   174     if( iSpSettings->DtCsToPsAllowedL() == 0 )
       
   175         val |= ECsToPsAllowed;
       
   176     
       
   177     if( iSpSettings->DtPsToCsAllowedL() == 0 )
       
   178         val |= EPsToCsAllowed;
       
   179     
       
   180     iPolicy.SetAllowedDirection( val );
       
   181     }    
       
   182     
       
   183 // ---------------------------------------------------------------------------
       
   184 // Resolves can handover occur when held or waiting calls exist. 
       
   185 // 3GPP 24.216-720 defines operator preference:
       
   186 // 0 - Indicates that the network operator prefers the domain transfer can 
       
   187 //     occur when the VCC UE is engaged in an active and a held/waiting 
       
   188 //     call/session on the transferring-out domain.
       
   189 // 1 - Indicates that the network operator prefers the domain transfer cannot
       
   190 //     occur when the VCC UE is engaged in an active and a held/waiting 
       
   191 //     call/session on the transferring-out domain.
       
   192 //
       
   193 // ---------------------------------------------------------------------------
       
   194 //   
       
   195 void CVccHoPolicyReader::ResolveHoInHeldWaitingCallsL()
       
   196     {
       
   197     RUBY_DEBUG_BLOCK( "ResolveHoInHeldWaitingCallsL" );
       
   198 
       
   199     TBool val( !iSpSettings->DtHeldWaitingCallsAllowedL() );
       
   200     iPolicy.SetDoHoInHeldWaitingCalls( val );
       
   201     }
       
   202 
       
   203 // ---------------------------------------------------------------------------
       
   204 // 
       
   205 // ---------------------------------------------------------------------------
       
   206 //
       
   207 void CVccHoPolicyReader::ResolveSignalLevelParametersL()
       
   208     {
       
   209     iCsParams.iHighLevel = iSpSettings->CsHoTresholdL();
       
   210     iCsParams.iLowLevel = iCsParams.iHighLevel + iSpSettings->CsHoHysteresisL();
       
   211     iCsParams.iLowTimeout = iSpSettings->CsHoHysteresisTimerLowL();
       
   212     iCsParams.iHighTimeout = iSpSettings->CsHoHysteresisTimerHighL();
       
   213     
       
   214     iPsParams.iHighLevel = iSpSettings->PsHoTresholdL();
       
   215     iPsParams.iLowLevel = iPsParams.iHighLevel + iSpSettings->PsHoHysteresisL();
       
   216     iPsParams.iLowTimeout = iSpSettings->PsHoHysteresisTimerLowL();
       
   217     iPsParams.iHighTimeout = iSpSettings->PsHoHysteresisTimerHighL();
       
   218     }
       
   219 
       
   220 // ---------------------------------------------------------------------------
       
   221 // 
       
   222 // ---------------------------------------------------------------------------
       
   223 //
       
   224 TSignalLevelParams CVccHoPolicyReader::CsSignalLevelParams() const
       
   225     {
       
   226     return iCsParams;
       
   227     }
       
   228 
       
   229 // ---------------------------------------------------------------------------
       
   230 // 
       
   231 // ---------------------------------------------------------------------------
       
   232 //
       
   233 TSignalLevelParams CVccHoPolicyReader::PsSignalLevelParams() const
       
   234     {
       
   235     return iPsParams;
       
   236     }
       
   237 
       
   238 // ---------------------------------------------------------------------------
       
   239 // 
       
   240 // ---------------------------------------------------------------------------
       
   241 //
       
   242 void CVccHoPolicyReader::ResolveDtAllowedWhenCsOriginatedL()
       
   243     {
       
   244     TBool val( iSpSettings->DtAllowedWhenCsOriginatedL() );
       
   245     iPolicy.SetDtAllowedWhenCsOriginated( val );
       
   246     }