|
1 /* |
|
2 * Copyright (c) 2010 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 * Client implementation for FlexTimerServerMonitor |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 1 % |
|
20 */ |
|
21 |
|
22 #ifndef RFLEXTIMERSERVERMONITOR_H |
|
23 #define RFLEXTIMERSERVERMONITOR_H |
|
24 |
|
25 // INCLUDE FILES |
|
26 #include <e32std.h> |
|
27 |
|
28 // CLASS DECLARATION |
|
29 /** |
|
30 * Client implementation for FlexTimerServerMonitor. |
|
31 * Forwards all requests as synchronous messages to the client. |
|
32 * |
|
33 * Creates the server if it is not up'n'running when connecting to the server |
|
34 * at the first time. |
|
35 * |
|
36 * StartMonitoring() has to be called before StopMonitoring() and GetStatus() |
|
37 * works. Note! The starting can be done by different handle. I.e. |
|
38 * |
|
39 * @code |
|
40 * |
|
41 * RFlexTimerServerMonitor mon1; |
|
42 * mon1.Connect(); |
|
43 * mon1.StartMonitoring(); |
|
44 * mon1.Close(); |
|
45 * |
|
46 * . |
|
47 * . |
|
48 * . |
|
49 * |
|
50 * RFlexTimerServerMonitor mon2; |
|
51 * mon2.Connect(); |
|
52 * TBool hasCrashed; |
|
53 * mon2.GetStatus( hasCrashed ); |
|
54 * // Do your stuff |
|
55 * ... |
|
56 * mon2.StopMonitoring(); |
|
57 * mon2.Close(); |
|
58 * |
|
59 * @endcode |
|
60 */ |
|
61 class RFlexTimerServerMonitor : public RSessionBase |
|
62 { |
|
63 public: |
|
64 // Constructors and destructors |
|
65 |
|
66 /** |
|
67 * Constructor |
|
68 */ |
|
69 IMPORT_C RFlexTimerServerMonitor(); |
|
70 |
|
71 /** |
|
72 * Destructor |
|
73 */ |
|
74 IMPORT_C ~RFlexTimerServerMonitor(); |
|
75 |
|
76 /** |
|
77 * Connect to the server. |
|
78 * |
|
79 * @return KErrNone on success. Otherwise returns one of the system-wide |
|
80 * error codes. |
|
81 */ |
|
82 IMPORT_C TInt Connect(); |
|
83 |
|
84 /** |
|
85 * Start detecting the crashes. |
|
86 * |
|
87 * @return KErrNone if succeeded, KErrAlreadyExists if monitoring is |
|
88 * already activated, or any other system-wide error code. |
|
89 */ |
|
90 IMPORT_C TInt StartMonitoring(); |
|
91 |
|
92 /** |
|
93 * Stop detecting the crashes. |
|
94 * |
|
95 * @return KErrNone if succeeded, KErrNotFound if monitoring is not |
|
96 * activated, or any other system-wide error code. |
|
97 */ |
|
98 IMPORT_C TInt StopMonitoring(); |
|
99 |
|
100 /** |
|
101 * Get the current status of monitoring. |
|
102 * |
|
103 * |
|
104 * @param aHasServerCrashed ETrue if server has crashed, EFalse otherwise |
|
105 * @return KErrNone if succeeded, KErrNotFound if monitoring is not |
|
106 * activated, or any other system-wide error code. |
|
107 */ |
|
108 IMPORT_C TInt GetStatus( TBool& aHasServerCrashed ); |
|
109 |
|
110 private: |
|
111 |
|
112 /** |
|
113 * Gets the version number. |
|
114 * @return The version. |
|
115 */ |
|
116 TVersion Version() const; |
|
117 |
|
118 /** |
|
119 * Connects to the server. If server does not exist, it is created. |
|
120 * @return KErrNone on success. Otherwise returns one of the system-wide |
|
121 * error codes. |
|
122 */ |
|
123 TInt StartServer(); |
|
124 }; |
|
125 |
|
126 #endif // RFLEXTIMERSERVERMONITOR_H |
|
127 |
|
128 // End of File |