summaryrefslogtreecommitdiffstats
path: root/src/power/power.h
blob: 2f923c8cb60a374a6c9b5e9d3a9ae160c1e19327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
 * Copyright (C) 2012-2013 Red Hat, Inc.  All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Authors: Radek Novacek <rnovacek@redhat.com>
 */

#ifndef POWER_H
#define POWER_H

#include <glib.h>
#include "globals.h"

const char *provider_name;
const ConfigEntry *provider_config_defaults;

typedef struct _Power Power;
typedef struct _PowerStateChangeJob PowerStateChangeJob;

/**
 * Get reference to global power object
 * \note Don't forget to call power_unref
 */
Power *power_ref(const CMPIBroker *_cb);

/**
 * Decrement reference counter for power struct
 */
void power_unref(Power *power);

/**
 * Get list of available requested power states
 *
 * \param power Pointer to power struct, obtained by power_ref
 * \param count Number of states returned
 * \return list of power states
 */
unsigned short *power_available_requested_power_states(Power *power, int *count);

/**
 * Get requested power state
 *
 * \param power Pointer to power struct, obtained by power_ref
 * \return current requested power state
 */
unsigned short power_requested_power_state(Power *power);

/**
 * Request change power state to \p state
 *
 * \param power Pointer to power struct, obtained by power_ref
 * \param state Requested power state
 * \return CMPI return code
 */
int power_request_power_state(Power *power, unsigned short state);

GList *power_get_jobs(Power *power);

unsigned short power_transitioning_to_power_state(Power *power);


unsigned short job_state(PowerStateChangeJob *state);
int job_timeOfLastChange(PowerStateChangeJob *state);
int job_timeBeforeRemoval(PowerStateChangeJob *state);
size_t job_id(PowerStateChangeJob *state);

#endif // POWER_H