|
1 // Copyright (c) 2003-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 // |
|
15 |
|
16 #include "WapFullySpecCLWSP.h" |
|
17 #include "WapMsgUtils.h" |
|
18 #include "CLWSPPduHandler.h" |
|
19 |
|
20 CSWSWapFullySpecCLWSPService* CSWSWapFullySpecCLWSPService::NewL() |
|
21 /** |
|
22 Static new function |
|
23 @internalComponent |
|
24 @released |
|
25 @since v8.0 |
|
26 */ |
|
27 { |
|
28 CSWSWapFullySpecCLWSPService* me = new(ELeave)CSWSWapFullySpecCLWSPService(); |
|
29 CleanupStack::PushL(me); |
|
30 me->ConstructL(); |
|
31 CleanupStack::Pop(me); |
|
32 return me; |
|
33 } |
|
34 |
|
35 CSWSWapFullySpecCLWSPService::CSWSWapFullySpecCLWSPService() |
|
36 : CWapFullySpecCLWSPService() |
|
37 /** |
|
38 Constructor |
|
39 @internalComponent |
|
40 @released |
|
41 @since v8.0 |
|
42 */ |
|
43 { |
|
44 } |
|
45 |
|
46 CSWSWapFullySpecCLWSPService::~CSWSWapFullySpecCLWSPService() |
|
47 /** |
|
48 Destructor |
|
49 @internalComponent |
|
50 @released |
|
51 @since v8.0 |
|
52 */ |
|
53 { |
|
54 delete iAgent; |
|
55 } |
|
56 |
|
57 void CSWSWapFullySpecCLWSPService::ConstructL() |
|
58 /** |
|
59 Second phase constructor |
|
60 @internalComponent |
|
61 @released |
|
62 @since v8.0 |
|
63 */ |
|
64 { |
|
65 // Parent class construction |
|
66 CWapFullySpecCLWSPService::ConstructL(); |
|
67 iAgent=CWspMessageApiAgent::NewL(); |
|
68 } |
|
69 |
|
70 TInt CSWSWapFullySpecCLWSPService::Connect(const TDesC8& aRemoteHost, Wap::TPort aPort, Wap::TBearer aBearer, TBool aSecure) |
|
71 /** |
|
72 Opens a end-point which is to be used only with a single, named remote host. |
|
73 @internalComponent |
|
74 @released |
|
75 @since v8.0 |
|
76 @param aRemoteHost the bearer-dependent address of the remote host with which the data will be exchanged |
|
77 @param aPort the port on the remote host to which data will be sent |
|
78 @param aBearer the bearer to use (not EAll) |
|
79 @param aSecure security flag indicates whether WTLS will be used or not |
|
80 @returns KErrNone on successful completion, or one of the system error codes on failure. |
|
81 */ |
|
82 { |
|
83 if(aSecure) |
|
84 { |
|
85 return KErrNotSupported; |
|
86 } |
|
87 return iAgent->Connect(aRemoteHost, aPort, aBearer, aSecure); |
|
88 } |
|
89 |
|
90 TInt CSWSWapFullySpecCLWSPService::MethodInvoke(TUint aMethod, const TDesC& aURI, const TDesC8& aReqHeaders, const TDesC8& aReqBody, const TUint8 aTransactionId) |
|
91 /** |
|
92 A synchronous call to send a method invoke method to the remote host. |
|
93 @internalComponent |
|
94 @released |
|
95 @since v8.0 |
|
96 @param aMethod (in) the method that will be invoked on server |
|
97 @param aURI (in) the uri to build wsp message |
|
98 @param aReqHeaders (in) the wsp header to be used to build method invoke message |
|
99 @param aReqBody (in) the wsp body to be used to build method invoke message |
|
100 @param aTransactionId (in) the transaction Id of the method invoke message |
|
101 @returns KErrNone on successful completion, or one of the system error codes on failure. |
|
102 */ |
|
103 { |
|
104 return iAgent->SendWspMessage(TWSPPduType(aMethod), aURI, aReqHeaders, aReqBody, aTransactionId); |
|
105 } |
|
106 |
|
107 TInt CSWSWapFullySpecCLWSPService::MethodResult(TDes8& aReqHeaders, TDes8& aReqBody, TPckgBuf<TUint8>& aTransactionIdPckg, TWSPStatus& aWspStatus, TRequestStatus& aReqStatus, TUint32 aTimeout) |
|
108 /** |
|
109 Request an asynchronous notification upon arrival of the method result messages on the listening connection. |
|
110 The request completes upon receipt of the message, filling the buffers with as much received data as possible. |
|
111 A return code will indicate whether further data remains. The call must be re-issued for subsequent messages |
|
112 or to receive remaining data from a previous method result message. |
|
113 @internalComponent |
|
114 @released |
|
115 @since v8.0 |
|
116 @param aReqHeaders (out) (client-allocated) - when a method result message arrives the header data is written here |
|
117 @param aReqBody (out) (client-allocated) - when a method result message arrives the body data is written here |
|
118 @param aTransactionIdPckg (out) when a method result message arrives an integer ID that uniquely specifies the message is written here |
|
119 @param aWspStatus (out) when a method result message arrives, the wsp status is written here. |
|
120 @param aReqStatus (inout) used by the service provider to notify the client when a method result has arrived |
|
121 @param aTimeout (in) an optional millisecond time-out which allows a timed read to be made. If no data is received |
|
122 within the timeout period the request completes with KErrTimedOut. If a value of 0 is supplied the timeout is infinite. |
|
123 @returns KErrNone on successful completion, or one of the system error codes on failure. |
|
124 */ |
|
125 { |
|
126 return iAgent->ReceiveWspMessage(aReqHeaders, aReqBody, aTransactionIdPckg, aWspStatus, aReqStatus, aTimeout); |
|
127 } |
|
128 |
|
129 void CSWSWapFullySpecCLWSPService::CancelReq() |
|
130 /** |
|
131 Cancel a previously-requested method result notification. If a method result message arrives the client will not be notified. |
|
132 @internalComponent |
|
133 @released |
|
134 @since v8.0 |
|
135 */ |
|
136 { |
|
137 iAgent->CancelRequest(); |
|
138 } |
|
139 |
|
140 TInt CSWSWapFullySpecCLWSPService::GetLocalPort(Wap::TPort& aPort) |
|
141 /** |
|
142 Get the local port of this endpoint.Useful if one was chosen automatically. |
|
143 @internalComponent |
|
144 @released |
|
145 @since v8.0 |
|
146 @param aPort (out) the port number |
|
147 @returns KErrNone on successful completion, or one of the system error codes on failure. |
|
148 */ |
|
149 { |
|
150 return iAgent->GetLocalPort(aPort); |
|
151 } |
|
152 |
|
153 TInt CSWSWapFullySpecCLWSPService::GetLocalAddress(HBufC8*& aLocalHost) |
|
154 /** |
|
155 Get the local address of this endpoint. |
|
156 @internalComponent |
|
157 @released |
|
158 @since v8.0 |
|
159 @param aLocalHost (inout) the address of the local host. A reference to a HBufC8 pointer should |
|
160 be passed in. This pointer MUST be null! A HBufC8 will be allocated to hold the address, ownership |
|
161 of this buffer will be passed over to the client. |
|
162 @returns KErrNone on successful completion, or one of the system error codes on failure. |
|
163 */ |
|
164 { |
|
165 return iAgent->GetLocalAddress(aLocalHost); |
|
166 } |