call-meter.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. #ifndef __OFONO_CALL_METER_H
  22. #define __OFONO_CALL_METER_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #include <ofono/types.h>
  27. struct ofono_call_meter;
  28. typedef void (*ofono_call_meter_query_cb_t)(const struct ofono_error *error,
  29. int value, void *data);
  30. typedef void (*ofono_call_meter_puct_query_cb_t)(
  31. const struct ofono_error *error,
  32. const char *currency, double ppu,
  33. void *data);
  34. typedef void(*ofono_call_meter_set_cb_t)(const struct ofono_error *error,
  35. void *data);
  36. struct ofono_call_meter_driver {
  37. const char *name;
  38. int (*probe)(struct ofono_call_meter *cm, unsigned int vendor,
  39. void *data);
  40. void (*remove)(struct ofono_call_meter *cm);
  41. void (*call_meter_query)(struct ofono_call_meter *cm,
  42. ofono_call_meter_query_cb_t cb, void *data);
  43. void (*acm_query)(struct ofono_call_meter *cm,
  44. ofono_call_meter_query_cb_t cb, void *data);
  45. void (*acm_reset)(struct ofono_call_meter *cm, const char *sim_pin2,
  46. ofono_call_meter_set_cb_t cb, void *data);
  47. void (*acm_max_query)(struct ofono_call_meter *cm,
  48. ofono_call_meter_query_cb_t cb, void *data);
  49. void (*acm_max_set)(struct ofono_call_meter *cm, int new_value,
  50. const char *sim_pin2,
  51. ofono_call_meter_set_cb_t cb, void *data);
  52. void (*puct_query)(struct ofono_call_meter *cm,
  53. ofono_call_meter_puct_query_cb_t cb, void *data);
  54. void (*puct_set)(struct ofono_call_meter *cm, const char *currency,
  55. double ppu, const char *sim_pin2,
  56. ofono_call_meter_set_cb_t cb, void *data);
  57. };
  58. int ofono_call_meter_driver_register(const struct ofono_call_meter_driver *d);
  59. void ofono_call_meter_driver_unregister(
  60. const struct ofono_call_meter_driver *d);
  61. struct ofono_call_meter *ofono_call_meter_create(struct ofono_modem *modem,
  62. unsigned int vendor,
  63. const char *driver,
  64. void *data);
  65. void ofono_call_meter_register(struct ofono_call_meter *cm);
  66. void ofono_call_meter_remove(struct ofono_call_meter *cm);
  67. void ofono_call_meter_maximum_notify(struct ofono_call_meter *cm);
  68. void ofono_call_meter_changed_notify(struct ofono_call_meter *cm,
  69. int new_value);
  70. void ofono_call_meter_set_data(struct ofono_call_meter *cm, void *data);
  71. void *ofono_call_meter_get_data(struct ofono_call_meter *cm);
  72. #ifdef __cplusplus
  73. }
  74. #endif
  75. #endif /* __OFONO_CALL_METER_H */