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