33
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 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 file contains the header file of the CCbsMcnSession class which
|
|
15 |
* responds to client MCN-related requests.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
|
22 |
#ifndef CCBSMCNSESSION_H
|
|
23 |
#define CCBSMCNSESSION_H
|
|
24 |
|
|
25 |
// INCLUDES
|
|
26 |
|
|
27 |
#include <e32base.h>
|
|
28 |
#include "CCbsObject.h"
|
|
29 |
#include "MCbsMcnSubscriptionsProvider.h"
|
|
30 |
#include <cbsmcncommon.h>
|
|
31 |
|
|
32 |
// FORWARD DECLARATIONS
|
|
33 |
|
|
34 |
class CCbsDbImpSettings;
|
|
35 |
class CCbsRecEtel;
|
|
36 |
class CCbsReceiverHelper;
|
|
37 |
class CCbsRecMessage;
|
|
38 |
class CCbsSession;
|
|
39 |
|
|
40 |
// CLASS DECLARATION
|
|
41 |
|
|
42 |
/**
|
|
43 |
* CCbsMcnSession is the server-side subsession object, which takes care
|
|
44 |
* of client-side MCN requests.
|
|
45 |
*/
|
|
46 |
class CCbsMcnSession
|
|
47 |
: public CCbsObject, public MCbsMcnSubscriptionsProvider
|
|
48 |
{
|
|
49 |
public: // New functions
|
|
50 |
/**
|
|
51 |
* Creates a new instance of the class.
|
|
52 |
*
|
|
53 |
* @param aSession Main session instance.
|
|
54 |
* @param aReceiver Receiver instance.
|
|
55 |
* @return New instance of CCbsMcnSession.
|
|
56 |
*/
|
|
57 |
static CCbsMcnSession* NewL( CCbsSession& aSession,
|
|
58 |
CCbsRecEtel& aReceiver );
|
|
59 |
|
|
60 |
/**
|
|
61 |
* Destructor.
|
|
62 |
*/
|
|
63 |
~CCbsMcnSession();
|
|
64 |
|
|
65 |
public: // From CCbsObject
|
|
66 |
/**
|
|
67 |
* Handle the requests for the object.
|
|
68 |
*
|
|
69 |
* @param aMessage Message to be handled.
|
|
70 |
* @return Indicates whether the message was
|
|
71 |
* handled.
|
|
72 |
*/
|
|
73 |
TBool HandleRequestsL( const RMessage2& aMessage );
|
|
74 |
|
|
75 |
public: // From MCbsMcnSubscriptionsProvider
|
|
76 |
/**
|
|
77 |
* Returns the number of topic subscriptions of this MCN client.
|
|
78 |
*
|
|
79 |
* @return Number of subscribed CB topics
|
|
80 |
*/
|
|
81 |
TUint NumberOfSubscriptions() const;
|
|
82 |
|
|
83 |
/**
|
|
84 |
* If aMessage is of topic subscribed by the client,
|
|
85 |
* aMessage is copied to client-side.
|
|
86 |
*
|
|
87 |
* @param aMessage CB message.
|
|
88 |
*/
|
|
89 |
void RouteMessageL( const CCbsMessage& aMessage );
|
|
90 |
|
|
91 |
private:
|
|
92 |
/**
|
|
93 |
* Constructor.
|
|
94 |
*
|
|
95 |
* @param aSession Main session object.
|
|
96 |
* @param aReceiver Receiver instance.
|
|
97 |
*/
|
|
98 |
CCbsMcnSession( CCbsSession& aSession, CCbsRecEtel& aReceiver );
|
|
99 |
|
|
100 |
/**
|
|
101 |
* Finalizes construction.
|
|
102 |
*/
|
|
103 |
void ConstructL();
|
|
104 |
|
|
105 |
/**
|
|
106 |
* Close the subsession.
|
|
107 |
*/
|
|
108 |
void CloseMcnSession();
|
|
109 |
|
|
110 |
/**
|
|
111 |
* Handles client request for message routing.
|
|
112 |
*/
|
|
113 |
void NotifyOnChange();
|
|
114 |
|
|
115 |
/**
|
|
116 |
* Handles client request to cancel an outstanding
|
|
117 |
* routing request.
|
|
118 |
*/
|
|
119 |
void NotifyOnChangeCancel();
|
|
120 |
|
|
121 |
/**
|
|
122 |
* Handles client request to subscribe a topic.
|
|
123 |
*
|
|
124 |
* Note: ApplySubscriptionL has to be called in order to
|
|
125 |
* apply receiver changes.
|
|
126 |
*/
|
|
127 |
void SubscribeTopicL();
|
|
128 |
|
|
129 |
/**
|
|
130 |
* Called by RouteMessageL() to actually copy the message content
|
|
131 |
* to client side.
|
|
132 |
*
|
|
133 |
* @param aMcnPckg Package containing the MCN message
|
|
134 |
* and it's parameters.
|
|
135 |
*/
|
|
136 |
void NotifyClientL( const TPckg<TCbsMcnMessage>& aMcnPckg );
|
|
137 |
|
|
138 |
/**
|
|
139 |
* Clears all topic subscriptions of this MCN session.
|
|
140 |
*
|
|
141 |
* Leaves only if CCbsRecEtel::ApplyStateChangesL() leaves.
|
|
142 |
*/
|
|
143 |
void ClearSubscriptionsL();
|
|
144 |
|
|
145 |
/**
|
|
146 |
* Forces receiver to reload CB topic subscriptions.
|
|
147 |
*
|
|
148 |
* This function has to be called after MCN client has subscribed
|
|
149 |
* topics with SubscribeTopicL().
|
|
150 |
*/
|
|
151 |
void ApplySubscriptionsL();
|
|
152 |
|
|
153 |
private: // Prohibited operators and functions
|
|
154 |
|
|
155 |
// Copy constructor
|
|
156 |
CCbsMcnSession( const CCbsMcnSession& );
|
|
157 |
|
|
158 |
// Assignment operator
|
|
159 |
CCbsMcnSession& operator=( const CCbsMcnSession& );
|
|
160 |
|
|
161 |
|
|
162 |
private: // Data
|
|
163 |
|
|
164 |
/// Receiver object.
|
|
165 |
CCbsRecEtel& iReceiver;
|
|
166 |
|
|
167 |
/**
|
|
168 |
* Indicates whether iMessage is a valid message; that is, there
|
|
169 |
* is a pending notify request.
|
|
170 |
*/
|
|
171 |
TBool iIsMessage;
|
|
172 |
|
|
173 |
/// Message for the pending notify request
|
|
174 |
RMessage2 iMessage;
|
|
175 |
|
|
176 |
/// Array of topic numbers subscribed by the client.
|
|
177 |
CArrayFixFlat< TUint16 >* iSubscribedTopics;
|
|
178 |
|
|
179 |
// MCN message
|
|
180 |
TCbsMcnMessage iMcnMessage;
|
|
181 |
|
|
182 |
// MCN message package for IPC
|
|
183 |
TPckg<TCbsMcnMessage> iMcnPckg;
|
|
184 |
|
|
185 |
};
|
|
186 |
|
|
187 |
#endif // CCBSMCNSESSION_H
|
|
188 |
|
|
189 |
// End of File
|
|
190 |
|
|
191 |
|