Subversion Repositories ALCASAR

Rev

Rev 2976 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log

Rev 2976 Rev 3037
Line 31... Line 31...
31
        case 'command':
31
        case 'command':
32
            CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
32
            CommonFunctions::executeProgram('ipmiutil', 'sensor -stw', $lines);
33
            $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
33
            $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
34
            break;
34
            break;
35
        case 'data':
35
        case 'data':
36
            if (CommonFunctions::rfts(PSI_APP_ROOT.'/data/ipmiutil.txt', $lines)) {
36
            if (CommonFunctions::rftsdata('ipmiutil.tmp', $lines)) {
37
                $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
37
                $this->_lines = preg_split("/\r?\n/", $lines, -1, PREG_SPLIT_NO_EMPTY);
38
            }
38
            }
39
            break;
39
            break;
40
        default:
40
        default:
41
            $this->error->addConfigError('__construct()', '[sensor_ipmiutil] ACCESS');
41
            $this->error->addConfigError('__construct()', '[sensor_ipmiutil] ACCESS');
42
            break;
-
 
43
        }
42
        }
44
    }
43
    }
45
 
44
 
46
    /**
45
    /**
47
     * get temperature information
46
     * get temperature information
Line 228... Line 227...
228
                $dev = new SensorDevice();
227
                $dev = new SensorDevice();
229
                $dev->setName($buffer[4].' ('.$buffer[2].')');
228
                $dev->setName($buffer[4].' ('.$buffer[2].')');
230
 
229
 
231
                $buffer5s = preg_split("/\s+/", $buffer5 = $buffer[5]);
230
                $buffer5s = preg_split("/\s+/", $buffer5 = $buffer[5]);
232
                if (isset($buffer5s[1])) {
231
                if (isset($buffer5s[1])) {
-
 
232
                    if (preg_match('/^[0-9A-Fa-f]+$/', $buffer5s[0])) {
233
                    $value = hexdec($buffer5s[0]) & 0xff;
233
                        $value = hexdec($buffer5s[0]) & 0xff;
234
                    if ($buffer5s[1] === 'DiscreteEvt') {
234
                        if ($buffer5s[1] === 'DiscreteEvt') {
235
                        $dev->setValue('0x'.dechex($value));
235
                            $dev->setValue('0x'.dechex($value));
236
                    } elseif (($buffer5s[1] === 'DiscreteUnit') && ($value > 0)) {
236
                        } elseif (($buffer5s[1] === 'DiscreteUnit') && ($value > 0)) {
237
                        $dev->setValue('0x'.dechex($value - 1));
237
                            $dev->setValue('0x'.dechex($value - 1));
-
 
238
                        } else {
-
 
239
                            $dev->setValue($buffer5);
-
 
240
                        }
238
                    } else {
241
                    } else {
239
                        $dev->setValue($buffer5);
242
                        $dev->setValue($buffer5);
240
                    }
243
                    }
241
                } else {
244
                } else {
242
                    $dev->setValue($buffer5);
245
                    $dev->setValue($buffer5);
Line 249... Line 252...
249
    /**
252
    /**
250
     * get the information
253
     * get the information
251
     *
254
     *
252
     * @see PSI_Interface_Sensor::build()
255
     * @see PSI_Interface_Sensor::build()
253
     *
256
     *
254
     * @return Void
257
     * @return void
255
     */
258
     */
256
    public function build()
259
    public function build()
257
    {
260
    {
258
        $this->_temperature();
261
        $this->_temperature();
259
        $this->_voltage();
262
        $this->_voltage();