connectivitymodules/SeCon/services/csc/inc/caputils.h
branchRCL_3
changeset 19 0aa8cc770c8a
parent 18 453dfc402455
child 20 4a793f564d72
equal deleted inserted replaced
18:453dfc402455 19:0aa8cc770c8a
     1 /*
       
     2 * Copyright (c) 2005-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:  CapUtil header file
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDES
       
    20 
       
    21 #ifndef _CAPUTILS_H_
       
    22 #define _CAPUTILS_H_
       
    23 
       
    24 #include "capability.h"
       
    25 
       
    26 class RFs;
       
    27 
       
    28 //
       
    29 // TMemoryInfo
       
    30 //
       
    31 NONSHARABLE_CLASS( TMemoryInfo )
       
    32     {
       
    33 public:
       
    34     TChar    iDriveLetter;
       
    35     TInt     iDriveNum;
       
    36     TBuf<16> iLocation;
       
    37     TInt64   iFree;
       
    38     TInt64   iUsed;
       
    39     TBool    iShared;
       
    40     TInt64   iFileSize;
       
    41     TInt64   iFolderSize;
       
    42     TInt     iFileNameSize;
       
    43     TInt     iFolderNameSize;
       
    44     TBool    iCaseSensitivity;
       
    45     TUint    iDriveStatus;
       
    46     TInt     iMemNr;
       
    47     };
       
    48 
       
    49 //
       
    50 // CapUtil 
       
    51 //
       
    52 NONSHARABLE_CLASS( CapUtil )
       
    53     {
       
    54 public:
       
    55     /**
       
    56      * Gets default root path from pathinfo. 
       
    57      * @param aText
       
    58      * @param aType
       
    59      * @return none
       
    60      */
       
    61     static void GetDefaultRootPathL( RFs& aFs, TDes& aRootPath );
       
    62     
       
    63     /**
       
    64      * Gets memory type. 
       
    65      * @param aFs
       
    66      * @param aMemoryType
       
    67      * @param aDrive
       
    68      * @return none
       
    69      */
       
    70     static void GetMemoryType( RFs& aFs, TDes& aMemoryType, const TInt aDrive );
       
    71     
       
    72     /**
       
    73      * Gets language
       
    74      * @param aText
       
    75      * @return none
       
    76      */
       
    77     static void GetLanguage( TDes& aText );
       
    78     
       
    79     /**
       
    80      * Gets SW version, SW version date  and device model from SysUtil. 
       
    81      * @param aVersion SW version
       
    82      * @param aDate SW date
       
    83      * @param aModel Device model
       
    84      * @return none
       
    85      */
       
    86     static void GetSWVersionL( TDes& aVersion, TDes& aDate, TDes& aModel );
       
    87     
       
    88     /**
       
    89      * Gets phone manufacturer from HAL. In case manufacturer is not known,
       
    90      * empty value is used.
       
    91      * @param aText Manufacturer
       
    92      * @return none
       
    93      */
       
    94     static void GetManufacturer( TDes& aText );
       
    95     
       
    96     /**
       
    97      * Get memory information for one drive.
       
    98      * @param aFs RFs handle
       
    99      * @param aDriveNumber drive number
       
   100      * @param aInfo Memory information
       
   101      * @return none
       
   102      */
       
   103     static void GetMemoryInfoL( const RFs& aFs, const TInt aDriveNumber, TMemoryInfo& aInfo );
       
   104     
       
   105     /**
       
   106      * Initializes TMemoryInfo.
       
   107      * @param aInfo TMemoryInfo to be initialized
       
   108      * @return none
       
   109      */
       
   110     static void InitMemoryInfo( TMemoryInfo& aInfo );
       
   111     
       
   112     /**
       
   113      * Get language string for aId.
       
   114      * @param aId Language id
       
   115      * @param aText Language text
       
   116      * @return none
       
   117      */
       
   118     static void GetLanguageString( TLanguage aId, TDes& aText );
       
   119     
       
   120     /**
       
   121      * Finds all files in aDir.
       
   122      * @param aFs RFs handle
       
   123      * @param aDir Directory
       
   124      * @param aList List of files in directory
       
   125      * @return none
       
   126      */
       
   127     static void GetFileListL( const RFs& aFs, const TDesC& aDir, 
       
   128                             RArray<TFileName>& aList );
       
   129     
       
   130     
       
   131     /**
       
   132      * Gets operator name, country code, network ID
       
   133      * @param aLongName
       
   134      * @param aCountryCode
       
   135      * @param aNetworkID
       
   136      * @return none
       
   137      */
       
   138     static void GetOperatorNameL( TDes& aLongName, TDes& aCountryCode, TDes& aNetworkID );
       
   139     
       
   140     /**
       
   141      * Creates a panic
       
   142      * @param aReason Panic code
       
   143      * @return none
       
   144      */
       
   145     static void Panic( TInt aReason );
       
   146     
       
   147     /**
       
   148      * String copy with lenght check.
       
   149      * @param aTarget Target string
       
   150      * @param aSource Source string
       
   151      * @return none
       
   152      */
       
   153     static void StrCopy( TDes& aTarget, const TDesC& aSource );
       
   154     
       
   155     /**
       
   156      * Function converts ínteger to string.
       
   157      * @param aText string
       
   158      * @param aNum integer
       
   159      * @return none
       
   160      */
       
   161     static void IntToStr( TDes& aText, TInt64 aNum );
       
   162     
       
   163     /**
       
   164      * Function converts string to integer. If string cannot be converted,
       
   165      * error code is returned.
       
   166      * @param aText string
       
   167      * @param aNum integer
       
   168      * @return error code
       
   169      */
       
   170     static TInt StrToInt( const TDesC& aText, TInt& aNum );
       
   171     
       
   172     /**
       
   173      * Function splits string (eg "name1, name2, name3") into substrings.
       
   174      * @param aText string
       
   175      * @param aSeparator separator character
       
   176      * @param aArray substrings
       
   177      * @return none
       
   178      */
       
   179     static void SplitL( const TDesC& aText, const TChar aSeparator, 
       
   180                         RArray<TPtrC>& aArray );
       
   181     
       
   182     /**
       
   183      * Constructs capability date as string
       
   184      * @param aText string
       
   185      * @param aTime time object
       
   186      * @return none
       
   187      */
       
   188     static void CapabilityDate( TDes& aText, const TTime aTime );
       
   189     
       
   190     /**
       
   191      * Function parses date string of the format "dd-mm-yy".
       
   192      * @param aText string
       
   193      * @return time object
       
   194      */
       
   195     static TTime ParseDateL( const TDesC& aText );
       
   196     
       
   197     /**
       
   198      * Function return TMonth presentation of integer
       
   199      * @param aNum
       
   200      * @return TMonth object
       
   201      */
       
   202     static TMonth Month( TInt aNum );
       
   203     
       
   204     /**
       
   205      * Function checks file extension.
       
   206      * @param aFile File name
       
   207      * @param aExt extension
       
   208      * @return boolean
       
   209      */
       
   210     static TBool CheckFileType( const TDesC& aFile, const TDesC& aExt );
       
   211     };
       
   212 
       
   213 //
       
   214 //  TIdStack
       
   215 //
       
   216 NONSHARABLE_CLASS( TIdStack )
       
   217     {
       
   218 public:
       
   219     
       
   220     /**
       
   221      * Push id to the stack
       
   222      * @param aId Id number
       
   223      * @return none
       
   224      */
       
   225     void Push( TInt aId );
       
   226     
       
   227     /**
       
   228      * Pop id from the stack
       
   229      * @return id
       
   230      */
       
   231     TInt Pop();
       
   232     
       
   233     /**
       
   234      * Size of the stack
       
   235      * @return size
       
   236      */
       
   237     TInt Size() const;
       
   238     
       
   239     /**
       
   240      * Reset the stack.
       
   241      * @return none
       
   242      */
       
   243     void Reset();
       
   244 
       
   245 private:
       
   246     TInt iPos;
       
   247     TFixedArray<TInt, KNestingLimit> iArray;
       
   248     };
       
   249 
       
   250 #endif // CapUtils.h
       
   251 
       
   252 // End of file