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 |
|
|
19 |
|
|
20 |
#ifndef __ISIKERNELCHANNEL_H__
|
|
21 |
#define __ISIKERNELCHANNEL_H__
|
|
22 |
|
|
23 |
#include <e32def.h> // For TInt, TAny
|
|
24 |
#include <e32cmn.h> // For TDesC8
|
|
25 |
#include <kernel.h> // For TMessageQue
|
9
|
26 |
#include "misirouterobjectif.h" // For MISIRouterObjectIf
|
0
|
27 |
#include "isiinternaldefs.h" // For TISIAsyncRequest
|
|
28 |
|
|
29 |
|
|
30 |
// Forward declarations
|
|
31 |
class DISIMsgQueue;
|
9
|
32 |
class MISIObjectRouterIf;
|
0
|
33 |
|
|
34 |
/*
|
|
35 |
* Kernel side ISI channel.
|
|
36 |
*/
|
9
|
37 |
NONSHARABLE_CLASS( DISIKernelChannel ) : public DBase, public MISIRouterObjectIf
|
0
|
38 |
{
|
|
39 |
|
|
40 |
public:
|
|
41 |
|
|
42 |
/*
|
|
43 |
* Default constructor
|
|
44 |
*/
|
|
45 |
DISIKernelChannel( const TUint16& aObjId );
|
|
46 |
|
|
47 |
/*
|
|
48 |
* Destructor
|
|
49 |
*/
|
|
50 |
~DISIKernelChannel();
|
|
51 |
|
|
52 |
/*
|
|
53 |
* Handles the thread message. Synchronizes the execution
|
|
54 |
* from multiple client threads to single thread.
|
|
55 |
* @param aMsg, thread message
|
|
56 |
* @return, return value of the operation.
|
|
57 |
*/
|
|
58 |
TInt HandleRequest( TThreadMessage& aMsg );
|
|
59 |
|
9
|
60 |
// From MISIRouterObjectIf start
|
0
|
61 |
|
|
62 |
/*
|
9
|
63 |
* See comments from MISIRouterObjectIf.
|
0
|
64 |
*/
|
9
|
65 |
void Receive( const TDesC8& aMessage );
|
0
|
66 |
|
|
67 |
/*
|
9
|
68 |
* See comments from MISIRouterObjectIf.
|
0
|
69 |
*/
|
|
70 |
void EnqueChannelRequestCompleteDfc( TInt aRequest, TInt aStatusToComplete );
|
|
71 |
|
9
|
72 |
// From MISIRouterObjectIf end
|
0
|
73 |
|
|
74 |
/*
|
|
75 |
* iKernelChMsgQue callback function in p2p router
|
|
76 |
* thread context.
|
|
77 |
* @param aPtr, pointer to self
|
|
78 |
*/
|
|
79 |
static void MsgQDfc( TAny* aPtr );
|
|
80 |
|
|
81 |
static void EmptyRxDfc( TAny* aPtr );
|
|
82 |
|
|
83 |
private:
|
|
84 |
|
|
85 |
void HandleThreadMsg( TThreadMessage& aMsg );
|
|
86 |
|
|
87 |
void HandleDfcRequest( TThreadMessage& aMsg );
|
|
88 |
|
|
89 |
TInt HandleSyncRequest( TThreadMessage& aMsg );
|
|
90 |
|
|
91 |
void DoCancel( TInt aRequest, TInt aMask );
|
|
92 |
|
|
93 |
void ResetQueues();
|
|
94 |
|
|
95 |
void Disconnect();
|
|
96 |
|
|
97 |
/*
|
|
98 |
* Internal class for handling requests.
|
|
99 |
*/
|
|
100 |
NONSHARABLE_CLASS( DISIKernelAsyncRequests ) : public DBase
|
|
101 |
{
|
|
102 |
|
|
103 |
public:
|
|
104 |
|
|
105 |
/*
|
|
106 |
* Constructor
|
|
107 |
* @param aSize, sife of the request list.
|
|
108 |
*/
|
|
109 |
DISIKernelAsyncRequests( const TInt aSize );
|
|
110 |
|
|
111 |
/*
|
|
112 |
* Destructor
|
|
113 |
*/
|
|
114 |
~DISIKernelAsyncRequests();
|
|
115 |
|
|
116 |
/*
|
|
117 |
* Completes the request if it is pending.
|
|
118 |
* Do not call with FM held.
|
|
119 |
* @param aRequest, request to complete
|
|
120 |
* @param aStatusToComplete, completion status to request to complete
|
|
121 |
*/
|
|
122 |
void Complete( const TUint aRequest, const TInt aStatusToComplete );
|
|
123 |
|
|
124 |
/*
|
|
125 |
* Check does is the request pending.
|
|
126 |
* Do not call with FM held.
|
|
127 |
* @param aRequest, request to check
|
|
128 |
*/
|
|
129 |
TBool IsPending( const TUint aRequest );
|
|
130 |
|
|
131 |
/*
|
|
132 |
* Set the request pending.
|
|
133 |
* Do not call with FM held.
|
|
134 |
* @param aRequest, request to set pending
|
|
135 |
* @param aDfc, pointer to DFC function which is enqued when request is completed
|
|
136 |
* @param aStatus, pointer to status which is modified when request is completed
|
|
137 |
*/
|
|
138 |
void SetPending( const TUint aRequest, TDfc* aDfc, TRequestStatus* aStatus );
|
|
139 |
|
|
140 |
private:
|
|
141 |
|
|
142 |
// Guarding lock.
|
|
143 |
NFastMutex* iRequestLock;
|
|
144 |
TDfc** iDfcFunctionList;
|
|
145 |
TRequestStatus** iRequestStatusList;
|
|
146 |
|
|
147 |
};
|
|
148 |
|
|
149 |
private:
|
|
150 |
|
|
151 |
// Synhronized internally with fastmutexes
|
|
152 |
DISIKernelAsyncRequests* iRequests;
|
|
153 |
// Not owned, just using
|
|
154 |
// Only acccessed from ISI Router thread.
|
|
155 |
TMessageQue iKernelChMsgQue;
|
|
156 |
TDes8** iPtrPtrToRxBuf;
|
9
|
157 |
MISIObjectRouterIf* iRouterIf;
|
0
|
158 |
// Owned
|
|
159 |
TDfc* iEmptyRxDfc;
|
|
160 |
TDfcQue* iMainThread;
|
|
161 |
TDfcQue* iCompletionThread;
|
|
162 |
// Owned, synhronized internally with fastmutexes
|
|
163 |
DISIMsgQueue* iRx;
|
|
164 |
TUint8 iObjId;
|
|
165 |
TInt32 iUID;
|
|
166 |
|
|
167 |
|
|
168 |
};
|
|
169 |
|
|
170 |
#endif /* __ISIKERNELCHANNEL_H__ */
|