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