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