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