servicediscoveryandcontrol/pnp/test/upnp/Client/upnpplugin/inc/cupnpsearch.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CUPNPSEARCH_H_
       
    17 #define __CUPNPSEARCH_H_
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <mpnpobserver.h>
       
    21 #include <upnp/upnpconstants.h>
       
    22 
       
    23 #include "pnputils.h"
       
    24 #include "ccallbackargument.h"
       
    25 #include "ctimermappeduri.h"
       
    26 
       
    27 /* Used to send discover requests for service points in the network
       
    28  @internalComponent
       
    29  */
       
    30 class CUPnPSearch: public CBase
       
    31 {
       
    32 public:
       
    33 	static CUPnPSearch* NewL( RSubConnection& aSubConnection );
       
    34 	void SubmitRequestL( const RPnPParameterBundle& aServiceInfo );
       
    35 	void NotifyResultsL( RPnPParameterBundleBase& aBundle );
       
    36 	void CancelSearchL( const RPnPParameterBundle& aServiceInfo );
       
    37 	inline TBool DiscoverInProgress();
       
    38 	~CUPnPSearch();
       
    39 
       
    40 private:
       
    41 	CUPnPSearch( RSubConnection& aSubConnection );
       
    42 	void ConstructL();
       
    43 	void CancelSearchL(const TDesC8& aUri);
       
    44 	void CreateTimerEntryL( const TDesC8& aUri );
       
    45 	void MakeBundleAndNotifyL(CCallbackArgument* aCallArgument);
       
    46 	static TInt StopSearch( TAny* aPtr );
       
    47 
       
    48 	inline TInt AdjustedDelay(TInt aTime);
       
    49 	inline RPointerArray<CTimerMappedUri>& GetTimerArray();
       
    50 	inline MPnPObserver* Observer();
       
    51 	inline RPointerArray<CCallbackArgument>& GetArgumentArray();
       
    52 	inline void SetDiscoverProgress( TBool aValue);
       
    53 	CTimerMappedUri* iMappedUri;
       
    54 	RSubConnection& iSubConnection;
       
    55 	CDeltaTimer* iDeltaTimer;
       
    56 	MPnPObserver* iObserver;
       
    57 	RPointerArray<CTimerMappedUri> 		iTimerMappedArray;
       
    58 	RPointerArray<CCallbackArgument> 	iCallbackArray;
       
    59 	TDeltaTimerEntry* iEntry;
       
    60 	TBool iIsSearching;
       
    61 };
       
    62 
       
    63 /* Used to calculate the time in microseconds to set the timer entry.Also a little
       
    64  of time is used extra to account for Intra process communication
       
    65  @param aTime	The time for which the timer has to be set in seconds
       
    66  @return The actual time in microseconds
       
    67  */
       
    68 TInt CUPnPSearch::AdjustedDelay( TInt aTime )
       
    69 	{
       
    70 	const TUint KIntTime = 1000000 ;
       
    71 	const TUint KInternalIPCLag = 1;
       
    72 	aTime = ( aTime + KInternalIPCLag ) * KIntTime ;
       
    73 	return aTime;
       
    74 	}
       
    75 
       
    76 MPnPObserver* CUPnPSearch::Observer()
       
    77 	{
       
    78 	return iObserver;
       
    79 	}
       
    80 
       
    81 /* inline method to return the RPointerArray */
       
    82 RPointerArray<CTimerMappedUri>& CUPnPSearch::GetTimerArray()
       
    83 	{
       
    84 	return iTimerMappedArray;
       
    85 	}
       
    86 RPointerArray<CCallbackArgument>& CUPnPSearch::GetArgumentArray()
       
    87 	{
       
    88 	return iCallbackArray;
       
    89 	}
       
    90 
       
    91 TBool CUPnPSearch::DiscoverInProgress()
       
    92 	{
       
    93 	return iIsSearching;
       
    94 	}
       
    95 void CUPnPSearch::SetDiscoverProgress( TBool aValue)
       
    96 	{
       
    97 	iIsSearching = aValue;
       
    98 	}
       
    99 #endif /*CUPNPSEARCH_H_*/