|
1 /* |
|
2 * Copyright (c) 2009 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: HTI NCN notification creating handler. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CHTINOTIFICATIONHANDLER_H |
|
20 #define CHTINOTIFICATIONHANDLER_H |
|
21 |
|
22 |
|
23 // INCLUDES |
|
24 #include <HtiServicePluginInterface.h> |
|
25 #include <etelmm.h> |
|
26 |
|
27 // CONSTANTS |
|
28 |
|
29 // MACROS |
|
30 |
|
31 // DATA TYPES |
|
32 |
|
33 // FUNCTION PROTOTYPES |
|
34 |
|
35 // FORWARD DECLARATIONS |
|
36 |
|
37 // CLASS DECLARATION |
|
38 #include <AknNotifyStd.h> //TAknSoftNotificationType |
|
39 #include <AknSoftNotifier.h> //CAknSoftNotifier |
|
40 #include <AknSoftNotificationParameters.h> //CAknSoftNotificationParameters |
|
41 |
|
42 /** |
|
43 * HTI NCN notification creating handler. |
|
44 */ |
|
45 class CHtiNotificationHandler : public CActive |
|
46 { |
|
47 public: |
|
48 |
|
49 /** |
|
50 * Two-phased constructor. |
|
51 */ |
|
52 static CHtiNotificationHandler* NewL(); |
|
53 |
|
54 /** |
|
55 * Called when there is a message to be processed by this service. |
|
56 * @param aMessage message body destinated to the servive |
|
57 * @param aPriority message priority |
|
58 */ |
|
59 void ProcessMessageL( const TDesC8& aMessage, |
|
60 THtiMessagePriority aPriority ); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 virtual ~CHtiNotificationHandler(); |
|
66 |
|
67 /** |
|
68 * Sets the dispatcher to send outgoing messages to. |
|
69 * @param aDispatcher pointer to dispatcher instance |
|
70 */ |
|
71 void SetDispatcher( MHtiDispatcher* aDispatcher ); |
|
72 |
|
73 protected: |
|
74 /*! from CActive */ |
|
75 void RunL(); |
|
76 /* from CActive */ |
|
77 void DoCancel(); |
|
78 /*! from CActive */ |
|
79 TInt RunError(TInt aError); |
|
80 |
|
81 private: |
|
82 |
|
83 /** |
|
84 * C++ default constructor. |
|
85 */ |
|
86 CHtiNotificationHandler(); |
|
87 |
|
88 /** |
|
89 * 2nd phase constructor. |
|
90 */ |
|
91 void ConstructL(); |
|
92 |
|
93 private: |
|
94 /** |
|
95 * Indicator support values. |
|
96 */ |
|
97 enum TNcnIndicator |
|
98 { |
|
99 ENcnIndicatorFax, |
|
100 ENcnIndicatorEmail, |
|
101 ENcnIndicatorOther, |
|
102 ENcnIndicatorVMLine1, |
|
103 ENcnIndicatorVMLine2, |
|
104 |
|
105 ENcnIndicatorLast // This must be last |
|
106 }; // TNcnIndicator |
|
107 |
|
108 enum TNcnCommand |
|
109 { |
|
110 ENcnSetIndicator, |
|
111 ENcnResetIndicator |
|
112 }; //TNcnCommand |
|
113 |
|
114 struct TNcnReqQueueElement |
|
115 { |
|
116 TNcnReqQueueElement(TNcnCommand aCmd, TNcnIndicator aIndicator, TUint aMsgCount, TBool aEnable) |
|
117 { |
|
118 iCmd = aCmd; |
|
119 iIndicator = aIndicator; |
|
120 iMsgCount = aMsgCount; |
|
121 iEnable = aEnable; |
|
122 } |
|
123 TNcnCommand iCmd; |
|
124 TNcnIndicator iIndicator; |
|
125 TUint iMsgCount; |
|
126 TBool iEnable; |
|
127 }; |
|
128 |
|
129 private: // helpers |
|
130 |
|
131 void HandleCreateVoiceMessageNotificationL( const TDesC8& aData ); |
|
132 void HandleClearAllNotificationsL( const TDesC8& aData ); |
|
133 |
|
134 CAknSoftNotificationParameters* CreateNotificationParametersLC( TBool aAmountKnown ); |
|
135 void ShowNewItemsL( CAknSoftNotifier* aNotifier, |
|
136 const TAknSoftNotificationType aNotificationType, const TInt aAmount ); |
|
137 void SetNotificationL(TUint aAmount); |
|
138 void SetIndicator(const TNcnIndicator aIndicator, TUint aMsgCount, TBool aEnable); |
|
139 void ResetIndicator(); |
|
140 |
|
141 void SendOkMsgL( const TDesC8& aData ); |
|
142 void SendErrorMessageL( TInt aError, const TDesC8& aDescription ); |
|
143 |
|
144 private: // Data |
|
145 // Needed to initialize mobilePhone |
|
146 RTelServer iTelServer; |
|
147 |
|
148 // Needed to initialize mobilePhone |
|
149 RTelServer::TPhoneInfo iPhoneInfo; |
|
150 |
|
151 // Used to store indicator flags and message counts. |
|
152 RMobilePhone iMobilePhone; |
|
153 |
|
154 // Struct is a container for indicator flags and message counts |
|
155 RMobilePhone::TMobilePhoneMessageWaitingV1 iMsgWaiting; |
|
156 |
|
157 // Package for iMsgWaitingV1 |
|
158 RMobilePhone::TMobilePhoneMessageWaitingV1Pckg iMsgWaitingPckg; |
|
159 |
|
160 // Pointer to the dispatcher (referenced) |
|
161 MHtiDispatcher* iDispatcher; // referenced |
|
162 |
|
163 TUint iVoiceMailsInLine1; |
|
164 |
|
165 RArray<TNcnReqQueueElement> iReqQueue; |
|
166 }; |
|
167 |
|
168 |
|
169 #endif // CHTINOTIFICATIONHANDLER_H |