xosview  1.23
About: xosview is an X Windows based system monitor (cpu, memory, swap and network usage; interrupt and serial activities; load average).
  Fossies Dox: xosview-1.23.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

btrymeter.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 1997, 2005, 2006 by Mike Romberg ( mike.romberg@noaa.gov )
3 //
4 // This file may be distributed under terms of the GPL
5 //
6 
7 #ifndef _BTRYMETER_H_
8 #define _BTRYMETER_H_
9 
10 #include "fieldmeter.h"
11 #include "xosview.h"
12 #include <string>
13 
14 
15 class BtryMeter : public FieldMeter {
16 public:
17  BtryMeter( XOSView *parent );
18  ~BtryMeter( void );
19 
20  const char *name( void ) const { return "BtryMeter"; }
21  void checkevent( void );
22 
23  void checkResources( void );
24 
25  // some basic fields of 'info','alarm','state'
26  // XXX: should be private
27  struct acpi_batt {
28  int alarm; // in mWh
29  int design_capacity; // in mWh
30  int last_full_capacity; // in mWh
31  int charging_state; // charged=0,discharging=-1,charging=1
32  int present_rate; // in mW, 0=unknown
33  int remaining_capacity; // in mW
34  };
36 
37  static bool has_source( void );
38 protected:
39 
40  void getpwrinfo( void );
41 private:
42 
43  bool getapminfo( void );
44  bool getacpi_or_sys_info( void );
45 
46  bool use_apm;
47  bool use_acpi;
49 
50  bool acpi_battery_present(const std::string& filename);
51  bool acpi_parse_battery(const std::string& filename);
52  bool sys_battery_present(const std::string& filename);
53  bool sys_parse_battery(const std::string& filename);
54 
55  static bool has_acpi(void);
56  static bool has_apm(void);
57  static bool has_syspower(void);
58 
59  void handle_apm_state(void);
60  void handle_acpi_state(void);
61 
64 
67 
72 
73 };
74 
75 
76 #endif
int acpi_sum_cap
Definition: btrymeter.h:68
~BtryMeter(void)
int acpi_sum_remain
Definition: btrymeter.h:69
int old_acpi_charge_state
Definition: btrymeter.h:66
static bool has_syspower(void)
Definition: btrymeter.cc:109
static bool has_source(void)
Definition: btrymeter.cc:51
const char * name(void) const
Definition: btrymeter.h:20
BtryMeter(XOSView *parent)
static bool has_acpi(void)
Definition: btrymeter.cc:85
void handle_acpi_state(void)
Definition: btrymeter.cc:201
void checkevent(void)
bool sys_parse_battery(const std::string &filename)
Definition: btrymeter.cc:609
int apm_battery_state
Definition: btrymeter.h:62
bool getacpi_or_sys_info(void)
Definition: btrymeter.cc:374
acpi_batt battery
Definition: btrymeter.h:35
void handle_apm_state(void)
Definition: btrymeter.cc:158
bool getapminfo(void)
Definition: btrymeter.cc:284
int acpi_charge_state
Definition: btrymeter.h:65
int acpi_sum_rate
Definition: btrymeter.h:70
bool acpi_battery_present(const std::string &filename)
Definition: btrymeter.cc:472
bool sys_battery_present(const std::string &filename)
Definition: btrymeter.cc:592
bool use_acpi
Definition: btrymeter.h:47
void getpwrinfo(void)
Definition: btrymeter.cc:262
int old_apm_battery_state
Definition: btrymeter.h:63
static bool has_apm(void)
Definition: btrymeter.cc:56
bool acpi_parse_battery(const std::string &filename)
Definition: btrymeter.cc:493
bool use_apm
Definition: btrymeter.h:46
void checkResources(void)
bool use_syspower
Definition: btrymeter.h:48
int acpi_sum_alarm
Definition: btrymeter.h:71