|
1 /** |
|
2 * Copyright (c) 2005-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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file mm_nodepeer.h |
|
22 @internalAll |
|
23 */ |
|
24 |
|
25 #ifndef SYMBIAN_MM_NODEPEER_H |
|
26 #define SYMBIAN_MM_NODEPEER_H |
|
27 |
|
28 |
|
29 namespace Messages |
|
30 { |
|
31 class TNodePeerId |
|
32 { |
|
33 friend class TNodeCtxId; |
|
34 |
|
35 public: |
|
36 TNodePeerId(const TRuntimeCtxId& aPeerId, RNodeInterface* aNodePeer) |
|
37 { |
|
38 __ASSERT_DEBUG(aNodePeer == NULL || (*aNodePeer) == aPeerId, User::Panic(KMessagesPanic, EAddressNotValidPanic)); |
|
39 iClientPeer.Open(aPeerId); |
|
40 iNodePeer = aNodePeer; |
|
41 } |
|
42 |
|
43 TBool operator==(const TRuntimeCtxId& aRHS) const |
|
44 { |
|
45 return (iClientPeer == aRHS); |
|
46 } |
|
47 |
|
48 TBool operator==(const TNodePeerId& aRHS) const |
|
49 { |
|
50 return (iClientPeer == aRHS.iClientPeer); |
|
51 } |
|
52 |
|
53 void PostMessage(const TRuntimeCtxId& aPostFrom, const TSignalBase& aMessage) const |
|
54 { |
|
55 iClientPeer.PostMessage(aPostFrom, aMessage); |
|
56 } |
|
57 |
|
58 inline const TRuntimeCtxId& RecipientId() const |
|
59 { |
|
60 return iClientPeer.RecipientId(); |
|
61 } |
|
62 |
|
63 TUint32 Type() const |
|
64 { |
|
65 return Peer().Type(); |
|
66 } |
|
67 |
|
68 TUint32 Flags() const |
|
69 { |
|
70 return Peer().Flags(); |
|
71 } |
|
72 |
|
73 TUint32 SetFlags(TUint32 aFlags) |
|
74 { |
|
75 return Peer().SetFlags(aFlags); |
|
76 } |
|
77 |
|
78 TUint32 ClearFlags(TUint32 aFlags) |
|
79 { |
|
80 return Peer().ClearFlags(aFlags); |
|
81 } |
|
82 |
|
83 const RNodeInterface& Peer() const |
|
84 { |
|
85 __ASSERT_DEBUG(PeerPtr(), User::Panic(KMessagesPanic, EClientNotValidPanic)); |
|
86 return *PeerPtr(); |
|
87 } |
|
88 |
|
89 RNodeInterface& Peer() |
|
90 { |
|
91 __ASSERT_DEBUG(PeerPtr(), User::Panic(KMessagesPanic, EClientNotValidPanic)); |
|
92 return *PeerPtr(); |
|
93 } |
|
94 |
|
95 const RNodeInterface* PeerPtr() const |
|
96 { |
|
97 return iNodePeer; |
|
98 } |
|
99 |
|
100 RNodeInterface* PeerPtr() |
|
101 { |
|
102 return iNodePeer; |
|
103 } |
|
104 |
|
105 private: |
|
106 RClientInterface iClientPeer; |
|
107 RNodeInterface* iNodePeer; |
|
108 }; |
|
109 |
|
110 /////////////////////////////////////////////////////////////////////////////// |
|
111 //XNodePeerId |
|
112 class XNodePeerId : public TNodePeerId |
|
113 { |
|
114 public: |
|
115 //The originator could be just another node (not TNodeCtxId) |
|
116 IMPORT_C explicit XNodePeerId(const TRuntimeCtxId& aPeerId, RNodeInterface* aPeer, CBase* aInfo = NULL); |
|
117 IMPORT_C void Destroy(); |
|
118 |
|
119 CBase* iInfo; //Used to store information related to the originator |
|
120 }; |
|
121 |
|
122 } // namespace Messages |
|
123 |
|
124 #endif // SYMBIAN_MM_NODEPEER_H |
|
125 |
|
126 |