sysstatemgmt/ssmmapperutility/src/ssmmapperutilitystatic.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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 * Implementation of SsmMapperUtility class.
       
    16 *
       
    17 */
       
    18 
       
    19 #include <ssm/ssmstate.h>
       
    20 
       
    21 #include "ssmmapperutilitystatic.h"
       
    22 #include "ssmmapperutility.h"
       
    23 #include "trace.h"
       
    24 
       
    25 // ======== LOCAL FUNCTIONS ========
       
    26 
       
    27 // ---------------------------------------------------------------------------
       
    28 // CreateUtility
       
    29 // ---------------------------------------------------------------------------
       
    30 //
       
    31 static CSsmMapperUtility* CreateUtility()
       
    32     {
       
    33     FUNC_LOG;
       
    34 
       
    35     CSsmMapperUtility* utility( NULL );
       
    36     TInt err( KErrNone );
       
    37     TRAP( err, utility = CSsmMapperUtility::NewL() );
       
    38     ERROR( err, "Failed to create CSsmMapperUtility" );
       
    39     return utility;
       
    40     }
       
    41 
       
    42 
       
    43 // ======== MEMBER FUNCTIONS ========
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // SsmMapperUtility::PsUid
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 EXPORT_C TUid SsmMapperUtility::PsUid( const TUid& aUid )
       
    50     {
       
    51     FUNC_LOG;
       
    52 
       
    53     TUid ret( TUid::Null() );
       
    54     CSsmMapperUtility* utility = CreateUtility();
       
    55     if ( utility )
       
    56         {
       
    57         ret = utility->PsUid( aUid );
       
    58         delete utility;
       
    59         }
       
    60     return ret;
       
    61     }
       
    62 
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // SsmMapperUtility::CrUid
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 EXPORT_C TUid SsmMapperUtility::CrUid( const TUid& aUid )
       
    69     {
       
    70     FUNC_LOG;
       
    71 
       
    72     TUid ret( TUid::Null() );
       
    73     CSsmMapperUtility* utility = CreateUtility();
       
    74     if ( utility )
       
    75         {
       
    76         ret = utility->CrUid( aUid );
       
    77         delete utility;
       
    78         }
       
    79     return ret;
       
    80     }
       
    81 
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // SsmMapperUtility::FeatureUid
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C TUid SsmMapperUtility::FeatureUid( const TUid& aUid )
       
    88     {
       
    89     FUNC_LOG;
       
    90 
       
    91     TUid ret( TUid::Null() );
       
    92     CSsmMapperUtility* utility = CreateUtility();
       
    93     if ( utility )
       
    94         {
       
    95         ret = utility->FeatureUid( aUid );
       
    96         delete utility;
       
    97         }
       
    98     return ret;
       
    99     }
       
   100 
       
   101 
       
   102 // ---------------------------------------------------------------------------
       
   103 // SsmMapperUtility::GetCurrentState
       
   104 // ---------------------------------------------------------------------------
       
   105 //
       
   106 EXPORT_C TInt SsmMapperUtility::GetCurrentState( TSsmState& aState )
       
   107     {
       
   108     FUNC_LOG;
       
   109 
       
   110     TInt ret( KErrGeneral );
       
   111     CSsmMapperUtility* utility = CreateUtility();
       
   112     if ( utility )
       
   113         {
       
   114         ret = utility->GetCurrentState( aState );
       
   115         delete utility;
       
   116         }
       
   117     return ret;
       
   118     }
       
   119 
       
   120 
       
   121 // ---------------------------------------------------------------------------
       
   122 // SsmMapperUtility::FeatureStatus
       
   123 // ---------------------------------------------------------------------------
       
   124 //
       
   125 EXPORT_C TBool SsmMapperUtility::FeatureStatus( const TUid& aUid )
       
   126     {
       
   127     FUNC_LOG;
       
   128 
       
   129     TBool ret( EFalse );
       
   130     CSsmMapperUtility* utility = CreateUtility();
       
   131     if ( utility )
       
   132         {
       
   133         ret = utility->FeatureStatus( aUid );
       
   134         delete utility;
       
   135         }
       
   136     return ret;
       
   137     }
       
   138 
       
   139 
       
   140 // ---------------------------------------------------------------------------
       
   141 // SsmMapperUtility::CrValue
       
   142 // ---------------------------------------------------------------------------
       
   143 //
       
   144 EXPORT_C TInt SsmMapperUtility::CrValue( const TUid& aUid, TUint32 aKey, TInt& aValue )
       
   145     {
       
   146     FUNC_LOG;
       
   147 
       
   148     TInt ret( KErrGeneral );
       
   149     CSsmMapperUtility* utility = CreateUtility();
       
   150     if ( utility )
       
   151         {
       
   152         ret = utility->CrValue( aUid, aKey, aValue );
       
   153         delete utility;
       
   154         }
       
   155     return ret;
       
   156     }
       
   157 
       
   158 
       
   159 // ---------------------------------------------------------------------------
       
   160 // SsmMapperUtility::CrValue
       
   161 // ---------------------------------------------------------------------------
       
   162 //
       
   163 EXPORT_C TInt SsmMapperUtility::CrValue( const TUid& aUid, TUint32 aKey, TDes& aValue )
       
   164     {
       
   165     FUNC_LOG;
       
   166 
       
   167     TInt ret( KErrGeneral );
       
   168     CSsmMapperUtility* utility = CreateUtility();
       
   169     if ( utility )
       
   170         {
       
   171         ret = utility->CrValue( aUid, aKey, aValue );
       
   172         delete utility;
       
   173         }
       
   174     return ret;
       
   175     }
       
   176 
       
   177 
       
   178 // ---------------------------------------------------------------------------
       
   179 // SsmMapperUtility::GetCommandListPath
       
   180 // ---------------------------------------------------------------------------
       
   181 //
       
   182 EXPORT_C void SsmMapperUtility::GetCommandListPath( TDes& aCmdListPath )
       
   183     {
       
   184     FUNC_LOG;
       
   185 
       
   186     CSsmMapperUtility* utility = CreateUtility();
       
   187     if ( utility )
       
   188         {
       
   189         utility->GetCommandListPath( aCmdListPath );
       
   190         delete utility;
       
   191         }
       
   192     }
       
   193 
       
   194 // ---------------------------------------------------------------------------
       
   195 // SsmMapperUtility::CheckCaps
       
   196 // ---------------------------------------------------------------------------
       
   197 //
       
   198 EXPORT_C TBool SsmMapperUtility::CheckCaps( const RMessagePtr2& aMessage )
       
   199     {
       
   200     FUNC_LOG;
       
   201 
       
   202     TBool ret( EFalse );
       
   203     CSsmMapperUtility* utility = CreateUtility();
       
   204     if ( utility )
       
   205         {
       
   206         ret = utility->CheckCaps( aMessage );
       
   207         delete utility;
       
   208         }
       
   209     return ret;
       
   210     }