271
|
1 |
// Copyright (c) 2004-2010 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 |
|
286
|
17 |
#include <e32std.h>
|
|
18 |
#include "mprotocol.h"
|
|
19 |
#include "mtransport.h"
|
|
20 |
#include "drivemanager.h"
|
271
|
21 |
#include "cusbmassstoragecontroller.h"
|
|
22 |
#include "cbulkonlytransport.h"
|
|
23 |
|
|
24 |
/**
|
|
25 |
Stub MS controller for bulk only transport testing.
|
|
26 |
*/
|
|
27 |
|
|
28 |
CUsbMassStorageController::CUsbMassStorageController() : CActive(EPriorityStandard)
|
|
29 |
{
|
|
30 |
}
|
|
31 |
|
|
32 |
CUsbMassStorageController::~CUsbMassStorageController()
|
|
33 |
{
|
|
34 |
delete iProtocol;
|
|
35 |
delete iTransport;
|
|
36 |
}
|
|
37 |
|
|
38 |
void CUsbMassStorageController::CreateL(TUint aMaxDrives)
|
|
39 |
{
|
|
40 |
iMaxDrives = aMaxDrives;
|
|
41 |
iStatus = KRequestPending;
|
|
42 |
CActiveScheduler::Add(this);
|
|
43 |
SetActive();
|
|
44 |
}
|
|
45 |
|
|
46 |
TInt CUsbMassStorageController::Start()
|
|
47 |
{
|
|
48 |
TInt err;
|
|
49 |
TRAP(err, iProtocol = CScsiProtocol::NewL());
|
|
50 |
if (err != KErrNone)
|
|
51 |
{
|
|
52 |
return err;
|
|
53 |
}
|
|
54 |
|
|
55 |
TRAP(err, iTransport = CBulkOnlyTransport::NewL(iMaxDrives, *this));
|
|
56 |
if (err != KErrNone)
|
|
57 |
{
|
|
58 |
return err;
|
|
59 |
}
|
|
60 |
|
|
61 |
TRAP(err, iTransport->InitialiseTransportL(1));
|
|
62 |
|
|
63 |
iTransport->RegisterProtocol(*iProtocol);
|
|
64 |
iProtocol->RegisterTransport(iTransport);
|
|
65 |
|
|
66 |
iTransport->Start();
|
|
67 |
|
|
68 |
return KErrNone;
|
|
69 |
}
|
|
70 |
|
|
71 |
TInt CUsbMassStorageController::Stop()
|
|
72 |
{
|
|
73 |
return 0;
|
|
74 |
}
|
|
75 |
|
|
76 |
void CUsbMassStorageController::Reset()
|
|
77 |
{
|
|
78 |
delete iProtocol;
|
|
79 |
TRAPD(err, iProtocol = CScsiProtocol::NewL());
|
|
80 |
__ASSERT_ALWAYS(err == KErrNone, User::Invariant());
|
|
81 |
iTransport->RegisterProtocol(*iProtocol);
|
|
82 |
iProtocol->RegisterTransport(iTransport);
|
|
83 |
}
|
|
84 |
|
|
85 |
|
|
86 |
void CUsbMassStorageController::GetTransport(MTransportBase* &aTransport)
|
|
87 |
{
|
|
88 |
aTransport = iTransport;
|
|
89 |
}
|
|
90 |
|
|
91 |
void CUsbMassStorageController::SetTransport(MTransportBase* aTransport)
|
|
92 |
{
|
|
93 |
iTransport = aTransport;
|
|
94 |
}
|
|
95 |
|
|
96 |
|
|
97 |
void CUsbMassStorageController::RunL()
|
|
98 |
{
|
|
99 |
CActiveScheduler::Stop();
|
|
100 |
}
|
|
101 |
|
|
102 |
void CUsbMassStorageController::DoCancel()
|
|
103 |
{
|
|
104 |
}
|
|
105 |
|
|
106 |
CDriveManager& CUsbMassStorageController::DriveManager()
|
|
107 |
{
|
|
108 |
return iStubDriveManager;
|
|
109 |
}
|
|
110 |
|
|
111 |
TInt CDriveManager::Connect(TUint /*aLun*/)
|
|
112 |
{
|
|
113 |
return KErrNone;
|
|
114 |
}
|
|
115 |
|
|
116 |
TInt CDriveManager::Disconnect(TUint /*aLun*/)
|
|
117 |
{
|
|
118 |
return KErrNone;
|
|
119 |
}
|