williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@2: // 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 williamr@2: // which accompanies this distribution, and is available williamr@2: // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // IrTranp API williamr@2: // williamr@2: // williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: @publishedAll williamr@2: @released williamr@2: */ williamr@2: williamr@2: #ifndef _TRANP_H_ williamr@2: #define _TRANP_H_ williamr@2: williamr@2: #include williamr@2: williamr@2: const TInt KErrIrtranpPeerDoesNotHaveIrtranp = -5530; williamr@2: williamr@2: _LIT8(KDefaultPMID, "\x08\x00\x74\x00\x00\x00\x00\x01"); //Casio's number williamr@2: _LIT8(KNullPMID, "\x00\x00\x00\x00\x00\x00\x00\x00"); williamr@2: williamr@2: enum TLatticeSize williamr@2: /** Encodes the size of a picture. williamr@2: williamr@2: @see TTranpPicture */ williamr@2: { williamr@2: /** Quarter VGA, 320x240 pixels. */ williamr@2: EQVGA, williamr@2: /** Full VGA, 640x480 pixels. */ williamr@2: EVGA, williamr@2: /** Super VGA, 800x600 pixels. */ williamr@2: ESVGA, williamr@2: /** XGA, 1024x768 pixels. */ williamr@2: EXGA, williamr@2: /** Super XGA, 1280x960 pixels. */ williamr@2: ESXGA, williamr@2: /** Arbitrary size. There is no implied width and height. These values must be williamr@2: explicitly supplied. */ williamr@2: EFREE williamr@2: }; williamr@2: williamr@2: NONSHARABLE_CLASS(TTranpConfig) williamr@2: williamr@2: /** Encapsulates configuration parameters for a session. williamr@2: @publishedAll williamr@2: @released williamr@2: @see CTranpSession */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C TTranpConfig(); williamr@2: IMPORT_C ~TTranpConfig(); williamr@2: williamr@2: IMPORT_C void SetPrimaryMachine(const TDesC8& aPMID); williamr@2: IMPORT_C void SetSecondaryMachine(const TDesC8& aSMID); williamr@2: williamr@2: IMPORT_C const TDesC8& PrimaryMachine(); williamr@2: IMPORT_C const TDesC8& SecondaryMachine(); williamr@2: williamr@2: private: williamr@2: TBufC8<8> iPMID; williamr@2: TBufC8<8> iSMID; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: // williamr@2: // Encapsulation the UPF file format. williamr@2: // williamr@2: NONSHARABLE_CLASS(TTranpPicture) williamr@2: williamr@2: /** Represents a picture in Unified Picture Format (UPF), a standard for image williamr@2: data transmitted via infrared communication. williamr@2: williamr@2: An object of this type is used when transmitting pictures using the IrTranP williamr@2: protocol. williamr@2: williamr@2: A received picture can be saved as a JPEG type for viewing or it can be saved williamr@2: in native UPF format. williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: friend class CTranpProtocol; williamr@2: public: williamr@2: IMPORT_C void SetFilename(const TDesC8& aName); williamr@2: IMPORT_C void SetLongFilename(const TDesC8& aName); williamr@2: IMPORT_C void SetTime(const TDesC8& aTime); williamr@2: williamr@2: IMPORT_C const TDesC8& Filename(); williamr@2: IMPORT_C const TDesC8& LongFilename(); williamr@2: IMPORT_C const TDesC8& Time(); williamr@2: IMPORT_C const TDesC8* Picture(); williamr@2: williamr@2: IMPORT_C void SetDesiredLatticeSize(TLatticeSize aSize, TInt iWidth = 0, TInt iHeight = 0); // Default is EVGA williamr@2: IMPORT_C void GetLatticeSize(TLatticeSize& aSize, TInt& iWidth, TInt& iHeight); williamr@2: williamr@2: IMPORT_C const TDesC8* GetThumbNail(); williamr@2: williamr@2: IMPORT_C TInt SaveAsJpeg(const TFileName& aFileName); williamr@2: IMPORT_C TInt LoadFromJpeg(const TFileName& aFileName); williamr@2: IMPORT_C TInt SaveAsUPF(const TFileName& aFileName); williamr@2: IMPORT_C TInt LoadFromUPF(const TFileName& aFileName); williamr@2: williamr@2: public: williamr@2: IMPORT_C TTranpPicture(); williamr@2: IMPORT_C ~TTranpPicture(); williamr@2: williamr@2: private: williamr@2: TBuf8<31> iFilename; // fomatted in DOS 8.3 format williamr@2: TBuf8<256> iLongFilename; // in SJIS or ISO8859-1 [Latin-1] williamr@2: TBuf8<14> iTime; // Time string in format YYYYMMDDHHMMSS williamr@2: TPtrC8 iPicture; // Pointer to a buffer conatining the image data [JPEG format] williamr@2: TDesC8* iUPFPicture; // Pointer to a buffer conatining the image data [UPF format] williamr@2: TPtrC8 iThumbNail; // Pointer to a buffer conatining the thumbnail image data [JPEG format] Not implemented. williamr@2: TLatticeSize iLatticeSize; // Size of picture williamr@2: TInt iWidth; // QVGA:=320x240, VGA:=640x480, SVGA:=800x600, XGA:=1024x768, SXGA:=1280x960, FREE:=m x n williamr@2: TInt iHeight; williamr@2: TInt iX; // Aspect Ratio iX:iY williamr@2: TInt iY; williamr@2: HBufC8* iHeapData; williamr@2: williamr@2: // This data padding has been added to help prevent future binary compatibility breaks williamr@2: // Neither iPadding1 nor iPadding2 have been zero'd because they are currently not used williamr@2: TUint32 iPadding1; williamr@2: TUint32 iPadding2; williamr@2: }; williamr@2: williamr@2: // williamr@2: // Callback interface for Asynchrnous requests williamr@2: // williamr@2: class MTranpNotification williamr@2: /** A callback interface providing notification of events that occur during a picture williamr@2: transmission session. williamr@2: williamr@2: Users of a picture transmission session must derive from this class an provide williamr@2: implementation for all of the pure virtual functions. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see CTranpSession */ williamr@2: { williamr@2: public: williamr@2: williamr@2: /** This function is called when a peer device connects successfully to the host williamr@2: device following an attempt to receive a picture. */ williamr@2: virtual void Connected() = 0; williamr@2: williamr@2: /** This function is called when a peer device disconnects or is disconnected from williamr@2: the host device. */ williamr@2: virtual void Disconnected() =0; williamr@2: williamr@2: /** This function is called when the reception of picture data is complete. */ williamr@2: virtual void GetComplete() = 0; williamr@2: williamr@2: /** This function is called during the sending or receiving of picture data and williamr@2: indicates the percentage of the data that has been transmitted. williamr@2: williamr@2: @param aPercent The percentage of picture data transmitted. */ williamr@2: virtual void ProgressIndication(TInt aPercent) = 0; williamr@2: williamr@2: /** This function is called when the sending of picture data is complete. */ williamr@2: virtual void PutComplete() = 0; williamr@2: williamr@2: /** This function is called when an operation querying the processing ability of williamr@2: a peer device completes. */ williamr@2: virtual void QueryComplete(/*return result from query [what]*/)= 0; williamr@2: williamr@2: /** This function is called when the connection with the peer device drops during williamr@2: picture data transmission. williamr@2: williamr@2: @param aError An error code associated with the connection drop. Normally, williamr@2: one of the system wide error codes. */ williamr@2: virtual void Error(TInt aError) =0; williamr@2: williamr@2: /** williamr@2: Returns a null aObject if the extension is not implemented, or a pointer to another interface if it is. williamr@2: @param aInterface UID of the interface to return williamr@2: @param aObject the container for another interface as specified by aInterface williamr@2: */ williamr@2: IMPORT_C virtual void MTN_ExtensionInterfaceL(TUid aInterface, void*& aObject); williamr@2: }; williamr@2: williamr@2: class CTranpProtocol; williamr@2: williamr@2: NONSHARABLE_CLASS(CTranpSession) : public CBase williamr@2: williamr@2: /** Encapsulates the behaviour for sending a picture to a peer device and for receiving williamr@2: a picture from a peer device. williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: enum TTranP williamr@2: /** The type of information required from a peer device. */ williamr@2: { williamr@2: /** Request still-information from the peer, e.g. resolution and size. */ williamr@2: EReqImageInfo = 0, williamr@2: /** Request information about the peer's battery status and free memory. */ williamr@2: EReqStatus, williamr@2: /** Request how many commands can be executed in one SCEP session. */ williamr@2: EReqCommands williamr@2: }; williamr@2: williamr@2: public: williamr@2: // Constructs a TranP Session williamr@2: IMPORT_C static CTranpSession* NewL(MTranpNotification& aNotifier); williamr@2: williamr@2: private: williamr@2: void ConstructL(MTranpNotification& aNotifier); williamr@2: williamr@2: public: williamr@2: // Methods for establishing a connection williamr@2: IMPORT_C void Connect(); williamr@2: IMPORT_C void Disconnect(); williamr@2: IMPORT_C void Abort(); williamr@2: // Query capabilities of peer williamr@2: IMPORT_C void Query(TTranP aWhat); williamr@2: // Receive picture from peer williamr@2: IMPORT_C void Get(TTranpPicture& aPicture); williamr@2: // Send picture to peer williamr@2: IMPORT_C void Put(const TTranpPicture& aPicture); williamr@2: // Change configuration parameters williamr@2: IMPORT_C void Config(const TTranpConfig& aConfig); williamr@2: IMPORT_C TTranpConfig Config() const; williamr@2: IMPORT_C ~CTranpSession(); williamr@2: williamr@2: private: williamr@2: CTranpSession(); williamr@2: williamr@2: private: williamr@2: CTranpProtocol* iTranpProtocol; williamr@2: TTranpConfig iConfig; williamr@2: }; williamr@2: williamr@2: #endif //_TRANP_H_