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 |
|
|
35 |
void ReadL(MBlockTransferProtocol& aProtocol,
|
|
36 |
TPos aPosition,
|
|
37 |
TInt aLength,
|
|
38 |
TDes8& aBuf);
|
|
39 |
|
|
40 |
void WriteL(MBlockTransferProtocol& aProtocol,
|
|
41 |
TPos aPosition,
|
|
42 |
TInt aLength,
|
|
43 |
TDesC8& aBuf);
|
|
44 |
|
|
45 |
TUint32 BlockLength() const;
|
|
46 |
void SetCapacity(TUint32 aBlockLength, TLba aLastLba);
|
|
47 |
|
|
48 |
private:
|
|
49 |
TPos GetHeadBlockOffset(TPos aPos);
|
|
50 |
TLba GetHeadBlockLbaL(TPos aPos);
|
|
51 |
|
|
52 |
TPos GetTailBlockOffset(TPos aPos, TInt aLen);
|
|
53 |
TLba GetTailBlockLbaL(TPos aPos, TInt aLen);
|
|
54 |
|
|
55 |
private:
|
|
56 |
/** Block Length */
|
|
57 |
TInt64 iBlockLength;
|
|
58 |
/** Last Logical Block Address */
|
|
59 |
TLba iLastLba;
|
|
60 |
};
|
|
61 |
|
|
62 |
|
|
63 |
/** Constructor */
|
|
64 |
inline TBlockTransfer::TBlockTransfer()
|
|
65 |
: iBlockLength(0)
|
|
66 |
{
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
/** return the Block Length */
|
|
71 |
inline TUint32 TBlockTransfer::BlockLength() const
|
|
72 |
{
|
|
73 |
return iBlockLength;
|
|
74 |
}
|
|
75 |
|
|
76 |
#endif // TBLOCKTRANSFER_H
|
|
77 |
|