|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * This class follows the offline status of the phone. When the mode is |
|
16 * changed from online to offline, the sending operation is started. When |
|
17 * the mode is changed from online to offline, the current sending |
|
18 * operation is cancelled. |
|
19 * |
|
20 */ |
|
21 |
|
22 #ifndef __OUTBOXSENDER_H__ |
|
23 #define __OUTBOXSENDER_H__ |
|
24 |
|
25 // INCLUDES |
|
26 #include <msvapi.h> |
|
27 #include <MuiuMsvSingleOpWatcher.h> |
|
28 #include <cenrepnotifyhandler.h> |
|
29 |
|
30 // FORWARD DECLARATIONS |
|
31 class CRepository; |
|
32 |
|
33 // CLASS DECLARATION |
|
34 /** |
|
35 * COutboxSender |
|
36 * Sends sms messages from the outbox when offline is changed back to online. |
|
37 * It only tries to send message once. If sending fails due to other reasons |
|
38 * than offline mode, then it is up to the user to go to outbox and send it. |
|
39 * Note: At the moment only sms'es are sent. MMS messages are sent by mms mtm |
|
40 * and emails are saved to outbox as 'During next connection' and those must |
|
41 * not be sent. |
|
42 */ |
|
43 class COutboxSender: public CBase, public MMsvSingleOpWatcher, public MCenRepNotifyHandlerCallback |
|
44 { |
|
45 public: |
|
46 // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * A two-phased constructor. |
|
50 */ |
|
51 static COutboxSender* NewL(CMsvSession& aMsvSession); |
|
52 |
|
53 /** |
|
54 * A destructor. |
|
55 */ |
|
56 virtual ~COutboxSender(); |
|
57 |
|
58 public: |
|
59 // New functions |
|
60 |
|
61 /** |
|
62 * Starts the message sending operation for sms-messages. |
|
63 */ |
|
64 void StartSendingL(); |
|
65 |
|
66 /** |
|
67 * Cancels current message sending operation. |
|
68 */ |
|
69 void CancelSending(); |
|
70 |
|
71 /** |
|
72 * Checks if the sending operation is currently active. |
|
73 */ |
|
74 TBool IsSending() const; |
|
75 |
|
76 /** |
|
77 * Confirms the network status and starts sending messages |
|
78 */ |
|
79 void CheckAndStartSendingL(const TInt& aNetworkBars); |
|
80 |
|
81 public: |
|
82 // Functions from base classes |
|
83 |
|
84 /** |
|
85 * From MMsvSingleOpWatcher. Deletes the sending operation. |
|
86 */ |
|
87 virtual void OpCompleted(CMsvSingleOpWatcher& aOpWatcher, TInt aCompletionCode); |
|
88 |
|
89 /** |
|
90 * From MCentRepNotifyHandlerCallback. |
|
91 */ |
|
92 void HandleNotifyInt(TUint32 aId, TInt aNewValue); |
|
93 |
|
94 /** |
|
95 * From MCentRepNotifyHandlerCallback. |
|
96 */ |
|
97 void HandleNotifyError(TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler); |
|
98 |
|
99 /** |
|
100 * From MCentRepNotifyHandlerCallback. |
|
101 */ |
|
102 void HandleNotifyGeneric(TUint32 aId); |
|
103 |
|
104 private: |
|
105 /** |
|
106 * A C++ Constructor |
|
107 */ |
|
108 COutboxSender(CMsvSession& aMsvSession); |
|
109 |
|
110 /** |
|
111 * Creates the connection to shared data and |
|
112 * begins listening the KGSNetworkConnectionAllowed-key. |
|
113 */ |
|
114 void ConstructL(); |
|
115 |
|
116 /** |
|
117 * Checks whether SMS sending is needed in boot-phase and |
|
118 * launches the sending operation |
|
119 */ |
|
120 void CheckBootPhaseL(); |
|
121 |
|
122 private: |
|
123 enum TCleanupFlags |
|
124 { |
|
125 EUserSettingsConnected = 0x01, |
|
126 EUserSettingsNotifierSet = 0x02, |
|
127 EOffllineSendingNeeded = 0x10 |
|
128 }; |
|
129 |
|
130 private: |
|
131 // Reference to Msv Session |
|
132 CMsvSession& iMsvSession; |
|
133 // Pointer to sending operation |
|
134 CMsvSingleOpWatcher* iRunningOperation; |
|
135 CCenRepNotifyHandler* iNotifyHandler; |
|
136 CRepository* iSession; |
|
137 // Flags to indicate status of Outbox Sender |
|
138 TInt8 iFlags; |
|
139 // Last known network coverage |
|
140 TInt iNetworkBars; |
|
141 |
|
142 }; |
|
143 |
|
144 #endif // __OUTBOXSENDER_H__ |
|
145 // End of file |