Skip to main content
Version: 12 Dec 2024

MLPowerManagerComponentProperty

Module: Power Manager

A structure to encapsulate the data for each MLPowerManagerPropertyType. More...

#include <ml_power_manager.h>

Public Attributes

TypeName
MLPowerManagerPropertyTypeproperty_type
union MLPowerManagerComponentProperty::@25Anonymous 26

Detailed Description

struct MLPowerManagerComponentProperty;

A structure to encapsulate the data for each MLPowerManagerPropertyType.

This struct and union is used as a flexible way for each component to output an array containing distinct types of data.

The below code shows how a Controller could output battery_info, battery_level, charging_state or connection_state. Where data is an instance of MLPowerManagerPropertyData returned from MLPowerManagerGetComponentProperties.

auto properties = data.properties;
for (int num = 0; num < data.size; num++) {
switch (properties[num]->property_type) {
case (MLPowerManagerPropertyType_BatteryInfo):
// Process properties[num]->battery_info enum
break;
case (MLPowerManagerPropertyType_BatteryLevel):
// Process properties[num]->battery_level as integer
break;
case (MLPowerManagerPropertyType_ChargingState):
// Process properties[num]->charging_state as enum
break;
case (MLPowerManagerPropertyType_ConnectionState):
// Process properties[num]->connection_state as enum
break;
default:
// Error handle if default case
break;
}
}

API Level:

  • 27

Public Attributes Documentation

property_type

MLPowerManagerPropertyType property_type;
TypeDescription
MLPowerManagerPropertyTypePower Manager property types. Query MLPowerManagerGetAvailableProperties() to determine which Power Manager properties are available for each component.

The type of each property.


Anonymous 26

union MLPowerManagerComponentProperty::@25 Anonymous 26;