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 00039 #include "base/fscapi.h" 00040 #include "spds/constants.h" 00041 #include "syncml/core/VerDTD.h" 00042 #include "base/Log.h" 00043 00044 /* 00045 * ---------------------------- DeviceConfig class ------------------------------- 00046 * This class groups all configuration properties related to the device. 00047 * Most of DeviceConfig properties are used to generate the 00048 * <DevInf> element for client capabilities. 00049 * DeviceConfig is a part of SyncManagerConfig (along with AccessConfig 00050 * and an array of SyncSourceConfig). 00051 * 00052 * Class members: 00053 * -------------- 00054 * verDTD : Specifies the major and minor version identifier of the 00055 * Device Information DTD used in the representation 00056 * of the Device Information. The value MUST be "1.1". 00057 * This property is mandatory. 00058 * man : Specifies the name of the manufacturer of the device. 00059 * This property is optional. 00060 * mod : Specifies the model name or model number of the device. 00061 * This property is optional. 00062 * oem : Specifies the OEM (Original Equipment Manufacturer) of the device. 00063 * This property is optional. 00064 * fwv : Specifies the firmware version of the device. 00065 * This property is optional. 00066 * swv : Specifies the software version of the device. 00067 * This property is optional. 00068 * hwv : Specifies the hardware version of the device. 00069 * This property is optional. 00070 * devID : Specifies the identifier of the source synchronization device. 00071 * The content information MUST specify a theoretically, 00072 * globally unique identifier. This property is mandatory. 00073 * devType : Specifies the type of the source synchronization device. 00074 * Type values for this element type can be e.g. "pager", 00075 * "handheld", "pda", "phone", "smartphone", "server", "workstation". 00076 * Other values can also be specified. This property is mandatory. 00077 * dsV : Specifies the implemented DS version. This property is optional. 00078 * utc : Boolean. Specifies that the device supports UTC based time. 00079 * If utc = TRUE, the server SHOULD send time in UTC format, 00080 * else MUST send in local time. Default value = TRUE. 00081 * loSupport : Boolean. Specifies that the device supports handling of large objects. 00082 * Default value = FALSE. 00083 * nocSupport : Boolean. Specifies that the device supports number of changes. 00084 * Default value = FALSE. 00085 * logLevel : Specifies the logging level on the device. 00086 * It can be one of 0 – 1 – 2 (none, info, debug). 00087 * Default value = 1 (info). 00088 * maxObjSize : Specifies the maximum object size allowed by the device. 00089 * Default value = 0 (no maxObjSize set). 00090 * devInfHash : This is a hash value generated from all properties that are used 00091 * for the <DevInf> element, plus the syncURL property from AccessConfig. 00092 * Initial value = "0". 00093 */ 00094 class DeviceConfig { 00095 00096 private: 00097 00098 char* verDTD ; 00099 char* man ; 00100 char* mod ; 00101 char* oem ; 00102 char* fwv ; 00103 char* swv ; 00104 char* hwv ; 00105 char* devID ; 00106 char* devType ; 00107 char* dsV ; 00108 BOOL utc ; 00109 BOOL loSupport ; 00110 BOOL nocSupport ; 00111 LogLevel logLevel ; 00112 unsigned int maxObjSize ; 00113 char* devInfHash ; 00114 00115 00123 void set(char* * buf, const char* v); 00124 00125 00126 public: 00127 00128 DeviceConfig(); 00129 DeviceConfig(DeviceConfig& s); 00130 ~DeviceConfig(); 00131 00132 00144 const char* getVerDTD() const ; 00145 void setVerDTD(const char* v) ; 00146 00147 const char* getMan() const ; 00148 void setMan(const char* v) ; 00149 00150 const char* getMod() const ; 00151 void setMod(const char* v) ; 00152 00153 const char* getOem() const ; 00154 void setOem(const char* v) ; 00155 00156 const char* getFwv() const ; 00157 void setFwv(const char* v) ; 00158 00159 const char* getSwv() const ; 00160 void setSwv(const char* v) ; 00161 00162 const char* getHwv() const ; 00163 void setHwv(const char* v) ; 00164 00165 const char* getDevID() const ; 00166 void setDevID(const char* v) ; 00167 00168 const char* getDevType() const ; 00169 void setDevType(const char* v) ; 00170 00171 const char* getDsV() const ; 00172 void setDsV(const char* v) ; 00173 00174 BOOL getUtc() const ; 00175 void setUtc(BOOL v) ; 00176 00177 BOOL getLoSupport() const ; 00178 void setLoSupport(BOOL v) ; 00179 00180 BOOL getNocSupport() const ; 00181 void setNocSupport(BOOL v) ; 00182 00183 LogLevel getLogLevel() const ; 00184 void setLogLevel(LogLevel v) ; 00185 00186 unsigned int getMaxObjSize() const ; 00187 void setMaxObjSize(unsigned int v) ; 00188 00189 const char* getDevInfHash() const ; 00190 void setDevInfHash(const char *v) ; 00191 00198 void assign(const DeviceConfig& s); 00199 00200 /* 00201 * Assign operator 00202 */ 00203 DeviceConfig& operator = (const DeviceConfig& dc) { 00204 assign(dc); 00205 return *this; 00206 } 00207 }; 00208 00210 #endif