dmi_power_controls

Synopsis

#include <opendmi/entity/power-controls.h>

typedef struct dmi_power_controls {
    unsigned short poweron_month;
    unsigned short poweron_day;
    unsigned short poweron_hour;
    unsigned short poweron_minute;
    unsigned short poweron_second;
} dmi_power_controls_t;

Description

The dmi_power_controls_t structure holds the decoded system power controls structure (type 25) of SMBIOS. Its presence tells that the system can be powered on at a set time; the fields give the date and time of the next scheduled power-on, from which software computes the number of seconds left until it.

The structure stores the values as binary-coded decimals; the decoder converts them to plain numbers. A field which is not set holds 0xFF, which is no decimal, and is decoded into USHRT_MAX. Such a field, and any value out of the range of its field, takes no part in the schedule: for example, a month which is not set means that the power-on falls within the next month.

The structure is returned by dmi_entity_info for the structures of type DMI_TYPE(power_controls), and lives as long as the context it has been decoded in.

Fields

poweron_month

Month of the next scheduled power-on, 1 to 12.

poweron_day

Day of the month of the next scheduled power-on, 1 to 31.

poweron_hour

Hour of the next scheduled power-on, 0 to 23.

poweron_minute

Minute of the next scheduled power-on, 0 to 59.

poweron_second

Second of the next scheduled power-on, 0 to 59.

Examples

dmi_registry_t       *registry = dmi_get_registry(context);
dmi_entity_t         *entity   = dmi_registry_lookup_first(registry,
                                     DMI_TYPE(power_controls), false);
dmi_power_controls_t *power    = dmi_entity_info(entity,
                                     DMI_TYPE(power_controls));

if (power != nullptr)
    printf("Next power-on: %02u-%02u %02u:%02u:%02u\n",
           power->poweron_month, power->poweron_day, power->poweron_hour,
           power->poweron_minute, power->poweron_second);

See also

Standards

DMTF SMBIOS Specification (DSP0134), version 2.2 or newer.