00001 /* 00002 * Copyright (c) 2009, Czech Technical University in Prague 00003 * All rights reserved. 00004 * 00005 * Authors/Contact: 00006 * 00007 * Petr Vlacil 00008 * (vlacipet@fel.cvut.cz) 00009 * R&D Centre (RDC) for Mobile Applications 00010 * Dept of Telecommunications Engineering 00011 * Faculty of Electrical Engineering 00012 * Czech Technical University in Prague 00013 * Technicka 2, 166 27 Prague 6, Czech Republic 00014 * 00015 * Redistribution and use in source and binary forms, with or 00016 * without modification, are permitted provided that the following 00017 * conditions are met: 00018 * 00019 * 1. Redistributions of source code must retain the above copyright 00020 * notice, this list of conditions and the following disclaimer. 00021 * 2. Redistributions in binary form must reproduce the above copyright 00022 * notice, this list of conditions and the following disclaimer in 00023 * the documentation and/or other materials provided with the 00024 * distribution. 00025 * 3. Neither the name of the Czech Technical University in Prague nor 00026 * the names of its contributors may be used to endorse or promote 00027 * products derived from this software without specific prior 00028 * written permission. 00029 * 00030 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00031 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00032 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00033 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00034 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00035 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00036 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00037 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00038 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00039 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00040 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00041 * 00042 */ 00043 00044 00045 #ifndef MLP_MESSAGE_H 00046 #define MLP_MESSAGE_H 00047 00048 00049 /** 00050 * \file 00051 * \brief MlpErrorHandler header file 00052 * 00053 * This file contains MlpErrorHandler class declaration. 00054 * 00055 * \author Petr Vláčil 00056 */ 00057 00058 00059 //-------------------------------------------------------------------------- 00060 // Standard libraries 00061 //-------------------------------------------------------------------------- 00062 #include <string> 00063 00064 //-------------------------------------------------------------------------- 00065 // MLP-Lib-Cpp library files 00066 //-------------------------------------------------------------------------- 00067 #include <libmlp-cpp/MlpHdr.hpp> 00068 #include <libmlp-cpp/MlpSubscriberList.hpp> 00069 #include <libmlp-cpp/MlpPositionList.hpp> 00070 00071 00072 /** 00073 * \brief MlpMessage 00074 * 00075 * This class implements MLP message. It holds some message parameters and 00076 * pointers to message header, subscriber list or position list. 00077 */ 00078 class MlpMessage { 00079 protected: 00080 /** */ 00081 std::string _msgBody; 00082 /** Session ID */ 00083 std::string _sessionId; 00084 /** Message version */ 00085 std::string _msgVersion; 00086 /** Message type */ 00087 int _msgType; 00088 /** Service version */ 00089 std::string _serviceVersion; 00090 /** Service type */ 00091 int _serviceType; 00092 /** Service response type */ 00093 int _serviceResType; 00094 /** request ID */ 00095 std::string _reqId; 00096 00097 /** Result in case of message does not contain position. */ 00098 std::string _result; 00099 /** Result id in case of error. */ 00100 std::string _resId; 00101 /** add Info in case of error. */ 00102 std::string _addInfo; 00103 00104 /** Pointer to MlpHdr */ 00105 MlpHdr* _hdr; 00106 /** Pointer to MlpSubscriberList */ 00107 MlpSubscriberList* _subscriberList; 00108 /** Pointer to MlpPoistionList */ 00109 MlpPositionList* _positionList; 00110 00111 public: 00112 /** Constructor */ 00113 MlpMessage (); 00114 /** Destructor */ 00115 ~MlpMessage (); 00116 00117 /** Setter for session id */ 00118 void setSessionId ( std::string sessionId ); 00119 /** Getter for session id */ 00120 std::string getSessionId (); 00121 00122 /** Setter for message version */ 00123 void setMsgVer ( std::string ver ); 00124 /** Getter for message version*/ 00125 std::string getMsgVer (); 00126 00127 /** Setter for message type */ 00128 void setMsgType ( int type ); 00129 /** Getter for message type */ 00130 int getMsgType (); 00131 00132 /** Setter for service version */ 00133 void setServiceVer ( std::string ver ); 00134 /** Getter for service version */ 00135 std::string getServiceVer (); 00136 00137 /** Setter for service type */ 00138 void setServiceType ( int type ); 00139 /** Getter for service type */ 00140 int getServiceType (); 00141 00142 /** Setter for service response type */ 00143 void setServiceResType ( int responseType); 00144 /** Getter for service response type */ 00145 int getServiceResType (); 00146 00147 /** Setter for request id */ 00148 void setReqId ( std::string reqId ); 00149 /** Getter for request id */ 00150 std::string getReqId (); 00151 00152 /** Set result in case of error. */ 00153 void setResult ( std::string result ); 00154 /** Get result in case of error. */ 00155 std::string getResult (); 00156 00157 /** Set result id in case of error. */ 00158 void setResId ( std::string resId ) ; 00159 /** Get result id in case of error. */ 00160 std::string getResId (); 00161 00162 /** Add Info in case of error. */ 00163 void setAddInfo ( std::string addInfo ); 00164 /** Get Info in case of error. */ 00165 std::string getAddInfo (); 00166 00167 00168 /** Create MlpHdr */ 00169 MlpHdr* createHdr (); 00170 /** Getter for MlpHdr pointer */ 00171 MlpHdr* getMlpHdr (); 00172 00173 /** Generate MlpSubscriberList */ 00174 MlpSubscriberList* createSubscriberList (); 00175 /** Getter for MlpSubscriberList */ 00176 MlpSubscriberList* getSubscriberList (); 00177 00178 /** Generate MlpPositionList */ 00179 MlpPositionList* createPositionList (); 00180 /** Getter for MlpPositionList */ 00181 MlpPositionList* getPositionList (); 00182 00183 00184 /** Convert message to XML string */ 00185 std::string toString (); 00186 00187 }; 00188 00189 #endif