00001 /* 00002 * Funambol is a mobile platform developed by Funambol, Inc. 00003 * Copyright (C) 2003 - 2007 Funambol, Inc. 00004 * 00005 * This program is free software; you can redistribute it and/or modify it under 00006 * the terms of the GNU Affero General Public License version 3 as published by 00007 * the Free Software Foundation with the addition of the following permission 00008 * added to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED 00009 * WORK IN WHICH THE COPYRIGHT IS OWNED BY FUNAMBOL, FUNAMBOL DISCLAIMS THE 00010 * WARRANTY OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. 00011 * 00012 * This program is distributed in the hope that it will be useful, but WITHOUT 00013 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00014 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 00015 * details. 00016 * 00017 * You should have received a copy of the GNU Affero General Public License 00018 * along with this program; if not, see http://www.gnu.org/licenses or write to 00019 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 00020 * MA 02110-1301 USA. 00021 * 00022 * You can contact Funambol, Inc. headquarters at 643 Bair Island Road, Suite 00023 * 305, Redwood City, CA 94063, USA, or at email address info@funambol.com. 00024 * 00025 * The interactive user interfaces in modified source and object code versions 00026 * of this program must display Appropriate Legal Notices, as required under 00027 * Section 5 of the GNU Affero General Public License version 3. 00028 * 00029 * In accordance with Section 7(b) of the GNU Affero General Public License 00030 * version 3, these Appropriate Legal Notices must retain the display of the 00031 * "Powered by Funambol" logo. If the display of the logo is not reasonably 00032 * feasible for technical reasons, the Appropriate Legal Notices must display 00033 * the words "Powered by Funambol". 00034 */ 00035 #ifndef INCL_DEVICE_CONFIG 00036 #define INCL_DEVICE_CONFIG 00037 /** @cond DEV */ 00038 00039 #include "base/fscapi.h" 00040 #include "spds/constants.h" 00041 #include "syncml/core/VerDTD.h" 00042 #include "base/Log.h" 00043 #include "base/globalsdef.h" 00044 00045 BEGIN_NAMESPACE 00046 00047 /* 00048 * ---------------------------- DeviceConfig class ------------------------------- 00049 * This class groups all configuration properties related to the device. 00050 * Most of DeviceConfig properties are used to generate the 00051 * <DevInf> element for client capabilities. 00052 * DeviceConfig is a part of SyncManagerConfig (along with AccessConfig 00053 * and an array of SyncSourceConfig). 00054 */ 00055 class DeviceConfig { 00056 00057 private: 00058 00059 char* man ; 00060 char* mod ; 00061 char* oem ; 00062 char* fwv ; 00063 char* swv ; 00064 char* hwv ; 00065 char* devID ; 00066 char* devType ; 00067 char* dsV ; 00068 bool utc ; 00069 bool loSupport ; 00070 bool nocSupport ; 00071 LogLevel logLevel ; 00072 unsigned int maxObjSize ; 00073 char* devInfHash ; 00074 00075 00076 /** 00077 * Sets the given buffer with the given value, dealing correctly with 00078 * NULL values. If a NULL value is passed, the empty string is used. 00079 * 00080 * @param buf the destination buffer 00081 * @param v the new value (CAN BE NULL) 00082 */ 00083 void set(char* * buf, const char* v); 00084 00085 00086 public: 00087 00088 DeviceConfig(); 00089 DeviceConfig(DeviceConfig& s); 00090 ~DeviceConfig(); 00091 00092 00093 /** 00094 * Methods to get/set data values. 00095 * ----------------------------------------------------- 00096 * get: return the internal value. 00097 * The caller MUST NOT release the memory itself. 00098 * 00099 * set: set the internal value. 00100 * The given data are copied in an internal 00101 * buffer so that the caller is assured that the 00102 * given address can be released after the call. 00103 */ 00104 const char* getMan() const ; 00105 void setMan(const char* v) ; 00106 00107 const char* getMod() const ; 00108 void setMod(const char* v) ; 00109 00110 const char* getOem() const ; 00111 void setOem(const char* v) ; 00112 00113 const char* getFwv() const ; 00114 void setFwv(const char* v) ; 00115 00116 const char* getSwv() const ; 00117 void setSwv(const char* v) ; 00118 00119 const char* getHwv() const ; 00120 void setHwv(const char* v) ; 00121 00122 const char* getDevID() const ; 00123 void setDevID(const char* v) ; 00124 00125 const char* getDevType() const ; 00126 void setDevType(const char* v) ; 00127 00128 const char* getDsV() const ; 00129 void setDsV(const char* v) ; 00130 00131 bool getUtc() const ; 00132 void setUtc(bool v) ; 00133 00134 bool getLoSupport() const ; 00135 void setLoSupport(bool v) ; 00136 00137 bool getNocSupport() const ; 00138 void setNocSupport(bool v) ; 00139 00140 LogLevel getLogLevel() const ; 00141 void setLogLevel(LogLevel v) ; 00142 00143 unsigned int getMaxObjSize() const ; 00144 void setMaxObjSize(unsigned int v) ; 00145 00146 const char* getDevInfHash() const ; 00147 void setDevInfHash(const char *v) ; 00148 00149 /** 00150 * Sets the values of this object with with the values from the given 00151 * DeviceConfig source object. 00152 * 00153 * @param s: the deviceConfig reference. 00154 */ 00155 void assign(const DeviceConfig& s); 00156 00157 /* 00158 * Assign operator 00159 */ 00160 DeviceConfig& operator = (const DeviceConfig& dc) { 00161 assign(dc); 00162 return *this; 00163 } 00164 }; 00165 00166 00167 END_NAMESPACE 00168 00169 /** @endcond */ 00170 #endif