![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Get the value of the property associated with a power managed object
#include <sys/pm.h>
int pm_get_property(pm_hdl_t hdl,
pm_property_t id,
void *value,
int size);
libpm
The pm_get_property() obtains the current value of the specified property associated with a power managed object.
#include <sys/pm.h> #include <stat.h> #include <stdlib.h>
// define a property identifier and structure containing property data
#define PROP_ID (PM_PROPERTY_USER + 1)
struct prop_value {
int data1;
int data2;
};
int
main()
{
pm_hdl_t hdl;
struct prop_value value = { 1, 2 };
hdl = pm_attach("object", O_RDWR);
if (!pm_valid_hdl(hdl)) {
perror("pm_attach");
return EXIT_FAILURE;
}
if (pm_get_property(hdl, PROP_ID, &value, sizeof value) == -1) {
perror("pm_add_property");
return EXIT_FAILURE;
}
printf("data1 = %d\n", value.data1);
printf("data2 = %d\n", value.data2);
return EXIT_SUCCESS;
}
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
pm_add_property(), pm_set_property(), pm_properties()
![]() |
![]() |
![]() |