Device Class Reference

device abstraction of a powermanagable device More...

#include <device.h>

Inheritance diagram for Device:

LanDevice SoundDevice UsbDevice WlanDevice List of all members.

Public Member Functions

 Device (const std::string &udi)
 constructor
virtual ~Device ()
 destructor
virtual bool suspend (DPM_POWER_STATE state=DPM_STATE_D3, bool force=false)
 Set device into powersave state.
virtual bool resume ()
 resumes a device from a powersave state
virtual bool isActive ()=0
 check whether device is currently busy
virtual DPM_DEVICE_CLASS deviceClass ()
 get the DPM_DEVICE_CLASS of the device
virtual std::string udi ()
 get the udi assigned by hal of the device
virtual DPM_POWER_STATE updateState ()
 get the current DPM_POWER_STATE of the device
DPM_POWER_STATE readState (const std::string &state_file)
 read out current power state from file

Protected Attributes

std::string _udi
 holding the udi assigned by hal
DPM_DEVICE_CLASS _device_class
 the device class (DPM_DEVICE_CLASS)
std::string _device_path
 the device path in system
std::string _state_file
 the full path of the power state file

Private Attributes

DPM_POWER_STATE _current_state
 the current power state the device is in

Detailed Description

device abstraction of a powermanagable device


Constructor & Destructor Documentation

Device::Device const std::string &  udi  ) 
 

constructor

Parameters:
udi the udi of the device given by hal

Device::~Device  )  [virtual]
 

destructor


Member Function Documentation

DPM_DEVICE_CLASS Device::deviceClass  )  [virtual]
 

get the DPM_DEVICE_CLASS of the device

Return values:
@ref DPM_DEVICE_CLASS

virtual bool Device::isActive  )  [pure virtual]
 

check whether device is currently busy

pure virtual

Returns:
true if device is busy

Implemented in UsbDevice, WlanDevice, SoundDevice, and LanDevice.

DPM_POWER_STATE Device::readState const std::string &  state_file  ) 
 

read out current power state from file

Parameters:
state_file power state file to read from
Returns:
DPM_POWER_STATE

bool Device::resume  )  [virtual]
 

resumes a device from a powersave state

Returns:
true if successfull, false on error

bool Device::suspend DPM_POWER_STATE  state = DPM_STATE_D3,
bool  force = false
[virtual]
 

Set device into powersave state.

Parameters:
state the power state to set (default is DPM_STATE_D3)
force suspend device even if active (default is false)
Returns:
true if successfull, false on error

string Device::udi  )  [virtual]
 

get the udi assigned by hal of the device

Return values:
udi of device

DPM_POWER_STATE Device::updateState  )  [virtual]
 

get the current DPM_POWER_STATE of the device

reads out current power state from state file and updates local _current_state variable

Returns:
DPM_POWER_STATE


Member Data Documentation

DPM_POWER_STATE Device::_current_state [private]
 

the current power state the device is in

DPM_DEVICE_CLASS Device::_device_class [protected]
 

the device class (DPM_DEVICE_CLASS)

std::string Device::_device_path [protected]
 

the device path in system

returned by linux.sysfs_path capability

std::string Device::_state_file [protected]
 

the full path of the power state file

e.g. _device_path + /device/power/state

std::string Device::_udi [protected]
 

holding the udi assigned by hal


The documentation for this class was generated from the following files:
Generated on Mon Mar 27 09:27:19 2006 for Powersave Daemon by  doxygen 1.4.6