usbmgmt/usbmgr/host/functiondrivers/ms/msmm/referencepolicyplugin/src/refppnotificationman.cpp
branchRCL_3
changeset 15 f92a4f87e424
parent 0 c9bc50fca66e
child 16 012cc2ee6408
equal deleted inserted replaced
14:d3e8e7d462dd 15:f92a4f87e424
     1 /*
     1 /*
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    22 
    22 
    23 #include "refppnotificationman.h"
    23 #include "refppnotificationman.h"
    24 #include <usb/usblogger.h>
    24 #include <usb/usblogger.h>
    25 #include <usb/hostms/policypluginnotifier.hrh>
    25 #include <usb/hostms/policypluginnotifier.hrh>
    26 #include "srvpanic.h"
    26 #include "srvpanic.h"
       
    27 #include "OstTraceDefinitions.h"
       
    28 #ifdef OST_TRACE_COMPILER_IN_USE
       
    29 #include "refppnotificationmanTraces.h"
       
    30 #endif
    27 
    31 
    28  
    32 
    29 #ifdef __FLOG_ACTIVE
       
    30 _LIT8(KLogComponent, "UsbHostMsmmRefPP");
       
    31 #endif
       
    32 
    33 
    33 #ifdef __OVER_DUMMYCOMPONENT__
    34 #ifdef __OVER_DUMMYCOMPONENT__
    34 const TUid KMountPolicyNotifierUid = {0x1028653E};
    35 const TUid KMountPolicyNotifierUid = {0x1028653E};
    35 #else
    36 #else
    36 const TUid KMountPolicyNotifierUid = {KUidMountPolicyNotifier};
    37 const TUid KMountPolicyNotifierUid = {KUidMountPolicyNotifier};
    37 #endif
    38 #endif
    38 
    39 
    39 CMsmmPolicyNotificationManager::~CMsmmPolicyNotificationManager()
    40 CMsmmPolicyNotificationManager::~CMsmmPolicyNotificationManager()
    40     {
    41     {
    41     LOG_FUNC
    42     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_ENTRY );
       
    43     
    42     Cancel();
    44     Cancel();
    43     iErrorQueue.Close();
    45     iErrorQueue.Close();
    44     iNotifier.Close();
    46     iNotifier.Close();
       
    47     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_DES_EXIT );
    45     }
    48     }
    46 
    49 
    47 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewL()
    50 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewL()
    48     {
    51     {
    49     LOG_STATIC_FUNC_ENTRY
    52     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_ENTRY );
       
    53     
    50     CMsmmPolicyNotificationManager* self = 
    54     CMsmmPolicyNotificationManager* self = 
    51         CMsmmPolicyNotificationManager::NewLC();
    55         CMsmmPolicyNotificationManager::NewLC();
    52     CleanupStack::Pop(self);
    56     CleanupStack::Pop(self);
    53     
    57     
       
    58     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWL_EXIT );
    54     return self;
    59     return self;
    55     }
    60     }
    56 
    61 
    57 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewLC()
    62 CMsmmPolicyNotificationManager* CMsmmPolicyNotificationManager::NewLC()
    58     {
    63     {
    59     LOG_STATIC_FUNC_ENTRY
    64     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_ENTRY );
       
    65     
    60     CMsmmPolicyNotificationManager* self = 
    66     CMsmmPolicyNotificationManager* self = 
    61         new (ELeave) CMsmmPolicyNotificationManager();
    67         new (ELeave) CMsmmPolicyNotificationManager();
    62     CleanupStack::PushL(self);
    68     CleanupStack::PushL(self);
    63     self->ConstructL();
    69     self->ConstructL();
    64     
    70     
       
    71     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_NEWLC_EXIT );
    65     return self;
    72     return self;
    66     }
    73     }
    67 
    74 
    68 void CMsmmPolicyNotificationManager::SendErrorNotificationL(
    75 void CMsmmPolicyNotificationManager::SendErrorNotificationL(
    69         const THostMsErrData& aErrData)
    76         const THostMsErrData& aErrData)
    70     {
    77     {
    71     LOG_FUNC
    78     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_ENTRY );
       
    79     
    72 
    80 
    73     // Print error notification data to log
    81     // Print error notification data to log
    74     LOGTEXT2(_L("Err:iError = %d"), aErrData.iError);
    82     OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL, 
    75     LOGTEXT2(_L("Err:iE32Error = %d"), aErrData.iE32Error);
    83             "Err:iError = %d", aErrData.iError );
    76     LOGTEXT2(_L("Err:iDriveName = %d"), aErrData.iDriveName);
    84     OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP1, 
    77     LOGTEXT2(_L("Err:iManufacturerString = %S"), &aErrData.iManufacturerString);
    85             "Err:iE32Error = %d", aErrData.iE32Error );
    78     LOGTEXT2(_L("Err:iProductString = %S"), &aErrData.iProductString);
    86     OstTrace1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP2, 
    79     
    87             "Err:iDriveName = %d", aErrData.iDriveName );
       
    88     OstTraceExt1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP3, 
       
    89             "Err:iManufacturerString = %S", aErrData.iManufacturerString );
       
    90     OstTraceExt1( TRACE_NORMAL, REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_DUP4, 
       
    91             "Err:iProductString = %S", aErrData.iProductString );
       
    92             
    80     THostMsErrorDataPckg errPckg = aErrData;
    93     THostMsErrorDataPckg errPckg = aErrData;
    81     iErrorQueue.AppendL(errPckg);
    94     iErrorQueue.AppendL(errPckg);
    82     if (!IsActive())
    95     if (!IsActive())
    83     	{
    96     	{
    84     	SendNotification();
    97     	SendNotification();
    85     	}
    98     	}
       
    99     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDERRORNOTIFICATIONL_EXIT );
    86     }
   100     }
    87 
   101 
    88 void CMsmmPolicyNotificationManager::RunL()
   102 void CMsmmPolicyNotificationManager::RunL()
    89     {
   103     {
    90     LOG_FUNC
   104     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_ENTRY );
       
   105     
    91     iErrorQueue.Remove(0);
   106     iErrorQueue.Remove(0);
    92     if (iErrorQueue.Count() > 0)
   107     if (iErrorQueue.Count() > 0)
    93         {
   108         {
    94         SendNotification();
   109         SendNotification();
    95         }
   110         }
       
   111     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_RUNL_EXIT );
    96     }
   112     }
    97 
   113 
    98 void CMsmmPolicyNotificationManager::DoCancel()
   114 void CMsmmPolicyNotificationManager::DoCancel()
    99     {
   115     {
   100     LOG_FUNC
   116     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_ENTRY );
       
   117     
   101     iErrorQueue.Reset();
   118     iErrorQueue.Reset();
   102     iNotifier.CancelNotifier(KMountPolicyNotifierUid);
   119     iNotifier.CancelNotifier(KMountPolicyNotifierUid);
       
   120     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_DOCANCEL_EXIT );
   103     }
   121     }
   104 
   122 
   105 CMsmmPolicyNotificationManager::CMsmmPolicyNotificationManager():
   123 CMsmmPolicyNotificationManager::CMsmmPolicyNotificationManager():
   106 CActive(EPriorityStandard)
   124 CActive(EPriorityStandard)
   107     {
   125     {
   108     LOG_FUNC
   126     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_ENTRY );
       
   127     
   109     CActiveScheduler::Add(this);
   128     CActiveScheduler::Add(this);
       
   129     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CMSMMPOLICYNOTIFICATIONMANAGER_EXIT );
   110     }
   130     }
   111 
   131 
   112 void CMsmmPolicyNotificationManager::ConstructL()
   132 void CMsmmPolicyNotificationManager::ConstructL()
   113     {
   133     {
   114     LOG_FUNC
   134     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_ENTRY );
       
   135     
   115     User::LeaveIfError(iNotifier.Connect());
   136     User::LeaveIfError(iNotifier.Connect());
       
   137     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_CONSTRUCTL_EXIT );
   116     }
   138     }
   117 
   139 
   118 void CMsmmPolicyNotificationManager::SendNotification()
   140 void CMsmmPolicyNotificationManager::SendNotification()
   119     {
   141     {
   120     LOG_FUNC
   142     OstTraceFunctionEntry0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_ENTRY );
       
   143     
   121     iNotifier.StartNotifierAndGetResponse(
   144     iNotifier.StartNotifierAndGetResponse(
   122         iStatus, KMountPolicyNotifierUid, iErrorQueue[0], iResponse);
   145         iStatus, KMountPolicyNotifierUid, iErrorQueue[0], iResponse);
   123     SetActive();
   146     SetActive();
       
   147     OstTraceFunctionExit0( REF_CMSMMPOLICYNOTIFICATIONMANAGER_SENDNOTIFICATION_EXIT );
   124     }
   148     }
   125 
   149 
   126 // End of file
   150 // End of file