27 #ifndef LIBTHINKDOCK_LIBRARY_H    28 #define LIBTHINKDOCK_LIBRARY_H    30 #define LIBTHINKPAD_MAJOR 2    31 #define LIBTHINKPAD_MINOR 6    37 #define IBM_DOCK "/sys/devices/platform/dock.2"    38 #define IBM_DOCK_DOCKED     "/sys/devices/platform/dock.2/docked"    39 #define IBM_DOCK_MODALIAS   "/sys/devices/platform/dock.2/modalias"    40 #define IBM_DOCK_ID         "acpi:IBM0079:PNP0C15:LNXDOCK:\n"    41 #define ERR_INVALID (-1)    45 #define ACPI_POWERBUTTON "button/power PBTN"    46 #define ACPI_LID_OPEN "button/lid LID open"    47 #define ACPI_LID_CLOSE "button/lid LID close"    49 #define ACPI_DOCK_EVENT "ibm/hotkey LEN0068:00 00000080 00004010"    50 #define ACPI_DOCK_EVENT2 "ibm/hotkey LEN0268:00 00000080 00004010"    51 #define ACPI_UNDOCK_EVENT "ibm/hotkey LEN0068:00 00000080 00004011"    52 #define ACPI_UNDOCK_EVENT2 "ibm/hotkey LEN0268:00 00000080 00004011"    54 #define ACPI_BUTTON_BRIGHTNESS_UP "video/brightnessup BRTUP"    55 #define ACPI_BUTTON_BRIGHTNESS_DOWN "video/brightnessdown BRTDN"    56 #define ACPI_BUTTON_VOLUME_UP "button/volumeup VOLUP"    57 #define ACPI_BUTTON_VOLUME_DOWN "button/volumedown VOLDN"    58 #define ACPI_BUTTON_MICMUTE "button/f20 F20"    59 #define ACPI_BUTTON_MUTE "button/mute MUTE"    60 #define ACPI_BUTTON_THINKVANTAGE "button/prog1 PROG1"    61 #define ACPI_BUTTON_FNF2_LOCK "button/screenlock SCRNLCK"    62 #define ACPI_BUTTON_FNF3_BATTERY "button/battery BAT"    63 #define ACPI_BUTTON_FNF4_SLEEP "button/sleep SBTN"    64 #define ACPI_BUTTON_FNF5_WLAN "button/wlan WLAN"    65 #define ACPI_BUTTON_FNF7_PROJECTOR "video/switchmode VMOD"    66 #define ACPI_BUTTON_FNF12_HIBERNATE "button/suspend SUSP"    68 #define ACPID_SOCK "/var/run/acpid.socket"    70 #define SYSFS_THINKLIGHT "/sys/class/leds/tpacpi::thinklight/brightness"    71 #define SYSFS_MACHINECHECK "/sys/devices/system/machinecheck/machinecheck"    73 #define SYSFS_BACKLIGHT_NVIDIA "/sys/class/backlight/nv_backlight"    74 #define SYSFS_BACKLIGHT_INTEL "/sys/class/backlight/intel_backlight"    76 #define SYSFS_BATTERY_PRIMARY   "/sys/class/power_supply/BAT0"    77 #define SYSFS_BATTERY_SECONDARY "/sys/class/power_supply/BAT1"    85 typedef int SUSPEND_REASON;
   154             int getMaxBrightness(System system);
   155             int getCurrentBrightness(System system);
   156             void setBrightness(System system, 
int value);
   164             void setBacklightLevel(
float factor);
   170             float getBacklightLevel();
   182         class BatteryManager {
   199             int getChargeStartThreshold(BatteryID battery);
   206             int getChargeStopThreshold(BatteryID battery);
   213             int setChargeStopThreshold(BatteryID battery, 
int value);
   220             int setChargeStartThreshold(BatteryID battery, 
int value);
   227             bool probe(BatteryID battery);
   229             const char *getFRU(BatteryID battery);
   230             const char *getOEM(BatteryID battery);
   243     namespace PowerManagement {
   352             BUTTON_BRIGHTNESS_DOWN,
   371         struct _ACPIEventMetadata {
   376         typedef struct _ACPIEventMetadata ACPIEventMetadata;
   394             static bool suspend();
   418             static void *handle_acpid(
void*);
   419             static void *handle_udev(
void*);
   421             static pthread_t acpid_listener;
   422             static pthread_t udev_listener;
   424             vector<ACPIEventHandler*> *ACPIhandlers;
   426             bool udev_running = 
true;
   468             static void* _handleEvent(
void* _this);
   476             virtual void handleEvent(
ACPIEvent event) = 0;
   486     namespace Utilities {
   508                 IniKeypair(
const char *key, 
const char *value);
   533                 vector<IniKeypair*> *keypairs = 
nullptr;
   540                 const char *getString(
const char *key) 
const;
   547                 const void setString(
const char *key, 
const char *value);
   557                 const int getInt(
const char *key) 
const;
   564                 const void setInt(
const char *key, 
const int value);
   571                 const vector<int> getIntArray(
const char *key) 
const;
   578                 const void setIntArray(
const char *key, vector<int> *values);
   585                 const void setStringArray(
const char *key, 
const vector<const char*> *strings);
   592                 const vector<const char*> getStringArray(
const char *key);
   604                 vector<IniSection*> *sections = 
new vector<IniSection*>;
   614                 vector<IniSection*>* readIni(
string path);
   621                 bool writeIni(
string path);
   629                 vector<IniSection*> getSections(
const char *section);
   660                 return LIBTHINKPAD_MAJOR;
   668                 return LIBTHINKPAD_MINOR;
   675             static const char *fileRead(
const char *path);
   676             static const int intRead(
const char *path);
   677             static int intWrite(
const char *path, 
int value);
 Definition: libthinkpad.h:257
Definition: libthinkpad.h:332
Definition: libthinkpad.h:342
Definition: libthinkpad.h:262
Definition: libthinkpad.h:673
Definition: libthinkpad.h:282
static int getMinorVersion()
The minor version of the library. 
Definition: libthinkpad.h:667
The main libthinkpad interface. This contains all the libthinkpad features. 
Definition: libthinkpad.cpp:56
The Dock class is used to probe for the dock validity and probe for basic information about the dock...
Definition: libthinkpad.h:102
The ThinkLight class is ued to probe for the ThinkLight state and validity. 
Definition: libthinkpad.h:127
bool probe()
Probes the dock if it is an IBM dock and if the dock is sane and ready for detection/state changes...
Definition: libthinkpad.cpp:76
SuspendReason
this defines the reason why a system suspend was requested 
Definition: libthinkpad.h:363
static int getMajorVersion()
The major version of the library. If this changes, the ABI compat is broken. 
Definition: libthinkpad.h:659
This handles the system power state and ACPI event dispatches. 
Definition: libthinkpad.h:415
Definition: libthinkpad.h:272
Definition: libthinkpad.h:347
bool isDocked()
Check if the ThinkPad is physically docked into the UltraDock or the UltraBase. 
Definition: libthinkpad.cpp:60
This class represents a .ini/.conf/.desktop file parser based on the Windows INI standard. 
Definition: libthinkpad.h:602
Definition: libthinkpad.h:307
ACPIEvent
Varoius ACPI events that can occur on the ThinkPad. 
Definition: libthinkpad.h:252
Definition: libthinkpad.h:327
Class used for programs to access the library version. 
Definition: libthinkpad.h:651
Definition: libthinkpad.h:297
This is the abstract ACPI event handler class. 
Definition: libthinkpad.h:463
Definition: libthinkpad.h:514
Definition: libthinkpad.h:267
Class for hardware power management. 
Definition: libthinkpad.h:385
The backlight class is used to control the backlight level on the integrated laptop screen...
Definition: libthinkpad.h:147
Defines a keypair in a .ini file. 
Definition: libthinkpad.h:496
Definition: libthinkpad.h:302
Definition: libthinkpad.h:292
Definition: libthinkpad.h:277
Definition: libthinkpad.h:287
Definition: libthinkpad.h:337
Definition: libthinkpad.h:312
Definition: libthinkpad.h:317
Definition: libthinkpad.h:322