~ricmm/powerd/support-mir-toggled

« back to all changes in this revision

Viewing changes to cli/powerd-cli.h

  • Committer: Tarmac
  • Author(s): Seth Forshee
  • Date: 2013-07-24 21:30:33 UTC
  • mfrom: (72.2.17 register-ack-api)
  • Revision ID: tarmac-20130724213033-q0697hki6gdgxoq6
Add support for registering clients to acknowledge system state changes.

Approved by PS Jenkins bot, Matthew Fischer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2013 Canonical Ltd.
 
3
 *
 
4
 * This file is part of powerd.
 
5
 *
 
6
 * powerd is free software; you can redistribute it and/or modify
 
7
 * it under the terms of the GNU General Public License as published by
 
8
 * the Free Software Foundation; version 3.
 
9
 *
 
10
 * powerd is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef __POWERD_CLI_H__
 
20
#define __POWERD_CLI_H__
 
21
 
 
22
#include <powerd.h>
 
23
 
 
24
#define do_test(test)                                               \
 
25
    ({                                                              \
 
26
        gboolean result;                                            \
 
27
        printf("Test: " #test "\n");                                \
 
28
        result = (test);                                            \
 
29
        printf("    result: %s\n", result ? "PASSED" : "FAILED");   \
 
30
        result;                                                     \
 
31
    })
 
32
 
 
33
extern gboolean silent_errors;
 
34
 
 
35
#define cli_warn(f, a...)   do { if (!silent_errors) g_warning(f, ##a); } while (0)
 
36
#define cli_debug(f, a...)  g_debug(f, ##a)
 
37
 
 
38
gboolean requestSysState(int state, powerd_cookie_t *cookie);
 
39
gboolean clearSysState(powerd_cookie_t cookie);
 
40
void powerd_cli_client_test(GDBusProxy *proxy);
 
41
 
 
42
#endif /* __POWERD_CLI_H__ */