emulator.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /*
  2. *
  3. * oFono - Open Source Telephony
  4. *
  5. * Copyright (C) 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_EMULATOR_H
  22. #define __OFONO_EMULATOR_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #include <ofono/types.h>
  27. #define OFONO_EMULATOR_IND_BATTERY "battchg"
  28. #define OFONO_EMULATOR_IND_CALL "call"
  29. #define OFONO_EMULATOR_IND_CALLHELD "callheld"
  30. #define OFONO_EMULATOR_IND_CALLSETUP "callsetup"
  31. #define OFONO_EMULATOR_IND_ROAMING "roam"
  32. #define OFONO_EMULATOR_IND_SERVICE "service"
  33. #define OFONO_EMULATOR_IND_SIGNAL "signal"
  34. #define OFONO_EMULATOR_CALL_INACTIVE 0
  35. #define OFONO_EMULATOR_CALL_ACTIVE 1
  36. #define OFONO_EMULATOR_CALLSETUP_INACTIVE 0
  37. #define OFONO_EMULATOR_CALLSETUP_INCOMING 1
  38. #define OFONO_EMULATOR_CALLSETUP_OUTGOING 2
  39. #define OFONO_EMULATOR_CALLSETUP_ALERTING 3
  40. #define OFONO_EMULATOR_CALLHELD_NONE 0
  41. #define OFONO_EMULATOR_CALLHELD_MULTIPLE 1
  42. #define OFONO_EMULATOR_CALLHELD_ON_HOLD 2
  43. struct ofono_emulator;
  44. struct ofono_emulator_request;
  45. struct ofono_handsfree_card;
  46. enum ofono_emulator_type {
  47. OFONO_EMULATOR_TYPE_DUN,
  48. OFONO_EMULATOR_TYPE_HFP,
  49. };
  50. enum ofono_emulator_request_type {
  51. OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY,
  52. OFONO_EMULATOR_REQUEST_TYPE_QUERY,
  53. OFONO_EMULATOR_REQUEST_TYPE_SUPPORT,
  54. OFONO_EMULATOR_REQUEST_TYPE_SET,
  55. };
  56. typedef void (*ofono_emulator_request_cb_t)(struct ofono_emulator *em,
  57. struct ofono_emulator_request *req,
  58. void *data);
  59. struct ofono_emulator *ofono_emulator_create(struct ofono_modem *modem,
  60. enum ofono_emulator_type type);
  61. void ofono_emulator_register(struct ofono_emulator *em, int fd);
  62. void ofono_emulator_remove(struct ofono_emulator *em);
  63. void ofono_emulator_send_final(struct ofono_emulator *em,
  64. const struct ofono_error *final);
  65. void ofono_emulator_send_unsolicited(struct ofono_emulator *em,
  66. const char *result);
  67. void ofono_emulator_send_intermediate(struct ofono_emulator *em,
  68. const char *result);
  69. void ofono_emulator_send_info(struct ofono_emulator *em, const char *line,
  70. ofono_bool_t last);
  71. ofono_bool_t ofono_emulator_add_handler(struct ofono_emulator *em,
  72. const char *prefix,
  73. ofono_emulator_request_cb_t cb,
  74. void *data, ofono_destroy_func destroy);
  75. ofono_bool_t ofono_emulator_remove_handler(struct ofono_emulator *em,
  76. const char *prefix);
  77. ofono_bool_t ofono_emulator_request_next_string(
  78. struct ofono_emulator_request *req,
  79. const char **str);
  80. ofono_bool_t ofono_emulator_request_next_number(
  81. struct ofono_emulator_request *req,
  82. int *number);
  83. const char *ofono_emulator_request_get_raw(struct ofono_emulator_request *req);
  84. enum ofono_emulator_request_type ofono_emulator_request_get_type(
  85. struct ofono_emulator_request *req);
  86. void ofono_emulator_set_indicator(struct ofono_emulator *em,
  87. const char *name, int value);
  88. void ofono_emulator_set_hf_indicator_active(struct ofono_emulator *em,
  89. int indicator,
  90. ofono_bool_t active);
  91. void ofono_emulator_set_handsfree_card(struct ofono_emulator *em,
  92. struct ofono_handsfree_card *card);
  93. typedef void (*ofono_emulator_codec_negotiation_cb)(int err, void *data);
  94. int ofono_emulator_start_codec_negotiation(struct ofono_emulator *em,
  95. ofono_emulator_codec_negotiation_cb cb, void *data);
  96. #ifdef __cplusplus
  97. }
  98. #endif
  99. #endif /* __OFONO_EMULATOR_H */