|
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 @internalComponent |
|
19 */ |
|
20 |
|
21 #ifndef REMCONMESSAGE_H |
|
22 #define REMCONMESSAGE_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <remconaddress.h> |
|
26 #include <remcon/messagetype.h> |
|
27 #include <remcon/clientid.h> |
|
28 |
|
29 /** |
|
30 Encapsulates a message internal to RemCon server. |
|
31 */ |
|
32 NONSHARABLE_CLASS(CRemConMessage) : public CBase |
|
33 { |
|
34 public: |
|
35 /** |
|
36 Factory function. |
|
37 @param aAddr The remote address associated with the message (source or |
|
38 destination). |
|
39 @param aMsgType The message type. |
|
40 @param aMsgSubType The message subtype. This should be ERemConDefault, |
|
41 except in the case of notify commands or notify responses |
|
42 @param aInterfaceUid The UID of the outer-layer interface to which the |
|
43 message belongs. |
|
44 @param aOperationId The operation ID of the message. |
|
45 @param aData The data associated with the operation ID. On success, |
|
46 ownership of aData is taken. |
|
47 @param aSessionId The unique ID of the CRemConSession associated with the |
|
48 message (source or destination). |
|
49 @param aTransactionId The transaction of which this message is a part. |
|
50 @param aIsReliableSend Stores whether the message was sent using Send or SendUnreliable |
|
51 @return Ownership of a new CRemConMessage. |
|
52 */ |
|
53 static CRemConMessage* NewL( |
|
54 const TRemConAddress& aAddr, |
|
55 TRemConMessageType aMsgType, |
|
56 TRemConMessageSubType aMsgSubType, |
|
57 TUid aInterfaceUid, |
|
58 TUint aOperationId, |
|
59 const RBuf8& aData, |
|
60 TUint aSessionId, |
|
61 TUint aTransactionId, |
|
62 TBool aIsReliableSend); |
|
63 |
|
64 /** |
|
65 Factory function |
|
66 Overload for messages created outside of CRemConSession, where the value of |
|
67 aIsReliableSend is not relevant. |
|
68 */ |
|
69 static CRemConMessage* NewL( |
|
70 const TRemConAddress& aAddr, |
|
71 const TRemConClientId& aClient, |
|
72 TRemConMessageType aMsgType, |
|
73 TRemConMessageSubType aMsgSubType, |
|
74 TUid aInterfaceUid, |
|
75 TUint aOperationId, |
|
76 const RBuf8& aData, |
|
77 TUint aSessionId, |
|
78 TUint aTransactionId); |
|
79 |
|
80 /** |
|
81 Factory function. |
|
82 @param aMsg The data in this message is copied to a new CRemConMessage. |
|
83 The new message does not take ownership of aMsg's OperationData, it makes |
|
84 its own copy. |
|
85 @return Ownership of a new CRemConMessage. |
|
86 */ |
|
87 static CRemConMessage* CopyL(const CRemConMessage& aMsg); |
|
88 |
|
89 ~CRemConMessage(); |
|
90 |
|
91 public: |
|
92 // const accessors |
|
93 inline const TRemConAddress& Addr() const; |
|
94 inline const TRemConClientId& Client() const; |
|
95 inline TRemConMessageType MsgType() const; |
|
96 inline TUid InterfaceUid() const; |
|
97 inline TUint OperationId() const; |
|
98 inline const RBuf8& OperationData() const; |
|
99 inline TUint SessionId() const; |
|
100 inline TUint TransactionId() const; |
|
101 inline TRemConMessageSubType MsgSubType() const; |
|
102 inline TBool IsReliableSend() const; |
|
103 |
|
104 // non-const accessors- the only things which may be changed about a |
|
105 // message after it's been created |
|
106 inline TRemConAddress& Addr(); |
|
107 inline RBuf8& OperationData(); |
|
108 inline TUint& SessionId(); |
|
109 inline TUint& TransactionId(); |
|
110 inline TRemConMessageSubType& MsgSubType(); |
|
111 |
|
112 public: |
|
113 /** Link between elements of this type in a TSglQue. */ |
|
114 TSglQueLink iLink; |
|
115 |
|
116 private: |
|
117 CRemConMessage( |
|
118 const TRemConAddress& aAddr, |
|
119 const TRemConClientId& aClient, |
|
120 TRemConMessageType aMsgType, |
|
121 TRemConMessageSubType aMsgSubType, |
|
122 TUid aInterfaceUid, |
|
123 TUint aOperationId, |
|
124 const RBuf8& aData, |
|
125 TUint aSessionId, |
|
126 TUint aTransactionId, |
|
127 TBool aIsReliableSend); |
|
128 |
|
129 static CRemConMessage* NewL( |
|
130 const TRemConAddress& aAddr, |
|
131 const TRemConClientId& aClient, |
|
132 TRemConMessageType aMsgType, |
|
133 TRemConMessageSubType aMsgSubType, |
|
134 TUid aInterfaceUid, |
|
135 TUint aOperationId, |
|
136 const RBuf8& aData, |
|
137 TUint aSessionId, |
|
138 TUint aTransactionId, |
|
139 TBool aIsReliableSend); |
|
140 |
|
141 private: // owned |
|
142 /** For incoming messages, the address it came from. For outgoing |
|
143 messages, the address it's going to. */ |
|
144 TRemConAddress iAddr; |
|
145 |
|
146 /** For incoming messages this is the client which the bearer requested |
|
147 the message be addressed to. If the bearer did not address the command |
|
148 it is set to KNullClientId. |
|
149 */ |
|
150 TRemConClientId iClient; |
|
151 |
|
152 /** The message type (command or response). */ |
|
153 TRemConMessageType iMsgType; |
|
154 |
|
155 /** The message subtype - could be |
|
156 Default - used for normal commands or responses |
|
157 Notify command awaiting interim/changed |
|
158 Notify interim/changed response |
|
159 */ |
|
160 TRemConMessageSubType iMsgSubType; |
|
161 |
|
162 /** The interface UID. */ |
|
163 TUid iInterfaceUid; |
|
164 |
|
165 /** The operation ID. */ |
|
166 TUint iOperationId; |
|
167 |
|
168 /** Arbitrary data associated with the operation. */ |
|
169 RBuf8 iData; |
|
170 |
|
171 /** For outgoing commands, the ID of the sending session. */ |
|
172 TUint iSessionId; |
|
173 |
|
174 /** The identifier of the transaction this message is part of. */ |
|
175 TUint iTransactionId; |
|
176 |
|
177 /** Whether the message was send using Send() or SendUnreliable(), if applicable */ |
|
178 TBool iIsReliableSend; |
|
179 |
|
180 }; |
|
181 |
|
182 #include "remconmessage.inl" |
|
183 |
|
184 #endif // REMCONMESSAGE_H |