bluetoothapitest/bluetoothsvs/T_BTSockAddrAPI/inc/T_BTSockAddrData.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_BT_SOCK_ADDR_DATA_H__)
       
    20 #define __T_BT_SOCK_ADDR_DATA_H__
       
    21 
       
    22 //	User Includes
       
    23 #include "DataWrapperBase.h"
       
    24 // Classes to get to protected members
       
    25 #include "T_TRfcommSockAddrChild.h"
       
    26 #include "T_TBTSockAddrChild.h"
       
    27 
       
    28 //	EPOC includes
       
    29 #include <w32std.h>
       
    30 #include <e32std.h>
       
    31 #include <es_sock.h> // TSockAddr address 
       
    32 #include <bt_sock.h> // Bluetooth address classes
       
    33 
       
    34 
       
    35 class CT_BTSockAddrData: public CDataWrapperBase
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	* Two phase constructor
       
    40 	*/
       
    41 	static CT_BTSockAddrData*	NewL();
       
    42 	
       
    43 	/**
       
    44 	* Process a command read from the ini file
       
    45 	*
       
    46 	* @param aCommand			The command to process
       
    47 	* @param aSection			The section in the ini containing data for the command
       
    48 	* @param aAsyncErrorIndex	Command index for async calls to return errors to
       
    49 	*
       
    50 	* @return					ETrue if the command is processed
       
    51 	*
       
    52 	* @leave					System wide error
       
    53 	*/
       
    54 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
       
    55 	
       
    56 	/**
       
    57 	* Destructor
       
    58 	*/
       
    59 	~CT_BTSockAddrData();
       
    60 	
       
    61 	/**
       
    62 	* Set object from outside so that it can be verified
       
    63 	*/	
       
    64 	void SetObject(T_TBTSockAddrChild* aTBTSockAddrChild, TBool aTransferOwnership);
       
    65 
       
    66 protected:
       
    67 	/**
       
    68 	* Protected constructor. First phase construction
       
    69 	*/
       
    70 	CT_BTSockAddrData();
       
    71 	
       
    72 		/**
       
    73 	* Return a pointer to the object that the data wraps
       
    74 	*
       
    75 	* \return pointer to the object that the data wraps
       
    76 	*/
       
    77 	virtual TAny*	GetObject();
       
    78 private:	
       
    79 	// Implementation of DoCommandL for each of the commands
       
    80 	inline void TBTSockAddrConstruct(const TDesC& aSection);
       
    81 	inline void TBTSockAddrCastFromTSockAddr(const TDesC& aSection);
       
    82 	inline void TBTSockAddrSetBTAddr(const TDesC& aSection);
       
    83 	inline void TBTSockAddrBTAddr(const TDesC& aSection);
       
    84 	inline void TBTSockAddrSetSecurity(const TDesC& aSection);
       
    85 	inline void TBTSockAddrBTSecurity(const TDesC& aSection);
       
    86 	inline void TBTSockAddrSetFamily(const TDesC& aSection);
       
    87 	inline void TBTSockAddrFamily(const TDesC& aSection);
       
    88 	inline void TBTSockAddrSetPort(const TDesC& aSection);
       
    89 	inline void TBTSockAddrPort(const TDesC& aSection);
       
    90 	inline void TBTSockAddrCmpPort(const TDesC& aSection);
       
    91 	inline void TBTSockAddrPROTECTEDSetUserLen(const TDesC& aSection);
       
    92 	inline void TBTSockAddrGetUserLen(const TDesC& aSection);
       
    93 	inline void TBTSockAddrPROTECTEDUserPtr();
       
    94 	inline void TBTSockAddrPROTECTEDEndBTSockAddrPtr();
       
    95 
       
    96 	/**
       
    97 	* Delete iTBTSockAddr if owned and set to 0
       
    98 	*/
       
    99 	void Cleanup();	
       
   100 
       
   101 private:
       
   102 	// An object of T_TBTSockAddrChild class in order to retain state between calls       
       
   103 	// T_TBTSockAddrChild is a wrapper around the TBTSockAddr to reach protected methods
       
   104     T_TBTSockAddrChild*	iTBTSockAddr;
       
   105     // Identifies if the iTBTSockAddr is owned, needed due to cast
       
   106     TBool iTBTSockAddrOwned;
       
   107     
       
   108 	};
       
   109 
       
   110 #endif /* __T_BT_SOCK_ADDR_DATA_H__ */