imservices/searchfeatureplugin/srcsearchprocessor/protocoldatahostimp.cpp
changeset 51 61fad867f68e
equal deleted inserted replaced
-1:000000000000 51:61fad867f68e
       
     1 /*
       
     2 * Copyright (c) 2006 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 of protocol data host
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #include <ximpprotocolconnection.h>
       
    21 #include <protocolsearchfeature.h>
       
    22 #include <searchobjectfactory.h>
       
    23 #include <ximpoperationbase.h>
       
    24 
       
    25 #include "ximpapiobjbase.h"
       
    26 #include "searchapiobjbase.h"
       
    27 #include "searchobjectfactoryimp.h"
       
    28 
       
    29 #include "protocoldatahostimp.h"
       
    30 #include "protocolsearchdatahostimp.h"
       
    31 #include "protocolsearchfeaturedatahostimp.h"
       
    32 #include "searchlogutils.h"
       
    33 
       
    34 #include "searchoperationdefs.h"
       
    35 
       
    36 // ======== MEMBER FUNCTIONS ========
       
    37 
       
    38 
       
    39 // This should be variated. Branding variation can be one
       
    40 // possibility. One is to leave adaptation deside how soon
       
    41 // cleanup will be done.
       
    42 // Now 5 sec used for testing purposes. Better value could be
       
    43 // some minutes.
       
    44 
       
    45 // ---------------------------------------------------------------------------
       
    46 // CProtocolDataHostImp::CProtocolDataHostImp()
       
    47 // ---------------------------------------------------------------------------
       
    48 //
       
    49 CProtocolDataHostImp::CProtocolDataHostImp( MXIMPHost& aHost )
       
    50 :iHost( aHost )
       
    51     {
       
    52     XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Started"));
       
    53     XSearchLogger::Log(_L("CProtocolDataHostImp::CProtocolDataHostImp Completed"));
       
    54     }
       
    55 
       
    56 
       
    57 // ---------------------------------------------------------------------------
       
    58 // CProtocolDataHostImp::ConstructL()
       
    59 // ---------------------------------------------------------------------------
       
    60 //
       
    61 void CProtocolDataHostImp::ConstructL()
       
    62     {
       
    63     XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Started"));
       
    64     iSearchDataHost = CProtocolSearchDataHostImp::NewL(iHost) ;
       
    65     XSearchLogger::Log(_L("CProtocolDataHostImp::ConstructL Completed"));
       
    66     }
       
    67 
       
    68 
       
    69 // ---------------------------------------------------------------------------
       
    70 // CProtocolDataHostImp::NewLC()
       
    71 // ---------------------------------------------------------------------------
       
    72 //
       
    73 EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewLC( MXIMPHost& aHost )
       
    74     {
       
    75     XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Started"));
       
    76     CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
       
    77     CleanupStack::PushL( self );
       
    78     self->ConstructL();
       
    79     XSearchLogger::Log(_L("CProtocolDataHostImp::NewLC Completed"));
       
    80     return self;
       
    81     }
       
    82 
       
    83 // ---------------------------------------------------------------------------
       
    84 // CProtocolDataHostImp::NewL()
       
    85 // ---------------------------------------------------------------------------
       
    86 //
       
    87 EXPORT_C CProtocolDataHostImp* CProtocolDataHostImp::NewL( MXIMPHost& aHost )
       
    88     {
       
    89     XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Started"));
       
    90     CProtocolDataHostImp* self = new( ELeave ) CProtocolDataHostImp( aHost );
       
    91     CleanupStack::PushL( self );
       
    92     self->ConstructL();
       
    93     CleanupStack::Pop( self );
       
    94     XSearchLogger::Log(_L("CProtocolDataHostImp::NewL Completed"));
       
    95     return self;
       
    96     }
       
    97 // ---------------------------------------------------------------------------
       
    98 // CProtocolDataHostImp::~CProtocolDataHostImp()
       
    99 // ---------------------------------------------------------------------------
       
   100 //
       
   101 CProtocolDataHostImp::~CProtocolDataHostImp()
       
   102     {
       
   103     XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Started"));
       
   104     delete iSearchDataHost ;
       
   105     XSearchLogger::Log(_L("CProtocolDataHostImp::~CProtocolDataHostImp Completed"));
       
   106     }
       
   107 
       
   108 // ---------------------------------------------------------------------------
       
   109 // CProtocolDataHostImp::SetHostToProtocol()
       
   110 // ---------------------------------------------------------------------------
       
   111 //
       
   112 void CProtocolDataHostImp::SetHostToProtocol()
       
   113 	{
       
   114 	MProtocolSearchFeature* searchProtocolFeature = static_cast< MProtocolSearchFeature*> 
       
   115 							(iHost.GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId) );
       
   116 	
       
   117 	if(searchProtocolFeature )
       
   118 		{
       
   119 		searchProtocolFeature->SetHost(*iSearchDataHost);	
       
   120 		}
       
   121 	
       
   122 	}
       
   123 
       
   124 // ---------------------------------------------------------------------------
       
   125 // CProtocolDataHostImp::GetInterface()
       
   126 // ---------------------------------------------------------------------------
       
   127 //
       
   128 TAny* CProtocolDataHostImp::GetInterface(TInt aInterfaceId)
       
   129 	{
       
   130 	if(aInterfaceId == MProtocolSearchDataHost::KInterfaceId )
       
   131 		{
       
   132 		return iSearchDataHost ;	
       
   133 		}
       
   134 	
       
   135 	else
       
   136 		{
       
   137 		return NULL ;	
       
   138 		}
       
   139 		
       
   140 	}
       
   141 
       
   142 // ---------------------------------------------------------------------------
       
   143 // CProtocolDataHostImp::GetCleanupOperation()
       
   144 // ---------------------------------------------------------------------------
       
   145 //
       
   146 TInt CProtocolDataHostImp::GetCleanupOperation() 
       
   147 	{
       
   148 	return NSearchOps::ESearchCleaner ; // return cleaner operation : 
       
   149 	                                    // BUT NO CLEANING IS IMPLEMENTED IN SERACH PLUGIN ( NOT REQUIRED)
       
   150 	}
       
   151 // End of file
       
   152