kpilot Library API Documentation

pilotSysInfo.h

00001 #ifndef _KPILOT_SYSINFO_H 00002 #define _KPILOT_SYSINFO_H 00003 /* sysInfo.h KPilot 00004 ** 00005 ** Copyright (C) 1998-2001 by Dan Pilone 00006 ** Written 2003 by Reinhold Kainhofer 00007 ** 00008 ** Wrapper for pilot-link's SysInfo Structure 00009 */ 00010 00011 /* 00012 ** This program is free software; you can redistribute it and/or modify 00013 ** it under the terms of the GNU Lesser General Public License as published by 00014 ** the Free Software Foundation; either version 2.1 of the License, or 00015 ** (at your option) any later version. 00016 ** 00017 ** This program is distributed in the hope that it will be useful, 00018 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 ** GNU Lesser General Public License for more details. 00021 ** 00022 ** You should have received a copy of the GNU Lesser General Public License 00023 ** along with this program in a file called COPYING; if not, write to 00024 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00025 ** MA 02111-1307, USA. 00026 */ 00027 00028 /* 00029 ** Bug reports and questions can be sent to kde-pim@kde.org 00030 */ 00031 00032 #include <stdlib.h> 00033 #include <string.h> 00034 #include <time.h> 00035 00036 #include <pi-dlp.h> 00037 #include <pi-version.h> 00038 00039 class KPilotSysInfo 00040 { 00041 public: 00042 KPilotSysInfo() { ::memset(&fSysInfo,0,sizeof(struct SysInfo)); } 00043 KPilotSysInfo(const SysInfo* sys_info) { fSysInfo = *sys_info; } 00044 00045 SysInfo *sysInfo() { return &fSysInfo; } 00046 00051 void boundsCheck() 00052 { 00053 } 00054 00055 const unsigned long getRomVersion() const {return fSysInfo.romVersion;} 00056 void setRomVersion(unsigned long newval) {fSysInfo.romVersion=newval;} 00057 00058 const unsigned long getLocale() const {return fSysInfo.locale;} 00059 void setLocale(unsigned long newval) {fSysInfo.locale=newval;} 00060 00061 #if (PILOT_LINK_VERSION * 1000 + PILOT_LINK_MAJOR * 10 + PILOT_LINK_MINOR) < 100 00062 // Older pilot-link versions < 0.11.x don't have prodID, but name instead, 00063 // and they also do not have the *Version members. 00064 const int getProductIDLength() const { return fSysInfo.nameLength; } 00065 const char* getProductID() 00066 { 00067 fSysInfo.name[fSysInfo.nameLength]='\0'; 00068 return fSysInfo.name; 00069 } 00070 void setProductID(char* prodid) 00071 { 00072 ::memset(fSysInfo.name, 0, sizeof(fSysInfo.name)); 00073 ::strncpy(fSysInfo.name, prodid, sizeof(fSysInfo.name)-1); 00074 boundsCheck(); 00075 fSysInfo.nameLength = ::strlen(fSysInfo.name); 00076 } 00077 00078 const unsigned short getMajorVersion() const {return 0;} 00079 const unsigned short getMinorVersion() const {return 0;} 00080 const unsigned short getCompatMajorVersion() const {return 0;} 00081 const unsigned short getCompatMinorVersion() const {return 0;} 00082 const unsigned short getMaxRecSize() const {return 0;} 00083 #else 00084 // Newer pilot-link versions have these fields, so use them: 00085 const int getProductIDLength() const { return fSysInfo.prodIDLength; } 00086 const char* getProductID() 00087 { 00088 fSysInfo.prodID[fSysInfo.prodIDLength]='\0'; 00089 return fSysInfo.prodID; 00090 } 00091 void setProductID(char* prodid) 00092 { 00093 ::memset(fSysInfo.prodID, 0, sizeof(fSysInfo.prodID)); 00094 ::strncpy(fSysInfo.prodID, prodid, sizeof(fSysInfo.prodID)-1); 00095 boundsCheck(); 00096 fSysInfo.prodIDLength = ::strlen(fSysInfo.prodID); 00097 } 00098 00099 const unsigned short getMajorVersion() const {return fSysInfo.dlpMajorVersion;} 00100 const unsigned short getMinorVersion() const {return fSysInfo.dlpMinorVersion;} 00101 const unsigned short getCompatMajorVersion() const {return fSysInfo.compatMajorVersion;} 00102 const unsigned short getCompatMinorVersion() const {return fSysInfo.compatMinorVersion;} 00103 const unsigned short getMaxRecSize() const {return fSysInfo.maxRecSize;} 00104 #endif 00105 00106 private: 00107 struct SysInfo fSysInfo; 00108 }; 00109 00110 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Jul 28 23:57:49 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003