gatchat: Print error message if opening tun failes
[platform/upstream/ofono.git] / include / call-meter.h
1 /*
2  *
3  *  oFono - Open Telephony stack for Linux
4  *
5  *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License version 2 as
9  *  published by the Free Software Foundation.
10  *
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU General Public License for more details.
15  *
16  *  You should have received a copy of the GNU General Public License
17  *  along with this program; if not, write to the Free Software
18  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19  *
20  */
21
22 #ifndef __OFONO_CALL_METER_H
23 #define __OFONO_CALL_METER_H
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include <ofono/types.h>
30
31 struct ofono_call_meter;
32
33 typedef void (*ofono_call_meter_query_cb_t)(const struct ofono_error *error,
34                                                 int value, void *data);
35
36 typedef void (*ofono_call_meter_puct_query_cb_t)(
37                                         const struct ofono_error *error,
38                                         const char *currency, double ppu,
39                                         void *data);
40
41 typedef void(*ofono_call_meter_set_cb_t)(const struct ofono_error *error,
42                                                 void *data);
43
44 struct ofono_call_meter_driver {
45         const char *name;
46         int (*probe)(struct ofono_call_meter *cm, unsigned int vendor,
47                         void *data);
48         void (*remove)(struct ofono_call_meter *cm);
49         void (*call_meter_query)(struct ofono_call_meter *cm,
50                                 ofono_call_meter_query_cb_t cb, void *data);
51         void (*acm_query)(struct ofono_call_meter *cm,
52                                 ofono_call_meter_query_cb_t cb, void *data);
53         void (*acm_reset)(struct ofono_call_meter *cm, const char *sim_pin2,
54                                 ofono_call_meter_set_cb_t cb, void *data);
55         void (*acm_max_query)(struct ofono_call_meter *cm,
56                                 ofono_call_meter_query_cb_t cb, void *data);
57         void (*acm_max_set)(struct ofono_call_meter *cm, int new_value,
58                                 const char *sim_pin2,
59                                 ofono_call_meter_set_cb_t cb, void *data);
60         void (*puct_query)(struct ofono_call_meter *cm,
61                         ofono_call_meter_puct_query_cb_t cb, void *data);
62         void (*puct_set)(struct ofono_call_meter *cm, const char *currency,
63                                 double ppu, const char *sim_pin2,
64                                 ofono_call_meter_set_cb_t cb, void *data);
65 };
66
67 int ofono_call_meter_driver_register(const struct ofono_call_meter_driver *d);
68 void ofono_call_meter_driver_unregister(
69                                 const struct ofono_call_meter_driver *d);
70
71 struct ofono_call_meter *ofono_call_meter_create(struct ofono_modem *modem,
72                                                         unsigned int vendor,
73                                                         const char *driver,
74                                                         void *data);
75
76 void ofono_call_meter_register(struct ofono_call_meter *cm);
77 void ofono_call_meter_remove(struct ofono_call_meter *cm);
78
79 void ofono_call_meter_maximum_notify(struct ofono_call_meter *cm);
80 void ofono_call_meter_changed_notify(struct ofono_call_meter *cm,
81                                         int new_value);
82
83 void ofono_call_meter_set_data(struct ofono_call_meter *cm, void *data);
84 void *ofono_call_meter_get_data(struct ofono_call_meter *cm);
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90 #endif /* __OFONO_CALL_METER_H */