00001 /* 00002 * Copyright (C) 2003-2007 Funambol 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00017 */ 00018 #ifndef INCL_DEVICE_CONFIG 00019 #define INCL_DEVICE_CONFIG 00020 00022 #include "base/fscapi.h" 00023 #include "spds/constants.h" 00024 #include "syncml/core/VerDTD.h" 00025 #include "base/Log.h" 00026 00027 /* 00028 * ---------------------------- DeviceConfig class ------------------------------- 00029 * This class groups all configuration properties related to the device. 00030 * Most of DeviceConfig properties are used to generate the 00031 * <DevInf> element for client capabilities. 00032 * DeviceConfig is a part of SyncManagerConfig (along with AccessConfig 00033 * and an array of SyncSourceConfig). 00034 * 00035 * Class members: 00036 * -------------- 00037 * verDTD : Specifies the major and minor version identifier of the 00038 * Device Information DTD used in the representation 00039 * of the Device Information. The value MUST be "1.1". 00040 * This property is mandatory. 00041 * man : Specifies the name of the manufacturer of the device. 00042 * This property is optional. 00043 * mod : Specifies the model name or model number of the device. 00044 * This property is optional. 00045 * oem : Specifies the OEM (Original Equipment Manufacturer) of the device. 00046 * This property is optional. 00047 * fwv : Specifies the firmware version of the device. 00048 * This property is optional. 00049 * swv : Specifies the software version of the device. 00050 * This property is optional. 00051 * hwv : Specifies the hardware version of the device. 00052 * This property is optional. 00053 * devID : Specifies the identifier of the source synchronization device. 00054 * The content information MUST specify a theoretically, 00055 * globally unique identifier. This property is mandatory. 00056 * devType : Specifies the type of the source synchronization device. 00057 * Type values for this element type can be e.g. "pager", 00058 * "handheld", "pda", "phone", "smartphone", "server", "workstation". 00059 * Other values can also be specified. This property is mandatory. 00060 * dsV : Specifies the implemented DS version. This property is optional. 00061 * utc : Boolean. Specifies that the device supports UTC based time. 00062 * If utc = TRUE, the server SHOULD send time in UTC format, 00063 * else MUST send in local time. Default value = TRUE. 00064 * loSupport : Boolean. Specifies that the device supports handling of large objects. 00065 * Default value = FALSE. 00066 * nocSupport : Boolean. Specifies that the device supports number of changes. 00067 * Default value = FALSE. 00068 * logLevel : Specifies the logging level on the device. 00069 * It can be one of 0 – 1 – 2 (none, info, debug). 00070 * Default value = 1 (info). 00071 * maxObjSize : Specifies the maximum object size allowed by the device. 00072 * Default value = 0 (no maxObjSize set). 00073 * devInfHash : This is a hash value generated from all properties that are used 00074 * for the <DevInf> element, plus the syncURL property from AccessConfig. 00075 * Initial value = "0". 00076 */ 00077 class DeviceConfig { 00078 00079 private: 00080 00081 char* verDTD ; 00082 char* man ; 00083 char* mod ; 00084 char* oem ; 00085 char* fwv ; 00086 char* swv ; 00087 char* hwv ; 00088 char* devID ; 00089 char* devType ; 00090 char* dsV ; 00091 BOOL utc ; 00092 BOOL loSupport ; 00093 BOOL nocSupport ; 00094 LogLevel logLevel ; 00095 unsigned int maxObjSize ; 00096 char* devInfHash ; 00097 00098 00106 void set(char* * buf, const char* v) EXTRA_SECTION_02; 00107 00108 00109 public: 00110 00111 DeviceConfig() EXTRA_SECTION_02; 00112 DeviceConfig(DeviceConfig& s) EXTRA_SECTION_02; 00113 ~DeviceConfig() EXTRA_SECTION_02; 00114 00115 00127 const char* getVerDTD() const EXTRA_SECTION_02; 00128 void setVerDTD(const char* v) EXTRA_SECTION_02; 00129 00130 const char* getMan() const EXTRA_SECTION_02; 00131 void setMan(const char* v) EXTRA_SECTION_02; 00132 00133 const char* getMod() const EXTRA_SECTION_02; 00134 void setMod(const char* v) EXTRA_SECTION_02; 00135 00136 const char* getOem() const EXTRA_SECTION_02; 00137 void setOem(const char* v) EXTRA_SECTION_02; 00138 00139 const char* getFwv() const EXTRA_SECTION_02; 00140 void setFwv(const char* v) EXTRA_SECTION_02; 00141 00142 const char* getSwv() const EXTRA_SECTION_02; 00143 void setSwv(const char* v) EXTRA_SECTION_02; 00144 00145 const char* getHwv() const EXTRA_SECTION_02; 00146 void setHwv(const char* v) EXTRA_SECTION_02; 00147 00148 const char* getDevID() const EXTRA_SECTION_02; 00149 void setDevID(const char* v) EXTRA_SECTION_02; 00150 00151 const char* getDevType() const EXTRA_SECTION_02; 00152 void setDevType(const char* v) EXTRA_SECTION_02; 00153 00154 const char* getDsV() const EXTRA_SECTION_02; 00155 void setDsV(const char* v) EXTRA_SECTION_02; 00156 00157 BOOL getUtc() const EXTRA_SECTION_02; 00158 void setUtc(BOOL v) EXTRA_SECTION_02; 00159 00160 BOOL getLoSupport() const EXTRA_SECTION_02; 00161 void setLoSupport(BOOL v) EXTRA_SECTION_02; 00162 00163 BOOL getNocSupport() const EXTRA_SECTION_02; 00164 void setNocSupport(BOOL v) EXTRA_SECTION_02; 00165 00166 LogLevel getLogLevel() const EXTRA_SECTION_02; 00167 void setLogLevel(LogLevel v) EXTRA_SECTION_02; 00168 00169 unsigned int getMaxObjSize() const EXTRA_SECTION_02; 00170 void setMaxObjSize(unsigned int v) EXTRA_SECTION_02; 00171 00172 const char* getDevInfHash() const EXTRA_SECTION_02; 00173 void setDevInfHash(const char *v) EXTRA_SECTION_02; 00174 00181 void assign(const DeviceConfig& s) EXTRA_SECTION_02; 00182 00183 /* 00184 * Assign operator 00185 */ 00186 DeviceConfig& operator = (const DeviceConfig& dc) { 00187 assign(dc); 00188 return *this; 00189 } 00190 }; 00191 00193 #endif