resourcemgmt/hwresourcesmgr/server/src/HWRMVibraCommonData.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     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 //
       
    15 
       
    16 
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include <centralrepository.h>
       
    21 #include "HWRMtrace.h"
       
    22 #include "HWRMVibraSDKCRKeys.h"
       
    23 #include "HWRMVibraCommonData.h"
       
    24 #include "HWRMClientServer.h"
       
    25 #include "HWRMPrivatePSKeys.h"
       
    26 #include "HWRMPrivateCRKeys.h"
       
    27 #include "HWRMConfiguration.h"
       
    28 #include "HWRMVibraService.h"
       
    29 #include "HWRMDomainPSKeys.h"
       
    30 
       
    31 
       
    32 
       
    33 // EXTERNAL DATA STRUCTURES
       
    34 // None
       
    35 
       
    36 // EXTERNAL FUNCTION PROTOTYPES  
       
    37 // None
       
    38 
       
    39 // CONSTANTS
       
    40 // None
       
    41 
       
    42 // MACROS
       
    43 // None
       
    44 
       
    45 // LOCAL CONSTANTS AND MACROS
       
    46 // None
       
    47 
       
    48 // MODULE DATA STRUCTURES
       
    49 // None
       
    50 
       
    51 // LOCAL FUNCTION PROTOTYPES
       
    52 // None
       
    53 
       
    54 // FORWARD DECLARATIONS
       
    55 // None
       
    56 
       
    57 // ============================= LOCAL FUNCTIONS ===============================
       
    58 
       
    59 // ============================ MEMBER FUNCTIONS ===============================
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CHWRMVibraCommonData::CHWRMVibraCommonData
       
    63 // C++ constructor
       
    64 // -----------------------------------------------------------------------------
       
    65 //
       
    66 CHWRMVibraCommonData::CHWRMVibraCommonData(CHWRMVibraCommonService& aCommonService)
       
    67     : iPulseSupported(EFalse),
       
    68     iLastPublishedStatus(CHWRMVibra::EVibraStatusNotAllowed),
       
    69     iCommonService(aCommonService)
       
    70     {
       
    71     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::CHWRMVibraCommonData()" ) );
       
    72     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::CHWRMVibraCommonData - return" ) );
       
    73     }
       
    74 
       
    75 // -----------------------------------------------------------------------------
       
    76 // CHWRMVibraCommonData::ConstructL
       
    77 // Symbian 2nd phase constructor can leave.
       
    78 // -----------------------------------------------------------------------------
       
    79 //
       
    80 void CHWRMVibraCommonData::ConstructL(CHWRMPluginHandler* aPluginHandler,
       
    81                                       CHWRMReservationHandler* aReservationHandler)
       
    82     {    
       
    83     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL()" ) );
       
    84 
       
    85     // Get read only values from cenrep
       
    86     CRepository* repository = CRepository::NewLC(KCRUidVibraCtrl);
       
    87 
       
    88     TInt value(0);
       
    89     User::LeaveIfError(repository->Get(KVibraMinOffTime, value));
       
    90     iMinimumOffTime = value * 1000; // milliseconds -> microseconds
       
    91     if ( iMinimumOffTime.Int() < 0 )
       
    92         {
       
    93         iMinimumOffTime = 0;  // do not allow negative value
       
    94         }
       
    95     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iMinimumOffTime: %d" ), iMinimumOffTime.Int() );
       
    96     
       
    97     User::LeaveIfError(repository->Get(KVibraCtrlMaxTime, value));
       
    98     iMaximumOnTime = value * 1000; // milliseconds -> microseconds
       
    99     if ( iMaximumOnTime.Int() < 0 )
       
   100         {
       
   101         iMaximumOnTime = 0;  // do not allow negative value
       
   102         }
       
   103     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iMaximumOnTime: %d" ), iMaximumOnTime.Int() );
       
   104     
       
   105     User::LeaveIfError(repository->Get(KVibraCtrlProfileVibraEnabled, value));
       
   106     iVibraSetting = (value == 0 ) ? CHWRMVibra::EVibraModeOFF : CHWRMVibra::EVibraModeON;
       
   107     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iVibraSetting: %d" ), iVibraSetting );
       
   108     
       
   109     User::LeaveIfError(repository->Get(KVibraCtrlProfileFeedbackEnabled, value));
       
   110     iVibraFeedbackSetting = (value == 0 ) ? CHWRMVibra::EVibraFeedbackModeOFF : CHWRMVibra::EVibraFeedbackModeON;
       
   111     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iVibraFeedbackSetting: %d" ), iVibraFeedbackSetting );
       
   112     
       
   113     User::LeaveIfError(repository->Get(KVibraCtrlFeedbackIntensity, iFeedbackIntensity));
       
   114     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iFeedbackIntensity: %d" ), iFeedbackIntensity );
       
   115     
       
   116     User::LeaveIfError(repository->Get(KVibraCtrlFeedbackDuration, iFeedbackDuration));
       
   117     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iFeedbackDuration: %d" ), iFeedbackDuration );
       
   118     
       
   119 
       
   120     
       
   121     CleanupStack::PopAndDestroy(repository);
       
   122     
       
   123     // Get privileged SID
       
   124     CRepository* hwrmRep = CRepository::NewLC(KCRUidHWRMSettings);
       
   125     TInt sidValue(0);
       
   126     User::LeaveIfError(hwrmRep->Get(KHWRMAudioVibraSID, sidValue));
       
   127     iPrivilegedSid = new (ELeave) TSecureId(sidValue);    
       
   128     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iPrivilegedSid: 0x%x" ), iPrivilegedSid->iId );
       
   129 
       
   130     // Initiate and get vibra blocking mask
       
   131     iConfVibraBlockMask =
       
   132         KHWRMInternalSettingsChargerBlockVibra |
       
   133         KHWRMInternalSettingsChargerBlockFeedback |
       
   134         KHWRMInternalSettingsAccessoryBlockFeedback |
       
   135         KHWRMInternalSettingsCoolOffBlockFeedback;
       
   136 
       
   137     TInt err = hwrmRep->Get(KHWRMInternalSettings, value);
       
   138     if ( err == KErrNone )
       
   139         {
       
   140         iConfVibraBlockMask = value;
       
   141         // clear bits, which do not mean block-mask
       
   142         iConfVibraBlockMask &= ~KHWRMInternalSettingsDeviceSupportsPulse;
       
   143         // set pulse support value
       
   144         iPulseSupported = value & KHWRMInternalSettingsDeviceSupportsPulse;
       
   145         }
       
   146 
       
   147     CleanupStack::PopAndDestroy(hwrmRep);
       
   148     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - iPrivilegedSid: 0x%x" ), iPrivilegedSid->iId );
       
   149     
       
   150     // Set up status P&S value
       
   151     User::LeaveIfError(RProperty::Define(KPSUidHWResourceNotification, KHWRMVibraStatus, RProperty::EInt, KNoCapability, KHWRMSidOnlyPolicy));
       
   152     User::LeaveIfError(iProperty.Attach(KPSUidHWResourceNotification, KHWRMVibraStatus));
       
   153     
       
   154     // Set up profile observer (Will also initialize the P&S value indirectly on callback)
       
   155     iProfileObserver = CHWRMVibraProfileObserver::NewL(this);
       
   156 
       
   157     // Construct vibra service last so that the common data is in order to be used
       
   158     // in service construction.    
       
   159     iVibraService = CHWRMVibraService::NewL(aPluginHandler, aReservationHandler, iCommonService, *this, EFalse);
       
   160 
       
   161     // Set up P&S observers for vibra blocking
       
   162     iAccessoryBlockObserver = CHWRMPSChangeObserver::NewL(*this, KPSUidHWRM, KHWRMAccessoryVibraBlocked);
       
   163     iInternalBlockObserver = CHWRMPSChangeObserver::NewL(*this, KPSUidHWRMPrivate, KHWRMInternalVibraBlocked);
       
   164 
       
   165     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::ConstructL - return" ) );
       
   166     }
       
   167 
       
   168 // -----------------------------------------------------------------------------
       
   169 // CHWRMVibraCommonData::NewL
       
   170 // Two-phased constructor.
       
   171 // -----------------------------------------------------------------------------
       
   172 //
       
   173 CHWRMVibraCommonData* CHWRMVibraCommonData::NewL(CHWRMPluginHandler* aPluginHandler,
       
   174                                                  CHWRMReservationHandler* aReservationHandler,
       
   175                                                  CHWRMVibraCommonService& aCommonService)
       
   176     {
       
   177     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::NewL()" ) );
       
   178 
       
   179     
       
   180     CHWRMVibraCommonData* self = new( ELeave ) CHWRMVibraCommonData(aCommonService);
       
   181 
       
   182     
       
   183     CleanupStack::PushL( self );
       
   184     self->ConstructL(aPluginHandler, aReservationHandler);
       
   185     CleanupStack::Pop();
       
   186 
       
   187     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::NewL - return 0x%x" ), self );
       
   188     
       
   189     return self;
       
   190     }
       
   191    
       
   192 // ---------------------------------------------------------
       
   193 // Destructor
       
   194 // ---------------------------------------------------------
       
   195 //
       
   196 CHWRMVibraCommonData::~CHWRMVibraCommonData()
       
   197     {
       
   198     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::~CHWRMVibraCommonData()" ) );
       
   199 
       
   200     delete iProfileObserver;    
       
   201     
       
   202     iProperty.Close();
       
   203 
       
   204     delete iAccessoryBlockObserver;
       
   205     delete iInternalBlockObserver;
       
   206     
       
   207     delete iVibraService;
       
   208     
       
   209     delete iPrivilegedSid;
       
   210 
       
   211     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::~CHWRMVibraCommonData - return" ) );
       
   212     }
       
   213 
       
   214 // -----------------------------------------------------------------------------
       
   215 // CHWRMVibraCommonData::VibraState
       
   216 // -----------------------------------------------------------------------------
       
   217 //
       
   218 CHWRMVibra::TVibraModeState CHWRMVibraCommonData::VibraState()
       
   219     {
       
   220     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::TVibraModeState()" ) );
       
   221 
       
   222     // If there has been a problem in the profile observer, try recreating it.
       
   223     if ( iVibraSetting == CHWRMVibra::EVibraModeUnknown )
       
   224         {
       
   225         COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibra::VibraState - Restarting profile observer") ); 
       
   226         delete iProfileObserver;
       
   227         iProfileObserver = NULL;
       
   228         
       
   229         TRAP_IGNORE(iProfileObserver = CHWRMVibraProfileObserver::NewL(this));
       
   230         }
       
   231 
       
   232     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::TVibraModeState - return 0x%x" ), iVibraSetting );
       
   233 
       
   234     return iVibraSetting;
       
   235     }
       
   236 
       
   237 // -----------------------------------------------------------------------------
       
   238 // CHWRMVibraCommonData::VibraModeChange
       
   239 // -----------------------------------------------------------------------------
       
   240 //
       
   241 void CHWRMVibraCommonData::VibraModeChange(CHWRMVibra::TVibraModeState aNewState)
       
   242     {
       
   243     COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::VibraModeChange(0x%x)"), aNewState); 
       
   244 
       
   245     iVibraSetting = aNewState;
       
   246     
       
   247     if ( iVibraSetting == CHWRMVibra::EVibraModeON )
       
   248         {
       
   249         // if just coming out of mode change, vibra can be assumed to be stopped
       
   250         // except if vibra is set on by privileged client.
       
   251         if ( !iPrivilegedVibraOn )
       
   252             {            
       
   253             PublishVibraStatus( CHWRMVibra::EVibraStatusStopped );
       
   254             }
       
   255         }
       
   256     else if ( !iPrivilegedVibraOn )
       
   257         {
       
   258         PublishVibraStatus( CHWRMVibra::EVibraStatusNotAllowed );
       
   259         
       
   260         // If vibra service is initialized, stop vibra.
       
   261         // Service will be uninitialized on first startup mode change, but 
       
   262         // vibra will not be on at that point anyway, as nobody could have
       
   263         // started it yet.
       
   264         if ( iVibraService )
       
   265             {
       
   266             iVibraService->ForceVibraStop();
       
   267             }        
       
   268         }
       
   269     else
       
   270         {
       
   271         // nothing
       
   272         }
       
   273 
       
   274     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::VibraModeChange - return") ); 
       
   275     }
       
   276     
       
   277     // -----------------------------------------------------------------------------
       
   278 // CHWRMVibraCommonData::VibraFeedbackState
       
   279 // -----------------------------------------------------------------------------
       
   280 //
       
   281 CHWRMVibra::TVibraFeedbackModeState CHWRMVibraCommonData::VibraFeedbackState()
       
   282     {
       
   283     COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonData::VibraFeedbackState()" ) );
       
   284 
       
   285     // If there has been a problem in the profile observer, try recreating it.
       
   286     if ( iVibraFeedbackSetting == CHWRMVibra::EVibraFeedbackModeUnknown )
       
   287         {
       
   288         COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibra::VibraState - Restarting profile observer") ); 
       
   289         delete iProfileObserver;
       
   290         iProfileObserver = NULL;
       
   291         
       
   292         TRAPD( err, iProfileObserver = CHWRMVibraProfileObserver::NewL(this) );
       
   293         
       
   294         if ( err != KErrNone )
       
   295             {
       
   296             // Unable to recreate profile observer. Memory probably low. Must recreate observer next time some
       
   297             COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibra::VibraFeedbackState - Unable to restart profile observer") ); 
       
   298             }
       
   299         }
       
   300 
       
   301     COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonData::VibraFeedbackState - return 0x%x" ), iVibraFeedbackSetting );
       
   302 
       
   303     return iVibraFeedbackSetting;
       
   304     }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CHWRMVibraCommonData::VibraFeedbackModeChange
       
   308 // -----------------------------------------------------------------------------
       
   309 //
       
   310 void CHWRMVibraCommonData::VibraFeedbackModeChange(CHWRMVibra::TVibraFeedbackModeState aNewState)
       
   311     {
       
   312     COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::VibraFeedbackModeChange(0x%x)"), aNewState); 
       
   313 
       
   314     iVibraFeedbackSetting = aNewState;
       
   315     
       
   316     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::VibraFeedbackModeChange - return") ); 
       
   317     }
       
   318     
       
   319     
       
   320 // -----------------------------------------------------------------------------
       
   321 // CHWRMVibraCommonData::PSValueChanged
       
   322 // Act on observed PS value changes
       
   323 // -----------------------------------------------------------------------------
       
   324 //
       
   325 void CHWRMVibraCommonData::PSValueChanged(const TUid& aUid, TUint32 aKey, TInt aValue)
       
   326     {
       
   327     COMPONENT_TRACE4(_L("HWRM Server - CHWRMVibraCommonData::PSValueChanged(0x%x, 0x%x, 0x%x)"), aUid, aKey, aValue); 
       
   328     
       
   329     //We are currently listening to is the Accessory server and charger statuses
       
   330     if ( ( aUid == KPSUidHWRM && aKey == KHWRMAccessoryVibraBlocked ) ||
       
   331          ( aUid == KPSUidHWRMPrivate && aKey == KHWRMInternalVibraBlocked ) )
       
   332         {
       
   333         if ( aValue )
       
   334             {
       
   335             // Set bit in blockmask
       
   336             iVibraBlockMask |= aKey;
       
   337             
       
   338             COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::PSValueChanged - Vibra block set, mask: 0x%x"), iVibraBlockMask );
       
   339 
       
   340             // Explicitly shut down the vibra
       
   341             if ( iVibraService )
       
   342                 {
       
   343                 iVibraService->ForceVibraStop();
       
   344                 PublishVibraStatus( CHWRMVibra::EVibraStatusNotAllowed );
       
   345                 }
       
   346             else
       
   347                 {
       
   348                 COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::PSValueChanged - Error: Service not initialized, cannot stop vibra!") ); 
       
   349                 }
       
   350             }
       
   351         else
       
   352             {
       
   353             // Clear bit in blockmask
       
   354             iVibraBlockMask &= ~aKey;
       
   355             COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::PSValueChanged - Vibra block cleared, mask: 0x%x"), iVibraBlockMask );
       
   356             
       
   357             // Status must be stopped if vibra block was just cleared
       
   358             if ( !iVibraBlockMask )
       
   359                 {
       
   360                 PublishVibraStatus( CHWRMVibra::EVibraStatusStopped );
       
   361                 }
       
   362             }
       
   363         }
       
   364      
       
   365     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::PSValueChanged - return") ); 
       
   366     }
       
   367 
       
   368 // -----------------------------------------------------------------------------
       
   369 // CHWRMVibraCommonData::VibraLocked
       
   370 // -----------------------------------------------------------------------------
       
   371 //
       
   372 TBool CHWRMVibraCommonData::VibraLocked() const
       
   373     {
       
   374     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::VibraLocked()")); 
       
   375 
       
   376     TBool retval(EFalse);
       
   377 
       
   378     // Vibra is considered also locked if it is blocked
       
   379     if ( iVibraBlockMask )
       
   380         {
       
   381         retval = ETrue;
       
   382         }
       
   383     else
       
   384         {        
       
   385         TTime currentTime;
       
   386         currentTime.UniversalTime();
       
   387 
       
   388         if ( currentTime < iVibraLockedUntil )
       
   389             {
       
   390             retval = ETrue;
       
   391             }
       
   392         }
       
   393         
       
   394     COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::VibraLocked - return 0x%x"), retval );     
       
   395     
       
   396     return retval;
       
   397     }
       
   398 
       
   399 // -----------------------------------------------------------------------------
       
   400 // CHWRMVibraCommonData::VibraBlocked
       
   401 // -----------------------------------------------------------------------------
       
   402 //
       
   403 TInt CHWRMVibraCommonData::VibraBlocked() const
       
   404     {
       
   405     COMPONENT_TRACE1( (_L("HWRM Server - CHWRMVibraCommonData::VibraBlocked()")) ); 
       
   406 
       
   407     TInt retval(EFalse);
       
   408 
       
   409     if ( iVibraBlockMask )
       
   410         {
       
   411         retval = iVibraBlockMask;
       
   412         }
       
   413         
       
   414     return retval;
       
   415     }
       
   416     
       
   417 // -----------------------------------------------------------------------------
       
   418 // CHWRMVibraCommonData::VibraBlocked
       
   419 // -----------------------------------------------------------------------------
       
   420 //
       
   421 TBool CHWRMVibraCommonData::VibraBlocked( TInt aMask ) const
       
   422     {
       
   423     TBool retval(EFalse);
       
   424     
       
   425     if ( iConfVibraBlockMask & aMask )
       
   426         {
       
   427         retval = ETrue;
       
   428         }
       
   429         
       
   430     return retval;
       
   431     }    
       
   432 
       
   433 // -----------------------------------------------------------------------------
       
   434 // CHWRMVibraCommonData::LockVibra
       
   435 // -----------------------------------------------------------------------------
       
   436 //
       
   437 void CHWRMVibraCommonData::LockVibra()
       
   438     {
       
   439     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::LockVibra()")); 
       
   440 
       
   441     iVibraLockedUntil.UniversalTime();
       
   442     iVibraLockedUntil += iMinimumOffTime;
       
   443 
       
   444     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::LockVibra - return") );     
       
   445     }
       
   446 
       
   447 // -----------------------------------------------------------------------------
       
   448 // CHWRMVibraCommonData::PublishVibraStatus
       
   449 // -----------------------------------------------------------------------------
       
   450 //
       
   451 void CHWRMVibraCommonData::PublishVibraStatus(CHWRMVibra::TVibraStatus aStatus,
       
   452                                               TBool aPrivilegedClient)
       
   453     {
       
   454     COMPONENT_TRACE3(_L("HWRM Server - CHWRMVibraCommonData::PublishVibraStatus(0x%x, 0x%x)"), aStatus, aPrivilegedClient ); 
       
   455 
       
   456     CHWRMVibra::TVibraStatus publishStatus(aStatus);
       
   457     
       
   458     // If vibra is on by a priviledged client, or privileged client is publishing status,
       
   459     // deciding published status requires some extra manouvering.
       
   460     // -> Check if actual status should be whatever is being set or not allowed 
       
   461     if ( ( (iPrivilegedVibraOn || aPrivilegedClient)
       
   462          && aStatus != CHWRMVibra::EVibraStatusOn 
       
   463          && (VibraLocked() || iVibraSetting == CHWRMVibra::EVibraModeOFF) )
       
   464          || VibraBlocked() ) // Blocked vibra will always set EVibraStatusNotAllowed
       
   465         {
       
   466         publishStatus = CHWRMVibra::EVibraStatusNotAllowed;
       
   467         }
       
   468 
       
   469     if ( aStatus == CHWRMVibra::EVibraStatusOn )
       
   470         {
       
   471         if ( aPrivilegedClient )
       
   472             {            
       
   473             iPrivilegedVibraOn = ETrue;  
       
   474             }
       
   475         // Note: Vibra on-call from non-privileged client will not change iPrivilegedVibraOn state.
       
   476         }
       
   477     else 
       
   478         {
       
   479         iPrivilegedVibraOn = EFalse;
       
   480         }
       
   481 
       
   482     // Publish vibra status to P&S. If publishing fails, something is very wrong
       
   483     // with P&S, so ignore it. If it is memory issue, hopefully it will work 
       
   484     // next time. If it is not, we can't do anything about it anyway.
       
   485     
       
   486     TInt err(KErrNone);
       
   487 	err = iProperty.Set(publishStatus);
       
   488         
       
   489     if ( err != KErrNone )
       
   490         {
       
   491         COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::PublishVibraStatus - Set failed: %d"), err );  
       
   492         }
       
   493     else
       
   494         {
       
   495         // In order to avoid publishing status for every short pulses, store last
       
   496         // published status.
       
   497         iLastPublishedStatus = publishStatus;
       
   498         COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::PublishVibraStatus - Set ok: %d"), publishStatus ); 
       
   499         }        
       
   500        
       
   501         
       
   502     COMPONENT_TRACE1(_L("HWRM Server - CHWRMVibraCommonData::PublishVibraStatus - return") );     
       
   503     }
       
   504 
       
   505 // -----------------------------------------------------------------------------
       
   506 // CHWRMVibraCommonData::IsPrivilegedSid
       
   507 // -----------------------------------------------------------------------------
       
   508 //
       
   509 TBool CHWRMVibraCommonData::IsPrivilegedSid(const TSecureId& aClientSid)
       
   510     {
       
   511     COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::IsPrivilegedSid(0x%x)"), aClientSid.iId ); 
       
   512     
       
   513     TBool retval(EFalse);
       
   514     
       
   515     if ( iPrivilegedSid )
       
   516         {
       
   517         if ( *iPrivilegedSid == aClientSid )
       
   518             {
       
   519             retval = ETrue;
       
   520             }
       
   521         }
       
   522 
       
   523     COMPONENT_TRACE2(_L("HWRM Server - CHWRMVibraCommonData::IsPrivileged - return 0x%x"), retval );        
       
   524     
       
   525     return retval;
       
   526     }
       
   527 
       
   528 // ========================== OTHER EXPORTED FUNCTIONS =========================
       
   529 
       
   530 
       
   531 
       
   532 //  End of File