2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
14 * Description: This is the superclass interface for wider set of
15 * concrete WSF message classes.
27 #ifndef M_SEN_MESSAGE_H
28 #define M_SEN_MESSAGE_H
32 // FORWARD DECLARATIONS
36 //using namespace SenContext;
39 //namespace SenContext // consider whether or not to declare new SenMessage c++ namespace
41 // // Message class type enumeration for class casting:
44 // FORWARD DECLARATIONS
45 class MSenMessageContext;
50 * This is abstract interface defines set of WSF message classes, providing
51 * convenience for other components, which typically cast this to some
52 * subclass via IsSafeToCast() method.
53 * @lib SenMessages.lib
78 * Direction Enumeration
87 * Gets the Message Type
89 virtual TClass Type() = 0;
91 * Gets the Message Direction
93 virtual TDirection Direction() = 0;
97 * Sets message context for this message. If context already
98 * exists, it is discarded and replaced by this context
99 * (context reset is performed).
100 * @param apNotOwnedContext is the context.
101 * Ownership is NOT transferred to this message.
103 * KErrNone on success
104 * KErrArgument if apOwnedContext == NULL
105 * or system-wide errorcode otherwise.
107 virtual TInt SetContext(MSenMessageContext* apNotOwnedContext) = 0;
110 * Getter for message's context
111 * @return message context, if this message relates to
112 * (has associated with) such context, or NULL.
114 virtual MSenMessageContext* Context() = 0;
117 * Sets properties for this message. Most typical use case
118 * is to set message spesific transport properties.
119 * @param apOwnedProperties pointer to the properties, which
120 * ownership is transferred to this class. This is performed
121 * in two different manners:
123 * 1. If message has context, the properties are (re)set into that context,
124 * discarding any pre-existing properties.
126 * 2. If context is NOT available, properties will be directly owned by
129 * KErrNone on success
130 * KErrArgument if apOwnedProperties == NULL
131 * or system-wide errorcode otherwise.
133 virtual TInt SetProperties(MSenProperties* apOwnedProperties) = 0;
136 * Getter for message specific (transport) properties
137 * @return (transport) properties of this message,
138 * if such have been applied to this message
141 virtual MSenProperties* Properties() = 0;
143 virtual TBool IsSafeToCast(TClass aType) = 0;
145 * Getter for transaction ID of this message.
146 * In case of receiving a response message from
147 * service provider, this transaction ID may be
148 * used to map the response with request that
149 * the service consumer sent via service connection.
150 * In such case, the consumer can store return
151 * value from SendL method that was invoked in
152 * order maintain this mapping.
153 * @return the transaction ID of this message
155 virtual TInt TxnId() = 0;
158 * Clone method that duplicates this message
159 * -- including all member data in the message.
160 * For the service consumers, a typical use case
161 * for cloning the message is when there is need
162 * to preserve the received response beyond the
163 * life time of a transaction. Normally, the
164 * response messages, that are owned by service
165 * connection are de-allocated after execution
166 * returns from MSenServiceConsumer interface's
167 * HandleMessageL or HandleErrorL method, back
168 * to the service connection.
169 * @return a pointer to a new message class instance,
170 * which ownership IS transferred to a caller. Note
171 * that caller is expected to cast this pointer to
172 * a proper subclass via the use of IsSafeToCast
173 * method. In case of responses, the message type
174 * is normally equal with the type of the request
175 * message that was sent by the consumer.
177 virtual MSenMessage* CloneL() = 0;
180 #endif // M_SEN_MESSAGE_H