sensorsupport/testsensor/src/ssyreferencepropertyprovider.cpp
branchRCL_3
changeset 62 924385140d98
equal deleted inserted replaced
58:0818dd463d41 62:924385140d98
       
     1 // ssyreferencepropertyprovider.cpp
       
     2 
       
     3 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 // All rights reserved.
       
     5 // This component and the accompanying materials are made available
       
     6 // under the terms of "Eclipse Public License v1.0"
       
     7 // which accompanies this distribution, and is available
       
     8 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 //
       
    10 // Initial Contributors:
       
    11 // Nokia Corporation - initial contribution.
       
    12 //
       
    13 // Contributors:
       
    14 //
       
    15 // Description:
       
    16 //
       
    17 
       
    18 
       
    19 
       
    20 #include "ssyreferencepropertyprovider.h"
       
    21 #include "ssyreferencetrace.h"
       
    22 #include "ssyreferencechannel.h"
       
    23 
       
    24 // ======== MEMBER FUNCTIONS ========
       
    25 
       
    26 // ---------------------------------------------------------------------------
       
    27 // CSsyReferencePropertyProvider C++ constructor
       
    28 // ---------------------------------------------------------------------------
       
    29 //
       
    30 CSsyReferencePropertyProvider::CSsyReferencePropertyProvider( CSsyReferenceChannel& aChannel ) :
       
    31     iChannel( aChannel )
       
    32     {
       
    33     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider()" ) ) );
       
    34     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CSsyReferencePropertyProvider() - return" ) ) );
       
    35     }
       
    36 
       
    37 
       
    38 // ---------------------------------------------------------------------------
       
    39 // Symbian 2nd phase constructor
       
    40 // ---------------------------------------------------------------------------
       
    41 //
       
    42 void CSsyReferencePropertyProvider::ConstructL()
       
    43     {
       
    44     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL()" ) ) );
       
    45     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::ConstructL() - return" ) ) );
       
    46     }
       
    47 
       
    48 
       
    49 // ---------------------------------------------------------------------------
       
    50 // CSsyReferencePropertyProvider::NewL
       
    51 // ---------------------------------------------------------------------------
       
    52 //
       
    53 CSsyReferencePropertyProvider* CSsyReferencePropertyProvider::NewL( CSsyReferenceChannel& aChannel )
       
    54     {
       
    55     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL()" ) ) );
       
    56     CSsyReferencePropertyProvider* self = new ( ELeave ) CSsyReferencePropertyProvider( aChannel );
       
    57     CleanupStack::PushL( self );
       
    58     self->ConstructL();
       
    59     CleanupStack::Pop( self );
       
    60     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::NewL() - return" ) ) );
       
    61     return self;
       
    62     }
       
    63 
       
    64 // ---------------------------------------------------------------------------
       
    65 // Destructor
       
    66 // ---------------------------------------------------------------------------
       
    67 //
       
    68 CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()
       
    69     {
       
    70     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider()" ) ) );
       
    71     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::~CSsyReferencePropertyProvider() - return" ) ) );
       
    72     }
       
    73 
       
    74 // ---------------------------------------------------------------------------
       
    75 // CSsyReferencePropertyProvider::CheckPropertyDependenciesL
       
    76 // ---------------------------------------------------------------------------
       
    77 //
       
    78 void CSsyReferencePropertyProvider::CheckPropertyDependenciesL( 
       
    79     const TSensrvChannelId /*aChannelId*/,
       
    80     const TSensrvProperty& /*aProperty*/,
       
    81     RSensrvChannelList& /*aAffectedChannels*/ )
       
    82     {
       
    83     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL()" ) ) );
       
    84     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::CheckPropertyDependenciesL() - return" ) ) );
       
    85     }
       
    86 
       
    87 // ---------------------------------------------------------------------------
       
    88 // CSsyReferencePropertyProvider::SetPropertyL
       
    89 // ---------------------------------------------------------------------------
       
    90 //
       
    91 void CSsyReferencePropertyProvider::SetPropertyL( 
       
    92     const TSensrvChannelId aChannelId,
       
    93     const TSensrvProperty& aProperty )
       
    94     {
       
    95     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL()" ) ) );
       
    96 
       
    97     if ( iChannel.ChannelId() != aChannelId )
       
    98         {
       
    99         User::Leave( KErrArgument );
       
   100         }
       
   101 
       
   102     // Search property. Leaves with KErrNotFound if property is not found. 
       
   103     // Leaves with KErrAccessDenied if found property is Read only
       
   104     iChannel.FindAndUpdatePropertyL( aProperty );
       
   105     
       
   106     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::SetPropertyL() - return" ) ) );
       
   107     }
       
   108 
       
   109 // ---------------------------------------------------------------------------
       
   110 // CSsyReferencePropertyProvider::GetPropertyL
       
   111 // ---------------------------------------------------------------------------
       
   112 //
       
   113 void CSsyReferencePropertyProvider::GetPropertyL( 
       
   114     const TSensrvChannelId aChannelId,
       
   115     TSensrvProperty& aProperty )
       
   116     {
       
   117     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL()" ) ) );
       
   118     
       
   119     if ( iChannel.ChannelId() != aChannelId && aChannelId != 0 )
       
   120         {
       
   121         User::Leave( KErrArgument );
       
   122         }
       
   123     else
       
   124         {
       
   125         // Search property. Leaves with KErrNotFound if property is not found
       
   126         aProperty = iChannel.FindPropertyL( 
       
   127                         aProperty.GetPropertyId(), 
       
   128                         aProperty.PropertyItemIndex(),
       
   129                         aProperty.GetArrayIndex() );
       
   130         }
       
   131 
       
   132     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetPropertyL() - return" ) ) );
       
   133     }
       
   134 
       
   135 // ---------------------------------------------------------------------------
       
   136 // CSsyReferencePropertyProvider::GetAllPropertiesL
       
   137 // ---------------------------------------------------------------------------
       
   138 //
       
   139 void CSsyReferencePropertyProvider::GetAllPropertiesL( 
       
   140     const TSensrvChannelId aChannelId,
       
   141     RSensrvPropertyList& aChannelPropertyList )
       
   142     {
       
   143     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL()" ) ) );
       
   144     
       
   145     if ( iChannel.ChannelId() != aChannelId )
       
   146         {
       
   147         User::Leave( KErrArgument );
       
   148         }
       
   149 
       
   150     iChannel.GetProperties( aChannelPropertyList );
       
   151 
       
   152     COMPONENT_TRACE( ( _L( "SSY Reference Plugin - CSsyReferencePropertyProvider::GetAllPropertiesL() - return" ) ) );
       
   153     }
       
   154 
       
   155 // ---------------------------------------------------------------------------
       
   156 // CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL
       
   157 // ---------------------------------------------------------------------------
       
   158 //
       
   159 void CSsyReferencePropertyProvider::GetPropertyProviderInterfaceL( TUid /*aInterfaceUid*/, 
       
   160 	                                        TAny*& aInterface )
       
   161     {
       
   162     aInterface = NULL;
       
   163     }
       
   164