battery: Relocate remove_health_popup() from mobile plugin
[platform/core/system/deviced.git] / src / battery / battery-ops.h
1 /*
2  * deviced
3  *
4  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19
20 #ifndef __BATTERY_OPS_H__
21 #define __BATTERY_OPS_H__
22
23 #include <errno.h>
24 #include "shared/common.h"
25 #include "power-supply.h"
26 #include <libsyscommon/libgdbus.h>
27
28 struct battery_ops {
29         char *name;
30         void (*init) (void *data);
31         void (*exit) (void *data);
32         int (*func) (unsigned int cmd, void *arg);
33 };
34
35 struct battery_plugin {
36         void *handle;
37
38         void (*launch_health_popup_by_display_state) (int display_state);
39         int (*check_power_supply_noti) (void);
40         /* Add plugins here */
41 };
42
43 void add_battery(const struct battery_ops *batt);
44 void remove_battery(const struct battery_ops *batt);
45 const struct battery_ops *find_battery_feature(const char *name);
46
47 void battery_ops_init(void *data);
48 void battery_ops_exit(void *data);
49
50 #define BATTERY_OPS_REGISTER(batt)      \
51 static void __CONSTRUCTOR__ module_init(void)   \
52 {       \
53         add_battery(batt);      \
54 }       \
55 static void __DESTRUCTOR__ module_exit(void)    \
56 {       \
57         remove_battery(batt);   \
58 }
59
60 #define FIND_BATTERY(dev, name) do { \
61         if (!dev) dev = find_battery_feature(name); \
62 } while (0)
63
64
65 #endif