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 |
Implements a thread per device functionality
|
|
19 |
*/
|
|
20 |
|
|
21 |
/** @file
|
|
22 |
@internalTechnology
|
|
23 |
*/
|
|
24 |
|
|
25 |
#ifndef CUSBMASSSTORAGEDEVICETHREAD_H
|
|
26 |
#define CUSBMASSSTORAGEDEVICETHREAD_H
|
|
27 |
|
|
28 |
|
|
29 |
class TDeviceHandler
|
|
30 |
{
|
|
31 |
public:
|
|
32 |
TDeviceHandler(CUsbHostMsDevice& aDevice);
|
|
33 |
void HandleMessageL(const RMessage2& aMessage);
|
|
34 |
|
|
35 |
private:
|
|
36 |
CUsbHostMsDevice& iDevice;
|
|
37 |
};
|
|
38 |
|
|
39 |
|
|
40 |
class TLogicalUnitHandler
|
|
41 |
{
|
|
42 |
public:
|
|
43 |
TLogicalUnitHandler(CUsbHostMsLogicalUnit& aLu);
|
|
44 |
void HandleMessageL(const RMessage2& aMessage);
|
|
45 |
|
|
46 |
private:
|
|
47 |
CUsbHostMsLogicalUnit& iLu;
|
|
48 |
};
|
|
49 |
|
|
50 |
|
|
51 |
class CUsbHostMsDeviceThread : public CActive
|
|
52 |
{
|
|
53 |
public:
|
|
54 |
static const TInt KMaxNumMessage = 32;
|
|
55 |
|
|
56 |
static TInt Entry(TAny* aPtr);
|
|
57 |
void RunL();
|
|
58 |
inline void DoCancel() { };
|
|
59 |
void Lock();
|
|
60 |
void Unlock();
|
|
61 |
TInt QueueMsg(const RMessage2& aMsg);
|
|
62 |
void HandleMessage(const RMessage2& aMessage);
|
|
63 |
static CUsbHostMsDeviceThread* NewL(TUint aToken);
|
|
64 |
void UnRegisterInterfaceL(const RMessage2& aMessage);
|
|
65 |
~CUsbHostMsDeviceThread();
|
|
66 |
private:
|
|
67 |
static void DoStartServerL(TAny* aPtr);
|
|
68 |
CUsbHostMsDeviceThread(TUint);
|
|
69 |
void RegisterInterfaceL(const RMessage2& aMessage);
|
|
70 |
void InitialiseInterfaceL(const RMessage2& aMessage);
|
|
71 |
void GetNumLunL(const RMessage2& aMessage);
|
|
72 |
void RegisterLogicalUnitL(const RMessage2& aMessage);
|
|
73 |
TInt Shutdown();
|
|
74 |
|
|
75 |
public:
|
|
76 |
TBool iIsSignalled;
|
|
77 |
|
|
78 |
private:
|
|
79 |
CUsbHostMsDevice* iUsbHostMsDevice;
|
|
80 |
|
|
81 |
RMessage2 iRMessage2[KMaxNumMessage];
|
|
82 |
RMutex iMutex;
|
|
83 |
|
|
84 |
TInt iQueueIndex;
|
|
85 |
TInt iDequeueIndex;
|
|
86 |
TBool iQueueFull;
|
|
87 |
};
|
|
88 |
|
|
89 |
#endif // CUSBMASSSTORAGEDEVICETHREAD_H
|