|
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 "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 #ifndef __OstBaseRouter_h__ |
|
19 #define __OstBaseRouter_h__ |
|
20 |
|
21 // System includes |
|
22 #include <e32base.h> |
|
23 |
|
24 #include "datalistener.h" |
|
25 |
|
26 class CDbgTrcPortMgr; |
|
27 class CDbgTrcSrvSession; |
|
28 class COstProtRegistry; |
|
29 class COstMessage; |
|
30 |
|
31 class COstWriteMsgEntry : public CBase |
|
32 { |
|
33 public: |
|
34 static COstWriteMsgEntry* NewL(TDesC8& aMsg, CDbgTrcSrvSession* aMsgListener); |
|
35 ~COstWriteMsgEntry(); |
|
36 |
|
37 //private construct |
|
38 private: |
|
39 COstWriteMsgEntry(CDbgTrcSrvSession* aMsgListener); |
|
40 void ConstructL(TDesC8& aMsg); |
|
41 |
|
42 public: |
|
43 COstMessage* iMessage; |
|
44 CDbgTrcSrvSession* iWriteMsgListener; |
|
45 }; |
|
46 |
|
47 class COstBaseRouter : public CBase, MDataListener |
|
48 { |
|
49 public: |
|
50 static COstBaseRouter* NewL(); |
|
51 ~COstBaseRouter(); |
|
52 |
|
53 //private construct |
|
54 private: |
|
55 COstBaseRouter(); |
|
56 void ConstructL(); |
|
57 |
|
58 public: |
|
59 |
|
60 void GetPortConfig(TDes8& aConfigDes); |
|
61 TInt SetPortConfig(TDesC8& aConfigDes); |
|
62 |
|
63 TInt OpenCommPortL(); |
|
64 TInt CloseCommPort(); |
|
65 |
|
66 void RegisterProtocol(const TOstProtIds aProtId, CDbgTrcSrvSession* aProtMsgListener, TBool aStripHeader); |
|
67 void UnRegisterProtocol(const TOstProtIds aProtId); |
|
68 |
|
69 void ReadMessage(); |
|
70 void WriteMessageL(TDesC8& aMsg, CDbgTrcSrvSession* aProtMsgListener); |
|
71 void WriteMessageL(TDesC8& aMsg, CDbgTrcSrvSession* aProtMsgListener, TOstProtIds aProtId); |
|
72 |
|
73 |
|
74 public: // from MDataListener |
|
75 void DataAvailable(TDesC8& aMsgData, TUint aLength); |
|
76 void DataWriteComplete(TInt aErrCode); |
|
77 |
|
78 private: |
|
79 void SwapBytes(TUint8* aTrgtData, const TUint8* aSrcData, TInt aLength); |
|
80 void DoWriteMessageL(CDbgTrcSrvSession* aProtMsgListener); |
|
81 void RemoveNonOstBytes(TDes8& aMsgBuffer); |
|
82 |
|
83 |
|
84 // data members |
|
85 private: |
|
86 |
|
87 CDbgTrcPortMgr* iPortManager; |
|
88 COstProtRegistry* iProtRegistry; |
|
89 |
|
90 CDbgTrcSrvSession* iWriteMsgListener; |
|
91 |
|
92 TBuf8<MAX_BUF_SIZE> iRecvMsgBuffer; |
|
93 TBuf8<MAX_BUF_SIZE> iSendMsgBuffer; |
|
94 |
|
95 RPointerArray<COstWriteMsgEntry> iWriteMsgQueue; |
|
96 |
|
97 TBool iIsBigEndian; |
|
98 }; |
|
99 |
|
100 #endif //__OstBaseRouter_h__ |
|
101 |