bluetoothapitest/bluetoothsvs/T_BTSdpAPI/inc/T_DataSdpAgent.h
changeset 0 29b1cd4cb562
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #if (!defined __T_DATA_SDP_AGENT_H__ )
       
    20 #define __T_DATA_SDP_AGENT_H__
       
    21 
       
    22 //	User Includes
       
    23 #include "T_DataSdpAttrValueNil.h"
       
    24 #include "DataWrapperBase.h"
       
    25 
       
    26 //	EPOC includes
       
    27 #include <bt_sock.h> // Bluetooth address classes
       
    28 
       
    29 /**
       
    30  * Test Active Notification class
       
    31  *
       
    32  */
       
    33 class CT_DataSdpAgent : public CDataWrapperBase, private MSdpAgentNotifier
       
    34 	{
       
    35 public:
       
    36 	/**
       
    37 	* Two phase constructor
       
    38 	*/
       
    39 	static CT_DataSdpAgent*	NewL();
       
    40 
       
    41 	/**
       
    42 	* Public destructor
       
    43 	*/
       
    44 	~CT_DataSdpAgent();
       
    45 
       
    46 	/**
       
    47 	* Process a command read from the ini file
       
    48 	*
       
    49 	* @param aCommand			The command to process
       
    50 	* @param aSection			The section in the ini containing data for the command
       
    51 	* @param aAsyncErrorIndex	Command index for async calls to return errors to
       
    52 	*
       
    53 	* @return					ETrue if the command is processed
       
    54 	*
       
    55 	* @leave					System wide error
       
    56 	*/
       
    57 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
       
    58 
       
    59 	/**
       
    60 	* Return a pointer to the object that the data wraps
       
    61 	*
       
    62 	* @return	pointer to the object that the data wraps
       
    63 	*/
       
    64 	virtual TAny*	GetObject()	{ return iSdpAgent; }
       
    65 
       
    66 	/**
       
    67 	* Set the object that the data wraps
       
    68 	*
       
    69 	* @param	aObject object that the wrapper is testing
       
    70 	*
       
    71 	*/
       
    72 	virtual void	SetObjectL(TAny* aAny);
       
    73 
       
    74 	/**
       
    75 	* The object will no longer be owned by this
       
    76 	*
       
    77 	* @leave	KErrNotSupported if the the function is not supported
       
    78 	*/
       
    79 	virtual void	DisownObjectL();
       
    80 
       
    81 	/**
       
    82 	* Query to see if there are any outstanding requests
       
    83 	*
       
    84 	* @return ETrue if there are any outstanding requests
       
    85 	*/
       
    86 	//virtual TBool	Outstanding() { return iOutstanding>0; }
       
    87 	
       
    88 	/**
       
    89 	* Export the attribute value array which contains the request results
       
    90 	*
       
    91 	* @return RPointerArray
       
    92 	*/
       
    93 	const RPointerArray<CSdpAttrValue>& GetAttrValArray();
       
    94 	
       
    95 	inline virtual TCleanupOperation CleanupOperation();
       
    96 	
       
    97 protected:
       
    98 	/**
       
    99 	* Protected constructor. First phase construction
       
   100 	*/
       
   101 	CT_DataSdpAgent();
       
   102 
       
   103 	/**
       
   104 	* Second phase construction
       
   105 	*/
       
   106 	void	ConstructL();
       
   107 
       
   108 private:
       
   109 	//	MSdpAgentNotifier implementation
       
   110 	virtual void	AttributeRequestComplete(TSdpServRecordHandle aHandle, TInt aError);
       
   111 	virtual void	AttributeRequestResult(TSdpServRecordHandle aHandle, TSdpAttributeID aAttrID, CSdpAttrValue* aAttrValue);
       
   112 	virtual void	NextRecordRequestComplete(TInt aError, TSdpServRecordHandle aHandle, TInt aTotalRecordsCount);
       
   113 
       
   114 	static void CleanupOperation(TAny* aAny);
       
   115 
       
   116 	/**
       
   117 	* Helper methods
       
   118 	*/
       
   119 	void			DestroyData();
       
   120 
       
   121 	//CSdpAgent	helper methods
       
   122     inline void		DoCmdNewL(const TDesC& aSection);
       
   123     inline void		DoCmdNewLC(const TDesC& aSection);
       
   124     inline void		DoCmdSetRecordFilterL(const TDesC& aSection);
       
   125     inline void		DoCmdNextRecordRequestL(const TDesC& aSection, const TInt aIndex);
       
   126     inline void		DoCmdSetAttributePredictorListL(const TDesC& aSection);
       
   127     inline void		DoCmdAttributeRequestL(const TDesC& aSection, const TInt aIndex);
       
   128     inline void		DoCmdCancel();
       
   129     inline void		DoCmdDestructor();
       
   130     inline void		DoCmdMSAN_ExtensionInterfaceL();
       
   131 
       
   132 private:
       
   133 	CSdpAgent*           			iSdpAgent;
       
   134 	CSdpAttrValueList*    			iAttrValueList;
       
   135 	TInt							iExpectedRecordsCount;
       
   136     TSdpServRecordHandle            iSSRHandle;
       
   137 	RPointerArray<CSdpAttrValue>	iAttrValArray;
       
   138 	TInt                            iAttrReqIndex;
       
   139 	TInt                            iNextRecReqIndex;
       
   140 	};
       
   141 
       
   142 #endif /* __T_DATA_SDP_AGENT_H__*/