radio-settings.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. /*
  2. *
  3. * oFono - Open Source Telephony
  4. *
  5. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  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_RADIO_SETTINGS_H
  22. #define __OFONO_RADIO_SETTINGS_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #include <ofono/types.h>
  27. enum ofono_radio_access_mode {
  28. OFONO_RADIO_ACCESS_MODE_ANY = 0x0,
  29. OFONO_RADIO_ACCESS_MODE_GSM = 0x1,
  30. OFONO_RADIO_ACCESS_MODE_UMTS = 0x2,
  31. OFONO_RADIO_ACCESS_MODE_LTE = 0x4,
  32. };
  33. enum ofono_radio_band_gsm {
  34. OFONO_RADIO_BAND_GSM_ANY,
  35. OFONO_RADIO_BAND_GSM_850,
  36. OFONO_RADIO_BAND_GSM_900P,
  37. OFONO_RADIO_BAND_GSM_900E,
  38. OFONO_RADIO_BAND_GSM_1800,
  39. OFONO_RADIO_BAND_GSM_1900,
  40. };
  41. enum ofono_radio_band_umts {
  42. OFONO_RADIO_BAND_UMTS_ANY,
  43. OFONO_RADIO_BAND_UMTS_850,
  44. OFONO_RADIO_BAND_UMTS_900,
  45. OFONO_RADIO_BAND_UMTS_1700AWS,
  46. OFONO_RADIO_BAND_UMTS_1900,
  47. OFONO_RADIO_BAND_UMTS_2100,
  48. };
  49. struct ofono_radio_settings;
  50. typedef void (*ofono_radio_settings_rat_mode_set_cb_t)(
  51. const struct ofono_error *error,
  52. void *data);
  53. typedef void (*ofono_radio_settings_rat_mode_query_cb_t)(
  54. const struct ofono_error *error,
  55. enum ofono_radio_access_mode mode,
  56. void *data);
  57. typedef void (*ofono_radio_settings_band_set_cb_t)(
  58. const struct ofono_error *error,
  59. void *data);
  60. typedef void (*ofono_radio_settings_band_query_cb_t)(
  61. const struct ofono_error *error,
  62. enum ofono_radio_band_gsm band_gsm,
  63. enum ofono_radio_band_umts band_umts,
  64. void *data);
  65. typedef void (*ofono_radio_settings_fast_dormancy_set_cb_t)(
  66. const struct ofono_error *error,
  67. void *data);
  68. typedef void (*ofono_radio_settings_fast_dormancy_query_cb_t)(
  69. const struct ofono_error *error,
  70. ofono_bool_t enable,
  71. void *data);
  72. typedef void (*ofono_radio_settings_available_rats_query_cb_t)(
  73. const struct ofono_error *error,
  74. unsigned int available_rats,
  75. void *data);
  76. struct ofono_radio_settings_driver {
  77. const char *name;
  78. int (*probe)(struct ofono_radio_settings *rs, unsigned int vendor,
  79. void *data);
  80. void (*remove)(struct ofono_radio_settings *rs);
  81. void (*query_rat_mode)(struct ofono_radio_settings *rs,
  82. ofono_radio_settings_rat_mode_query_cb_t cb,
  83. void *data);
  84. void (*set_rat_mode)(struct ofono_radio_settings *rs,
  85. enum ofono_radio_access_mode mode,
  86. ofono_radio_settings_rat_mode_set_cb_t cb,
  87. void *data);
  88. void (*query_band)(struct ofono_radio_settings *rs,
  89. ofono_radio_settings_band_query_cb_t cb,
  90. void *data);
  91. void (*set_band)(struct ofono_radio_settings *rs,
  92. enum ofono_radio_band_gsm band_gsm,
  93. enum ofono_radio_band_umts band_umts,
  94. ofono_radio_settings_band_set_cb_t cb,
  95. void *data);
  96. void (*query_fast_dormancy)(struct ofono_radio_settings *rs,
  97. ofono_radio_settings_fast_dormancy_query_cb_t cb,
  98. void *data);
  99. void (*set_fast_dormancy)(struct ofono_radio_settings *rs,
  100. ofono_bool_t enable,
  101. ofono_radio_settings_fast_dormancy_set_cb_t,
  102. void *data);
  103. void (*query_available_rats)(struct ofono_radio_settings *rs,
  104. ofono_radio_settings_available_rats_query_cb_t cb,
  105. void *data);
  106. };
  107. int ofono_radio_settings_driver_register(
  108. const struct ofono_radio_settings_driver *d);
  109. void ofono_radio_settings_driver_unregister(
  110. const struct ofono_radio_settings_driver *d);
  111. struct ofono_radio_settings *ofono_radio_settings_create(
  112. struct ofono_modem *modem,
  113. unsigned int vendor,
  114. const char *driver, void *data);
  115. void ofono_radio_settings_register(struct ofono_radio_settings *rs);
  116. void ofono_radio_settings_remove(struct ofono_radio_settings *rs);
  117. void ofono_radio_settings_set_data(struct ofono_radio_settings *rs, void *data);
  118. void *ofono_radio_settings_get_data(struct ofono_radio_settings *rs);
  119. struct ofono_modem *ofono_radio_settings_get_modem(
  120. struct ofono_radio_settings *rs);
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124. #endif /* __OFONO_RADIO_SETTINGS_H */