|
1 /* |
|
2 * Copyright (c) 2004 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 |
|
23 |
|
24 |
|
25 #ifndef __NCNOUTBOXSENDER_H__ |
|
26 #define __NCNOUTBOXSENDER_H__ |
|
27 |
|
28 // INCLUDES |
|
29 #include <msvapi.h> |
|
30 #include <MuiuMsvSingleOpWatcher.h> |
|
31 |
|
32 #include <cenrepnotifyhandler.h> |
|
33 |
|
34 // FORWARD DECLARATIONS |
|
35 class CNcnModelBase; |
|
36 class CRepository; |
|
37 |
|
38 // CLASS DECLARATION |
|
39 /** |
|
40 * CNcnOutboxSender |
|
41 * Sends sms messages from the outbox when offline is changed back to online. |
|
42 * It only tries to send message once. If sending fails due to other reasons |
|
43 * than offline mode, then it is up to the user to go to outbox and send it. |
|
44 * Note: At the moment only sms'es are sent. MMS messages are sent by mms mtm |
|
45 * and emails are saved to outbox as 'During next connection' and those must |
|
46 * not be sent. |
|
47 */ |
|
48 class CNcnOutboxSender : |
|
49 public CBase, |
|
50 public MMsvSingleOpWatcher, |
|
51 public MCenRepNotifyHandlerCallback |
|
52 { |
|
53 public: // Constructors and destructor |
|
54 |
|
55 /** |
|
56 * A two-phased constructor. |
|
57 */ |
|
58 static CNcnOutboxSender* NewL( |
|
59 CNcnModelBase* aModel, CMsvSession& aMsvSession ); |
|
60 |
|
61 /** |
|
62 * A destructor. |
|
63 */ |
|
64 virtual ~CNcnOutboxSender(); |
|
65 |
|
66 public: // New functions |
|
67 |
|
68 /** |
|
69 * Starts the message sending operation for sms-messages. |
|
70 */ |
|
71 void StartSendingL(); |
|
72 |
|
73 /** |
|
74 * Cancels current message sending operation. |
|
75 */ |
|
76 void CancelSending(); |
|
77 |
|
78 /** |
|
79 * Checks if the sending operation is currently active. |
|
80 */ |
|
81 TBool IsSending() const; |
|
82 |
|
83 /** |
|
84 * Confirms the network status and starts sending messages |
|
85 */ |
|
86 void CheckAndStartSendingL( const TInt& aNetworkBars ); |
|
87 |
|
88 public: // Functions from base classes |
|
89 |
|
90 /** |
|
91 * From MMsvSingleOpWatcher. Deletes the sending operation. |
|
92 */ |
|
93 virtual void OpCompleted( |
|
94 CMsvSingleOpWatcher& aOpWatcher, TInt aCompletionCode ); |
|
95 |
|
96 /** |
|
97 * From MCentRepNotifyHandlerCallback. |
|
98 */ |
|
99 void HandleNotifyInt( TUint32 aId, TInt aNewValue ); |
|
100 |
|
101 /** |
|
102 * From MCentRepNotifyHandlerCallback. |
|
103 */ |
|
104 void HandleNotifyError( |
|
105 TUint32 aId, TInt aError, CCenRepNotifyHandler* aHandler ); |
|
106 |
|
107 /** |
|
108 * From MCentRepNotifyHandlerCallback. |
|
109 */ |
|
110 void HandleNotifyGeneric( TUint32 aId ); |
|
111 |
|
112 private: |
|
113 /** |
|
114 * A C++ Constructor |
|
115 */ |
|
116 CNcnOutboxSender( |
|
117 CNcnModelBase* aModel, CMsvSession& aMsvSession ); |
|
118 |
|
119 /** |
|
120 * Creates the connection to shared data and |
|
121 * begins listening the KGSNetworkConnectionAllowed-key. |
|
122 */ |
|
123 void ConstructL(); |
|
124 |
|
125 /** |
|
126 * Checks whether SMS sending is needed in boot-phase and |
|
127 * launches the sending operation |
|
128 */ |
|
129 void CheckBootPhaseL(); |
|
130 |
|
131 private: |
|
132 enum TCleanupFlags |
|
133 { |
|
134 EUserSettingsConnected = 0x01, |
|
135 EUserSettingsNotifierSet = 0x02, |
|
136 EOffllineSendingNeeded = 0x10 |
|
137 }; |
|
138 |
|
139 private: // Data |
|
140 |
|
141 // Pointer to main class |
|
142 CNcnModelBase* iNcnModel; |
|
143 // Reference to Msv Session |
|
144 CMsvSession& iMsvSession; |
|
145 // Pointer to sending operation |
|
146 CMsvSingleOpWatcher* iRunningOperation; |
|
147 CCenRepNotifyHandler* iNotifyHandler; |
|
148 CRepository* iSession; |
|
149 // Flags to indicate status of Outbox Sender |
|
150 TInt8 iFlags; |
|
151 // Last known network coverage |
|
152 TInt iNetworkBars; |
|
153 |
|
154 }; |
|
155 |
|
156 |
|
157 #endif // __NCNOUTBOXSENDER_H__ |
|
158 |
|
159 // End of file |