epoc32/include/tranp.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
     1 // Copyright (c) 1997-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 // IrTranp API 
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @publishedAll
    21  @released
    22 */
    23 
    24 #ifndef _TRANP_H_
    25 #define _TRANP_H_
    26 
    27 #include <e32base.h>
    28 
    29 const TInt KErrIrtranpPeerDoesNotHaveIrtranp = -5530;
    30 
    31 _LIT8(KDefaultPMID, "\x08\x00\x74\x00\x00\x00\x00\x01"); //Casio's number
    32 _LIT8(KNullPMID, "\x00\x00\x00\x00\x00\x00\x00\x00");
    33 
    34 enum TLatticeSize 
    35 /** Encodes the size of a picture.
    36 
    37 @see TTranpPicture */
    38 	{
    39 	/** Quarter VGA, 320x240 pixels. */
    40 	EQVGA,
    41 	/** Full VGA, 640x480 pixels. */
    42 	EVGA,
    43 	/** Super VGA, 800x600 pixels. */
    44 	ESVGA,
    45     /** XGA, 1024x768 pixels. */
    46 	EXGA,
    47 	/** Super XGA, 1280x960 pixels. */
    48 	ESXGA,
    49 	/** Arbitrary size. There is no implied width and height. These values must be 
    50 	explicitly supplied. */
    51 	EFREE
    52 };
    53 
    54 NONSHARABLE_CLASS(TTranpConfig)
    55 
    56 /** Encapsulates configuration parameters for a session.
    57 @publishedAll
    58 @released
    59 @see CTranpSession */
    60 	{
    61 public:
    62 	IMPORT_C TTranpConfig();
    63 	IMPORT_C ~TTranpConfig();
    64 
    65 	IMPORT_C void SetPrimaryMachine(const TDesC8& aPMID);
    66 	IMPORT_C void SetSecondaryMachine(const TDesC8& aSMID);
    67 
    68 	IMPORT_C const TDesC8& PrimaryMachine();
    69 	IMPORT_C const TDesC8& SecondaryMachine();
    70 
    71 private:
    72 	TBufC8<8> iPMID;
    73 	TBufC8<8> iSMID;
    74 
    75 	// This data padding has been added to help prevent future binary compatibility breaks	
    76 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
    77 	TUint32     iPadding1; 
    78 	TUint32     iPadding2; 	
    79 	};
    80 
    81 //
    82 // Encapsulation the UPF file format.
    83 //
    84 NONSHARABLE_CLASS(TTranpPicture)
    85 
    86 /** Represents a picture in Unified Picture Format (UPF), a standard for image 
    87 data transmitted via infrared communication.
    88 
    89 An object of this type is used when transmitting pictures using the IrTranP 
    90 protocol.
    91 
    92 A received picture can be saved as a JPEG type for viewing or it can be saved 
    93 in native UPF format. 
    94 @publishedAll
    95 @released */
    96 	{
    97 friend class CTranpProtocol;
    98 public:
    99 	IMPORT_C void SetFilename(const TDesC8& aName);
   100 	IMPORT_C void SetLongFilename(const TDesC8& aName);    
   101 	IMPORT_C void SetTime(const TDesC8& aTime);
   102 
   103 	IMPORT_C const TDesC8& Filename();
   104 	IMPORT_C const TDesC8& LongFilename();
   105 	IMPORT_C const TDesC8& Time();
   106 	IMPORT_C const TDesC8* Picture();
   107 	
   108 	IMPORT_C void SetDesiredLatticeSize(TLatticeSize aSize, TInt iWidth = 0, TInt iHeight = 0); // Default is EVGA
   109 	IMPORT_C void GetLatticeSize(TLatticeSize& aSize, TInt& iWidth, TInt& iHeight);
   110 
   111 	IMPORT_C const TDesC8* GetThumbNail();
   112 
   113 	IMPORT_C TInt SaveAsJpeg(const TFileName& aFileName);
   114 	IMPORT_C TInt LoadFromJpeg(const TFileName& aFileName);
   115 	IMPORT_C TInt SaveAsUPF(const TFileName& aFileName);
   116 	IMPORT_C TInt LoadFromUPF(const TFileName& aFileName);
   117 
   118 public:
   119 	IMPORT_C TTranpPicture();
   120 	IMPORT_C ~TTranpPicture();
   121 
   122 private:
   123 	TBuf8<31> iFilename;		// fomatted in DOS 8.3 format
   124 	TBuf8<256> iLongFilename;	// in SJIS or ISO8859-1 [Latin-1]
   125 	TBuf8<14> iTime;			// Time string in format YYYYMMDDHHMMSS
   126 	TPtrC8 iPicture;			// Pointer to a buffer conatining the image data [JPEG format]
   127 	TDesC8* iUPFPicture;		// Pointer to a buffer conatining the image data [UPF format]
   128 	TPtrC8 iThumbNail;			// Pointer to a buffer conatining the thumbnail image data [JPEG format] Not implemented.
   129 	TLatticeSize iLatticeSize;	// Size of picture 
   130 	TInt iWidth;	// QVGA:=320x240, VGA:=640x480, SVGA:=800x600, XGA:=1024x768, SXGA:=1280x960, FREE:=m x n
   131 	TInt iHeight;
   132 	TInt iX;		// Aspect Ratio iX:iY
   133 	TInt iY;
   134 	HBufC8* iHeapData;
   135 	
   136 	// This data padding has been added to help prevent future binary compatibility breaks	
   137 	// Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
   138 	TUint32     iPadding1; 
   139 	TUint32     iPadding2; 	
   140 	};
   141 
   142 // 
   143 // Callback interface for Asynchrnous requests
   144 //
   145 class MTranpNotification
   146 /** A callback interface providing notification of events that occur during a picture 
   147 transmission session.
   148 
   149 Users of a picture transmission session must derive from this class an provide 
   150 implementation for all of the pure virtual functions.
   151 
   152 @publishedAll
   153 @released
   154 @see CTranpSession */
   155 	{
   156 public:
   157 	
   158 	/** This function is called when a peer device connects successfully to the host 
   159 	device following an attempt to receive a picture. */
   160 	virtual void Connected() = 0;
   161 	
   162 	/** This function is called when a peer device disconnects or is disconnected from 
   163 	the host device. */
   164 	virtual void Disconnected() =0;
   165 	
   166 	/** This function is called when the reception of picture data is complete. */
   167 	virtual void GetComplete() = 0;
   168 	
   169 	/** This function is called during the sending or receiving of picture data and 
   170 	indicates the percentage of the data that has been transmitted.
   171 	
   172 	@param aPercent The percentage of picture data transmitted. */
   173 	virtual void ProgressIndication(TInt aPercent) = 0;
   174 	
   175 	/** This function is called when the sending of picture data is complete. */
   176 	virtual void PutComplete() = 0;
   177 	
   178 	/** This function is called when an operation querying the processing ability of 
   179 	a peer device completes. */
   180 	virtual void QueryComplete(/*return result from query [what]*/)= 0;
   181 	
   182 	/** This function is called when the connection with the peer device drops during 
   183 	picture data transmission.
   184 	
   185 	@param aError An error code associated with the connection drop. Normally, 
   186 	one of the system wide error codes. */
   187 	virtual void Error(TInt aError) =0;
   188 
   189     /**
   190  	 Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
   191 	 @param aInterface UID of the interface to return
   192 	 @param aObject the container for another interface as specified by aInterface
   193 	 */
   194 	IMPORT_C virtual void MTN_ExtensionInterfaceL(TUid aInterface, void*& aObject);	
   195 	};
   196 
   197 class CTranpProtocol;
   198 
   199 NONSHARABLE_CLASS(CTranpSession) : public CBase
   200 
   201 /** Encapsulates the behaviour for sending a picture to a peer device and for receiving 
   202 a picture from a peer device. 
   203 
   204 @publishedAll
   205 @released */
   206 	{
   207 public: 
   208     enum TTranP
   209     /** The type of information required from a peer device. */
   210     {
   211      /** Request still-information from the peer, e.g. resolution and size. */
   212      EReqImageInfo = 0, 
   213      /** Request information about the peer's battery status and free memory. */
   214      EReqStatus, 
   215      /** Request how many commands can be executed in one SCEP session. */
   216      EReqCommands
   217 	};
   218 
   219 public:
   220 	// Constructs a TranP Session
   221 	IMPORT_C static CTranpSession* NewL(MTranpNotification& aNotifier);
   222 
   223 private:
   224 	void ConstructL(MTranpNotification& aNotifier);
   225 
   226 public:
   227 	// Methods for establishing a connection
   228 	IMPORT_C void Connect();
   229 	IMPORT_C void Disconnect();
   230 	IMPORT_C void Abort();
   231 	// Query capabilities of peer
   232 	IMPORT_C void Query(TTranP aWhat);
   233 	// Receive picture from peer
   234 	IMPORT_C void Get(TTranpPicture& aPicture);
   235 	// Send picture to peer
   236 	IMPORT_C void Put(const TTranpPicture& aPicture);
   237 	// Change configuration parameters
   238 	IMPORT_C void Config(const TTranpConfig& aConfig);
   239 	IMPORT_C TTranpConfig Config() const;
   240 	IMPORT_C ~CTranpSession();
   241 
   242 private:
   243 	CTranpSession();	
   244 
   245 private:
   246 	CTranpProtocol* iTranpProtocol;
   247 	TTranpConfig iConfig;
   248 	};
   249 
   250 #endif //_TRANP_H_