|
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 // BioSMSWatcher.CPP |
|
15 // |
|
16 // |
|
17 |
|
18 #include "WapWatcher.h" |
|
19 #include <c32comm.h> |
|
20 |
|
21 #include <biodb.h> |
|
22 #include "WapSocketWatcher.h" |
|
23 |
|
24 #include <e32test.h> |
|
25 |
|
26 |
|
27 |
|
28 #include <ecom/implementationproxy.h> |
|
29 |
|
30 const TImplementationProxy ImplementationTable[] = |
|
31 { |
|
32 IMPLEMENTATION_PROXY_ENTRY(0x10008C67, CWapWatcher::NewL) |
|
33 }; |
|
34 |
|
35 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) |
|
36 { |
|
37 aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); |
|
38 |
|
39 return ImplementationTable; |
|
40 } |
|
41 |
|
42 // |
|
43 // CWapWatcher |
|
44 // |
|
45 |
|
46 |
|
47 // |
|
48 // Construction |
|
49 // protected |
|
50 // |
|
51 CWapWatcher::CWapWatcher(RFs& aFs, CWatcherLog& aWatcherLog) |
|
52 : CSmsBaseWatcher(aFs, aWatcherLog, EPriorityStandard + 2) |
|
53 { |
|
54 } |
|
55 |
|
56 CWapWatcher::~CWapWatcher() |
|
57 { |
|
58 } |
|
59 |
|
60 // |
|
61 CWapWatcher* CWapWatcher::NewL(TAny* aWatcherParams) |
|
62 { |
|
63 TWatcherParams* params = reinterpret_cast<TWatcherParams*>(aWatcherParams); |
|
64 CWapWatcher* self= new (ELeave) CWapWatcher(params->iFs, params->iLog); |
|
65 CleanupStack::PushL(self); |
|
66 self->ConstructL(); |
|
67 CleanupStack::Pop(); // self |
|
68 return self; |
|
69 } |
|
70 |
|
71 // |
|
72 // Construction/destruction |
|
73 |
|
74 void CWapWatcher::StartL() |
|
75 { |
|
76 CSmsBaseWatcher::StartL(); |
|
77 |
|
78 GetBioServiceId(*iSession, iBioServiceId, iSmsServiceId); |
|
79 |
|
80 CreateSocketWatchersFromBioDbL(EBioMsgIdNbs); |
|
81 CreateSocketWatchersFromBioDbL(EBioMsgIdWap); |
|
82 CreateSocketWatchersFromBioDbL(EBioMsgIdWapSecure); |
|
83 CreateSocketWatchersFromBioDbL(EBioMsgIdWsp); |
|
84 CreateSocketWatchersFromBioDbL(EBioMsgIdWspSecure); |
|
85 StartSocketWatchersL(); |
|
86 ResetDb(); //these members are only required during construction |
|
87 |
|
88 delete iSession; |
|
89 iSession = NULL; |
|
90 } |
|
91 |
|
92 CBaseSmsActiveSocketWatcher* CWapWatcher::CreateSocketWatcherLC(const TUid aBioUid, const TBioMsgId& aBioMsg) |
|
93 { |
|
94 if (!SupportBioMsgId(aBioMsg)) |
|
95 User::Leave(KErrNotSupported); |
|
96 |
|
97 CBaseSmsActiveSocketWatcher* portWatcher = CWapPortWatcher::NewL(iBioServiceId, iSmsServiceId, *iBioDb, iWatcherLog, Priority(), aBioUid, iFs, aBioMsg); |
|
98 CleanupStack::PushL(portWatcher); |
|
99 return portWatcher; |
|
100 } |
|
101 |
|
102 TBool CWapWatcher::SupportBioMsgId(const TBioMsgId& aBioMsg) const |
|
103 { |
|
104 TBool retVal = aBioMsg.iType == EBioMsgIdWap || aBioMsg.iType == EBioMsgIdWapSecure || aBioMsg.iType == EBioMsgIdWsp || aBioMsg.iType == EBioMsgIdWspSecure; |
|
105 |
|
106 if (!retVal) |
|
107 { |
|
108 retVal = (aBioMsg.iType == EBioMsgIdNbs && !aBioMsg.iText.Length()); |
|
109 } |
|
110 |
|
111 retVal = retVal && (aBioMsg.iPort > 0); |
|
112 |
|
113 return retVal; |
|
114 } |
|
115 |
|
116 void CWapWatcher::AddBifL(TUid aBioID) |
|
117 { |
|
118 BIOWATCHERLOG(iWatcherLog.Printf(_L("BioWap: AddBifL(BioUid: %d)"), aBioID.iUid)); |
|
119 |
|
120 AddBifWithTypeL(EBioMsgIdWap, aBioID); |
|
121 AddBifWithTypeL(EBioMsgIdWapSecure, aBioID); |
|
122 AddBifWithTypeL(EBioMsgIdWsp, aBioID); |
|
123 AddBifWithTypeL(EBioMsgIdWspSecure, aBioID); |
|
124 AddBifWithTypeL(EBioMsgIdNbs, aBioID); |
|
125 |
|
126 ResetDb(); |
|
127 } |