summaryrefslogtreecommitdiffstats
path: root/src/devices/mem24/base/mem24.h
blob: d66ff477abd2affc38200193d2cb2db6424adfed (plain)
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
/***************************************************************************
 *   Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org>                  *
 *                                                                         *
 *   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.                                   *
 ***************************************************************************/
#ifndef MEM24_H
#define MEM24_H

#include "common/common/misc.h"
#include "devices/base/generic_device.h"

namespace Mem24
{
class XmlToData;
class Group;

//-----------------------------------------------------------------------------
class Data : public Device::Data
{
public:
  Data() : Device::Data(0) {}
  virtual QString listViewGroup() const { return i18n("24 EEPROM"); }
  uint nbBytes() const { return _nbBytes; }
  virtual bool matchId(BitValue, Device::IdData &) const { return false; }
  virtual uint nbBitsAddress() const { return nbBits(_nbBytes-1); }
  virtual bool canWriteCalibration() const { return false; }
  uint nbBlocks() const { return _nbBlocks; }
  uint nbBytesPage() const { return _nbBytesPage; }

private:
  uint _nbBytes, _nbBlocks, _nbBytesPage;

  friend class XmlToData;
  friend class Group;
  friend QDataStream &operator <<(QDataStream &s, const Data &data);
  friend QDataStream &operator >>(QDataStream &s, Data &data);
};

QDataStream &operator <<(QDataStream &s, const Data &data);
QDataStream &operator >>(QDataStream &s, Data &data);

} // namespace

#endif