|
1 /* |
|
2 * Copyright (c) 2002-2006 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: This class handles communications between a notifier client & |
|
15 * DRM server in DRM notifier. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #ifndef RDRMNOTIFIERCLIENT_H |
|
22 #define RDRMNOTIFIERCLIENT_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <E32STD.H> |
|
26 #include <DRMEvent.h> |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KMaxMessageSlots = 2; |
|
30 |
|
31 // MACROS |
|
32 // DATA TYPES |
|
33 // FUNCTION PROTOTYPES |
|
34 // FORWARD DECLARATIONS |
|
35 // CLASS DECLARATION |
|
36 |
|
37 /** |
|
38 * This class handles all client/server communications. |
|
39 * |
|
40 * @lib DRMCommon.dll |
|
41 * @since S60Rel2.6 |
|
42 */ |
|
43 class RDRMNotifierClient : public RSessionBase |
|
44 { |
|
45 public: // Constructors and destructor |
|
46 /** |
|
47 * C++ default constructor. |
|
48 */ |
|
49 RDRMNotifierClient(TDRMEventType* aEventType, TDRMEventType* aEventTypeWait, |
|
50 TPtr8* aPtr, TPtr8* aWaitPtr); |
|
51 |
|
52 /** |
|
53 * Destructor. |
|
54 */ |
|
55 virtual ~RDRMNotifierClient(); |
|
56 |
|
57 public: // New functions |
|
58 |
|
59 /** |
|
60 * This method opens a connection to the server. |
|
61 * @since S60Rel2.6 |
|
62 * Return Symbian OS / DRM Engine specific error code. |
|
63 */ |
|
64 TInt Connect( void ); |
|
65 |
|
66 /** |
|
67 * WaitForCompletion |
|
68 * |
|
69 * Waits for notifications. When the status is completed a notification |
|
70 * has been received. |
|
71 * |
|
72 * @since S60Rel2.6 |
|
73 * @param aStatus the status will be updated when the a notification |
|
74 * has been received |
|
75 * @return none |
|
76 */ |
|
77 void WaitForCompletion( TRequestStatus& aStatus ); |
|
78 |
|
79 |
|
80 /** |
|
81 * SendEvent |
|
82 * |
|
83 * Sends an event to the notifier server, the request status is updated |
|
84 * when all the notifications have been forwarded |
|
85 * |
|
86 * @since S60Rel2.6 |
|
87 * @param aStatus the status will be updated when all notifications have |
|
88 * been forwarded |
|
89 * @return none |
|
90 */ |
|
91 void SendEvent( TRequestStatus& aStatus ); |
|
92 |
|
93 /** |
|
94 * RegisterForType |
|
95 * |
|
96 * Register to the server to listen to specific event types, if a URI |
|
97 * is provided notifications of the type that have that URI as affected |
|
98 * URI will get notified |
|
99 * |
|
100 * @since S60Rel2.6 |
|
101 * @param aEventType the event type to listen to |
|
102 * @param aURI optional URI to limit the C/S communication |
|
103 * @return none |
|
104 */ |
|
105 void RegisterForType( TDRMEventType aEventType, HBufC8* aURI = 0 ); |
|
106 |
|
107 |
|
108 /** |
|
109 * UnRegisterFromType |
|
110 * |
|
111 * Unregister from the server from listening to specific event types, |
|
112 * if a URI is provided notifications of the type that have that URI |
|
113 * as affected URI will get unregistered |
|
114 * |
|
115 * @since S60Rel2.6 |
|
116 * @param aEventType the event type to listen to |
|
117 * @param aURI optional URI to limit the C/S communication |
|
118 * @return none |
|
119 */ |
|
120 void UnRegisterFromType( TDRMEventType aEventType, HBufC8* aURI = 0 ); |
|
121 |
|
122 /** |
|
123 * CancelRequest() |
|
124 * |
|
125 * Used when the object is being destroyed. All calls are cancelled and |
|
126 * the server side will get a notification to remove all notifications |
|
127 * from their lists |
|
128 * |
|
129 * @since S60Rel2.6 |
|
130 * @return none |
|
131 */ |
|
132 void CancelRequest(); |
|
133 |
|
134 |
|
135 public: // Functions from base classes |
|
136 void Close(); |
|
137 protected: // New functions |
|
138 |
|
139 protected: // Functions from base classes |
|
140 |
|
141 private: |
|
142 |
|
143 // Prohibit copy constructor |
|
144 RDRMNotifierClient( const RDRMNotifierClient& ); |
|
145 // Prohibit assigment operator |
|
146 RDRMNotifierClient& operator=( const RDRMNotifierClient& ); |
|
147 |
|
148 public: // Data |
|
149 protected: // Data |
|
150 private: // Data |
|
151 TDRMEventType* iEventType; |
|
152 TDRMEventType* iEventTypeWait; |
|
153 TPtr8* iData; |
|
154 TPtr8* iWaitData; |
|
155 TPckg<TInt> numdata; |
|
156 |
|
157 public: // Friend classes |
|
158 protected: // Friend classes |
|
159 private: // Friend classes |
|
160 }; |
|
161 |
|
162 #endif // RDRMNOTIFIERCLIENT_H |
|
163 |
|
164 // End of File |