24
|
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 |
// Implements CWapSapMessageSender and CWapProtocolObserver
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file
|
|
20 |
*/
|
|
21 |
|
|
22 |
#include "ws_obsvr.h"
|
|
23 |
|
|
24 |
#include <commsdattypesv1_1.h>
|
|
25 |
|
|
26 |
#include "smsprot.h"
|
|
27 |
#include "ws_main.h"
|
|
28 |
#include "wapmain.h"
|
|
29 |
#include "WAPDGRM.H"
|
|
30 |
#include "gsmuieoperations.h"
|
|
31 |
#include "gsmunonieoperations.h"
|
|
32 |
|
|
33 |
using namespace CommsDat;
|
|
34 |
|
|
35 |
//
|
|
36 |
// Constant values
|
|
37 |
//
|
|
38 |
// KWapSmsmessageValidityPeriod - Hardcoded message validity period (in minutes)
|
|
39 |
// for WAPSMS and WAPSMS7 bearers.
|
|
40 |
//
|
|
41 |
//
|
|
42 |
|
|
43 |
const TInt KWapSmsMessageValidityPeriod = 5;
|
|
44 |
const TInt KSmsMsgArraySegmentSize = 8;
|
|
45 |
|
|
46 |
//
|
|
47 |
// CWapSapMessageSender
|
|
48 |
//
|
|
49 |
// Owned by CWapSmsProvider, implements MSmsMessageObserver.
|
|
50 |
// Splits up a CWapDatagram into one or more SMS messages and sends them to
|
|
51 |
// Sms.Prt one at a time.
|
|
52 |
//
|
|
53 |
|
|
54 |
_LIT(KWAPSMSBearer, "WAPSMSBearer");
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Constructor
|
|
58 |
*/
|
|
59 |
CWapSapMessageSender::CWapSapMessageSender(CSmsProtocol* aSmsProtocol, CWapSmsProvider* aWapSap)
|
|
60 |
{
|
|
61 |
iSmsAddr.SetSmsAddrFamily(ESmsAddrSendOnly);
|
|
62 |
iSmsProtocol = aSmsProtocol;
|
|
63 |
iProvider = aWapSap;
|
|
64 |
} // CWapSapMessageSender::CWapSapMessageSender
|
|
65 |
|
|
66 |
|
|
67 |
/**
|
|
68 |
* Destructor
|
|
69 |
*/
|
|
70 |
CWapSapMessageSender::~CWapSapMessageSender()
|
|
71 |
{
|
|
72 |
if (iSmsProtocol)
|
|
73 |
{
|
|
74 |
iSmsProtocol->RemoveSmsMessageObserver(*this);
|
|
75 |
}
|
|
76 |
|
|
77 |
delete iSmsMsgArray;
|
|
78 |
} // CWapSapMessageSender::~CWapSapMessageSender
|
|
79 |
|
|
80 |
|
|
81 |
/**
|
|
82 |
* Factory
|
|
83 |
*/
|
|
84 |
CWapSapMessageSender* CWapSapMessageSender::NewL(CSmsProtocol* aSmsProtocol, CWapSmsProvider* aWapSap)
|
|
85 |
{
|
|
86 |
LOGWAPPROT1("CWapSapMessageSender::NewL");
|
|
87 |
|
|
88 |
CWapSapMessageSender* msgSender = new(ELeave) CWapSapMessageSender(aSmsProtocol,aWapSap);
|
|
89 |
CleanupStack::PushL(msgSender);
|
|
90 |
msgSender->iSmsMsgArray = new(ELeave) CArrayPtrFlat<CSmsMessage>(KSmsMsgArraySegmentSize);
|
|
91 |
aSmsProtocol->AddSmsMessageObserverL(*msgSender);
|
|
92 |
User::LeaveIfError(aSmsProtocol->BindSmsMessageObserver(*msgSender,msgSender->iSmsAddr));
|
|
93 |
CleanupStack::Pop();
|
|
94 |
return msgSender;
|
|
95 |
} // CWapSapMessageSender::NewL
|
|
96 |
|
|
97 |
|
|
98 |
/**
|
|
99 |
* Send a message to the SMSPROT.PRT
|
|
100 |
* Splits up the CWapDatagram into one or more SMS messages and sends them
|
|
101 |
* one at a time to SMSPROT.PRT
|
|
102 |
*/
|
|
103 |
void CWapSapMessageSender::SendDatagramL(CWapDatagram* aMsg)
|
|
104 |
{
|
|
105 |
LOGWAPPROT1("CWapSapMessageSender::SendDatagramL");
|
|
106 |
|
|
107 |
__ASSERT_DEBUG(iSmsMsgArray->Count()==0,Panic(EWapSmsSapMessageSenderBusy));
|
|
108 |
|
|
109 |
CleanupStack::PushL(aMsg);
|
|
110 |
aMsg->EncodeConcatenatedMessagesL(iSmsProtocol->FileSession(), *iSmsMsgArray);
|
|
111 |
SendNextSms();
|
|
112 |
CleanupStack::PopAndDestroy();
|
|
113 |
} // CWapSapMessageSender::SendDatagramL
|
|
114 |
|
|
115 |
|
|
116 |
/**
|
|
117 |
* Send an SMS message to SMSPROT.PRT
|
|
118 |
*/
|
|
119 |
void CWapSapMessageSender::SendNextSms()
|
|
120 |
{
|
|
121 |
LOGWAPPROT1("CWapSapMessageSender::SendNextSms");
|
|
122 |
|
|
123 |
__ASSERT_DEBUG(iSmsMsgArray->Count()>0,Panic(EWapSmsSapMessageSenderNothingToSend));
|
|
124 |
CSmsMessage* smsMsg = iSmsMsgArray->At(0);
|
|
125 |
TRAPD(ret, SetSmsMessageSettingsL(smsMsg) );
|
|
126 |
if(ret != KErrNone)
|
|
127 |
iProvider->Error(ret, MSocketNotify::EErrorSend);
|
|
128 |
else
|
|
129 |
{
|
|
130 |
iSmsMsgArray->Delete(0);
|
|
131 |
iSmsProtocol->SendSmsMessage(smsMsg,*this,0);
|
|
132 |
}
|
|
133 |
|
|
134 |
} // CWapSapMessageSender::SendNextSms
|
|
135 |
|
|
136 |
|
|
137 |
/**
|
|
138 |
* Setup the SMS message according to the settings stored in the CommDB
|
|
139 |
*/
|
|
140 |
void CWapSapMessageSender::SetSmsMessageSettingsL(CSmsMessage* aSmsMessage)
|
|
141 |
{
|
|
142 |
LOGWAPPROT1("CWapSapMessageSender::SetSmsMessageSettingsL");
|
|
143 |
|
|
144 |
TBuf<KCommsDbSvrMaxFieldLength> msgCenterNumberValue;
|
|
145 |
TUint32 msgValidityPeriodValue = KWapSmsMessageValidityPeriod;
|
|
146 |
TBool msgDeliveryReportValue = EFalse;
|
|
147 |
|
|
148 |
TUint32 modemId = 0;
|
|
149 |
#ifdef SYMBIAN_NON_SEAMLESS_NETWORK_BEARER_MOBILITY
|
|
150 |
CMDBSession* db = CMDBSession::NewL(KCDVersion1_2);
|
|
151 |
#else
|
|
152 |
CMDBSession* db = CMDBSession::NewL(KCDVersion1_1);
|
|
153 |
#endif
|
|
154 |
CleanupStack::PushL(db);
|
|
155 |
|
|
156 |
CSmsSubmit* smsSubmit = reinterpret_cast<CSmsSubmit*>(&aSmsMessage->SmsPDU());
|
|
157 |
if (iProvider->MessageType()==CWapSmsProvider::ESmartMessage)
|
|
158 |
{
|
|
159 |
CMDBField<TUint32>* globalSettingsField = new(ELeave) CMDBField<TUint32>(KCDTIdModemPhoneServicesSMS);
|
|
160 |
CleanupStack::PushL(globalSettingsField);
|
|
161 |
globalSettingsField->SetRecordId(1);
|
|
162 |
globalSettingsField->LoadL(*db);
|
|
163 |
modemId = *globalSettingsField;
|
|
164 |
CleanupStack::PopAndDestroy(globalSettingsField);
|
|
165 |
|
|
166 |
CMDBField<TDesC>* msgCenterNumberValueField = new(ELeave) CMDBField<TDesC>(KCDTIdMessageCentreNumber);
|
|
167 |
CleanupStack::PushL(msgCenterNumberValueField);
|
|
168 |
msgCenterNumberValueField->SetRecordId(modemId);
|
|
169 |
msgCenterNumberValueField->LoadL(*db);
|
|
170 |
msgCenterNumberValue = *msgCenterNumberValueField;
|
|
171 |
CleanupStack::PopAndDestroy(msgCenterNumberValueField);
|
|
172 |
|
|
173 |
CMDBField<TUint32>* msgValidityPeriodValueField = new(ELeave) CMDBField<TUint32>(KCDTIdMessageValidityPeriod);
|
|
174 |
CleanupStack::PushL(msgValidityPeriodValueField);
|
|
175 |
msgValidityPeriodValueField->SetRecordId(modemId);
|
|
176 |
msgValidityPeriodValueField->LoadL(*db);
|
|
177 |
msgValidityPeriodValue = *msgValidityPeriodValueField;
|
|
178 |
CleanupStack::PopAndDestroy(msgValidityPeriodValueField);
|
|
179 |
|
|
180 |
CMDBField<TBool>* msgDeliveryReportValueField = new(ELeave) CMDBField<TBool>(KCDTIdMessageDeliveryReport);
|
|
181 |
CleanupStack::PushL(msgDeliveryReportValueField);
|
|
182 |
msgDeliveryReportValueField->SetRecordId(modemId);
|
|
183 |
msgDeliveryReportValueField->LoadL(*db);
|
|
184 |
msgDeliveryReportValue = *msgDeliveryReportValueField;
|
|
185 |
CleanupStack::PopAndDestroy(msgDeliveryReportValueField);
|
|
186 |
|
|
187 |
TTimeIntervalMinutes validityPeriod(msgValidityPeriodValue);
|
|
188 |
smsSubmit->SetValidityPeriod(validityPeriod);
|
|
189 |
|
|
190 |
if (msgDeliveryReportValue)
|
|
191 |
{
|
|
192 |
if ((iProvider->GetStatusReportScheme() == EWapSmsTPSRR) && (iProvider->GetDataCodingScheme() == EWapSms8BitDCS))
|
|
193 |
{
|
|
194 |
CSmsTPSRROperations& operation = (CSmsTPSRROperations&)aSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter);
|
|
195 |
operation.SetSchemeL();
|
|
196 |
operation.SetLastSegmentStatusReportL(ETrue);
|
|
197 |
}
|
|
198 |
else
|
|
199 |
{
|
|
200 |
smsSubmit->SetStatusReportRequest(msgDeliveryReportValue);
|
|
201 |
}
|
|
202 |
}
|
|
203 |
|
|
204 |
}
|
|
205 |
else // 8-bit WAP
|
|
206 |
{
|
|
207 |
CMDBField<TUint32>* globalSettingsField = new(ELeave) CMDBField<TUint32>(KCDTIdGlobalWapAcessPoint);
|
|
208 |
CleanupStack::PushL(globalSettingsField);
|
|
209 |
globalSettingsField->SetRecordId(1);
|
|
210 |
globalSettingsField->LoadL(*db);
|
|
211 |
modemId = *globalSettingsField;
|
|
212 |
CleanupStack::PopAndDestroy(globalSettingsField);
|
|
213 |
|
|
214 |
CMDBField<TDesC>* bearerField = new(ELeave) CMDBField<TDesC>(KCDTIdWAPCurrentBearer);
|
|
215 |
CleanupStack::PushL(bearerField);
|
|
216 |
bearerField->SetRecordId(modemId);
|
|
217 |
bearerField->LoadL(*db);
|
|
218 |
TBuf<KCommsDbSvrMaxFieldLength> bearerType;
|
|
219 |
bearerType = *bearerField;
|
|
220 |
CleanupStack::PopAndDestroy(bearerField);
|
|
221 |
|
|
222 |
if (TPtrC(KWAPSMSBearer) != TPtrC(bearerType))
|
|
223 |
{
|
|
224 |
// We're not the current bearer - cancel msgs in send queue
|
|
225 |
// and leave with not supported error indication
|
|
226 |
iSmsMsgArray->ResetAndDestroy();
|
|
227 |
User::Leave(KErrNotSupported);
|
|
228 |
}
|
|
229 |
|
|
230 |
CMDBField<TDesC>* centerNumberField = new(ELeave) CMDBField<TDesC>(KCDTIdWAPSMSServiceCentreAddress);
|
|
231 |
CleanupStack::PushL(centerNumberField);
|
|
232 |
centerNumberField->SetRecordId(modemId);
|
|
233 |
centerNumberField->LoadL(*db);
|
|
234 |
msgCenterNumberValue = *centerNumberField;
|
|
235 |
CleanupStack::PopAndDestroy(centerNumberField);
|
|
236 |
|
|
237 |
smsSubmit->SetValidityPeriodFormat(TSmsFirstOctet::ESmsVPFNone);
|
|
238 |
|
|
239 |
CMDBField<TUint32>* globalSettingsField2 = new(ELeave) CMDBField<TUint32>(KCDTIdModemPhoneServicesSMS);
|
|
240 |
CleanupStack::PushL(globalSettingsField2);
|
|
241 |
globalSettingsField2->SetRecordId(1);
|
|
242 |
globalSettingsField2->LoadL(*db);
|
|
243 |
modemId = *globalSettingsField2;
|
|
244 |
CleanupStack::PopAndDestroy(globalSettingsField2);
|
|
245 |
|
|
246 |
CMDBField<TBool>* msgDeliveryReportValueField = new(ELeave) CMDBField<TBool>(KCDTIdMessageDeliveryReport);
|
|
247 |
CleanupStack::PushL(msgDeliveryReportValueField);
|
|
248 |
msgDeliveryReportValueField->SetRecordId(modemId);
|
|
249 |
msgDeliveryReportValueField->LoadL(*db);
|
|
250 |
msgDeliveryReportValue = *msgDeliveryReportValueField;
|
|
251 |
CleanupStack::PopAndDestroy(msgDeliveryReportValueField);
|
|
252 |
|
|
253 |
if (msgDeliveryReportValue)
|
|
254 |
{
|
|
255 |
if ((iProvider->GetStatusReportScheme() == EWapSmsTPSRR) && (iProvider->GetDataCodingScheme() == EWapSms8BitDCS))
|
|
256 |
{
|
|
257 |
CSmsTPSRROperations& operation = (CSmsTPSRROperations&)aSmsMessage->GetOperationsForNonIEL(ESmsTPSRRParameter);
|
|
258 |
operation.SetSchemeL();
|
|
259 |
operation.SetLastSegmentStatusReportL(ETrue);
|
|
260 |
}
|
|
261 |
else
|
|
262 |
{
|
|
263 |
smsSubmit->SetStatusReportRequest(msgDeliveryReportValue);
|
|
264 |
}
|
|
265 |
}
|
|
266 |
|
|
267 |
}
|
|
268 |
CleanupStack::PopAndDestroy(); // db
|
|
269 |
|
|
270 |
aSmsMessage->SmsPDU().SetServiceCenterAddressL(msgCenterNumberValue);
|
|
271 |
} // CWapSapMessageSender::SetSmsMessageSettingsL
|
|
272 |
|
|
273 |
|
|
274 |
/**
|
|
275 |
* Received notification that a message has been sent.
|
|
276 |
* Continue sending SMSs if we have more or complete the send.
|
|
277 |
*/
|
|
278 |
void CWapSapMessageSender::MessageSendCompleted(TInt aStatus)
|
|
279 |
{
|
|
280 |
LOGWAPPROT2("CWapSapMessageSender::MessageSendCompleted [aStatus=%d]", aStatus);
|
|
281 |
|
|
282 |
if (aStatus!=KErrNone)
|
|
283 |
iSmsMsgArray->ResetAndDestroy();
|
|
284 |
|
|
285 |
if (iSmsMsgArray->Count()==0)
|
|
286 |
{
|
|
287 |
iProvider->Error(aStatus,MSocketNotify::EErrorSend);
|
|
288 |
return;
|
|
289 |
}
|
|
290 |
|
|
291 |
SendNextSms();
|
|
292 |
} // CWapSapMessageSender::MessageSendCompleted
|
|
293 |
|
|
294 |
/**
|
|
295 |
* Return the address
|
|
296 |
*/
|
|
297 |
const TSmsAddr& CWapSapMessageSender::GetLocalAddress() const
|
|
298 |
{
|
|
299 |
LOGWAPPROT1("CWapSapMessageSender::GetLocalAddress()");
|
|
300 |
|
|
301 |
return iSmsAddr;
|
|
302 |
} // CWapSapMessageSender::GetLocalAddress
|
|
303 |
|
|
304 |
|
|
305 |
/**
|
|
306 |
* Set the address
|
|
307 |
*/
|
|
308 |
void CWapSapMessageSender::SetLocalAddress(const TSmsAddr& aSmsAddr)
|
|
309 |
{
|
|
310 |
LOGWAPPROT1("CWapSapMessageSender::SetLocalAddress()");
|
|
311 |
|
|
312 |
iSmsAddr = aSmsAddr;
|
|
313 |
} // CWapSapMessageSender::SetLocalAddress
|
|
314 |
|
|
315 |
|
|
316 |
/**
|
|
317 |
* Notification that the modem has been connected or disconnected
|
|
318 |
* (Has no relevance for the wap stack)
|
|
319 |
*/
|
|
320 |
void CWapSapMessageSender::ModemNotificationCompleted(TInt /*aStatus*/)
|
|
321 |
{
|
|
322 |
// Ignore in code coverage - implementation required by base class
|
|
323 |
// but not relavent for WAP PROT.
|
|
324 |
BULLSEYE_OFF
|
|
325 |
LOGWAPPROT1("CWapSapMessageSender::ModemNotificationCompleted()");
|
|
326 |
BULLSEYE_RESTORE
|
|
327 |
}
|
|
328 |
|
|
329 |
/**
|
|
330 |
* Notification that the enumeration has completed
|
|
331 |
* (Has no relevance for the wap stack)
|
|
332 |
*/
|
|
333 |
void CWapSapMessageSender::EnumeratePhoneCompleted(TInt /*aStatus*/)
|
|
334 |
{
|
|
335 |
// Ignore in code coverage - implementation required by base class
|
|
336 |
// but not relavent for WAP PROT.
|
|
337 |
BULLSEYE_OFF
|
|
338 |
LOGWAPPROT1("CWapSapMessageSender::EnumeratePhoneCompleted()");
|
|
339 |
BULLSEYE_RESTORE
|
|
340 |
}
|
|
341 |
|
|
342 |
/**
|
|
343 |
* Notification that a message has been received
|
|
344 |
* Messages should never be directly received by a SAP
|
|
345 |
*/
|
|
346 |
TInt CWapSapMessageSender::MessageReceived(const CSmsMessage& /*aSmsMessage*/,TDes& /*aDes*/)
|
|
347 |
{
|
|
348 |
// Ignore in code coverage - implementation required by base class
|
|
349 |
// but not relavent for WAP PROT.
|
|
350 |
BULLSEYE_OFF
|
|
351 |
LOGWAPPROT1("CWapSapMessageSender::MessageReceived");
|
|
352 |
__ASSERT_DEBUG(EFalse,Panic(EWapSmsReceiveOnMessageSender));
|
|
353 |
return KErrNone;
|
|
354 |
BULLSEYE_RESTORE
|
|
355 |
}
|
|
356 |
|
|
357 |
/**
|
|
358 |
* Informs protocol whether client confirms received message
|
|
359 |
*/
|
|
360 |
TBool CWapSapMessageSender::ClientConfirmsMessage()const
|
|
361 |
{
|
|
362 |
// Ignore in code coverage - implementation required by base class
|
|
363 |
// but not relavent for WAP PROT.
|
|
364 |
BULLSEYE_OFF
|
|
365 |
LOGWAPPROT1("CWapSapMessageSender::ClientConfirmsMessage");
|
|
366 |
__ASSERT_DEBUG(EFalse,Panic(EWapSmsReceiveOnMessageSender));
|
|
367 |
return ETrue;
|
|
368 |
BULLSEYE_RESTORE
|
|
369 |
}
|
|
370 |
|
|
371 |
/**
|
|
372 |
* Informs protocol whether address is used by the observer
|
|
373 |
*/
|
|
374 |
TInt CWapSapMessageSender::SmsAddrIsDuplicate(const MSmsMessageObserver* /*aObserver*/,const TSmsAddr& /*aAddr*/)const
|
|
375 |
{
|
|
376 |
LOGWAPPROT1("CWapSapMessageSender::SmsAddrIsDuplicate()");
|
|
377 |
|
|
378 |
return EFalse;
|
|
379 |
} // CWapSapMessageSender::SmsAddrIsDuplicate
|
|
380 |
|
|
381 |
|
|
382 |
/**
|
|
383 |
* Notification that a message has been written to the phone or SIM
|
|
384 |
* (Has no relevance for the wap stack)
|
|
385 |
*/
|
|
386 |
void CWapSapMessageSender::MessageWriteCompleted(TInt /*aStatus*/, const CSmsMessage* /*aSmsMessage*/)
|
|
387 |
{
|
|
388 |
// Ignore in code coverage - implementation required by base class
|
|
389 |
// but not relavent for WAP PROT.
|
|
390 |
BULLSEYE_OFF
|
|
391 |
LOGWAPPROT1("CWapSapMessageSender::MessageWriteCompleted()");
|
|
392 |
BULLSEYE_RESTORE
|
|
393 |
}
|
|
394 |
|
|
395 |
/**
|
|
396 |
* Notification that a PDU delete has completed
|
|
397 |
* (Has no relevance for the wap stack)
|
|
398 |
*/
|
|
399 |
void CWapSapMessageSender::MessageDeleteCompleted(TInt /*aStatus*/)
|
|
400 |
{
|
|
401 |
// Ignore in code coverage - implementation required by base class
|
|
402 |
// but not relavent for WAP PROT.
|
|
403 |
BULLSEYE_OFF
|
|
404 |
LOGWAPPROT1("CWapSapMessageSender::MessageDeleteCompleted()");
|
|
405 |
BULLSEYE_RESTORE
|
|
406 |
}
|
|
407 |
|
|
408 |
/**
|
|
409 |
* Notification that a read SMS parameters has completed
|
|
410 |
* (Has no relevance for the wap stack)
|
|
411 |
*/
|
|
412 |
void CWapSapMessageSender::ReadSmsParamsCompleted(TInt /*aStatus*/,CMobilePhoneSmspList* /*aSmspList*/)
|
|
413 |
{
|
|
414 |
// Ignore in code coverage - implementation required by base class
|
|
415 |
// but not relavent for WAP PROT.
|
|
416 |
BULLSEYE_OFF
|
|
417 |
LOGWAPPROT1("CWapSapMessageSender::ReadSmsParamsCompleted()");
|
|
418 |
BULLSEYE_RESTORE
|
|
419 |
}
|
|
420 |
|
|
421 |
/**
|
|
422 |
* Notification that a write SMS parameters has completed
|
|
423 |
* (Has no relevance for the wap stack)
|
|
424 |
*/
|
|
425 |
void CWapSapMessageSender::WriteSmsParamsCompleted(TInt /*aStatus*/)
|
|
426 |
{
|
|
427 |
// Ignore in code coverage - implementation required by base class
|
|
428 |
// but not relavent for WAP PROT.
|
|
429 |
BULLSEYE_OFF
|
|
430 |
LOGWAPPROT1("CWapSapMessageSender::WriteSmsParamsCompleted()");
|
|
431 |
BULLSEYE_RESTORE
|
|
432 |
}
|
|
433 |
|
|
434 |
//
|
|
435 |
// CWapProtocolObserver
|
|
436 |
//
|
|
437 |
// This class implements the MSmsMessageObserver interface defined by Sms.Prt
|
|
438 |
// Receives Sms messages from sms.prt.
|
|
439 |
//
|
|
440 |
|
|
441 |
|
|
442 |
/**
|
|
443 |
* Factory
|
|
444 |
*/
|
|
445 |
CWapProtocolObserver* CWapProtocolObserver::NewL(CWapSmsProtocol* aProtocol)
|
|
446 |
{
|
|
447 |
LOGWAPPROT1("CWapProtocolObserver::NewL()");
|
|
448 |
|
|
449 |
CWapProtocolObserver* prot = new(ELeave) CWapProtocolObserver;
|
|
450 |
prot->iWapSmsProtocol=aProtocol;
|
|
451 |
return prot;
|
|
452 |
} // CWapProtocolObserver::NewL
|
|
453 |
|
|
454 |
|
|
455 |
/**
|
|
456 |
* Return the address
|
|
457 |
*/
|
|
458 |
const TSmsAddr& CWapProtocolObserver::GetLocalAddress() const
|
|
459 |
{
|
|
460 |
LOGWAPPROT1("CWapProtocolObserver::GetLocalAddress()");
|
|
461 |
|
|
462 |
return iSmsAddr;
|
|
463 |
} // CWapProtocolObserver::GetLocalAddress
|
|
464 |
|
|
465 |
|
|
466 |
/**
|
|
467 |
* Set the address
|
|
468 |
*/
|
|
469 |
void CWapProtocolObserver::SetLocalAddress(const TSmsAddr& aSmsAddr)
|
|
470 |
{
|
|
471 |
LOGWAPPROT1("CWapProtocolObserver::SetLocalAddress()");
|
|
472 |
|
|
473 |
iSmsAddr = aSmsAddr;
|
|
474 |
} // CWapProtocolObserver::SetLocalAddress
|
|
475 |
|
|
476 |
|
|
477 |
/**
|
|
478 |
* Notification that the modem has been connected or disconnected
|
|
479 |
* (Has no relevance for the wap stack)
|
|
480 |
*/
|
|
481 |
void CWapProtocolObserver::ModemNotificationCompleted(TInt /*aStatus*/)
|
|
482 |
{
|
|
483 |
LOGWAPPROT1("CWapProtocolObserver::ModemNotificationCompleted()");
|
|
484 |
|
|
485 |
} // CWapProtocolObserver::ModemNotificationCompleted
|
|
486 |
|
|
487 |
|
|
488 |
/*
|
|
489 |
* Notification that a message has been sent
|
|
490 |
* (does nothing)
|
|
491 |
*/
|
|
492 |
void CWapProtocolObserver::MessageSendCompleted(TInt /*aStatus*/)
|
|
493 |
{
|
|
494 |
// Ignore in code coverage - implementation required by base class
|
|
495 |
// but not relavent for WAP PROT.
|
|
496 |
BULLSEYE_OFF
|
|
497 |
LOGWAPPROT1("CWapProtocolObserver::MessageSendCompleted()");
|
|
498 |
BULLSEYE_RESTORE
|
|
499 |
}
|
|
500 |
|
|
501 |
/**
|
|
502 |
* Informs protocol whether client confirms received message
|
|
503 |
*/
|
|
504 |
TBool CWapProtocolObserver::ClientConfirmsMessage()const
|
|
505 |
{
|
|
506 |
LOGWAPPROT1("CWapProtocolObserver::ClientConfirmsMessage()");
|
|
507 |
|
|
508 |
return EFalse;
|
|
509 |
} // CWapProtocolObserver::ClientConfirmsMessage
|
|
510 |
|
|
511 |
|
|
512 |
/**
|
|
513 |
* Informs protocol whether client confirms received message
|
|
514 |
*/
|
|
515 |
TInt CWapProtocolObserver::SmsAddrIsDuplicate(const MSmsMessageObserver* aObserver,const TSmsAddr& aAddr)const
|
|
516 |
{
|
|
517 |
LOGWAPPROT1("CWapProtocolObserver::SmsAddrIsDuplicate()");
|
|
518 |
|
|
519 |
if(this == aObserver)return EFalse;
|
|
520 |
if(aAddr.SmsAddrFamily() == ESmsAddrApplication8BitPort || ( aAddr.SmsAddrFamily() == ESmsAddrApplication16BitPort && aAddr.Port() > 255))
|
|
521 |
{
|
|
522 |
TWapAddr wapAddr;
|
|
523 |
wapAddr.SetPort(aAddr.Port());
|
|
524 |
if(iWapSmsProtocol->AddrAlreadyUsedByWAP(wapAddr,NULL) != KErrNone) return ETrue;
|
|
525 |
else return EFalse;
|
|
526 |
}
|
|
527 |
return iSmsAddr==aAddr;
|
|
528 |
} // CWapProtocolObserver::SmsAddrIsDuplicate
|
|
529 |
|
|
530 |
|
|
531 |
/**
|
|
532 |
* Notification that a message has been received
|
|
533 |
*/
|
|
534 |
TInt CWapProtocolObserver::MessageReceived(const CSmsMessage& aSmsMessage,TDes& /*aDes*/)
|
|
535 |
{
|
|
536 |
LOGWAPPROT1("CWapProtocolObserver::MessageReceived");
|
|
537 |
|
|
538 |
TRAPD(ret, iWapSmsProtocol->ProcessSmsL(aSmsMessage) );
|
|
539 |
return ret;
|
|
540 |
} // CWapProtocolObserver::MessageReceived
|
|
541 |
|
|
542 |
|
|
543 |
/**
|
|
544 |
* Notification that the enumeration has completed
|
|
545 |
* (Has no relevance for the wap stack)
|
|
546 |
*/
|
|
547 |
void CWapProtocolObserver::EnumeratePhoneCompleted(TInt /*aStatus*/)
|
|
548 |
{
|
|
549 |
// Ignore in code coverage - implementation required by base class
|
|
550 |
// but not relavent for WAP PROT.
|
|
551 |
BULLSEYE_OFF
|
|
552 |
LOGWAPPROT1("CWapProtocolObserver::EnumeratePhoneCompleted()");
|
|
553 |
BULLSEYE_RESTORE
|
|
554 |
}
|
|
555 |
|
|
556 |
/**
|
|
557 |
* Notification that a message has been written to the phone or SIM
|
|
558 |
* (Has no relevance for the wap stack)
|
|
559 |
*/
|
|
560 |
void CWapProtocolObserver::MessageWriteCompleted(TInt /*aStatus*/, const CSmsMessage* /*aSmsMessage*/)
|
|
561 |
{
|
|
562 |
// Ignore in code coverage - implementation required by base class
|
|
563 |
// but not relavent for WAP PROT.
|
|
564 |
BULLSEYE_OFF
|
|
565 |
LOGWAPPROT1("CWapProtocolObserver::MessageWriteCompleted()");
|
|
566 |
BULLSEYE_RESTORE
|
|
567 |
}
|
|
568 |
|
|
569 |
/**
|
|
570 |
* Notification that a PDU delete has completed
|
|
571 |
* (Has no relevance for the wap stack)
|
|
572 |
*/
|
|
573 |
void CWapProtocolObserver::MessageDeleteCompleted(TInt /*aStatus*/)
|
|
574 |
{
|
|
575 |
// Ignore in code coverage - implementation required by base class
|
|
576 |
// but not relavent for WAP PROT.
|
|
577 |
BULLSEYE_OFF
|
|
578 |
LOGWAPPROT1("CWapProtocolObserver::MessageDeleteCompleted()");
|
|
579 |
BULLSEYE_RESTORE
|
|
580 |
}
|
|
581 |
|
|
582 |
/**
|
|
583 |
* Notification that a read SMS parameters has completed
|
|
584 |
* (Has no relevance for the wap stack)
|
|
585 |
*/
|
|
586 |
void CWapProtocolObserver::ReadSmsParamsCompleted(TInt /*aStatus*/,CMobilePhoneSmspList* /*aSmspList*/)
|
|
587 |
{
|
|
588 |
// Ignore in code coverage - implementation required by base class
|
|
589 |
// but not relavent for WAP PROT.
|
|
590 |
BULLSEYE_OFF
|
|
591 |
LOGWAPPROT1("CWapProtocolObserver::ReadSmsParamsCompleted()");
|
|
592 |
BULLSEYE_RESTORE
|
|
593 |
}
|
|
594 |
|
|
595 |
void CWapProtocolObserver::WriteSmsParamsCompleted(TInt /*aStatus*/)
|
|
596 |
/**
|
|
597 |
* Notification that a write SMS parameters has completed
|
|
598 |
* (Has no relevance for the wap stack)
|
|
599 |
*/
|
|
600 |
{
|
|
601 |
// Ignore in code coverage - implementation required by base class
|
|
602 |
// but not relavent for WAP PROT.
|
|
603 |
BULLSEYE_OFF
|
|
604 |
LOGWAPPROT1("CWapProtocolObserver::WriteSmsParamsCompleted()");
|
|
605 |
BULLSEYE_RESTORE
|
|
606 |
}
|