/usr/include/usbprog/firmwarepool.h is in libusbprog-dev 0.2.0-2.2+b2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | /*
* (c) 2007-2010, Bernhard Walle <bernhard@bwalle.de>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FIRMWAREPOOL_H
#define FIRMWAREPOOL_H
#include <stdint.h>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <usbprog/date.h>
#include <usbprog/inifile.h>
#include <usbprog/downloader.h>
/* Typedefs {{{ */
class Firmware;
typedef std::map<std::string, Firmware *> StringFirmwareMap;
typedef std::list<std::string> StringList;
/* }}} */
/* Firmware {{{ */
class Firmware {
public:
Firmware(const std::string &name);
/* name is immutable */
std::string getName() const;
void setLabel(const std::string &label);
std::string getLabel() const;
void setFilename(const std::string &filename);
std::string getFilename() const;
std::string getVerFilename() const;
void setUrl(const std::string &url);
std::string getUrl() const;
void setAuthor(const std::string &author);
std::string getAuthor() const;
void setVersion(int version);
int getVersion() const;
std::string getVersionString() const;
void setMD5Sum(const std::string &md5);
std::string getMD5Sum() const;
void setDate(const DateTime &date);
const DateTime getDate() const;
void setDescription(const std::string &description);
std::string getDescription() const;
void setPin(const std::string &name, const std::string &value);
std::string getPin(const std::string &name) const;
StringVector getPins() const;
void setData(const ByteVector &data);
ByteVector &getData();
const ByteVector &getData() const;
void setVendorId(uint16_t vendorid);
uint16_t getVendorId() const;
void setProductId(uint16_t productid);
uint16_t getProductId() const;
void setBcdDevice(uint16_t bcdDevice);
uint16_t getBcdDevice() const;
bool hasDeviceId() const;
std::string toString() const;
std::string formatDateVersion() const;
std::string formatDeviceId() const;
private:
const std::string m_name;
std::string m_label;
std::string m_filename;
std::string m_url;
std::string m_author;
int m_version;
DateTime m_date;
std::string m_description;
StringStringMap m_pins;
ByteVector m_data;
uint16_t m_vendorId;
uint16_t m_productId;
uint16_t m_bcdDevice;
std::string m_md5sum;
};
/* }}} */
/* Firmwarepool {{{ */
class FirmwareXMLParser;
class Firmwarepool {
friend class FirmwareXMLParser;
public:
static void readFromFile(const std::string &filename,
ByteVector &bv) throw (IOError);
public:
Firmwarepool(const std::string &cacheDir)
throw (IOError);
virtual ~Firmwarepool();
public:
/* m_cacheDir is immutable */
std::string getCacheDir() const;
void downloadIndex(const std::string &url)
throw (DownloadError);
void readIndex()
throw (IOError, ParseError);
void deleteIndex()
throw (IOError);
StringList getFirmwareNameList() const;
Firmware *getFirmware(const std::string &name) const;
std::vector<Firmware *> getFirmwareList() const;
void setProgress(ProgressNotifier *notifier);
void setIndexUpdatetime(int minutes);
void downloadFirmware(const std::string &name)
throw (DownloadError, GeneralError);
void fillFirmware(const std::string &name)
throw (IOError, GeneralError);
bool isFirmwareOnDisk(const std::string &name)
throw (IOError);
void deleteCache()
throw (IOError);
void cleanCache()
throw (IOError);
protected:
std::string getFirmwareFilename(Firmware *fw) const;
void addFirmware(Firmware *fw);
private:
const std::string m_cacheDir;
StringFirmwareMap m_firmware;
ProgressNotifier *m_progressNotifier;
int m_indexAutoUpdatetime;
};
/* }}} */
#endif /* FIRMWAREPOOL_H */
// vim: set sw=4 ts=4 fdm=marker et: :collapseFolds=1:
|