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 DISAKERNELCHANNEL_H
|
|
21 |
#define DISAKERNELCHANNEL_H
|
|
22 |
|
|
23 |
#include <e32def.h> // For TInt, TAny
|
|
24 |
#include <e32cmn.h> // For TDesC8,
|
|
25 |
#include <dfcs.h> // For TDfc
|
|
26 |
#include "internalapi.h" // For MIAD2ChannelApi, MChannel2IADApi
|
|
27 |
|
|
28 |
class DExtensionAPI;
|
|
29 |
class DQueue;
|
|
30 |
|
|
31 |
NONSHARABLE_CLASS( DISAKernelChannel ) : public MIAD2ChannelApi
|
|
32 |
{
|
|
33 |
|
|
34 |
public:
|
|
35 |
DISAKernelChannel();
|
|
36 |
~DISAKernelChannel();
|
|
37 |
|
|
38 |
// Handles request according to enumeration fromm DIsaKernelApi
|
|
39 |
// TInt HandleRequest( const TUint16 aRequest, TAny* aParams );
|
|
40 |
TInt HandleRequest( TThreadMessage& aMsg );
|
|
41 |
|
|
42 |
// From MIAD2ChannelApi
|
|
43 |
|
|
44 |
/*
|
|
45 |
* @param aStatus, connection status
|
|
46 |
* @return void
|
|
47 |
*/
|
|
48 |
void NotifyConnectionStatus( TIADConnectionStatus aStatus );
|
|
49 |
|
|
50 |
void ReceiveMsg( const TDesC8& aMessage );
|
|
51 |
|
|
52 |
// Register pep associated to this channel to listen data message
|
|
53 |
// deliveries.
|
|
54 |
void RegisterPep( MDataMessageStatus& aPep );
|
|
55 |
|
|
56 |
// When data message is written to user thread call
|
|
57 |
// MDataMesssageStatus::DataMessageDelivered. It's responsibility is to
|
|
58 |
// tell PEP that one data message e.g.a credit is used. PEP's should also
|
|
59 |
// keep count of data messages added to channel to be abel to control the
|
|
60 |
// legacy flowcontrol
|
|
61 |
void ReceiveDataMsg( const TDesC8& aDataMessage );
|
|
62 |
|
|
63 |
void NotifyFlowCtrl( TIADFlowControlStatus aStatus );
|
|
64 |
|
|
65 |
void CompleteChannelRequest( TInt aRequest, TInt aStatusToComplete );
|
|
66 |
|
|
67 |
inline TUint8 GetChannelNumber(){ return iChannelNumber; };
|
|
68 |
// MIAD2ChannelApi end
|
|
69 |
|
|
70 |
private:
|
|
71 |
|
|
72 |
void Close( const TUint16 aChannelId );
|
|
73 |
|
|
74 |
static void MsgQDfc( TAny* aPtr );
|
|
75 |
|
|
76 |
void HandleThreadMsg( TThreadMessage& aMsg );
|
|
77 |
|
|
78 |
void HandleDfcRequest( TThreadMessage& aMsg );
|
|
79 |
|
|
80 |
TInt HandleSyncRequest( TThreadMessage& aMsg );
|
|
81 |
|
|
82 |
void DoCancel( TInt aRequest, TInt aMask );
|
|
83 |
|
|
84 |
// TODO: unique??
|
|
85 |
void ResetQueues();
|
|
86 |
|
|
87 |
static void EmptyRxDfc( TAny* aPtr );
|
|
88 |
|
|
89 |
static void EmptyDataRxDfc( TAny* aPtr );
|
|
90 |
|
|
91 |
// Checking context.
|
|
92 |
void CheckDfc();
|
|
93 |
|
|
94 |
private:
|
|
95 |
|
|
96 |
class TIADKernelAsyncRequest
|
|
97 |
{
|
|
98 |
public:
|
|
99 |
TDfc* iDfcFunction;
|
|
100 |
TInt* iRequestStatus;
|
|
101 |
};
|
|
102 |
|
|
103 |
TUint16 iChannelNumber;
|
|
104 |
// owned
|
|
105 |
DQueue* iRx;
|
|
106 |
DQueue* iDataRx;
|
|
107 |
TDes8** iPtrPtrToRxBuf;
|
|
108 |
TDes8** iPtrPtrToDataRxBuf;
|
|
109 |
TDfc* iEmptyRxDfc;
|
|
110 |
TDfc* iEmptyDataRxDfc;
|
|
111 |
// not owned, just using
|
|
112 |
MDataMessageStatus* iPep;
|
|
113 |
MChannel2IADApi* iExtensionApi;
|
|
114 |
TIADKernelAsyncRequest iRequests[ EIADAsyncLast ]; // TODO: the amount of kernel request.
|
|
115 |
TMessageQue iKernelChMsgQue;
|
|
116 |
|
|
117 |
};
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
#endif /* DISAKERNELCHANNEL_H */
|