summaryrefslogtreecommitdiffstats
path: root/src/knutupsdata.h
blob: 258028e7504f922b338f48118b611b33d05aa7e6 (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
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
/***************************************************************************
                          knutupsdata.h  -  description
                             -------------------
    begin                : Tue Aug 21 2001
    copyright            : (C) 2001 by Daniel Prynych
    email                : Daniel@prynych.cz
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 KNUTUPSDATA_H
#define KNUTUPSDATA_H

#include "knutconst.h"
#include "knutanalog.h"

#include <tqstring.h>
#include <tqvaluelist.h>

class TQString;

/**
  *@author Daniel Prynych
  */



 /**
  * Trida obsahuje data o UPS-kach,
  * nazev, adresu port, protokol, promenne atd.
  * Class includes data about UPSes like name. address, port, protocol, variables ...
  *
  * @author Daniel Prynych
  * @short Information about UPS
  * @version 0.4
  **/
class KNutUpsData {


public:


struct upsRecordDef {  //include information about one UPS
  TQString name; // name
  TQString upsName; // name of UPSky <> mojeups
  TQString upsAddress; // address of UPS <> muj.pc.cz
  long delay;  // time between read date from UPS
  unsigned short port; // port for connecting server
  TQString userName;
  TQString password;
  bool savePassword; //save password into configuration 
  int upsVarCode[knc::NumberOfVars];
  };



 /**
  * Konstruktor
  *
  * @since  0.3
  **/
  KNutUpsData();

 /**
  * Destruktor
  *
  * @since  0.3
  **/
  ~KNutUpsData();

 /**
  * Adds record
  * Prida zaznam.
  *
  * @param upsRecord are data of record in structure of upsRecordStruct.
  * @param upsRecord jsou data zaznamu ve strukture upsRecordStruct.
  * @since  0.4
  **/
  void add (const upsRecordDef upsRecord);

 /**
  * Rewrites record
  * Prepise zaznam.
  *
  * @param index Describes order number od record.
  * @param index Udava poradove cislo zaznamu..
  * @param upsRecord are data of record in structure of upsRecordStruct.
  * @param upsRecord jsou data zaznamu ve strukture upsRecordStruct.
  * @since  0.4
  **/
  void put (const int index, const upsRecordDef upsRecord );

 /**
  * Returns record.
  * Vrati zaznam.
  *
  * @param index Describes order number od record.
  * @param index Udava poradove cislo zaznamu.
  * @param upsRecord are data of record in structure upsRecordStruct.
  * @param upsRecord jsou data zaznamu ve strukture upsRecordStruct.
  *
  * @since  0.4
  **/
  void get (const int index, upsRecordDef& upsRecord );

 /**
  * Returns name of record.
  * Vrati jmeno zaznamu.
  *
  * @param index Describes order number od record.
  * @param index Udava poradove cislo zaznamu.
  * @since  0.3
  **/
  TQString getName (const int index);

 /**
  * Deletes record;
  * Zrusi zaznam.
  *
  * @param index Describes order number od record.
  * @param index Udava poradove cislo zaznamu.
  *
  * @since  0.3
  **/
  void deleteName (const int index);

 /**
  * Returns count of records
  * Vrati pocet zaznamu.
  *
  * @since  0.3
  **/
  int getCount ( void );

 /**
  * Returns pointer on record, when record is not existed returns 0
  * Vrati ukazatel na zaznam, pokud zaznam neexistuje vrati 0.
  *
  * @param name Is name of list.
  * @param name Je jmeno zaznamu.
  * @since  0.3
  **/
  upsRecordDef* findName (const TQString name);



private:
  int m_countUpsRecords;

  TQValueList<upsRecordDef> m_listRecords;
};


#endif