1.1 --- a/epoc32/include/tranp.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/tranp.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,252 @@
1.4 -tranp.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +// IrTranp API
1.19 +//
1.20 +//
1.21 +
1.22 +
1.23 +
1.24 +/**
1.25 + @file
1.26 + @publishedAll
1.27 + @released
1.28 +*/
1.29 +
1.30 +#ifndef _TRANP_H_
1.31 +#define _TRANP_H_
1.32 +
1.33 +#include <e32base.h>
1.34 +
1.35 +const TInt KErrIrtranpPeerDoesNotHaveIrtranp = -5530;
1.36 +
1.37 +_LIT8(KDefaultPMID, "\x08\x00\x74\x00\x00\x00\x00\x01"); //Casio's number
1.38 +_LIT8(KNullPMID, "\x00\x00\x00\x00\x00\x00\x00\x00");
1.39 +
1.40 +enum TLatticeSize
1.41 +/** Encodes the size of a picture.
1.42 +
1.43 +@see TTranpPicture */
1.44 + {
1.45 + /** Quarter VGA, 320x240 pixels. */
1.46 + EQVGA,
1.47 + /** Full VGA, 640x480 pixels. */
1.48 + EVGA,
1.49 + /** Super VGA, 800x600 pixels. */
1.50 + ESVGA,
1.51 + /** XGA, 1024x768 pixels. */
1.52 + EXGA,
1.53 + /** Super XGA, 1280x960 pixels. */
1.54 + ESXGA,
1.55 + /** Arbitrary size. There is no implied width and height. These values must be
1.56 + explicitly supplied. */
1.57 + EFREE
1.58 +};
1.59 +
1.60 +NONSHARABLE_CLASS(TTranpConfig)
1.61 +
1.62 +/** Encapsulates configuration parameters for a session.
1.63 +@publishedAll
1.64 +@released
1.65 +@see CTranpSession */
1.66 + {
1.67 +public:
1.68 + IMPORT_C TTranpConfig();
1.69 + IMPORT_C ~TTranpConfig();
1.70 +
1.71 + IMPORT_C void SetPrimaryMachine(const TDesC8& aPMID);
1.72 + IMPORT_C void SetSecondaryMachine(const TDesC8& aSMID);
1.73 +
1.74 + IMPORT_C const TDesC8& PrimaryMachine();
1.75 + IMPORT_C const TDesC8& SecondaryMachine();
1.76 +
1.77 +private:
1.78 + TBufC8<8> iPMID;
1.79 + TBufC8<8> iSMID;
1.80 +
1.81 + // This data padding has been added to help prevent future binary compatibility breaks
1.82 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.83 + TUint32 iPadding1;
1.84 + TUint32 iPadding2;
1.85 + };
1.86 +
1.87 +//
1.88 +// Encapsulation the UPF file format.
1.89 +//
1.90 +NONSHARABLE_CLASS(TTranpPicture)
1.91 +
1.92 +/** Represents a picture in Unified Picture Format (UPF), a standard for image
1.93 +data transmitted via infrared communication.
1.94 +
1.95 +An object of this type is used when transmitting pictures using the IrTranP
1.96 +protocol.
1.97 +
1.98 +A received picture can be saved as a JPEG type for viewing or it can be saved
1.99 +in native UPF format.
1.100 +@publishedAll
1.101 +@released */
1.102 + {
1.103 +friend class CTranpProtocol;
1.104 +public:
1.105 + IMPORT_C void SetFilename(const TDesC8& aName);
1.106 + IMPORT_C void SetLongFilename(const TDesC8& aName);
1.107 + IMPORT_C void SetTime(const TDesC8& aTime);
1.108 +
1.109 + IMPORT_C const TDesC8& Filename();
1.110 + IMPORT_C const TDesC8& LongFilename();
1.111 + IMPORT_C const TDesC8& Time();
1.112 + IMPORT_C const TDesC8* Picture();
1.113 +
1.114 + IMPORT_C void SetDesiredLatticeSize(TLatticeSize aSize, TInt iWidth = 0, TInt iHeight = 0); // Default is EVGA
1.115 + IMPORT_C void GetLatticeSize(TLatticeSize& aSize, TInt& iWidth, TInt& iHeight);
1.116 +
1.117 + IMPORT_C const TDesC8* GetThumbNail();
1.118 +
1.119 + IMPORT_C TInt SaveAsJpeg(const TFileName& aFileName);
1.120 + IMPORT_C TInt LoadFromJpeg(const TFileName& aFileName);
1.121 + IMPORT_C TInt SaveAsUPF(const TFileName& aFileName);
1.122 + IMPORT_C TInt LoadFromUPF(const TFileName& aFileName);
1.123 +
1.124 +public:
1.125 + IMPORT_C TTranpPicture();
1.126 + IMPORT_C ~TTranpPicture();
1.127 +
1.128 +private:
1.129 + TBuf8<31> iFilename; // fomatted in DOS 8.3 format
1.130 + TBuf8<256> iLongFilename; // in SJIS or ISO8859-1 [Latin-1]
1.131 + TBuf8<14> iTime; // Time string in format YYYYMMDDHHMMSS
1.132 + TPtrC8 iPicture; // Pointer to a buffer conatining the image data [JPEG format]
1.133 + TDesC8* iUPFPicture; // Pointer to a buffer conatining the image data [UPF format]
1.134 + TPtrC8 iThumbNail; // Pointer to a buffer conatining the thumbnail image data [JPEG format] Not implemented.
1.135 + TLatticeSize iLatticeSize; // Size of picture
1.136 + TInt iWidth; // QVGA:=320x240, VGA:=640x480, SVGA:=800x600, XGA:=1024x768, SXGA:=1280x960, FREE:=m x n
1.137 + TInt iHeight;
1.138 + TInt iX; // Aspect Ratio iX:iY
1.139 + TInt iY;
1.140 + HBufC8* iHeapData;
1.141 +
1.142 + // This data padding has been added to help prevent future binary compatibility breaks
1.143 + // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used
1.144 + TUint32 iPadding1;
1.145 + TUint32 iPadding2;
1.146 + };
1.147 +
1.148 +//
1.149 +// Callback interface for Asynchrnous requests
1.150 +//
1.151 +class MTranpNotification
1.152 +/** A callback interface providing notification of events that occur during a picture
1.153 +transmission session.
1.154 +
1.155 +Users of a picture transmission session must derive from this class an provide
1.156 +implementation for all of the pure virtual functions.
1.157 +
1.158 +@publishedAll
1.159 +@released
1.160 +@see CTranpSession */
1.161 + {
1.162 +public:
1.163 +
1.164 + /** This function is called when a peer device connects successfully to the host
1.165 + device following an attempt to receive a picture. */
1.166 + virtual void Connected() = 0;
1.167 +
1.168 + /** This function is called when a peer device disconnects or is disconnected from
1.169 + the host device. */
1.170 + virtual void Disconnected() =0;
1.171 +
1.172 + /** This function is called when the reception of picture data is complete. */
1.173 + virtual void GetComplete() = 0;
1.174 +
1.175 + /** This function is called during the sending or receiving of picture data and
1.176 + indicates the percentage of the data that has been transmitted.
1.177 +
1.178 + @param aPercent The percentage of picture data transmitted. */
1.179 + virtual void ProgressIndication(TInt aPercent) = 0;
1.180 +
1.181 + /** This function is called when the sending of picture data is complete. */
1.182 + virtual void PutComplete() = 0;
1.183 +
1.184 + /** This function is called when an operation querying the processing ability of
1.185 + a peer device completes. */
1.186 + virtual void QueryComplete(/*return result from query [what]*/)= 0;
1.187 +
1.188 + /** This function is called when the connection with the peer device drops during
1.189 + picture data transmission.
1.190 +
1.191 + @param aError An error code associated with the connection drop. Normally,
1.192 + one of the system wide error codes. */
1.193 + virtual void Error(TInt aError) =0;
1.194 +
1.195 + /**
1.196 + Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is.
1.197 + @param aInterface UID of the interface to return
1.198 + @param aObject the container for another interface as specified by aInterface
1.199 + */
1.200 + IMPORT_C virtual void MTN_ExtensionInterfaceL(TUid aInterface, void*& aObject);
1.201 + };
1.202 +
1.203 +class CTranpProtocol;
1.204 +
1.205 +NONSHARABLE_CLASS(CTranpSession) : public CBase
1.206 +
1.207 +/** Encapsulates the behaviour for sending a picture to a peer device and for receiving
1.208 +a picture from a peer device.
1.209 +
1.210 +@publishedAll
1.211 +@released */
1.212 + {
1.213 +public:
1.214 + enum TTranP
1.215 + /** The type of information required from a peer device. */
1.216 + {
1.217 + /** Request still-information from the peer, e.g. resolution and size. */
1.218 + EReqImageInfo = 0,
1.219 + /** Request information about the peer's battery status and free memory. */
1.220 + EReqStatus,
1.221 + /** Request how many commands can be executed in one SCEP session. */
1.222 + EReqCommands
1.223 + };
1.224 +
1.225 +public:
1.226 + // Constructs a TranP Session
1.227 + IMPORT_C static CTranpSession* NewL(MTranpNotification& aNotifier);
1.228 +
1.229 +private:
1.230 + void ConstructL(MTranpNotification& aNotifier);
1.231 +
1.232 +public:
1.233 + // Methods for establishing a connection
1.234 + IMPORT_C void Connect();
1.235 + IMPORT_C void Disconnect();
1.236 + IMPORT_C void Abort();
1.237 + // Query capabilities of peer
1.238 + IMPORT_C void Query(TTranP aWhat);
1.239 + // Receive picture from peer
1.240 + IMPORT_C void Get(TTranpPicture& aPicture);
1.241 + // Send picture to peer
1.242 + IMPORT_C void Put(const TTranpPicture& aPicture);
1.243 + // Change configuration parameters
1.244 + IMPORT_C void Config(const TTranpConfig& aConfig);
1.245 + IMPORT_C TTranpConfig Config() const;
1.246 + IMPORT_C ~CTranpSession();
1.247 +
1.248 +private:
1.249 + CTranpSession();
1.250 +
1.251 +private:
1.252 + CTranpProtocol* iTranpProtocol;
1.253 + TTranpConfig iConfig;
1.254 + };
1.255 +
1.256 +#endif //_TRANP_H_