|
1 /* |
|
2 * Copyright (c) 2007 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 the License "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 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef __MESSAGENOTIFY_H |
|
20 #define __MESSAGENOTIFY_H |
|
21 |
|
22 class CMsgCallbackBase; |
|
23 class CMessageHeader; |
|
24 |
|
25 #include <msvapi.h> |
|
26 |
|
27 /** |
|
28 *This class implements MessageNotify SAPI core logic.It includes |
|
29 * methods for notification of new messages. |
|
30 * |
|
31 */ |
|
32 class CMessageObserver : public CBase, public MMsvSessionObserver |
|
33 { |
|
34 public: |
|
35 |
|
36 /** |
|
37 * Two-phased constructor. |
|
38 * @param CMsvSession* a message server session. |
|
39 * @param CMsgCallbackBase* |
|
40 */ |
|
41 static CMessageObserver* NewL( CMsvSession* aSession = NULL, |
|
42 CMsgCallbackBase* aNotifyCallback = NULL ); |
|
43 |
|
44 /** |
|
45 * Destructor. |
|
46 */ |
|
47 virtual ~CMessageObserver(); |
|
48 |
|
49 /** |
|
50 * Inherited from MMsvSessionObserver class |
|
51 */ |
|
52 virtual void HandleSessionEventL( TMsvSessionEvent aEvent, |
|
53 TAny* aArg1, |
|
54 TAny* aArg2, |
|
55 TAny* aArg3 ); |
|
56 |
|
57 /** |
|
58 * Sets the message server session |
|
59 * @param aSession It is a message server session. |
|
60 */ |
|
61 void SetSession( CMsvSession* aSession ); |
|
62 |
|
63 /** |
|
64 * Sets the callback object |
|
65 * @param aCallback It is callback object to be registered |
|
66 * @return Old callback object |
|
67 */ |
|
68 CMsgCallbackBase* SetCallback( CMsgCallbackBase* aCallback ); |
|
69 |
|
70 /** |
|
71 * Checks if Notification is activated |
|
72 * |
|
73 * @return True if notification request is active. |
|
74 */ |
|
75 TBool IsActive(); |
|
76 |
|
77 private: |
|
78 |
|
79 /** |
|
80 * Default constructor. |
|
81 * @param aSession It is an object of CMsvSession Class which |
|
82 * represents a channel of communication between a client thread |
|
83 * and the Message Server thread . |
|
84 * @param aNotifyCallback It is a callback notification |
|
85 */ |
|
86 CMessageObserver( CMsvSession* aSession, CMsgCallbackBase* aNotifyCallback ); |
|
87 |
|
88 /** |
|
89 * Sets the message header fields |
|
90 * @param aMessageId It is the ID of message whose header fields are to be set |
|
91 */ |
|
92 CMessageHeader* MessageHeaderL( TMsvId aMessageId ); |
|
93 |
|
94 private: |
|
95 |
|
96 /** |
|
97 * Message server session |
|
98 * Not own. |
|
99 */ |
|
100 CMsvSession* iServerSession; |
|
101 |
|
102 /** |
|
103 * Callback Object |
|
104 * Not own. |
|
105 */ |
|
106 CMsgCallbackBase* iNotifyCallback; |
|
107 |
|
108 /** |
|
109 * Message ID |
|
110 */ |
|
111 TMsvId iNewMessageId; |
|
112 }; |
|
113 |
|
114 |
|
115 |
|
116 #endif __MESSAGENOTIFY_H |