Acpi

 view release on metacpan or  search on metacpan

Temperature.pm  view on Meta::CPAN

package Acpi::Temperature;
use Acpi::Field;
use strict;

our $VERSION = '0.1';

my $rfield;

sub new{
	my($class) = shift;
	my($self) = {};

	bless($self,$class);
	
	$rfield = Acpi::Field->new;
	return $self;
}

sub getTemperature{
	my($self) = shift;
	my($temperature) = undef;

	$temperature = $rfield->getValueField("/proc/acpi/thermal_zone/THRM/temperature","temperature");

	return $temperature;
}

sub getState{
	my($self) = shift;

	if($rfield->getValueField("/proc/acpi/thermal_zone/THRM/state","state") eq "ok"){
		return 0;
	}
	else{
		return -1;
	}
}

sub getCritical{
	my($self) = shift;

	my($critical) = $rfield->getValueField("/proc/acpi/thermal_zone/THRM/trip_points","critical (S5)");

	return $critical;
}

sub getPassive{
	my($self) = shift;

	my($passive) = $rfield->getValueField("/proc/acpi/thermal_zone/THRM/trip_points","passive");

	return $passive;
}

sub getActive{
	my($self) = shift;

	my($active) = $rfield->getValueField("/proc/acpi/thermal_zone/THRM/trip_points","active[0]");

	return $active;
}

sub getCoolingMode{
	my($self) = shift;

	if($rfield>getValueField("/proc/acpi/thermal_zone/THRM/cooling_mode","cooling mode") eq "active"){
		return 0;
	}
	else{
		return -1;
	}
}
1;



( run in 2.883 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )