imservices/ossprotocoladaptation/src/search/cossprotocolsearch.cpp
changeset 46 860cd8a5168c
parent 35 085f765766a0
equal deleted inserted replaced
35:085f765766a0 46:860cd8a5168c
     1 /*
       
     2 * Copyright (c) 2008 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:  Oss Protocol search implementation
       
    15 *
       
    16 */
       
    17 
       
    18 #include <ximpbase.h>
       
    19 #include <ximpidentity.h>
       
    20 #include <ximpprotocolconnectionhost.h>
       
    21 #include <searchelement.h>
       
    22 
       
    23 #include "cossprotocolsearch.h"
       
    24 #include "cossprotocolconnectionmanager.h"
       
    25 #include "csearchrequest.h"
       
    26 #include "mossprotocolconnectionmanager.h"
       
    27 #include "ossprotocolpluginlogger.h"
       
    28 #include "ossprotocolpluginpanics.h"
       
    29 
       
    30 #include "csearchgetsearchkeys.h"
       
    31 
       
    32 // ======== MEMBER FUNCTIONS ========
       
    33 
       
    34 // ---------------------------------------------------------------------------
       
    35 // COSSProtocolSearch::GetInterface()
       
    36 // ---------------------------------------------------------------------------
       
    37 //
       
    38 TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId,
       
    39         TIfGetOps aOptions )
       
    40 	{
       
    41 	LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) );
       
    42 	 
       
    43 	MProtocolSearch* self= NULL;
       
    44 	if ( aInterfaceId == MProtocolSearch::KInterfaceId )
       
    45 		{
       
    46 	     self = this ;
       
    47 		}
       
    48 	else
       
    49 		{
       
    50 		if (aOptions == MXIMPBase::EPanicIfUnknown )
       
    51 
       
    52 			{
       
    53 			User::Panic ( _L("serach"), KErrExtensionNotSupported );
       
    54 			}
       
    55 		}
       
    56 
       
    57 	
       
    58 
       
    59 	LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) );
       
    60 
       
    61 	return self;
       
    62 	}
       
    63 
       
    64 
       
    65 // ---------------------------------------------------------------------------
       
    66 // COSSProtocolSearch::GetInterface()
       
    67 // ---------------------------------------------------------------------------
       
    68 //
       
    69 const TAny* COSSProtocolSearch::GetInterface ( TInt32 aInterfaceId,
       
    70         TIfGetOps aOptions ) const
       
    71 	{
       
    72 	LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() Start" ) );
       
    73 	 
       
    74 	const MProtocolSearch* self= NULL;
       
    75 	if ( aInterfaceId == MProtocolSearch::KInterfaceId )
       
    76 		{
       
    77 	     self = this ;
       
    78 		}
       
    79 	else
       
    80 		{
       
    81 		if (aOptions == MXIMPBase::EPanicIfUnknown )
       
    82 
       
    83 			{
       
    84 			User::Panic ( _L("serach"), KErrExtensionNotSupported );
       
    85 			}
       
    86 		}
       
    87 
       
    88 	LOGGER ( TXT ( "COSSProtocolSearch::GetInterface() End" ) );
       
    89 
       
    90 	return self;
       
    91 	}
       
    92 
       
    93 
       
    94 // ---------------------------------------------------------------------------
       
    95 // COSSProtocolSearch::GetInterfaceId()
       
    96 // ---------------------------------------------------------------------------
       
    97 //
       
    98 TInt32 COSSProtocolSearch::GetInterfaceId() const
       
    99 	{
       
   100 	LOGGER ( TXT ( "COSSProtocolSearch::GetInterfaceId() Start-End" ) );
       
   101 	return MProtocolSearch::KInterfaceId;
       
   102 	}
       
   103 
       
   104 
       
   105 // ---------------------------------------------------------------------------
       
   106 // COSSProtocolSearch::COSSProtocolSearch()
       
   107 // ---------------------------------------------------------------------------
       
   108 //
       
   109 COSSProtocolSearch::COSSProtocolSearch (
       
   110     MOSSProtocolConnectionManager& aConnMan )
       
   111 		: iConnMan ( aConnMan )
       
   112 	{
       
   113 	LOGGER ( TXT ( "Groups::COSSProtocolSearch() Start-End" ) );
       
   114 	}
       
   115 
       
   116 
       
   117 // ---------------------------------------------------------------------------
       
   118 // COSSProtocolSearch::ConstructL()
       
   119 // ---------------------------------------------------------------------------
       
   120 //
       
   121 void COSSProtocolSearch::ConstructL()
       
   122 	{
       
   123 	LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() Start" ) );
       
   124 	LOGGER ( TXT ( "COSSProtocolSearch::ConstructL() End" ) );
       
   125 	}
       
   126 
       
   127 
       
   128 // ---------------------------------------------------------------------------
       
   129 // COSSProtocolSearch::NewL()
       
   130 // ---------------------------------------------------------------------------
       
   131 //
       
   132 COSSProtocolSearch* COSSProtocolSearch::NewL (
       
   133     MOSSProtocolConnectionManager& aConnMan )
       
   134 	{
       
   135 	LOGGER ( TXT ( "COSSProtocolSearch::NewL() Start" ) );
       
   136 
       
   137 	COSSProtocolSearch* self =
       
   138 	    new ( ELeave ) COSSProtocolSearch ( aConnMan );
       
   139 	CleanupStack::PushL ( self );
       
   140 	self->ConstructL( );
       
   141 	CleanupStack::Pop ( self );
       
   142 
       
   143 	LOGGER ( TXT ( "COSSProtocolSearch::NewL() End" ) );
       
   144 	return self;
       
   145 	}
       
   146 
       
   147 
       
   148 // ---------------------------------------------------------------------------
       
   149 // COSSProtocolSearch::~COSSProtocolSearch()
       
   150 // ---------------------------------------------------------------------------
       
   151 //
       
   152 COSSProtocolSearch::~COSSProtocolSearch()
       
   153 	{
       
   154 	LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() Start" ) );
       
   155 
       
   156 	LOGGER ( TXT ( "COSSProtocolSearch::~COSSProtocolSearch() End" ) );
       
   157 	}
       
   158 
       
   159 
       
   160 
       
   161 // ---------------------------------------------------------------------------
       
   162 // COSSProtocolSearch::DoSearchL()
       
   163 // ---------------------------------------------------------------------------
       
   164 //
       
   165 void COSSProtocolSearch::DoSearchL( const  MXIMPIdentity& aSearchId,
       
   166     							    const  RPointerArray< MSearchElement >& aObjs,
       
   167                                     TInt   aSearchLimit,
       
   168                                     TXIMPRequestId  aReqId )
       
   169    {
       
   170    LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) );
       
   171    
       
   172    CSearchrequest* req = CSearchrequest::NewLC ( iConnMan, aReqId );
       
   173    req->SearchL(aSearchId,aObjs,aSearchLimit); 
       
   174    
       
   175    CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation
       
   176 
       
   177    LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) );
       
   178    }
       
   179                                		   
       
   180 
       
   181 // ---------------------------------------------------------------------------
       
   182 // COSSProtocolSearch::DoSearchL()
       
   183 // ---------------------------------------------------------------------------
       
   184 //
       
   185 void COSSProtocolSearch::DoGetSearchKeysL( TXIMPRequestId aReqId )
       
   186    {
       
   187    LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() Start" ) );
       
   188    //Shoudl be changed to NewLC
       
   189    CSearchGetSearchKeys* req = CSearchGetSearchKeys::NewL ( 
       
   190    								iConnMan, aReqId );
       
   191   // req->SearchL(aSearchId,aObjs,aSearchLimit); 
       
   192   
       
   193    req->GetSearchKeysL();
       
   194    
       
   195    //CleanupStack::Pop ( req ); // req is deleted by itself once it completes the operation
       
   196 
       
   197    LOGGER ( TXT ( "COSSProtocolSearch::DoSearchL() End" ) );
       
   198    }
       
   199 // End of file
       
   200