commsconfig/commsdatabaseshim/commdbshim/SCDB/RESNUM.CPP
changeset 0 dfb7c4ff071f
equal deleted inserted replaced
-1:000000000000 0:dfb7c4ff071f
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Resolution of phone numbers
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @deprecated since v9.1. Functionality is replaced with commsdat.
       
    21 */
       
    22 
       
    23 #include <commdb.h>
       
    24 #include "commdb_impl.H"
       
    25 #include <commsdatutils.h>
       
    26 
       
    27 namespace commdb_dll
       
    28 /**
       
    29 @internalComponent
       
    30 */
       
    31 
       
    32     {
       
    33 //	const TText KStarChar='*';
       
    34 //	const TText KPlusChar='+';
       
    35     }
       
    36 using namespace commdb_dll;
       
    37 using namespace CommsDatUtils;
       
    38 
       
    39 
       
    40 EXPORT_C void CCommsDatabaseBase::ResolvePhoneNumberL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId)
       
    41 /** Resolves a given telephone number based on a specified dialling location and chargecard.
       
    42 The function does not require a connection to the database server, but will
       
    43 form one itself.
       
    44 
       
    45 The function does not resolve for mobile phones; aNumber is just copied to
       
    46 aDialString.
       
    47 
       
    48 @param aNumber The number to be parsed.
       
    49 @param aDialString On return, contains the parsed number.
       
    50 @param aDialParseMode Indicates whether the parsed string is intended for dialling
       
    51 or for display.
       
    52 @param aLocationId ID of the dialling location record to be used for resolution.
       
    53 @param aChargecardId ID of the chargecard ID to be used for resolution.
       
    54 @leave KErrNotFound if the specified location and chargecard records cannot be found;
       
    55 KErrOverflow if aDialString is not long enough to hold the resolved number. */
       
    56     {
       
    57     CCommsDatUtils::ResolvePhoneNumberL(aNumber, aDialString, aDialParseMode, aLocationId, aChargecardId);
       
    58     }
       
    59 
       
    60 EXPORT_C void CCommsDatabaseBase::ResolvePhoneNumberFromDatabaseL(TDesC& aNumber, TDes& aDialString, TParseMode aDialParseMode, TUint32 aLocationId, TUint32 aChargecardId)
       
    61 /** Resolves a given telephone number based on a specified dialling location and chargecard.
       
    62 A connection must already exist to the database.
       
    63 
       
    64 The function does not resolve for mobile phones; aNumber is just copied to
       
    65 aDialString.
       
    66 
       
    67 @param aNumber A reference to the descriptor containing the number to be parsed.
       
    68 @param aDialString On return, a reference to a descriptor which contains the parsed number.
       
    69 @param aDialParseMode Indicates whether the parsed string is intended for dialling
       
    70 or for display.
       
    71 @param aLocationId ID of the location record.
       
    72 @param aChargecardId ID of the chargecard ID to be used for resolution.
       
    73 @leave KErrNotFound if the specified location and chargecard records cannot be found;
       
    74 KErrOverflow if aDialString is not long enough to hold the resolved number. */
       
    75     {
       
    76     CCommsDatUtils::ResolvePhoneNumberFromDatabaseL(aNumber, aDialString, aDialParseMode, aLocationId, aChargecardId);
       
    77     }
       
    78 void CCommsDatabaseBase::PopulateDialLocationL(TUint32 aId, TDialLocation& aLocation)
       
    79 /**
       
    80 populates aLocation with configuration details related to the current location of the telephone equipment
       
    81 getting the details from the database based on aId.
       
    82 
       
    83 @param aId Unique Id associated with the record in the database.
       
    84 @param aLocation On return, contains the configuration details related to the current location of the telephone equipment
       
    85 */
       
    86     {
       
    87     CCDLocationRecord* locationRecord = static_cast<CCDLocationRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdLocationRecord));
       
    88     CleanupStack::PushL(locationRecord);
       
    89 
       
    90     // Prime for record id
       
    91     locationRecord->SetRecordId(aId);
       
    92     // load data from database
       
    93     locationRecord->LoadL(*iImpl->iDbs);
       
    94 
       
    95     // read values from database
       
    96     aLocation.SetIntlPrefCode(locationRecord->iIntlPrefixCode);
       
    97     aLocation.SetNatPrefCode(locationRecord->iNatPrefixCode);
       
    98     aLocation.SetNatCode(locationRecord->iNatCode);
       
    99     aLocation.SetAreaCode(locationRecord->iAreaCode);
       
   100     aLocation.SetDialOutLocalCode(locationRecord->iDialOutCode);
       
   101     aLocation.SetDialOutLongDistanceCode(locationRecord->iDialOutCode);
       
   102     aLocation.SetDisableCallWaitingCode(locationRecord->iDisableCallWaitingCode);
       
   103 
       
   104     TUint flags(0);
       
   105 
       
   106     if (locationRecord->iMobile)
       
   107         {
       
   108         flags |= KPhoneNumberMobile;
       
   109         }
       
   110     if (locationRecord->iUsePulseDial)
       
   111         {
       
   112         flags |= KPhoneNumberUsePulseDial;
       
   113         }
       
   114     if (locationRecord->iWaitForDialTone)
       
   115         {
       
   116         flags |= KPhoneNumberWaitForDialingTone;
       
   117         }
       
   118 
       
   119     aLocation.SetDialLocationFlags(flags);
       
   120     aLocation.SetPauseAfterDialout(locationRecord->iPauseAfterDialOut);
       
   121 
       
   122     CleanupStack::PopAndDestroy(); // table
       
   123     }
       
   124 
       
   125 void CCommsDatabaseBase::PopulateChargeCardL(TUint32 aId, TChargeCard& aChargeCard)
       
   126 /**
       
   127 Populates aChargeCard with charge card account and PIN details and network operator specific dialling rules
       
   128 for local, national and international calls by getting the details from the database based on aId.
       
   129 
       
   130 @param aId Unique Id associated with the record in the database.
       
   131 @param aChargeCard On return, contains the charge card account and PIN details and network operator specific dialling rules
       
   132 for local, national and international calls
       
   133 */
       
   134     {
       
   135     CCDChargecardRecord* ccardRecord = static_cast<CCDChargecardRecord*>(CCDRecordBase::RecordFactoryL(KCDTIdChargecardRecord));
       
   136     CleanupStack::PushL(ccardRecord);
       
   137     // Prime for record id
       
   138     ccardRecord->SetRecordId(aId);
       
   139     // load data from database
       
   140     ccardRecord->LoadL(*iImpl->iDbs);
       
   141 
       
   142     aChargeCard.SetNumber(ccardRecord->iAccountNo);
       
   143     aChargeCard.SetPin(ccardRecord->iPin);
       
   144     aChargeCard.SetLocalRule(ccardRecord->iLocalRule);
       
   145     aChargeCard.SetNatRule(ccardRecord->iNatRule);
       
   146     aChargeCard.SetIntlRule(ccardRecord->iIntlRule);
       
   147 
       
   148     CleanupStack::PopAndDestroy(); // table
       
   149     }