applicationinterworkingfw/ServiceHandler/src/AiwEcomMonitor.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2003-2005 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:     Implementation for ECom monitoring class for AIW framework.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #include "AiwEcomMonitor.h"
       
    22 #include "AiwCommon.h"
       
    23 #include "AiwUids.hrh"
       
    24 #include "AiwServiceIfBase.h"
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT8(KContentTag, "<CONTENT>");
       
    28 _LIT8(KOpaqueTag, "<OPAQUE>");
       
    29 _LIT8(KAiwMimeTypeAll, "*");
       
    30 
       
    31 const TInt KMaxDataParamSize = 255;
       
    32 
       
    33 CAiwEcomMonitor* CAiwEcomMonitor::NewL(TCallBack& aSynchronizeCallBack)
       
    34     {
       
    35     CAiwEcomMonitor* self = new (ELeave) CAiwEcomMonitor(aSynchronizeCallBack); 
       
    36     CleanupStack::PushL(self);  
       
    37     self->ConstructL();
       
    38     CleanupStack::Pop(); // self
       
    39     return self;
       
    40     }
       
    41 
       
    42 
       
    43 CAiwEcomMonitor::CAiwEcomMonitor(TCallBack& aSynchronizeCallBack) 
       
    44 :CActive(CActive::EPriorityStandard), iSynchronizeCallBack(aSynchronizeCallBack)
       
    45     {
       
    46     }
       
    47 
       
    48 
       
    49 CAiwEcomMonitor::~CAiwEcomMonitor()
       
    50     {
       
    51     Cancel();
       
    52     iEcomSession.Close();
       
    53     REComSession::FinalClose();
       
    54     }
       
    55 
       
    56 
       
    57 void CAiwEcomMonitor::ConstructL()
       
    58     {
       
    59     iEcomSession = REComSession::OpenL();
       
    60     CActiveScheduler::Add(this);
       
    61     StartMonitoring();
       
    62     }
       
    63 
       
    64       
       
    65 void CAiwEcomMonitor::RunL()
       
    66     {
       
    67     iSynchronizeCallBack.CallBack();
       
    68     StartMonitoring();
       
    69     }
       
    70 
       
    71 
       
    72     
       
    73 void CAiwEcomMonitor::DoCancel()
       
    74     {
       
    75     iEcomSession.CancelNotifyOnChange(iStatus);
       
    76     }
       
    77 
       
    78 
       
    79 void CAiwEcomMonitor::StartMonitoring()
       
    80     {
       
    81     iEcomSession.NotifyOnChange(iStatus);
       
    82     SetActive();
       
    83     }
       
    84 
       
    85 
       
    86 
       
    87 void CAiwEcomMonitor::ListImplemetationsL(RImplInfoPtrArray& aResult, 
       
    88     CAiwCriteriaItem* aItem) const
       
    89     {
       
    90     TEComResolverParams params;
       
    91     
       
    92     TUid resolvUid = { KAiwResolverImplUidValue };  
       
    93     
       
    94     TBuf8<KMaxDataParamSize> dataType;     
       
    95     dataType.Copy(KContentTag);
       
    96     dataType.Append(aItem->ContentType());
       
    97     dataType.Append(KOpaqueTag);
       
    98     dataType.AppendNumUC(aItem->ServiceCmd(), EHex);
       
    99 
       
   100     params.SetDataType(dataType);
       
   101     params.SetWildcardMatch(dataType.Find(KAiwMimeTypeAll) != KErrNotFound);
       
   102     
       
   103     iEcomSession.ListImplementationsL(aItem->ServiceClass(), params, resolvUid, aResult);
       
   104     }
       
   105 
       
   106 
       
   107 
       
   108 CAiwServiceIfBase* CAiwEcomMonitor::CreateImplementationL(TUid aImplUid)
       
   109     {
       
   110     TUid dtorKeyId;
       
   111 
       
   112     CAiwServiceIfBase* iface = (CAiwServiceIfBase*)iEcomSession.CreateImplementationL(aImplUid, 
       
   113         dtorKeyId);
       
   114 
       
   115     if (iface)
       
   116         {
       
   117         iface->SetDtorKeyId( dtorKeyId );               
       
   118         iface->SetImplementationUid( aImplUid );
       
   119         }           
       
   120     
       
   121     return iface;
       
   122     }
       
   123 
       
   124 // End of file