messagingappbase/obexmtms/btmtm/btclient/Include/btHeader.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2001-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 // $Workfile: btHeader.h $
       
    15 // $Author: Stevep $
       
    16 // $Revision: 5 $
       
    17 // $Date: 23/01/02 13:31 $
       
    18 // 
       
    19 //
       
    20 
       
    21 
       
    22 #if !defined (__BTHEADER_H__)
       
    23 #define __BTHEADER_H__
       
    24 
       
    25 
       
    26 #include <e32std.h>
       
    27 #include <obexheader.h>		//CObexMtmHeader
       
    28 #include <obex.h>			//TObexBluetoothProtocolInfo
       
    29 
       
    30 class CMsvStore;
       
    31 class RMsvReadStream;
       
    32 class RMsvWriteStream;
       
    33 
       
    34 
       
    35 // Stream version -- increment by one each time the externalized data format changes
       
    36 // for a significant release.
       
    37 const TInt32 KBtMessageStreamVersion = 1;//<Stream version
       
    38 const TUid KUidStreamBtHeaders  = {0x1000AABC};    //< Stream UID for the CBtHeaders object
       
    39 _LIT(KBtTransport, "RFCOMM");
       
    40 
       
    41 class CBtHeader : public CObexMtmHeader
       
    42 /**
       
    43 Base class for OBEX object headers. Allows them to be stored and restored to and from the
       
    44 CMsvStore.
       
    45 
       
    46 @internalTechnology
       
    47 @released
       
    48 */
       
    49 	{
       
    50 public:
       
    51 
       
    52 	/**
       
    53 	 * Destructor. Empty
       
    54 	 */
       
    55 	
       
    56     IMPORT_C ~CBtHeader();
       
    57     
       
    58 	/**
       
    59 	 * Second-phase constructor. Calls BaseConstructL to initialise the base members
       
    60 	 */
       
    61 	
       
    62 	IMPORT_C void ConstructL();
       
    63     
       
    64 	/**
       
    65 	 * Canonical NewL factory function
       
    66 	 */
       
    67 
       
    68 	IMPORT_C static CBtHeader* NewL();
       
    69 	//Setters/Getters
       
    70 	
       
    71 	
       
    72 	/**
       
    73 	 * Get the BT protocol info of the recipient
       
    74 	 *
       
    75 	 * @return The protocol info of the recipient (NB: only one recipient is currently supported)
       
    76 	 */
       
    77 
       
    78 	IMPORT_C virtual const TObexBluetoothProtocolInfo& BtProtocolInfo() const;
       
    79 	
       
    80 	/**
       
    81 	 * Get the BT address of the recipient
       
    82 	 *
       
    83 	 *  @return The address of the recipient (NB: only one recipient is currently supported)
       
    84 	 */
       
    85 	
       
    86 	IMPORT_C virtual TPtrC8 Addr() const;
       
    87 	
       
    88 	/**
       
    89 	 * Set the BT address of the recipient.  The RfComm service slot will be obtained through 
       
    90 	 * an SDP lookup in the server side MTM.
       
    91 	 *
       
    92 	 *  @param aAddr the address of the recipient (NB: only one recipient is currently supported)
       
    93 	 */
       
    94 	
       
    95 	IMPORT_C virtual void SetAddrL(const TDesC8& aAddr);
       
    96 
       
    97 	//Called by Store/Restore--must be implelented in the base class, and must call
       
    98 	//BaseExternalizeL/BaseInternaliseL first
       
    99 
       
   100 	/**
       
   101 	 * Internaliser. Reads data in from aReadStream. Calls BaseInternalizeL() to read in the base 
       
   102 	 * data first.
       
   103 	 *
       
   104 	 * @param aReadStream Stream to read data in from
       
   105 	 * @leave KErrXXX Standard EPOC stream leave codes
       
   106 	 */
       
   107 
       
   108     IMPORT_C virtual void InternalizeL(RMsvReadStream& aReadStream);
       
   109     
       
   110 	/**
       
   111 	 * Externaliser. Writes data out to aWriteStream. Calls BaseExternalizeL() to write out
       
   112 	 * the base data first.
       
   113 	 *
       
   114 	 * @param aWriteStream Stream to write data to
       
   115 	 * @leave KErrXXX Standard SymbianOS stream leave codes
       
   116 	 */
       
   117 	
       
   118 	IMPORT_C virtual void ExternalizeL(RMsvWriteStream& aWriteStream) const;
       
   119 
       
   120 private:
       
   121 
       
   122 	/**
       
   123 	 * Default constructor, initialises the base class and sets the value of iBtProtocolInfo.iTransport
       
   124 	 * as appropriate for BT
       
   125 	 */
       
   126 
       
   127 	CBtHeader();
       
   128 
       
   129 private:
       
   130 	TObexBluetoothProtocolInfo iBtProtocolInfo;		//< Protocol info to be internalised/externalised
       
   131 	};
       
   132 
       
   133 #endif	//!defined (__BTHEADER_H__)