Subversion Repositories ALCASAR

Rev

Rev 2976 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2788 rexy 1
<?php
2
/**
3
 * HWDevice TO class
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PSI_TO
9
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
10
 * @copyright 2009 phpSysInfo
11
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
12
 * @version   SVN: $Id: class.HWDevice.inc.php 255 2009-06-17 13:39:41Z bigmichi1 $
13
 * @link      http://phpsysinfo.sourceforge.net
14
 */
15
 /**
16
 * HWDevice TO class
17
 *
18
 * @category  PHP
19
 * @package   PSI_TO
20
 * @author    Michael Cramer <BigMichi1@users.sourceforge.net>
21
 * @copyright 2009 phpSysInfo
22
 * @license   http://opensource.org/licenses/gpl-2.0.php GNU General Public License version 2, or (at your option) any later version
23
 * @version   Release: 3.0
24
 * @link      http://phpsysinfo.sourceforge.net
25
 */
26
class HWDevice
27
{
28
    /**
29
     * name of the device
30
     *
3037 rexy 31
     * @var string
2788 rexy 32
     */
33
    private $_name = "";
34
 
35
    /**
36
     * capacity of the device, if not available it will be null
37
     *
3037 rexy 38
     * @var int
2788 rexy 39
     */
40
    private $_capacity = null;
41
 
42
    /**
43
     * manufacturer of the device, if not available it will be null
44
     *
3037 rexy 45
     * @var int
2788 rexy 46
     */
47
    private $_manufacturer = null;
48
 
49
    /**
50
     * product of the device, if not available it will be null
51
     *
3037 rexy 52
     * @var int
2788 rexy 53
     */
54
    private $_product = null;
55
 
56
    /**
57
     * serial number of the device, if not available it will be null
58
     *
3037 rexy 59
     * @var string
2788 rexy 60
     */
61
    private $_serial = null;
62
 
63
    /**
2976 rexy 64
     * speed of the device, if not available it will be null
65
     *
66
     * @var Float
67
     */
68
    private $_speed = null;
69
 
70
    /**
71
     * voltage of the device, if not available it will be null
72
     *
73
     * @var Float
74
     */
75
    private $_voltage = null;
76
 
77
    /**
2788 rexy 78
     * count of the device
79
     *
3037 rexy 80
     * @var int
2788 rexy 81
     */
82
    private $_count = 1;
83
 
84
    /**
85
     * compare a given device with the internal one
86
     *
87
     * @param HWDevice $dev device that should be compared
88
     *
89
     * @return boolean
90
     */
91
    public function equals(HWDevice $dev)
92
    {
93
        if ($dev->getName() === $this->_name
94
           && $dev->getCapacity() === $this->_capacity
95
           && $dev->getManufacturer() === $this->_manufacturer
96
           && $dev->getProduct() === $this->_product
2976 rexy 97
           && $dev->getSerial() === $this->_serial
98
           && $dev->getSpeed() === $this->_speed) {
2788 rexy 99
            return true;
100
        } else {
101
            return false;
102
        }
103
    }
104
 
105
    /**
106
     * Returns $_name.
107
     *
108
     * @see HWDevice::$_name
109
     *
110
     * @return String
111
     */
112
    public function getName()
113
    {
114
        return $this->_name;
115
    }
116
 
117
    /**
118
     * Sets $_name.
119
     *
120
     * @param String $name device name
121
     *
122
     * @see HWDevice::$_name
123
     *
3037 rexy 124
     * @return void
2788 rexy 125
     */
126
    public function setName($name)
127
    {
128
        $this->_name = $name;
129
    }
130
 
131
    /**
132
     * Returns $_manufacturer.
133
     *
134
     * @see HWDevice::$_manufacturer
135
     *
136
     * @return String
137
     */
138
    public function getManufacturer()
139
    {
140
        return $this->_manufacturer;
141
    }
142
 
143
    /**
144
     * Sets $_manufacturer.
145
     *
146
     * @param String $manufacturer manufacturer name
147
     *
148
     * @see HWDevice::$_manufacturer
149
     *
3037 rexy 150
     * @return void
2788 rexy 151
     */
152
    public function setManufacturer($manufacturer)
153
    {
154
        $this->_manufacturer = $manufacturer;
155
    }
156
 
157
    /**
158
     * Returns $_product.
159
     *
160
     * @see HWDevice::$_product
161
     *
162
     * @return String
163
     */
164
    public function getProduct()
165
    {
166
        return $this->_product;
167
    }
168
 
169
    /**
170
     * Sets $_product.
171
     *
172
     * @param String $product product name
173
     *
174
     * @see HWDevice::$_product
175
     *
3037 rexy 176
     * @return void
2788 rexy 177
     */
178
    public function setProduct($product)
179
    {
180
        $this->_product = $product;
181
    }
182
 
183
    /**
184
     * Returns $_serial.
185
     *
186
     * @see HWDevice::$_serial
187
     *
188
     * @return String
189
     */
190
    public function getSerial()
191
    {
192
        return $this->_serial;
193
    }
194
 
195
    /**
196
     * Sets $_serial.
197
     *
198
     * @param String $serial serial number
199
     *
200
     * @see HWDevice::$_serial
201
     *
3037 rexy 202
     * @return void
2788 rexy 203
     */
204
    public function setSerial($serial)
205
    {
206
        $this->_serial = $serial;
207
    }
208
 
209
    /**
2976 rexy 210
     * Returns $_speed.
211
     *
212
     * @see HWDevice::$_speed
213
     *
214
     * @return Float
215
     */
216
    public function getSpeed()
217
    {
218
        return $this->_speed;
219
    }
220
 
221
    /**
222
     * Sets $_speed.
223
     *
224
     * @param Float $speed speed
225
     *
226
     * @see HWDevice::$_speed
227
     *
3037 rexy 228
     * @return void
2976 rexy 229
     */
230
    public function setSpeed($speed)
231
    {
232
        $this->_speed = $speed;
233
    }
234
 
235
    /**
236
     * Returns $_voltage.
237
     *
238
     * @see HWDevice::$_voltage
239
     *
240
     * @return Float
241
     */
242
    public function getVoltage()
243
    {
244
        return $this->_voltage;
245
    }
246
 
247
    /**
248
     * Sets $_voltage.
249
     *
250
     * @param Float $voltage voltage
251
     *
252
     * @see HWDevice::$_voltage
253
     *
3037 rexy 254
     * @return void
2976 rexy 255
     */
256
    public function setVoltage($voltage)
257
    {
258
        $this->_voltage = $voltage;
259
    }
260
 
261
    /**
2788 rexy 262
     * Returns $_capacity.
263
     *
264
     * @see HWDevice::$_capacity
265
     *
3037 rexy 266
     * @return int
2788 rexy 267
     */
268
    public function getCapacity()
269
    {
270
        return $this->_capacity;
271
    }
272
 
273
    /**
274
     * Sets $_capacity.
275
     *
3037 rexy 276
     * @param int $capacity device capacity
2788 rexy 277
     *
278
     * @see HWDevice::$_capacity
279
     *
3037 rexy 280
     * @return void
2788 rexy 281
     */
282
    public function setCapacity($capacity)
283
    {
284
        $this->_capacity = $capacity;
285
    }
286
 
287
    /**
288
     * Returns $_count.
289
     *
290
     * @see HWDevice::$_count
291
     *
3037 rexy 292
     * @return int
2788 rexy 293
     */
294
    public function getCount()
295
    {
296
        return $this->_count;
297
    }
298
 
299
    /**
300
     * Sets $_count.
301
     *
3037 rexy 302
     * @param int $count device count
2788 rexy 303
     *
304
     * @see HWDevice::$_count
305
     *
3037 rexy 306
     * @return void
2788 rexy 307
     */
308
    public function setCount($count)
309
    {
310
        $this->_count = $count;
311
    }
312
}