|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @internalTechnology |
|
19 */ |
|
20 |
|
21 #ifndef __NETSIGNALEVENT_H_ |
|
22 #define __NETSIGNALEVENT_H_ |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <e32std.h> |
|
26 |
|
27 namespace Meta |
|
28 { |
|
29 struct SMetaData; |
|
30 } |
|
31 |
|
32 namespace NetSubscribe |
|
33 { |
|
34 |
|
35 const TInt32 KEventUid = 0x102055A9; |
|
36 |
|
37 /** |
|
38 * Signal Id encapsulation Interface Id, Event Id and the instance handle, The instance |
|
39 * handle represent the context of the signal and should be obtained beforehead |
|
40 * |
|
41 * @see STypeId |
|
42 */ |
|
43 struct SSignalId |
|
44 { |
|
45 SSignalId( const Meta::STypeId& aTypeId, TUint32 aHandle ) : |
|
46 iTypeId(aTypeId), |
|
47 iHandle(aHandle) |
|
48 { |
|
49 } |
|
50 SSignalId( TUint32 aInterfaceId, TUint32 aEventId, TUint32 aHandle ) : |
|
51 iHandle(aHandle) |
|
52 { |
|
53 iTypeId = Meta::STypeId::CreateSTypeId(aInterfaceId, aEventId); |
|
54 } |
|
55 SSignalId( TUint32 aInterfaceId, TUint32 aEventId ) : |
|
56 iHandle(NULL) |
|
57 { |
|
58 iTypeId = Meta::STypeId::CreateSTypeId(aInterfaceId, aEventId); |
|
59 } |
|
60 inline TBool operator==(const SSignalId& obj) const |
|
61 { |
|
62 return iTypeId==obj.iTypeId && iHandle==obj.iHandle; |
|
63 } |
|
64 Meta::STypeId iTypeId; |
|
65 TUint32 iHandle; |
|
66 }; |
|
67 |
|
68 class TEventBase |
|
69 /** |
|
70 A base for all event classes |
|
71 |
|
72 */ |
|
73 { |
|
74 }; |
|
75 |
|
76 class TEvent; |
|
77 typedef void (*TSignalCallback)( TAny* , const Meta::SMetaData* ); |
|
78 typedef void (*TSignalErrorCallback)(TAny* , TInt); |
|
79 |
|
80 class CNetSubscribe; |
|
81 class TEvent : public TEventBase |
|
82 /** |
|
83 An event class to convey callback info and callback data of type SMetaData. |
|
84 |
|
85 */ |
|
86 { |
|
87 friend class TEventClientData; |
|
88 |
|
89 public: |
|
90 TEvent( TAny* aThis, TSignalCallback aSignalCallback, TSignalErrorCallback aSignalErrorCallback ) : |
|
91 iHandler( aSignalCallback ), |
|
92 iErrHandler( aSignalErrorCallback ), |
|
93 iThis( aThis ) |
|
94 { |
|
95 } |
|
96 TEvent( TAny* aThis, TSignalCallback aSignalCallback ) : |
|
97 iHandler( aSignalCallback ), |
|
98 iErrHandler( NULL ), |
|
99 iThis( aThis ) |
|
100 { |
|
101 } |
|
102 |
|
103 IMPORT_C void SubscribeL(CNetSubscribe& aSubscribe, const SSignalId& aSignalId ); |
|
104 IMPORT_C void Cancel(CNetSubscribe& aSubscribe); |
|
105 |
|
106 protected: |
|
107 TSignalCallback iHandler; |
|
108 TSignalErrorCallback iErrHandler; |
|
109 TAny* iThis; |
|
110 }; |
|
111 |
|
112 } // namespace NetSubscribe |
|
113 |
|
114 |
|
115 #endif // __NETSUBSCRIBE_H_ |
|
116 |