Subversion Repositories ALCASAR

Rev

Rev 2788 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log

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