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 |
* DMC Logical Channel class declaration.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef DMC_LOGICAL_CHANNEL_H
|
|
21 |
#define DMC_LOGICAL_CHANNEL_H
|
|
22 |
|
|
23 |
#ifndef DMC_INTERNAL_INCLUDE
|
|
24 |
#error Illegal usage of dmc_logical_channel.h, It is only for DMC internal use !
|
|
25 |
#endif // DMC_INTERNAL_INCLUDE
|
|
26 |
|
|
27 |
// INCLUDES
|
|
28 |
#include <kernel.h> // DLogicalChannel
|
|
29 |
|
|
30 |
// CONSTANTS
|
|
31 |
// MACROS
|
|
32 |
// DATA TYPES
|
|
33 |
// EXTERNAL DATA STRUCTURES
|
|
34 |
// FUNCTION PROTOTYPES
|
|
35 |
// FORWARD DECLARATIONS
|
|
36 |
class DDmcLogicalDevice;
|
|
37 |
class DThread;
|
|
38 |
|
|
39 |
// CLASS DEFINITIONS
|
|
40 |
|
|
41 |
/**
|
|
42 |
* DDmcLogicalChannel
|
|
43 |
*/
|
|
44 |
NONSHARABLE_CLASS(DDmcLogicalChannel) : public DLogicalChannel
|
|
45 |
{
|
|
46 |
public: // Constructor / destructor
|
|
47 |
/**
|
|
48 |
* C++ default constructor.
|
|
49 |
*/
|
|
50 |
DDmcLogicalChannel(DLogicalDevice* aLogicalDevicePtr);
|
|
51 |
|
|
52 |
/**
|
|
53 |
* C++ default destructor.
|
|
54 |
*/
|
|
55 |
~DDmcLogicalChannel();
|
|
56 |
|
|
57 |
public: // from DLogicalChannelBase
|
|
58 |
/**
|
|
59 |
* Second stage constructor called by the kernel's device driver framework.
|
|
60 |
* This is called in the context of the user thread (client) which requested
|
|
61 |
* the creation of a Logical Channel (E.g. through a call to RBusLogicalChannel::DoCreate)
|
|
62 |
* The thread is in a critical section.
|
|
63 |
|
|
64 |
@param aUnit The unit argument supplied by the client to RBusLogicalChannel::DoCreate
|
|
65 |
@param aInfo The info argument supplied by the client to RBusLogicalChannel::DoCreate
|
|
66 |
@param aVer The version argument supplied by the client to RBusLogicalChannel::DoCreate
|
|
67 |
|
|
68 |
@return KErrNone or standard error code.
|
|
69 |
*/
|
|
70 |
TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer);
|
|
71 |
|
|
72 |
public: // from DLogicalChannel
|
|
73 |
/**
|
|
74 |
* @param aMsg The message to process.
|
|
75 |
* The iValue member of this distinguishes the message type:
|
|
76 |
* iValue==ECloseMsg, channel close message
|
|
77 |
* iValue==KMaxTInt, a 'DoCancel' message
|
|
78 |
* iValue>=0, a 'DoControl' message with function number equal to iValue
|
|
79 |
* iValue<0, a 'DoRequest' message with function number equal to ~iValue
|
|
80 |
* return void
|
|
81 |
*/
|
|
82 |
void HandleMsg(TMessageBase* aMsg);
|
|
83 |
|
|
84 |
/**
|
|
85 |
* Send an event to a user side client.
|
|
86 |
*
|
|
87 |
* @param aEvent A type of the event.
|
|
88 |
* @return None
|
|
89 |
*/
|
|
90 |
void SendEvent(const RDmc::TEvent& aEvent);
|
|
91 |
|
|
92 |
private:
|
|
93 |
/**
|
|
94 |
* Handles a synchronous request.
|
|
95 |
* @param aFunction A number identifying specific functionality.
|
|
96 |
* @param *a1 A parameter from the user side.
|
|
97 |
* @return KErrNone if successful, otherwise one of the system wide error codes.
|
|
98 |
*/
|
|
99 |
TInt DoControl(const TInt aFunction, TAny* a1);
|
|
100 |
|
|
101 |
/**
|
|
102 |
* Handles an asynchronous request.
|
|
103 |
* @param aReqId A request number.
|
|
104 |
* @param aStatus Request status, completed with KErrNone when data has arrived.
|
|
105 |
* @param *a1 A parameter from the user side.
|
|
106 |
* @return KErrNone if successful, otherwise one of the system wide error codes.
|
|
107 |
*/
|
|
108 |
TInt DoRequest(const TInt aReqId, TRequestStatus* const aStatus, TAny* const a1);
|
|
109 |
|
|
110 |
private: // Data members
|
|
111 |
|
|
112 |
/**
|
|
113 |
* A pointer to the logical device class.
|
|
114 |
*/
|
|
115 |
DDmcLogicalDevice* iDmcLogicalDevPtr;
|
|
116 |
|
|
117 |
/**
|
|
118 |
* A pointer to a client thread.
|
|
119 |
*/
|
|
120 |
DThread* iClientThreadPtr;
|
|
121 |
|
|
122 |
/**
|
|
123 |
* A pointer to a client request status.
|
|
124 |
*/
|
|
125 |
TRequestStatus* iClientStatusPtr;
|
|
126 |
|
|
127 |
/**
|
|
128 |
* A pointer where client event data is written to.
|
|
129 |
*/
|
|
130 |
RDmc::TEvent* iClientEventBufferPtr;
|
|
131 |
};
|
|
132 |
|
|
133 |
#endif // DMC_LOGICAL_CHANNEL_H
|
|
134 |
|
|
135 |
// End of File
|