systemswstubs/ssyreference/src/ssyreferencepropertyprovider.cpp
branchRCL_3
changeset 44 b5894bb67e73
parent 35 37b610eb7fe3
equal deleted inserted replaced
35:37b610eb7fe3 44:b5894bb67e73
     1 /*
       
     2 * Copyright (c) 2006-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:  Reference implementation of SSY Property Provider interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include "ssyreferencepropertyprovider.h"
       
    20 #include "ssyreferencetrace.h"
       
    21 #include "ssyreferencechannel.h"
       
    22 
       
    23 // ======== MEMBER FUNCTIONS ========
       
    24 
       
    25 // ---------------------------------------------------------------------------
       
    26 // CSsyReferencePropertyProvider C++ constructor
       
    27 // ---------------------------------------------------------------------------
       
    28 //
       
    29 CSsyReferencePropertyProvider::CSsyReferencePropertyProvider( CSsyReferenceChannel& aChannel ) :
       
    30     iChannel( aChannel )
       
    31     {
       
    32     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider()" ) ) );
       
    33     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider() - return" ) ) );
       
    34     }
       
    35 
       
    36 
       
    37 // ---------------------------------------------------------------------------
       
    38 // Symbian 2nd phase constructor
       
    39 // ---------------------------------------------------------------------------
       
    40 //
       
    41 void CSsyReferencePropertyProvider::ConstructL()
       
    42     {
       
    43     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL()" ) ) );
       
    44     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL() - return" ) ) );
       
    45     }
       
    46 
       
    47 
       
    48 // ---------------------------------------------------------------------------
       
    49 // CSsyReferencePropertyProvider::NewL
       
    50 // ---------------------------------------------------------------------------
       
    51 //
       
    52 CSsyReferencePropertyProvider* CSsyReferencePropertyProvider::NewL( CSsyReferenceChannel& aChannel )
       
    53     {
       
    54     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL()" ) ) );
       
    55     CSsyReferencePropertyProvider* self = new ( ELeave ) CSsyReferencePropertyProvider( aChannel );
       
    56     CleanupStack::PushL( self );
       
    57     self->ConstructL();
       
    58     CleanupStack::Pop( self );
       
    59     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL() - return" ) ) );
       
    60     return self;
       
    61     }
       
    62 
       
    63 // ---------------------------------------------------------------------------
       
    64 // Destructor
       
    65 // ---------------------------------------------------------------------------
       
    66 //
       
    67 CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()
       
    68     {
       
    69     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()" ) ) );
       
    70     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider() - return" ) ) );
       
    71     }
       
    72 
       
    73 // ---------------------------------------------------------------------------
       
    74 // CSsyReferencePropertyProvider::CheckPropertyDependenciesL
       
    75 // ---------------------------------------------------------------------------
       
    76 //
       
    77 void CSsyReferencePropertyProvider::CheckPropertyDependenciesL( 
       
    78     const TSensrvChannelId /*aChannelId*/,
       
    79     const TSensrvProperty& /*aProperty*/,
       
    80     RSensrvChannelList& /*aAffectedChannels*/ )
       
    81     {
       
    82     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL()" ) ) );
       
    83     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL() - return" ) ) );
       
    84     }
       
    85 
       
    86 // ---------------------------------------------------------------------------
       
    87 // CSsyReferencePropertyProvider::SetPropertyL
       
    88 // ---------------------------------------------------------------------------
       
    89 //
       
    90 void CSsyReferencePropertyProvider::SetPropertyL( 
       
    91     const TSensrvChannelId aChannelId,
       
    92     const TSensrvProperty& aProperty )
       
    93     {
       
    94     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL()" ) ) );
       
    95 
       
    96     if ( iChannel.ChannelId() != aChannelId )
       
    97         {
       
    98         User::Leave( KErrArgument );
       
    99         }
       
   100 
       
   101     // Search property. Leaves with KErrNotFound if property is not found. 
       
   102     // Leaves with KErrAccessDenied if found property is Read only
       
   103     iChannel.FindAndUpdatePropertyL( aProperty );
       
   104     
       
   105     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL() - return" ) ) );
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CSsyReferencePropertyProvider::GetPropertyL
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 void CSsyReferencePropertyProvider::GetPropertyL( 
       
   113     const TSensrvChannelId aChannelId,
       
   114     TSensrvProperty& aProperty )
       
   115     {
       
   116     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL()" ) ) );
       
   117     
       
   118     if ( iChannel.ChannelId() != aChannelId && aChannelId != 0 )
       
   119         {
       
   120         User::Leave( KErrArgument );
       
   121         }
       
   122     else
       
   123         {
       
   124         // Search property. Leaves with KErrNotFound if property is not found
       
   125         aProperty = iChannel.FindPropertyL( 
       
   126                         aProperty.GetPropertyId(), 
       
   127                         aProperty.PropertyItemIndex(),
       
   128                         aProperty.GetArrayIndex() );
       
   129         }
       
   130 
       
   131     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL() - return" ) ) );
       
   132     }
       
   133 
       
   134 // ---------------------------------------------------------------------------
       
   135 // CSsyReferencePropertyProvider::GetAllPropertiesL
       
   136 // ---------------------------------------------------------------------------
       
   137 //
       
   138 void CSsyReferencePropertyProvider::GetAllPropertiesL( 
       
   139     const TSensrvChannelId aChannelId,
       
   140     RSensrvPropertyList& aChannelPropertyList )
       
   141     {
       
   142     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL()" ) ) );
       
   143     
       
   144     if ( iChannel.ChannelId() != aChannelId )
       
   145         {
       
   146         User::Leave( KErrArgument );
       
   147         }
       
   148 
       
   149     iChannel.GetProperties( aChannelPropertyList );
       
   150 
       
   151     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL() - return" ) ) );
       
   152     }
       
   153 
       
   154 // ---------------------------------------------------------------------------
       
   155 // CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL
       
   156 // ---------------------------------------------------------------------------
       
   157 //
       
   158 void CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL( TUid aInterfaceUid, 
       
   159 	                                        TAny*& aInterface )
       
   160     {
       
   161     aInterface = NULL;
       
   162     
       
   163 	if ( aInterfaceUid.iUid == KSsyPropertyProviderInterface1.iUid )
       
   164 		{
       
   165 		aInterface = reinterpret_cast<TAny*>(
       
   166 			static_cast<MSsyPropertyProvider*>( this ) );
       
   167 		}
       
   168     }
       
   169   
       
   170 // End of file