"Fossies" - the Fresh Open Source Software Archive

Member "xosview-1.23/linux/btrymeter.h" (11 Jul 2020, 1684 Bytes) of package /linux/misc/xosview-1.23.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "btrymeter.h" see the Fossies "Dox" file reference documentation.

    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   };
   35   acpi_batt battery;
   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;
   48   bool use_syspower;
   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 
   62   int apm_battery_state;
   63   int old_apm_battery_state;
   64 
   65   int acpi_charge_state;
   66   int old_acpi_charge_state;
   67 
   68   int acpi_sum_cap;
   69   int acpi_sum_remain;
   70   int acpi_sum_rate;
   71   int acpi_sum_alarm;
   72 
   73 };
   74 
   75 
   76 #endif