author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 May 2010 14:17:14 +0300 | |
changeset 139 | 95f71bcdcdb7 |
parent 31 | 56f325a607ea |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// |
|
15 |
||
16 |
/** |
|
17 |
@file |
|
18 |
@internalTechnology |
|
19 |
*/ |
|
20 |
||
21 |
#ifndef TBLOCKTRANSFER_H |
|
22 |
#define TBLOCKTRANSFER_H |
|
23 |
||
24 |
class MBlockTransferProtocol; |
|
25 |
||
26 |
/** |
|
27 |
Split the byte stream on block boundaries and transfer using |
|
28 |
MBlockTransferProtocol interface in blocks |
|
29 |
*/ |
|
30 |
class TBlockTransfer |
|
31 |
{ |
|
32 |
public: |
|
33 |
TBlockTransfer(); |
|
34 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
void InitBuffers(RBuf8* aHeadbuf, RBuf8* aTailbuf); |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
|
0 | 37 |
void ReadL(MBlockTransferProtocol& aProtocol, |
38 |
TPos aPosition, |
|
39 |
TInt aLength, |
|
40 |
TDes8& aBuf); |
|
41 |
||
42 |
void WriteL(MBlockTransferProtocol& aProtocol, |
|
43 |
TPos aPosition, |
|
44 |
TInt aLength, |
|
45 |
TDesC8& aBuf); |
|
46 |
||
47 |
TUint32 BlockLength() const; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
48 |
void SetCapacityL(TUint32 aBlockLength, TLba aLastLba); |
0 | 49 |
|
50 |
private: |
|
51 |
TPos GetHeadBlockOffset(TPos aPos); |
|
52 |
TLba GetHeadBlockLbaL(TPos aPos); |
|
53 |
||
54 |
TPos GetTailBlockOffset(TPos aPos, TInt aLen); |
|
55 |
TLba GetTailBlockLbaL(TPos aPos, TInt aLen); |
|
56 |
||
57 |
private: |
|
58 |
/** Block Length */ |
|
59 |
TInt64 iBlockLength; |
|
60 |
/** Last Logical Block Address */ |
|
61 |
TLba iLastLba; |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
62 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
63 |
// buffers for block manipulation (not owend by this class) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
64 |
RBuf8* iHeadbuf; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
65 |
RBuf8* iTailbuf; |
0 | 66 |
}; |
67 |
||
68 |
||
69 |
/** Constructor */ |
|
70 |
inline TBlockTransfer::TBlockTransfer() |
|
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
71 |
: iBlockLength(0), |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
iHeadbuf(NULL), |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
73 |
iTailbuf(NULL) |
0 | 74 |
{ |
75 |
} |
|
76 |
||
77 |
||
78 |
/** return the Block Length */ |
|
79 |
inline TUint32 TBlockTransfer::BlockLength() const |
|
80 |
{ |
|
81 |
return iBlockLength; |
|
82 |
} |
|
83 |
||
31
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
|
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
inline void TBlockTransfer::InitBuffers(RBuf8* aHeadbuf, RBuf8* aTailbuf) |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
86 |
{ |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
87 |
iHeadbuf = aHeadbuf; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
88 |
iTailbuf = aTailbuf; |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
89 |
} |
56f325a607ea
Revision: 200951
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
90 |
|
0 | 91 |
#endif // TBLOCKTRANSFER_H |
92 |