|
85
|
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 |
*
|
|
87
|
14 |
* Description:
|
|
85
|
15 |
*
|
|
|
16 |
*/
|
|
|
17 |
|
|
|
18 |
#ifndef CACLIENTNOTIFIERPROXY_H
|
|
|
19 |
#define CACLIENTNOTIFIERPROXY_H
|
|
|
20 |
|
|
|
21 |
#include <QObject>
|
|
|
22 |
#include <QMutex>
|
|
|
23 |
#include "cadef.h"
|
|
|
24 |
|
|
|
25 |
#include "caclient_global.h"
|
|
|
26 |
#include "cadefs.h"
|
|
|
27 |
#include "canotifier_p.h"
|
|
|
28 |
#include "caclientnotifiersession.h"
|
|
|
29 |
|
|
|
30 |
class CaEntry;
|
|
|
31 |
class CaNotifierFilter;
|
|
|
32 |
|
|
93
|
33 |
class CACLIENT_EXPORT CaClientNotifierProxy: public QObject
|
|
85
|
34 |
{
|
|
87
|
35 |
Q_OBJECT
|
|
85
|
36 |
|
|
|
37 |
public:
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* Constructor.
|
|
|
41 |
* @param parent pointer to parent. Defaults to NULL.
|
|
|
42 |
*/
|
|
|
43 |
explicit CaClientNotifierProxy(QObject *parent = 0);
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* Destructor.
|
|
|
47 |
*/
|
|
|
48 |
~CaClientNotifierProxy();
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
* Method for registering notifier
|
|
|
52 |
*
|
|
|
53 |
* @param notifierFilter notifierFilter used to register notifier.
|
|
|
54 |
* @param notifierType type of notifier
|
|
|
55 |
* @return error code
|
|
|
56 |
*/
|
|
|
57 |
int registerNotifier(
|
|
|
58 |
const CaNotifierFilter *notifierFilter,
|
|
|
59 |
CaNotifierPrivate::NotifierType notifierType,
|
|
93
|
60 |
const IDataObserver *observer);
|
|
85
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
* Method for unregistering notifier.
|
|
|
64 |
*
|
|
|
65 |
* @param notifierFilter notifierFilter used to unregister notifier.
|
|
|
66 |
* @param notifierType type of notifier
|
|
|
67 |
*/
|
|
|
68 |
void unregisterNotifier(
|
|
|
69 |
const CaNotifierFilter ¬ifierFilter,
|
|
|
70 |
CaNotifierPrivate::NotifierType notifierType);
|
|
|
71 |
|
|
93
|
72 |
/**
|
|
|
73 |
* Reconnect all sessions when server was terminated
|
|
|
74 |
*
|
|
|
75 |
*/
|
|
|
76 |
void connectSessions();
|
|
85
|
77 |
|
|
|
78 |
private:
|
|
|
79 |
/**
|
|
|
80 |
* Method for finding a session with free slots.
|
|
|
81 |
*
|
|
|
82 |
* @return a pointer to a session.
|
|
|
83 |
*/
|
|
|
84 |
RCaClientNotifierSession *findSession();
|
|
|
85 |
|
|
|
86 |
/**
|
|
|
87 |
* Method for finding a position of a session with a subsession
|
|
|
88 |
* associated with given parameters.
|
|
|
89 |
*
|
|
|
90 |
* @param notifierFilter notifierFilter used to unregister notifier.
|
|
|
91 |
* @param innerNotifierType inner type of notifier
|
|
|
92 |
* @return a position of a pointer to a session,
|
|
|
93 |
* KErrNotFound when not found.
|
|
|
94 |
*/
|
|
|
95 |
TInt findSession(
|
|
|
96 |
const CaNotifierFilter ¬ifierFilter,
|
|
|
97 |
CCaInnerNotifierFilter::TNotifierType innerNotifierType) const;
|
|
|
98 |
|
|
|
99 |
/**
|
|
|
100 |
* Method for creating a new session.
|
|
|
101 |
*
|
|
|
102 |
* @param[out] error error code.
|
|
|
103 |
* @return a pointer to a newly created session, NULL in case of error.
|
|
|
104 |
*/
|
|
|
105 |
RCaClientNotifierSession *newSession(TInt &error);
|
|
|
106 |
|
|
|
107 |
private:
|
|
|
108 |
|
|
|
109 |
// Sessions to server.
|
|
|
110 |
RArray<RCaClientNotifierSession> mSessions;
|
|
|
111 |
|
|
|
112 |
// Mutex to serialize access to mSessions.
|
|
|
113 |
QMutex mMutex;
|
|
|
114 |
|
|
|
115 |
Q_DISABLE_COPY(CaClientNotifierProxy)
|
|
|
116 |
|
|
|
117 |
friend class CaClientProxy;
|
|
|
118 |
|
|
|
119 |
};
|
|
|
120 |
|
|
|
121 |
#endif //_CACLIENTNOTIFIERPROXY_H
|