|
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 * |
|
16 */ |
|
17 #ifndef STFASYNCEVENTACTIVE_H_ |
|
18 #define STFASYNCEVENTACTIVE_H_ |
|
19 |
|
20 #include <e32base.h> |
|
21 |
|
22 #include <stfeventsystemdefs.h> |
|
23 #include "stfasynceventlist.h" |
|
24 #include <stfeventsystem.h> |
|
25 |
|
26 // This class defines active object which represents asynchronous request |
|
27 // to Event Server. |
|
28 // On RunL each objects deletes itself. |
|
29 class CAsyncEventActive: public CActive |
|
30 { |
|
31 public: |
|
32 /** |
|
33 * NewL is first phase of two-phased constructor. |
|
34 */ |
|
35 IMPORT_C static CAsyncEventActive* NewL(const TInt aOwnerId); |
|
36 |
|
37 /** |
|
38 * Destructor. |
|
39 */ |
|
40 ~CAsyncEventActive(); |
|
41 |
|
42 /** |
|
43 * Starts active object |
|
44 */ |
|
45 IMPORT_C void StartL(TRequestStatus* aStatus, TThreadId aStatusThreadId, const TDesC& aEventName, CAsyncEventList* aAsyncEventList); |
|
46 |
|
47 /** |
|
48 * Checks if request to event server is in pending state |
|
49 */ |
|
50 IMPORT_C TBool IsPending(); |
|
51 |
|
52 private: |
|
53 /** |
|
54 * C++ default constructor. |
|
55 */ |
|
56 CAsyncEventActive(const TInt aOwnerId); |
|
57 |
|
58 /** |
|
59 * By default Symbian OS constructor is private. |
|
60 */ |
|
61 void ConstructL(); |
|
62 |
|
63 /** |
|
64 * Handles active object and deletes the object! |
|
65 */ |
|
66 void RunL(); |
|
67 |
|
68 /** |
|
69 * DoCancel |
|
70 */ |
|
71 void DoCancel(); |
|
72 |
|
73 /** |
|
74 * RunError |
|
75 */ |
|
76 TInt RunError(TInt aError); |
|
77 |
|
78 /** |
|
79 * Complete caller status with specified code |
|
80 */ |
|
81 TInt CompleteCallerStatus(TInt aCode); |
|
82 |
|
83 |
|
84 private: |
|
85 // List of active objects |
|
86 CAsyncEventList* iAsyncEventList; |
|
87 |
|
88 // Event name |
|
89 HBufC* iEventName; |
|
90 |
|
91 // Event system client |
|
92 REventSystem iEventSystem; |
|
93 |
|
94 // Status of caller |
|
95 TRequestStatus *iCallerStatus; |
|
96 |
|
97 // If of thread which owns caller status |
|
98 TThreadId iStatusThreadId; |
|
99 |
|
100 // Identifier of the owner of waiting event |
|
101 const TInt iOwnerId; |
|
102 |
|
103 }; /* class CAsyncEventActive */ |
|
104 |
|
105 |
|
106 #endif /* STFASYNCEVENTACTIVE_H_ */ |
|
107 // EOF |