bluetooth/btsdp/agent/engine.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 // Copyright (c) 2000-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 BTSDPAGENTENGINE_H
       
    17 #define BTSDPAGENTENGINE_H
       
    18 
       
    19 #include <e32base.h>
       
    20 #include <bttypes.h>
       
    21 #include <btsdp.h>
       
    22 #include "agtypes.h"
       
    23 
       
    24 class CSdpAttrBuilder;
       
    25 class CSdpRequesterBase;
       
    26 class CSdpAttributeRequester;
       
    27 class CSdpSearchRequester;
       
    28 
       
    29 /**
       
    30    Engine that actually implements the CSdpAgent facade funtionality.
       
    31 **/
       
    32 NONSHARABLE_CLASS(CSdpAgentEng) : public CBase
       
    33 	{
       
    34 friend class CSdpAttributeRequester;
       
    35 friend class CSdpSearchRequester;
       
    36 public:
       
    37 	static CSdpAgentEng* NewL(MSdpAgentNotifier& aNotifier, TBTDevAddr aDevAddr);
       
    38 	void ConstructL();
       
    39 	~CSdpAgentEng();
       
    40 	void SetRecordFilterL(const CSdpSearchPattern& aUUIDFilter);
       
    41 	void NextRecordRequestL();
       
    42 
       
    43 	void AttributeRequestL(TSdpServRecordHandle aHandle, 
       
    44 						   const CSdpAttrIdMatchList& aMatchList);
       
    45 	void AttributeRequestL(MSdpElementBuilder* aBuilder,
       
    46 		                   TSdpServRecordHandle aHandle, 
       
    47 						   const CSdpAttrIdMatchList& aMatchList);
       
    48 	void Cancel();
       
    49 
       
    50 private:
       
    51 	// upcalls from requesters AOs. Not exported
       
    52 	void HandleServiceSearchResponseL(TUint16 aTotalRecCount,
       
    53 									 TUint16 aCurrentRecCount,
       
    54 									 const TDesC8& aRecHandles,
       
    55 									 const TDesC8& aContState);
       
    56 	void HandleServiceSearchError(TInt aError);
       
    57 	void HandleAttributeResponseL(const TDesC8& aAttributeList, 
       
    58 								  const TDesC8& aContState);
       
    59 	void HandleAttributeError(TInt aError);
       
    60 
       
    61 	void SendAttributeRequestL();
       
    62 
       
    63 	TBool TryToCompleteNextRecordRequest();
       
    64 	 //FIXME: do we need this or do we search?
       
    65 	CSdpAgentEng(MSdpAgentNotifier& aNotifier, TBTDevAddr aDevAddr);
       
    66 	void ResetForNewAttributeRequest();
       
    67 	void ResetForNewRecordRequest();
       
    68 
       
    69 private:
       
    70 	enum TServiceSearchState
       
    71 		{
       
    72 		EIdle,
       
    73 		ERequesting,
       
    74 		EResultsReceived
       
    75 		};
       
    76 
       
    77 	TContState iSearchRequestContState;
       
    78 	CSdpSearchPattern* iUUIDFilter;
       
    79 	CArrayFix<TSdpServRecordHandle>* iBuiltRecHandles;
       
    80 	TInt iNextRecHandle;
       
    81 	TInt iTotalRecCount;
       
    82 	TServiceSearchState iServiceSearchState;
       
    83 	TBool iCancelCalled;
       
    84 
       
    85 	TSdpServRecordHandle iAttributeRequestHandle;
       
    86 	TContState iAttributeRequestContState;
       
    87 	CSdpAttrIdMatchList* iMatchList;
       
    88 	CSdpAttrBuilder* iDefaultAttributeBuilder;
       
    89 	CElementParser* iParser;
       
    90 
       
    91 	MSdpAgentNotifier& iNotifier;
       
    92 	TBTDevAddr iRemoteAddress;
       
    93 	RSdpSession iSdpSession;
       
    94 	CSdpSearchRequester* iSearchRequester;
       
    95 	CSdpAttributeRequester* iAttributeRequester;
       
    96 	};
       
    97 
       
    98 #endif