~morphis/aethercast/add-urfkill-support2

« back to all changes in this revision

Viewing changes to src/w11tng/urfkillmanager.h

  • Committer: Simon Fels
  • Date: 2016-06-28 08:28:52 UTC
  • Revision ID: simon.fels@canonical.com-20160628082852-dr6h341t6bkrsizh
Implement URfkill based rfkill manager

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2016 Canonical, Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify it
 
5
 * under the terms of the GNU General Public License version 3, as published
 
6
 * by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful, but
 
9
 * WITHOUT ANY WARRANTY; without even the implied warranties of
 
10
 * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
 
11
 * PURPOSE.  See the GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License along
 
14
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
#ifndef W11TNG_URFKILL_MANAGER_H_
 
19
#define W11TNG_URFKILL_MANAGER_H_
 
20
 
 
21
#include "w11tng/rfkillmanager.h"
 
22
#include "ac/scoped_gobject.h"
 
23
 
 
24
#include <map>
 
25
 
 
26
namespace w11tng {
 
27
class URfkillManager : public RfkillManager,
 
28
                       public std::enable_shared_from_this<URfkillManager> {
 
29
public:
 
30
    static Ptr Create();
 
31
 
 
32
    static constexpr const char* kBusName{"org.freedesktop.URfkill"};
 
33
    static constexpr const char* kObjectPath{"/org/freedesktop/URfkill/WLAN"};
 
34
 
 
35
    ~URfkillManager();
 
36
 
 
37
    bool IsBlocked(const Type &type) override;
 
38
 
 
39
private:
 
40
    URfkillManager();
 
41
    Ptr FinalizeConstruction();
 
42
 
 
43
    void ParseProperties(GVariant *properties);
 
44
    void SyncProperties();
 
45
 
 
46
    static void OnPropertiesChanged(GDBusConnection *connection, const gchar *sender_name,
 
47
                                    const gchar *object_path, const gchar *interface_name,
 
48
                                    const gchar *signal_name, GVariant *parameters,
 
49
                                    gpointer user_data);
 
50
 
 
51
    ac::ScopedGObject<GDBusConnection> connection_;
 
52
    std::map<Type,bool> block_status_;
 
53
};
 
54
} // namespace w11tng
 
55
 
 
56
#endif