|
1 /* |
|
2 * Copyright (c) 2007-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: |
|
15 * Name : sipalrmonitor.h |
|
16 * Part of : SIP / SIP ALR Monitor |
|
17 * Version : SIP/6.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef CSIPALRMONITOR_H |
|
29 #define CSIPALRMONITOR_H |
|
30 |
|
31 // INCLUDES |
|
32 #include "sipalrsnapmonitor.h" |
|
33 #include <in_sock.h> |
|
34 #include <e32base.h> |
|
35 |
|
36 // FORWARD DECLARATIONS |
|
37 class MSipAlrObserver; |
|
38 class CSipSystemStateMonitor; |
|
39 |
|
40 // CLASS DECLARATION |
|
41 /** |
|
42 * The implementation for SIP ALR monitor. |
|
43 */ |
|
44 class CSipAlrMonitor : public CBase |
|
45 { |
|
46 public: // Constructors and destructor |
|
47 |
|
48 /** |
|
49 * Two-phased constructor. |
|
50 * @param aSystemStateMonitor used for monitoring SNAP availability |
|
51 * @return a new instance, the ownership is transferred. |
|
52 */ |
|
53 static CSipAlrMonitor* NewL( |
|
54 CSipSystemStateMonitor& aSystemStateMonitor); |
|
55 |
|
56 /** |
|
57 * Destructor. |
|
58 */ |
|
59 ~CSipAlrMonitor(); |
|
60 |
|
61 public: // New functions |
|
62 |
|
63 /** |
|
64 * Starts to monitor IAP availability for the SNAP. |
|
65 * The observer will be informed asynchronouysly |
|
66 * when any IAP is available for the monitored SNAP. |
|
67 * @param aSnapId SNAP id |
|
68 * @param aObserver observer to be informed when an IAP becomes available |
|
69 */ |
|
70 void MonitorSnapL( TUint32 aSnapId, |
|
71 MSipAlrObserver& aObserver ); |
|
72 |
|
73 |
|
74 /** |
|
75 * Refreshes the IAP availability for the SNAP. |
|
76 * Scans the available IAPs for the SNAP and informs all the observers |
|
77 * if a better IAP than the current one is available. |
|
78 * @param aSnapId SNAP id |
|
79 */ |
|
80 void RefreshIapAvailabilityL( TUint32 aSnapId ); |
|
81 |
|
82 /** |
|
83 * Allows migration to a new IAP for the SNAP. |
|
84 * @param aSnapId SNAP id |
|
85 * @return KErrNone on success, otherwise a system wide error code. |
|
86 */ |
|
87 TInt AllowMigration( TUint32 aSnapId ); |
|
88 |
|
89 /** |
|
90 * Disallows migration to a new IAP for the SNAP. |
|
91 * @param aSnapId SNAP id |
|
92 * @return KErrNone on success, otherwise a system wide error code. |
|
93 */ |
|
94 TInt DisallowMigration( TUint32 aSnapId ); |
|
95 |
|
96 /** |
|
97 * The migration has succeeded and the new IAP has been taken into use. |
|
98 * @param aSnapId SNAP id |
|
99 * @return KErrNone on success, otherwise a system wide error code. |
|
100 */ |
|
101 TInt NewIapAccepted( TUint32 aSnapId ); |
|
102 |
|
103 /** |
|
104 * The migration has failed and the new IAP was not taken into use. |
|
105 * @param aSnapId SNAP id |
|
106 * @return KErrNone on success, otherwise a system wide error code. |
|
107 */ |
|
108 TInt NewIapRejected( TUint32 aSnapId ); |
|
109 |
|
110 /** |
|
111 * Frees all the resources reserved for the observer. |
|
112 * @param aObserver a observer |
|
113 */ |
|
114 void FreeResources( MSipAlrObserver& aObserver ); |
|
115 |
|
116 |
|
117 private: // Constructors |
|
118 |
|
119 void ConstructL(); |
|
120 |
|
121 CSipAlrMonitor(CSipSystemStateMonitor& aSystemStateMonitor); |
|
122 |
|
123 private: // New functions |
|
124 |
|
125 CSipAlrSnapMonitor* FindSnapMonitor( TUint32 aSnapId ); |
|
126 |
|
127 private: // Data |
|
128 |
|
129 // Used for monitoring SNAP availability |
|
130 CSipSystemStateMonitor& iSystemStateMonitor; |
|
131 |
|
132 // SNAP monitors, owned |
|
133 RPointerArray<CSipAlrSnapMonitor> iSnapMonitors; |
|
134 |
|
135 // Socket server session |
|
136 RSocketServ iSocketServer; |
|
137 |
|
138 private: // For testing purposes |
|
139 |
|
140 #ifdef CPPUNIT_TEST |
|
141 friend class CSipAlrMonitorTest; |
|
142 #endif |
|
143 }; |
|
144 |
|
145 #endif // CSIPALRMONITOR_H |