Exemplo n.º 1
0
        void EnumerateDevices()
        {
            devices = new List <IUPowerDevice> ();

            foreach (string s in upower.EnumerateDevices())
            {
                IUPowerDevice device = Bus.System.GetObject <IUPowerDevice> (UPowerName, new ObjectPath(s));

                // only want batteries
                if (GetType(device) != 2)
                {
                    continue;
                }

                devices.Add(device);
            }
        }
Exemplo n.º 2
0
 uint GetType(IUPowerDevice device)
 {
     return(GetUInt(device, UPowerDeviceName, "Type"));
 }
Exemplo n.º 3
0
 uint GetState(IUPowerDevice device)
 {
     return(GetUInt(device, UPowerDeviceName, "State"));
 }
Exemplo n.º 4
0
 int GetTimeToFull(IUPowerDevice device)
 {
     return(GetInt(device, UPowerDeviceName, "TimeToFull"));
 }
Exemplo n.º 5
0
 int GetTimeToEmpty(IUPowerDevice device)
 {
     return(GetInt(device, UPowerDeviceName, "TimeToEmpty"));
 }
Exemplo n.º 6
0
 double GetEnergyFull(IUPowerDevice device)
 {
     return(GetDouble(device, UPowerDeviceName, "EnergyFull"));
 }