netmon.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. *
  3. * oFono - Open Source Telephony
  4. *
  5. * Copyright (C) 2008-2016 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_NETMON_H
  22. #define __OFONO_NETMON_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #include <ofono/types.h>
  27. struct ofono_netmon;
  28. typedef void (*ofono_netmon_cb_t)(const struct ofono_error *error, void *data);
  29. struct ofono_netmon_driver {
  30. const char *name;
  31. int (*probe)(struct ofono_netmon *netmon, unsigned int vendor,
  32. void *data);
  33. void (*remove)(struct ofono_netmon *netmon);
  34. void (*request_update)(struct ofono_netmon *netmon,
  35. ofono_netmon_cb_t cb, void *data);
  36. };
  37. enum ofono_netmon_cell_type {
  38. OFONO_NETMON_CELL_TYPE_GSM,
  39. OFONO_NETMON_CELL_TYPE_UMTS,
  40. OFONO_NETMON_CELL_TYPE_LTE,
  41. };
  42. enum ofono_netmon_info {
  43. OFONO_NETMON_INFO_MCC, /* char *, up to 3 digits + null */
  44. OFONO_NETMON_INFO_MNC, /* char *, up to 3 digits + null */
  45. OFONO_NETMON_INFO_LAC, /* int */
  46. OFONO_NETMON_INFO_CI, /* int */
  47. OFONO_NETMON_INFO_ARFCN, /* int */
  48. OFONO_NETMON_INFO_BSIC, /* int */
  49. OFONO_NETMON_INFO_RXLEV, /* int */
  50. OFONO_NETMON_INFO_BER, /* int */
  51. OFONO_NETMON_INFO_RSSI, /* int */
  52. OFONO_NETMON_INFO_TIMING_ADVANCE, /* int */
  53. OFONO_NETMON_INFO_PSC, /* int */
  54. OFONO_NETMON_INFO_INVALID,
  55. };
  56. /*
  57. * Examples:
  58. * ofono_netmon_serving_cell_notify(netmon, OFONO_NETMON_CELL_TYPE_GSM,
  59. * OFONO_NETMON_INFO_MCC, "123",
  60. * OFONO_NETMON_INFO_MNC, "456",
  61. * OFONO_NETMON_INFO_LAC, lac,
  62. * OFONO_NETMON_INFO_CI, ci,
  63. * OFONO_NETMON_INFO_RSSI, rssi,
  64. * OFONO_NETMON_INFO_RXLEV, rxlev,
  65. * OFONO_NETMON_INFO_INVALID);
  66. */
  67. void ofono_netmon_serving_cell_notify(struct ofono_netmon *netmon,
  68. enum ofono_netmon_cell_type type,
  69. int info_type, ...);
  70. int ofono_netmon_driver_register(const struct ofono_netmon_driver *d);
  71. void ofono_netmon_driver_unregister(const struct ofono_netmon_driver *d);
  72. struct ofono_netmon *ofono_netmon_create(struct ofono_modem *modem,
  73. unsigned int vendor,
  74. const char *driver, void *data);
  75. void ofono_netmon_register(struct ofono_netmon *netmon);
  76. void ofono_netmon_remove(struct ofono_netmon *netmon);
  77. void ofono_netmon_set_data(struct ofono_netmon *netmon, void *data);
  78. void *ofono_netmon_get_data(struct ofono_netmon *netmon);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __OFONO_NETMON_H */