4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef __BATTERY_OPS_H__
21 #define __BATTERY_OPS_H__
24 #include "shared/common.h"
25 #include "power-supply.h"
26 #include <libsyscommon/libgdbus.h>
30 void (*init) (void *data);
31 void (*exit) (void *data);
32 int (*func) (unsigned int cmd, void *arg);
35 struct battery_plugin {
37 /* low battery notification */
38 int (*lowbat_noti_launch) (int capacity, int option);
39 void (*lowbat_noti_clean) (const char *prev, const char *str);
41 void (*remove_health_popup) (void);
43 void (*launch_health_popup_by_display_state) (int display_state);
44 int (*check_power_supply_noti) (void);
45 void (*update_ovp) (enum battery_noti_status status);
46 /* Add plugins here */
49 void add_battery(const struct battery_ops *batt);
50 void remove_battery(const struct battery_ops *batt);
51 const struct battery_ops *find_battery_feature(const char *name);
53 void battery_ops_init(void *data);
54 void battery_ops_exit(void *data);
56 #define BATTERY_OPS_REGISTER(batt) \
57 static void __CONSTRUCTOR__ module_init(void) \
61 static void __DESTRUCTOR__ module_exit(void) \
63 remove_battery(batt); \
66 #define FIND_BATTERY(dev, name) do { \
67 if (!dev) dev = find_battery_feature(name); \