|
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 #ifndef SMS_BASE_WATCHER_H |
|
17 #define SMS_BASE_WATCHER_H |
|
18 |
|
19 #include "SmsSocketWatcher.h" |
|
20 #include <watcher.h> |
|
21 #include <bifchangeobserver.h> |
|
22 |
|
23 class CActive; |
|
24 |
|
25 // Data types |
|
26 class CSmsBaseWatcher : public CActive, public MBioWatcherObserver, public MBifChangeObserver, public MMsvSessionObserver |
|
27 { |
|
28 public: |
|
29 //-------------------------------------- |
|
30 // Construction & Destruction |
|
31 //-------------------------------------- |
|
32 IMPORT_C ~CSmsBaseWatcher(); |
|
33 |
|
34 protected: |
|
35 IMPORT_C CSmsBaseWatcher(RFs& aFs, CWatcherLog& aLog, TInt aPriority = EPriorityStandard); |
|
36 IMPORT_C void ConstructL(); |
|
37 IMPORT_C virtual void StartL(); |
|
38 IMPORT_C virtual void Reset(); |
|
39 |
|
40 IMPORT_C void RunL(); |
|
41 IMPORT_C TInt RunError(TInt aError); |
|
42 IMPORT_C void DoCancel(); |
|
43 IMPORT_C void CompleteMyself(TInt aError); |
|
44 |
|
45 //MBioWatcherObserver |
|
46 IMPORT_C void HandleWatcherComplete(CBaseSmsActiveSocketWatcher& aWatcher, TInt aError); |
|
47 |
|
48 IMPORT_C void CreateSocketWatchersFromBioDbL(TBioMsgIdType aType); |
|
49 IMPORT_C void CreateSocketWatchersFromBioDbL(TBioMsgIdType aType, TUid aBioID); |
|
50 |
|
51 IMPORT_C void DeleteSocketWatchersWithUidL(TUid aUid); |
|
52 |
|
53 IMPORT_C void StartSocketWatchersL(); |
|
54 |
|
55 virtual CBaseSmsActiveSocketWatcher* CreateSocketWatcherLC(const TUid aBioUid, const TBioMsgId& aBioMsg) = 0; |
|
56 virtual TBool SupportBioMsgId(const TBioMsgId& aBioMsg) const = 0; |
|
57 |
|
58 //MBifChangeObserver |
|
59 IMPORT_C void HandleBifChangeL(TBifChangeEvent aEvent, TUid aBioID); |
|
60 |
|
61 virtual void AddBifL(TUid aBioID) = 0; |
|
62 IMPORT_C void AddBifWithTypeL(TBioMsgIdType aType, TUid aBioID); |
|
63 |
|
64 IMPORT_C virtual void DeleteBifL(TUid aBioID); |
|
65 IMPORT_C virtual void ReloadBifL(TUid aBioID); |
|
66 |
|
67 //Returns the error returned by SetupL() |
|
68 //Leaves if: |
|
69 // Setup() returns other than KErrNone, KErrNotFound, KErrAlreadyExists; or |
|
70 // AppendL() leaves |
|
71 IMPORT_C TInt SetupAndAppendL(CBaseSmsActiveSocketWatcher& aSocketWatcher, CArrayPtrFlat<CBaseSmsActiveSocketWatcher>& rSocketWatchers); |
|
72 IMPORT_C void ResetDb(); |
|
73 |
|
74 IMPORT_C void GetBioServiceId(CMsvSession& aSession, TMsvId& aBioServiceId, TMsvId& aSmsServiceId); |
|
75 private: |
|
76 void CreateSocketWatchersFromBioDbL(TBioMsgIdType aType, CArrayPtrFlat<CBaseSmsActiveSocketWatcher>& rSocketWatchers); |
|
77 void CreateSocketWatchersFromBioDbL(TBioMsgIdType aType, TUid aBioID, CArrayPtrFlat<CBaseSmsActiveSocketWatcher>& rSocketWatchers); |
|
78 void StartSocketWatchersL(const CArrayPtrFlat<CBaseSmsActiveSocketWatcher>& aSocketWatchers); |
|
79 void ConstructDbL(); |
|
80 |
|
81 //MMsvSessionObserver |
|
82 void HandleSessionEventL(TMsvSessionEvent, TAny*, TAny*, TAny*) {}; |
|
83 protected: |
|
84 CArrayPtrFlat<CBaseSmsActiveSocketWatcher>* iSocketWatchers; |
|
85 |
|
86 RFs& iFs; |
|
87 CWatcherLog& iWatcherLog; |
|
88 |
|
89 CBifChangeObserver* iBifObserver; |
|
90 |
|
91 CBIODatabase* iBioDb; //used during construction only |
|
92 RTimer iTimer; |
|
93 |
|
94 CMsvSession* iSession; |
|
95 |
|
96 // member variables used to pass settings |
|
97 TMsvId iBioServiceId; |
|
98 TMsvId iSmsServiceId; |
|
99 }; |
|
100 |
|
101 #endif |