@@ 62-82 (lines=21) @@ | ||
59 | * |
|
60 | * @return void |
|
61 | */ |
|
62 | private function _temperature() |
|
63 | { |
|
64 | foreach ($this->_lines as $line) { |
|
65 | $buffer = preg_split("/\s*\|\s*/", $line); |
|
66 | if (isset($buffer[2]) && $buffer[2] == "Temperature" && $buffer[1] == "Full" && isset($buffer[6]) && preg_match("/^(\S+)\sC$/", $buffer[6], $value)) { |
|
67 | $dev = new SensorDevice(); |
|
68 | $dev->setName($buffer[4]); |
|
69 | $dev->setValue($value[1]); |
|
70 | if (isset($buffer[7]) && $buffer[7] == "Thresholds") { |
|
71 | if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits)) |
|
72 | ||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits)) |
|
73 | ||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits)) |
|
74 | ||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) { |
|
75 | $dev->setMax($limits[1]); |
|
76 | } |
|
77 | } |
|
78 | if ($buffer[5] != "OK") $dev->setEvent($buffer[5]); |
|
79 | $this->mbinfo->setMbTemp($dev); |
|
80 | } |
|
81 | } |
|
82 | } |
|
83 | ||
84 | /** |
|
85 | * get voltage information |
|
@@ 156-176 (lines=21) @@ | ||
153 | * |
|
154 | * @return void |
|
155 | */ |
|
156 | private function _power() |
|
157 | { |
|
158 | foreach ($this->_lines as $line) { |
|
159 | $buffer = preg_split("/\s*\|\s*/", $line); |
|
160 | if (isset($buffer[2]) && $buffer[2] == "Current" && $buffer[1] == "Full" && isset($buffer[6]) && preg_match("/^(\S+)\sW$/", $buffer[6], $value)) { |
|
161 | $dev = new SensorDevice(); |
|
162 | $dev->setName($buffer[4]); |
|
163 | $dev->setValue($value[1]); |
|
164 | if (isset($buffer[7]) && $buffer[7] == "Thresholds") { |
|
165 | if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits)) |
|
166 | ||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits)) |
|
167 | ||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits)) |
|
168 | ||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) { |
|
169 | $dev->setMax($limits[1]); |
|
170 | } |
|
171 | } |
|
172 | if ($buffer[5] != "OK") $dev->setEvent($buffer[5]); |
|
173 | $this->mbinfo->setMbPower($dev); |
|
174 | } |
|
175 | } |
|
176 | } |
|
177 | ||
178 | /** |
|
179 | * get current information |
|
@@ 183-203 (lines=21) @@ | ||
180 | * |
|
181 | * @return void |
|
182 | */ |
|
183 | private function _current() |
|
184 | { |
|
185 | foreach ($this->_lines as $line) { |
|
186 | $buffer = preg_split("/\s*\|\s*/", $line); |
|
187 | if (isset($buffer[2]) && $buffer[2] == "Current" && $buffer[1] == "Full" && isset($buffer[6]) && preg_match("/^(\S+)\sA$/", $buffer[6], $value)) { |
|
188 | $dev = new SensorDevice(); |
|
189 | $dev->setName($buffer[4]); |
|
190 | $dev->setValue($value[1]); |
|
191 | if (isset($buffer[7]) && $buffer[7] == "Thresholds") { |
|
192 | if ((isset($buffer[8]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[8], $limits)) |
|
193 | ||(isset($buffer[9]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[9], $limits)) |
|
194 | ||(isset($buffer[10]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[10], $limits)) |
|
195 | ||(isset($buffer[11]) && preg_match("/^hi-crit\s(\S+)\s*$/", $buffer[11], $limits))) { |
|
196 | $dev->setMax($limits[1]); |
|
197 | } |
|
198 | } |
|
199 | if ($buffer[5] != "OK") $dev->setEvent($buffer[5]); |
|
200 | $this->mbinfo->setMbCurrent($dev); |
|
201 | } |
|
202 | } |
|
203 | } |
|
204 | ||
205 | /** |
|
206 | * get the information |