|
1 /* |
|
2 * Copyright (c) 2002 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 * This file defines the class CDosEventSender and RDosEventSnd that are used |
|
16 * to raise events using Dos Server from a different process than the one |
|
17 * running the server. |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 #ifndef __DOSEVENTSENDER_H__ |
|
23 #define __DOSEVENTSENDER_H__ |
|
24 |
|
25 #include "DosSvrServices.h" |
|
26 |
|
27 /** |
|
28 * Raises DosServer events from a different thread/proccess. |
|
29 * This class can't be used directly. Use CDosEventSender class instead |
|
30 * to fire events. |
|
31 */ |
|
32 class RDosEventSnd : public RDosSubSession |
|
33 { |
|
34 public: |
|
35 /** |
|
36 * Registers the Subsession into an already openend session. |
|
37 * @param aServer A connected session. |
|
38 * @return Symbian error code. |
|
39 */ |
|
40 TInt Register(RDosServer& aServer); |
|
41 |
|
42 /** |
|
43 * Sends and event to DosServer. |
|
44 * @param aPar Parameter array. Same as the RMessage class uses. |
|
45 * @return Symbian error code. |
|
46 */ |
|
47 TInt SendEvent(TIpcArgs &aParams); |
|
48 }; |
|
49 |
|
50 |
|
51 /** |
|
52 * Class to fire events in the DosServer. |
|
53 */ |
|
54 class CDosEventSender : public CBase |
|
55 { |
|
56 public: |
|
57 /** |
|
58 * Constructor. |
|
59 */ |
|
60 CDosEventSender(); |
|
61 |
|
62 /** |
|
63 * Destructor. |
|
64 */ |
|
65 IMPORT_C ~CDosEventSender(); |
|
66 |
|
67 /** |
|
68 * NewL function that creates object. |
|
69 * It uses an already opened session. |
|
70 * @param aDosServer An already connected session to the server. |
|
71 * @return A pointer to the newly created object. |
|
72 */ |
|
73 IMPORT_C static CDosEventSender* NewL(RDosServer& aDosServer); |
|
74 |
|
75 /** |
|
76 * NewL function that creates object. |
|
77 * It creates its own Session with the Server. |
|
78 * @param aDosServer An already connected session to the server. |
|
79 * @return A pointer to the newly created object. |
|
80 */ |
|
81 IMPORT_C static CDosEventSender* NewL(); |
|
82 |
|
83 //====================================================== |
|
84 // Events that can be launched. |
|
85 // Look into the definition of CDosEventListenerBase |
|
86 // in DosSvrServices.h for a description of these. |
|
87 //====================================================== |
|
88 |
|
89 IMPORT_C void GeneralEvent(TInt32 aEvent,TAny* aParameter,TInt aParSize); |
|
90 |
|
91 private: |
|
92 /** |
|
93 * Symbian two-phased constructor. |
|
94 * @param aDosServer A pointer to the Session object. |
|
95 */ |
|
96 void ConstructL(RDosServer* aDosServer); |
|
97 |
|
98 private: |
|
99 // A pointer to the session object to be used. |
|
100 RDosServer* iDosServer; |
|
101 |
|
102 // A Event sender subsession object. |
|
103 RDosEventSnd iEventSender; |
|
104 |
|
105 // Indicates if this object is responsible for destroying iDosServer. |
|
106 TBool iDestroyDosServer; |
|
107 }; |
|
108 |
|
109 |
|
110 #endif // __DOSEVENTSENDER_H__ |