Add UPower Device interface
Add a YAML description of the UPower Device interface defined at
https://upower.freedesktop.org/docs/Device.html
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: Ib70d6525b913cf06da4e93a53e332487126f1db0
diff --git a/README.md b/README.md
index 41d0d66..df63ef7 100644
--- a/README.md
+++ b/README.md
@@ -14,8 +14,8 @@
## Configuration
-Only the xyz/openbmc_project interfaces are built by default. Other interfaces
-can be enabled by meson options:
+Only the xyz/openbmc_project and org/freedesktop interfaces are built by
+default. Other interfaces can be enabled by meson options:
- com/ibm - `-Ddata_com_ibm=true`
- org/open_power - `-Ddata_org_open_power=true`
diff --git a/gen/org/freedesktop/UPower/Device/meson.build b/gen/org/freedesktop/UPower/Device/meson.build
new file mode 100644
index 0000000..79421b7
--- /dev/null
+++ b/gen/org/freedesktop/UPower/Device/meson.build
@@ -0,0 +1,14 @@
+# Generated file; do not modify.
+generated_sources += custom_target(
+ 'org/freedesktop/UPower/Device__cpp'.underscorify(),
+ input: [ '../../../../../yaml/org/freedesktop/UPower/Device.interface.yaml', ],
+ output: [ 'server.cpp', 'server.hpp', 'client.hpp', ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'cpp',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../../yaml',
+ 'org/freedesktop/UPower/Device',
+ ],
+)
+
diff --git a/gen/org/freedesktop/UPower/meson.build b/gen/org/freedesktop/UPower/meson.build
new file mode 100644
index 0000000..5569eff
--- /dev/null
+++ b/gen/org/freedesktop/UPower/meson.build
@@ -0,0 +1,15 @@
+# Generated file; do not modify.
+subdir('Device')
+generated_others += custom_target(
+ 'org/freedesktop/UPower/Device__markdown'.underscorify(),
+ input: [ '../../../../yaml/org/freedesktop/UPower/Device.interface.yaml', ],
+ output: [ 'Device.md' ],
+ command: [
+ sdbuspp_gen_meson_prog, '--command', 'markdown',
+ '--output', meson.current_build_dir(),
+ '--tool', sdbusplusplus_prog,
+ '--directory', meson.current_source_dir() / '../../../../yaml',
+ 'org/freedesktop/UPower/Device',
+ ],
+)
+
diff --git a/gen/org/freedesktop/meson.build b/gen/org/freedesktop/meson.build
new file mode 100644
index 0000000..1ee0a87
--- /dev/null
+++ b/gen/org/freedesktop/meson.build
@@ -0,0 +1,2 @@
+# Generated file; do not modify.
+subdir('UPower')
diff --git a/gen/org/meson.build b/gen/org/meson.build
index 6488f22..dc6fcbb 100644
--- a/gen/org/meson.build
+++ b/gen/org/meson.build
@@ -1,2 +1,3 @@
# Generated file; do not modify.
+subdir('freedesktop')
subdir('open_power')
diff --git a/meson.build b/meson.build
index 7b2ad92..be863f2 100644
--- a/meson.build
+++ b/meson.build
@@ -29,6 +29,9 @@
if get_option('data_com_ibm')
selected_subdirs += 'com/ibm'
endif
+if get_option('data_org_freedesktop')
+ selected_subdirs += 'org/freedesktop'
+endif
if get_option('data_org_open_power')
selected_subdirs += 'org/open_power'
endif
diff --git a/meson_options.txt b/meson_options.txt
index aa06d2e..30a49de 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,5 +1,6 @@
option('generate_md', type: 'boolean', value: true)
option('libphosphor_dbus', type: 'boolean', value: true)
option('data_com_ibm', type: 'boolean', value: false)
+option('data_org_freedesktop', type: 'boolean', value: true)
option('data_org_open_power', type: 'boolean', value: false)
option('data_xyz_openbmc_project', type: 'boolean', value: true)
diff --git a/yaml/org/freedesktop/UPower/Device.interface.yaml b/yaml/org/freedesktop/UPower/Device.interface.yaml
new file mode 100644
index 0000000..9f13d61
--- /dev/null
+++ b/yaml/org/freedesktop/UPower/Device.interface.yaml
@@ -0,0 +1,290 @@
+description: >
+ "org.freedesktop.UPower.Device -- Device interface
+ Defined at https://upower.freedesktop.org/docs/Device.html
+ Objects implementing org.freedesktop.UPower.Device also implement the
+ org.freedesktop.DBus.Introspectable and org.freedesktop.DBus.Properties
+ interfaces. Unless otherwise noted, an empty string or the value 0 in a
+ property on this interface means not set."
+
+methods:
+ - name: Refresh
+ description: >
+ "Refreshes the data collected from the power source. Callers need the
+ org.freedesktop.upower.refresh-power-source authorization"
+
+ - name: GetHistory
+ description: >
+ "Gets history for the power device that is persistent across
+ reboots."
+ parameters:
+ - name: type
+ type: string
+ description: >
+ "The type of history. Valid types are rate or charge."
+ - name: timespan
+ type: uint32
+ description: >
+ "The amount of data to return in seconds, or 0 for all."
+ - name: resolution
+ type: uint32
+ description: >
+ "The approximate number of points to return. A higher resolution is
+ more accurate, at the expense of plotting speed."
+ returns:
+ - name: data
+ type: array[struct[uint32, double, uint32]]
+ description: >
+ "The history data for the power device, if the device supports
+ history. Data is ordered from the earliest in time, to the newest
+ data point. Each element contains the following members:
+ time: The time value in seconds from the gettimeofday() method.
+ value: The data value, for instance the rate in W or the charge
+ in %.
+ state: The state of the device, for instance charging or
+ discharging."
+
+ - name: GetStatistics
+ description: >
+ "Gets statistics for the power device that may be interesting to show
+ on a graph in the session."
+ parameters:
+ - name: type
+ type: string
+ description: >
+ "The mode for the statistics. Valid types are charging or
+ discharging."
+ returns:
+ - name: data
+ type: array[struct[double, double]]
+ description: >
+ "The statistics data for the power device. Each element contains the
+ following members:
+ value: The value of the percentage point, usually in seconds.
+ accuracy: The accuracy of the prediction in percent."
+
+properties:
+ - name: NativePath
+ default: ""
+ type: string
+ description: >
+ "OS specific native path of the power source. On Linux this is the
+ sysfs path, for example
+ /sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0. Is
+ blank if the device is being driven by a user space driver."
+ - name: Vendor
+ default: ""
+ type: string
+ description: >
+ "Name of the vendor of the battery."
+ - name: Model
+ default: ""
+ type: string
+ description: >
+ "Name of the model of this battery."
+ - name: Serial
+ default: ""
+ type: string
+ description: >
+ "Unique serial number of the battery."
+ - name: UpdateTime
+ default: 0
+ type: uint64
+ description: >
+ "The point in time (seconds since the Epoch Jan 1, 1970 0:00 UTC)
+ that data was read from the power source."
+ - name: Type
+ default: 0
+ type: uint32
+ description: >
+ "Type of power source.
+ 0: Unknown
+ 1: Line Power
+ 2: Battery
+ 3: Ups
+ 4: Monitor
+ 5: Mouse
+ 6: Keyboard
+ 7: Pda
+ 8: Phone"
+ - name: PowerSupply
+ default: false
+ type: boolean
+ description: >
+ "If the power device is used to supply the system. This would be set
+ TRUE for laptop batteries and UPS devices, but set FALSE for wireless
+ mice or PDAs."
+ - name: HasHistory
+ default: false
+ type: boolean
+ description: >
+ "If the power device has history."
+ - name: HasStatistics
+ default: false
+ type: boolean
+ description: >
+ "If the power device has statistics."
+ - name: Online
+ default: false
+ type: boolean
+ description: >
+ "Whether power is currently being provided through line power. This
+ property is only valid if the property type has the value
+ 'line-power'."
+ - name: Energy
+ default: 0.0
+ type: double
+ description: >
+ "Amount of energy (measured in Wh) currently available in the power
+ source. This property is only valid if the property type has the
+ value 'battery'."
+ - name: EnergyEmpty
+ default: 0.0
+ type: double
+ description: >
+ "Amount of energy (measured in Wh) in the power source when it's
+ considered to be empty. This property is only valid if the property
+ type has the value 'battery'."
+ - name: EnergyFull
+ default: 0.0
+ type: double
+ description: >
+ "Amount of energy (measured in Wh) in the power source when it's
+ considered full. This property is only valid if the property type
+ has the value 'battery'."
+ - name: EnergyFullDesign
+ default: 0.0
+ type: double
+ description: >
+ "Amount of energy (measured in Wh) the power source is designed to
+ hold when it's considered full. This property is only valid if the
+ property type has the value 'battery'."
+ - name: EnergyRate
+ default: 0.0
+ type: double
+ description: >
+ "Amount of energy being drained from the source, measured in W. If
+ positive, the source is being discharged, if negative it's being
+ charged. This property is only valid if the property type has the
+ value 'battery'."
+ - name: Voltage
+ default: 0.0
+ type: double
+ description: >
+ "Voltage in the Cell or being recorded by the meter."
+ - name: Luminosity
+ default: 0.0
+ type: double
+ description: >
+ "Luminosity being recorded by the meter."
+ - name: TimeToEmpty
+ default: 0
+ type: int64
+ description: >
+ "Number of seconds until the power source is considered empty. Is set
+ to 0 if unknown. This property is only valid if the property type
+ has the value 'battery'."
+ - name: TimeToFull
+ default: 0
+ type: int64
+ description: >
+ "Number of seconds until the power source is considered full. Is set
+ to 0 if unknown. This property is only valid if the property type
+ has the value 'battery'."
+ - name: Percentage
+ default: 0.0
+ type: double
+ description: >
+ "The amount of energy left in the power source expressed as a
+ percentage between 0 and 100. Typically this is the same as (energy -
+ energy-empty) / (energy-full - energy-empty). However, some primitive
+ power sources are capable of only reporting percentages and in this
+ case the energy-* properties will be unset while this property is
+ set. This property is only valid if the property type has the value
+ 'battery'."
+ - name: Temperature
+ default: 0.0
+ type: double
+ description: >
+ "The temperature of the device in degrees Celsius. This property is
+ only valid if the property type has the value 'battery'."
+ - name: IsPresent
+ default: false
+ type: boolean
+ description: >
+ "If the power source is present in the bay. This field is required as
+ some batteries are hot-removable, for example expensive UPS and most
+ laptop batteries. This property is only valid if the property type
+ has the value 'battery'."
+ - name: State
+ default: 0
+ type: uint32
+ description: >
+ "The battery power state.
+ 0: Unknown
+ 1: Charging
+ 2: Discharging
+ 3: Empty
+ 4: Fully charged
+ 5: Pending charge
+ 6: Pending discharge
+ This property is only valid if the property type has the value
+ 'battery'."
+ - name: IsRechargeable
+ default: false
+ type: boolean
+ description: >
+ "If the power source is rechargeable. This property is only valid if
+ the property type has the value 'battery'."
+ - name: Capacity
+ default: 0.0
+ type: double
+ description: >
+ "The capacity of the power source expressed as a percentage between 0
+ and 100. The capacity of the battery will reduce with age. A capacity
+ value less than 75% is usually a sign that you should renew your
+ battery. Typically this value is the same as (full-design / full) *
+ 100. However, some primitive power sources are not capable reporting
+ capacity and in this case the capacity property will be unset. This
+ property is only valid if the property type has the value 'battery'."
+ - name: Technology
+ default: 0
+ type: uint32
+ description: >
+ "Technology used in the battery:
+ 0: Unknown
+ 1: Lithium ion
+ 2: Lithium polymer
+ 3: Lithium iron phosphate
+ 4: Lead acid
+ 5: Nickel cadmium
+ 6: Nickel metal hydride
+ This property is only valid if the property type has the value
+ 'battery'."
+ - name: WarningLevel
+ default: 0
+ type: uint32
+ description: >
+ "Warning level of the battery:
+ 0: Unknown
+ 1: None
+ 2: Discharging (only for UPSes)
+ 3: Low
+ 4: Critical
+ 5: Action"
+ - name: BatteryLevel
+ default: 0
+ type: uint32
+ description: >
+ "Level of the battery:
+ 0: Unknown
+ 1: None (the battery does not use a coarse level of battery reporting)
+ 3: Low
+ 4: Critical
+ 6: Normal
+ 7: High
+ 8: Full"
+ - name: IconName
+ default: ""
+ type: string
+ description: >
+ "An icon name, following the Icon Naming Specification"