|
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // BIO-message Socket Port Watcher |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef WAPSOCKETWATCHER_H__ |
|
19 #define WAPSOCKETWATCHER_H__ |
|
20 |
|
21 #include <smsuaddr.h> |
|
22 #include <gsmumsg.h> |
|
23 #include <gsmubuf.h> |
|
24 #include <smsustrm.h> |
|
25 #include <etelmm.h> |
|
26 |
|
27 |
|
28 #include <e32base.h> |
|
29 #include "SmsSocketWatcher.h" |
|
30 #include <es_wsms.h> |
|
31 |
|
32 #include <wapmessage.h> |
|
33 |
|
34 const TInt KReceiveBufferSize = 256; |
|
35 const TInt KWspReceiveHeaderSize = 64; |
|
36 |
|
37 |
|
38 //********************************** |
|
39 // CWapPortWatcher |
|
40 //********************************** |
|
41 // |
|
42 // |
|
43 // |
|
44 class CWapPortWatcher : public CBaseSmsActiveSocketWatcher |
|
45 { |
|
46 public: |
|
47 static CWapPortWatcher* NewL(TMsvId aBioServiceId, |
|
48 TMsvId aSmsServiceId, |
|
49 CBIODatabase& aBioDb, |
|
50 CWatcherLog& aWatcherLog, |
|
51 TInt aPriority, |
|
52 TUid aBioID, |
|
53 RFs& aFs, |
|
54 const TBioMsgId& aBioMsg); |
|
55 ~CWapPortWatcher(); |
|
56 |
|
57 protected: |
|
58 CWapPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, Wap::TPort aWapPort); |
|
59 void DoReceiveL(const TDesC8& aRecvFrom); |
|
60 |
|
61 void DoComplete(TInt&); |
|
62 virtual void CloseConn(); |
|
63 void AppendToHBufC8L(HBufC8*& aBuf, const TDesC8& aAppend); |
|
64 |
|
65 void DoRunL(); |
|
66 void CompleteSelf(); |
|
67 protected: |
|
68 //The entire received message |
|
69 HBufC8* iRecvBuf; |
|
70 Wap::TPort iWapPort; |
|
71 }; |
|
72 |
|
73 |
|
74 |
|
75 // |
|
76 // CWdpPortWatcher |
|
77 // |
|
78 |
|
79 class CWdpPortWatcher : public CWapPortWatcher |
|
80 { |
|
81 public: |
|
82 CWdpPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, TUint16 aWapPort); |
|
83 ~CWdpPortWatcher(); |
|
84 void DoCancel(); |
|
85 void DoSetupL(); |
|
86 |
|
87 private: |
|
88 void CloseConn(); |
|
89 void WaitForMessageL(); |
|
90 void ReceiveL(); |
|
91 |
|
92 private: |
|
93 //Members required for receiving |
|
94 TBuf8<RMobilePhone::KMaxMobileTelNumberSize> iRemoteAddress; |
|
95 Wap::TPort iRemotePort; |
|
96 CWapBoundDatagramService* iWdpConn; |
|
97 TBool iTruncated; |
|
98 |
|
99 TPtr8 iRecvPtr; |
|
100 TUint16 iDataSize; |
|
101 TPckg<TUint16> iDataSizePckg; |
|
102 |
|
103 enum TWdpRecvState |
|
104 { |
|
105 ERecvSize, |
|
106 ERecv |
|
107 } iRecvNext; |
|
108 }; |
|
109 |
|
110 |
|
111 |
|
112 // |
|
113 // CWspPortWatcher |
|
114 // |
|
115 |
|
116 class CWspPortWatcher : public CWapPortWatcher |
|
117 { |
|
118 public: |
|
119 CWspPortWatcher(CWatcherLog& aWatcherLog, TInt aPriority, TUid aBioID, RFs& aFs, TUint16 aWapPort); |
|
120 ~CWspPortWatcher(); |
|
121 |
|
122 void DoCancel(); |
|
123 void DoSetupL(); |
|
124 |
|
125 private: |
|
126 void CloseConn(); |
|
127 void WaitForMessageL(); |
|
128 void ReceiveL(); |
|
129 |
|
130 private: |
|
131 //Members required for receiving |
|
132 HBufC8* iRecvHeader; |
|
133 TPckgBuf <TUint8> iPushPckgId; |
|
134 CWapBoundCLPushService* iWspConn; |
|
135 |
|
136 //Used to receive parts of each message. |
|
137 TBuf8<KReceiveBufferSize> iTempRecvBuf; |
|
138 TBuf8<KWspReceiveHeaderSize> iTempRecvHeader; |
|
139 }; |
|
140 |
|
141 #endif //WAPSOCKETWATCHER_H__ |