0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef TISI_H
|
|
20 |
#define TISI_H
|
|
21 |
|
|
22 |
|
|
23 |
// INCLUDE FILES
|
|
24 |
#include <e32std.h>
|
|
25 |
#include <phonetisi.h>
|
|
26 |
|
|
27 |
|
|
28 |
// MACROS
|
|
29 |
// None
|
|
30 |
|
|
31 |
// DATA TYPES
|
|
32 |
// None
|
|
33 |
|
|
34 |
// FUNCTION PROTOTYPES
|
|
35 |
//None
|
|
36 |
|
|
37 |
|
|
38 |
// FORWARD DECLARATIONS
|
|
39 |
class TIsiSend;
|
|
40 |
class TIsiReceiveC;
|
|
41 |
class TIsiSubBlock;
|
|
42 |
class TIsiUtility;
|
|
43 |
class TIsi;
|
|
44 |
|
|
45 |
|
|
46 |
enum TSubBlockType
|
|
47 |
{
|
|
48 |
|
|
49 |
EIsiSubBlockTypeId8Len8 = 1,
|
|
50 |
EIsiSubBlockTypeId8Len16,
|
|
51 |
EIsiSubBlockTypeId16Len8,
|
|
52 |
EIsiSubBlockTypeId16Len16,
|
|
53 |
EIsiSubBlockTypeId8Len32
|
|
54 |
|
|
55 |
};
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
// CLASS DECLARATION
|
|
60 |
|
|
61 |
/**
|
|
62 |
* TIsi
|
|
63 |
* This class implements the TIsi
|
|
64 |
*/
|
|
65 |
class TIsi
|
|
66 |
{
|
|
67 |
|
|
68 |
// Functions
|
|
69 |
public:
|
|
70 |
|
|
71 |
/**
|
|
72 |
* Copies data into this TIsi object replacing any existing data.
|
|
73 |
* @param TIsi&
|
|
74 |
* @return TIsi&
|
|
75 |
*/
|
|
76 |
IMPORT_C TIsi& operator=( const TIsi& );
|
|
77 |
|
|
78 |
protected:
|
|
79 |
|
|
80 |
/**
|
|
81 |
* Default C++ constructor.
|
|
82 |
* @param None
|
|
83 |
* @return
|
|
84 |
*/
|
|
85 |
inline TIsi(){};
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
// Data
|
|
90 |
protected:
|
|
91 |
|
|
92 |
|
|
93 |
};
|
|
94 |
|
|
95 |
class TIsiReceiveC : public TIsi
|
|
96 |
{
|
|
97 |
|
|
98 |
// Functions
|
|
99 |
public:
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Used to receive a message, subblock or data.
|
|
103 |
* @param const TDesC8& aBuf
|
|
104 |
*/
|
|
105 |
IMPORT_C TIsiReceiveC( const TDesC8& aBuf );
|
|
106 |
|
|
107 |
/**
|
|
108 |
* Get 16-bit data (TUint16) from message.
|
|
109 |
* @param const TUint aOffset
|
|
110 |
* @return TUint16
|
|
111 |
*/
|
|
112 |
IMPORT_C TUint16 Get16bit( const TUint aOffset ) const;
|
|
113 |
|
|
114 |
/**
|
|
115 |
* Get 32-bit data (TUint32) from message.
|
|
116 |
* @param const TUint aOffset
|
|
117 |
* @return TUint32
|
|
118 |
*/
|
|
119 |
IMPORT_C TUint32 Get32bit( const TUint aOffset ) const;
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Get 8-bit data (TUint8) from message.
|
|
123 |
* @param const TUint aOffset
|
|
124 |
* @return TUint8
|
|
125 |
*/
|
|
126 |
IMPORT_C TUint8 Get8bit( const TUint aOffset ) const;
|
|
127 |
|
|
128 |
/**
|
|
129 |
* Get TPtr8 descriptor to message data.
|
|
130 |
* @param const TUint aOffset
|
|
131 |
* @param const TInt aLength
|
|
132 |
* @return const TPtrC8
|
|
133 |
*/
|
|
134 |
IMPORT_C const TPtrC8 GetData( const TUint aOffset, const TInt aLength ) const;
|
|
135 |
|
|
136 |
/**
|
|
137 |
* Find subblock offset within message by using subblock id.
|
|
138 |
* @param TUint aSbStartOffset, TUint aSubblockId, TSubBlockType aType, TUint &aSubBlockOffset
|
|
139 |
* @return TInt
|
|
140 |
*/
|
|
141 |
IMPORT_C TInt FindSubBlockOffsetById ( const TUint aSbStartOffset,
|
|
142 |
const TUint aSubblockId,
|
|
143 |
const TSubBlockType aType,
|
|
144 |
TUint &aSubBlockOffset ) const;
|
|
145 |
|
|
146 |
/**
|
|
147 |
* Find subblock offset within message by using subblock index
|
|
148 |
* @param TUint aSbStartOffset, TUint aSubblockId, TSubBlockType aType, TUint &aSubBlockOffset
|
|
149 |
* @return TInt
|
|
150 |
*/
|
|
151 |
IMPORT_C TInt FindSubBlockOffsetByIndex( const TUint aSbStartOffset,
|
|
152 |
const TUint aSubblockIndex,
|
|
153 |
const TSubBlockType aType,
|
|
154 |
TUint &aSubBlockOffset ) const;
|
|
155 |
|
|
156 |
/**
|
|
157 |
* Get TPtrC8 descriptor to whole isi message.
|
|
158 |
* @return const TPtrC8
|
|
159 |
*/
|
|
160 |
IMPORT_C const TPtrC8 GetBuffer() const;
|
|
161 |
|
|
162 |
/**
|
|
163 |
* Get 6-bit receiver device from message.
|
|
164 |
* @return TUint8
|
|
165 |
*/
|
|
166 |
IMPORT_C TUint8 GetReceiverDevice( ) const;
|
|
167 |
|
|
168 |
/**
|
|
169 |
* Get 6-bit sender device from message.
|
|
170 |
* @return TUint8
|
|
171 |
*/
|
|
172 |
IMPORT_C TUint8 GetSenderDevice( ) const;
|
|
173 |
|
|
174 |
/**
|
|
175 |
* Gets 10-bit receiver object from message.
|
|
176 |
* @return TUint16
|
|
177 |
*/
|
|
178 |
IMPORT_C TUint16 GetReceiverObject( ) const;
|
|
179 |
|
|
180 |
/**
|
|
181 |
* Gets 10-bit sender object from message.
|
|
182 |
* @return TUint16
|
|
183 |
*/
|
|
184 |
IMPORT_C TUint16 GetSenderObject( ) const;
|
|
185 |
|
|
186 |
/**
|
|
187 |
* Gets 24-bit extended resource id from message.
|
|
188 |
* @return TUint32
|
|
189 |
*/
|
|
190 |
IMPORT_C TUint32 GetExtendedResourceId( ) const;
|
|
191 |
|
|
192 |
|
|
193 |
|
|
194 |
// Data
|
|
195 |
protected:
|
|
196 |
|
|
197 |
// For message.
|
|
198 |
const TDesC8& iBuffer;
|
|
199 |
|
|
200 |
};
|
|
201 |
|
|
202 |
class TIsiSend : public TIsi
|
|
203 |
{
|
|
204 |
|
|
205 |
// Functions
|
|
206 |
public:
|
|
207 |
|
|
208 |
/**
|
|
209 |
* Adds message length and check fillers to the end of message,
|
|
210 |
* message buffer content and length are modified
|
|
211 |
* Must be used when creating a new message to be send.
|
|
212 |
* Checks also that critical information for the message is set.
|
|
213 |
* Critical information:Resource, MessageId.
|
|
214 |
* Returns the reference to the message to be send.
|
|
215 |
* @param None
|
|
216 |
* @return TDes8&
|
|
217 |
*/
|
|
218 |
IMPORT_C TDes8& Complete();
|
|
219 |
|
|
220 |
/**
|
|
221 |
* Copy descriptor to message data,
|
|
222 |
* message buffer content and length are modified.
|
|
223 |
* @param const TUint aOffset
|
|
224 |
* @param const TDesC8& aData
|
|
225 |
* @return none
|
|
226 |
*/
|
|
227 |
IMPORT_C void CopyData( const TUint aOffset, const TDesC8& aData );
|
|
228 |
|
|
229 |
/**
|
|
230 |
* Used to generate a message, subblock or datastruct.
|
|
231 |
* Descriptor aBuf content is filled with zeroes
|
|
232 |
* and length is also reset to zero.
|
|
233 |
* @param TDes8& aBuf
|
|
234 |
* @param const TUint aLength
|
|
235 |
*/
|
|
236 |
IMPORT_C TIsiSend( TDes8& aBuf, const TUint aLength );
|
|
237 |
|
|
238 |
/**
|
|
239 |
* Used to generate a message, subblock or datastruct.
|
|
240 |
* Descriptor aBuf content is filled with zeroes
|
|
241 |
* and length is also reset to zero.
|
|
242 |
* @param TDes8& aBuf
|
|
243 |
*/
|
|
244 |
IMPORT_C TIsiSend( TDes8& aBuf );
|
|
245 |
|
|
246 |
/**
|
|
247 |
* Set 16-bit data (TUint16) to message,
|
|
248 |
* message buffer content and length are modified.
|
|
249 |
* @param const TUint aOffset
|
|
250 |
* @param const TUint16 aData
|
|
251 |
* @return none
|
|
252 |
*/
|
|
253 |
IMPORT_C void Set16bit( const TUint aOffset, const TUint16 aData );
|
|
254 |
|
|
255 |
/**
|
|
256 |
* Set 32-bit data (TUint) to message,
|
|
257 |
* message buffer content and length are modified.
|
|
258 |
* @param const TUint aOffset
|
|
259 |
* @param const TUint32 aData
|
|
260 |
* @return none
|
|
261 |
*/
|
|
262 |
IMPORT_C void Set32bit( const TUint aOffset, const TUint32 aData );
|
|
263 |
|
|
264 |
/**
|
|
265 |
* Set 8-bit (TUint8) data to message,
|
|
266 |
* message buffer content and length are modified.
|
|
267 |
* @param const TUint aOffset
|
|
268 |
* @param const TUint8 aData
|
|
269 |
* @return none
|
|
270 |
*/
|
|
271 |
IMPORT_C void Set8bit( const TUint aOffset, const TUint8 aData );
|
|
272 |
|
|
273 |
/**
|
|
274 |
* Set 6-bit (TUint8) receiver device to message,
|
|
275 |
* message buffer content and length are modified.
|
|
276 |
* @param const TUint8 aReceiverDevice
|
|
277 |
* @return none
|
|
278 |
*/
|
|
279 |
IMPORT_C void SetReceiverDevice( const TUint8 aReceiverDevice );
|
|
280 |
|
|
281 |
/**
|
|
282 |
* Set 6-bit (TUint8) sender device to message,
|
|
283 |
* message buffer content and length are modified.
|
|
284 |
* @param const TUint8 aSenderDevice
|
|
285 |
* @return none
|
|
286 |
*/
|
|
287 |
IMPORT_C void SetSenderDevice( const TUint8 aSenderDevice );
|
|
288 |
|
|
289 |
/**
|
|
290 |
* Set 10-bit (TUint16) data to message,
|
|
291 |
* message buffer content and length are modified.
|
|
292 |
* @param const TUint16 aReceiverObject
|
|
293 |
* @return none
|
|
294 |
*/
|
|
295 |
IMPORT_C void SetReceiverObject( const TUint16 aReceiverObject );
|
|
296 |
|
|
297 |
/**
|
|
298 |
* Set 10-bit (TUint16) data to message,
|
|
299 |
* message buffer content and length are modified.
|
|
300 |
* @param const TUint16 aSenderObject
|
|
301 |
* @return none
|
|
302 |
*/
|
|
303 |
IMPORT_C void SetSenderObject( const TUint16 aSenderObject );
|
|
304 |
|
|
305 |
/**
|
|
306 |
* Set 24-bit (TUint32) extended resource id to message,
|
|
307 |
* message buffer content and length are modified.
|
|
308 |
* @param const TUint32 aExtendedResourceId
|
|
309 |
* @return none
|
|
310 |
* In the resource field in the PhoNet header is set to a fix value called PN_PREFIX telling
|
|
311 |
* that additional resource information can be found in the Type and SubType fields as follows:
|
|
312 |
* Media Receiver Sender PN_PREFIX Length Rec.Obj Send.Obj UTID MsgID Type SubType
|
|
313 |
*/
|
|
314 |
IMPORT_C void SetExtendedResourceId ( const TUint32 aExtendedResourceId );
|
|
315 |
|
|
316 |
// Data
|
|
317 |
protected:
|
|
318 |
|
|
319 |
// For message.
|
|
320 |
TDes8& iBuffer;
|
|
321 |
|
|
322 |
private:
|
|
323 |
TUint iFinalLength;
|
|
324 |
|
|
325 |
};
|
|
326 |
|
|
327 |
/**
|
|
328 |
* TIsiSubBlock
|
|
329 |
* This class implements the TIsiSubBlock
|
|
330 |
*/
|
|
331 |
class TIsiSubBlock
|
|
332 |
{
|
|
333 |
public:
|
|
334 |
/**
|
|
335 |
* Used to generate a subblock
|
|
336 |
* @param TDes8& aMsg
|
|
337 |
* @param TUint16 aSbId
|
|
338 |
* @param const TSubBlockType aType
|
|
339 |
*/
|
|
340 |
IMPORT_C TIsiSubBlock( TDes8& aMsg, TUint16 aSbId, const TSubBlockType aType );
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Adds message length and check fillers to the end of message.
|
|
344 |
* Returns the reference to the message.
|
|
345 |
* @return TDes8&
|
|
346 |
*/
|
|
347 |
IMPORT_C TDes8& CompleteSubBlock();
|
|
348 |
|
|
349 |
protected:
|
|
350 |
TInt iSubBlockStart;
|
|
351 |
TDes8& iMsg;
|
|
352 |
TSubBlockType iSubBlockType;
|
|
353 |
|
|
354 |
};
|
|
355 |
|
|
356 |
/**
|
|
357 |
* TIsiUtility
|
|
358 |
* This class implements the TIsiUtility
|
|
359 |
*/
|
|
360 |
class TIsiUtility
|
|
361 |
{
|
|
362 |
|
|
363 |
public:
|
|
364 |
/**
|
|
365 |
* Used for copying from unicode strings
|
|
366 |
* @param const TDesC8& aSource
|
|
367 |
* @param TDes16& aTarget
|
|
368 |
*/
|
|
369 |
static IMPORT_C void CopyFromBigEndian( const TDesC8& aSource, TDes16& aTarget);
|
|
370 |
|
|
371 |
/**
|
|
372 |
* Used for copying to unicode strings
|
|
373 |
* @param const TDesC16& aSource
|
|
374 |
* @param TDes8& aTarget
|
|
375 |
*/
|
|
376 |
static IMPORT_C void CopyToBigEndian( const TDesC16& aSource, TDes8& aTarget );
|
|
377 |
|
|
378 |
protected:
|
|
379 |
|
|
380 |
};
|
|
381 |
|
|
382 |
#endif
|