bta_mce_api.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /******************************************************************************
  2. *
  3. * Copyright 2014 The Android Open Source Project
  4. * Copyright 2006-2012 Broadcom Corporation
  5. *
  6. * Licensed under the Apache License, Version 2.0 (the "License");
  7. * you may not use this file except in compliance with the License.
  8. * You may obtain a copy of the License at:
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. *
  18. ******************************************************************************/
  19. /******************************************************************************
  20. *
  21. * This is the public interface file the BTA MCE I/F
  22. *
  23. ******************************************************************************/
  24. #ifndef BTA_MCE_API_H
  25. #define BTA_MCE_API_H
  26. #include "bt_target.h"
  27. #include "bt_types.h"
  28. #include "bta_api.h"
  29. #include "btm_api.h"
  30. /*****************************************************************************
  31. * Constants and data types
  32. ****************************************************************************/
  33. /* status values */
  34. #define BTA_MCE_SUCCESS 0 /* Successful operation. */
  35. #define BTA_MCE_FAILURE 1 /* Generic failure. */
  36. #define BTA_MCE_BUSY 2 /* Temporarily can not handle this request. */
  37. typedef uint8_t tBTA_MCE_STATUS;
  38. /* MCE I/F callback events */
  39. /* events received by tBTA_MCE_DM_CBACK */
  40. #define BTA_MCE_ENABLE_EVT 0 /* MCE enabled */
  41. #define BTA_MCE_MAS_DISCOVERY_COMP_EVT 1 /* SDP MAS discovery complete */
  42. #define BTA_MCE_MAX_EVT 2 /* max number of MCE events */
  43. #define BTA_MCE_MAX_MAS_INSTANCES 12
  44. typedef uint16_t tBTA_MCE_EVT;
  45. typedef struct {
  46. uint8_t scn;
  47. char* p_srv_name;
  48. uint16_t srv_name_len;
  49. uint8_t instance_id;
  50. uint8_t msg_type;
  51. } tBTA_MCE_MAS_INFO;
  52. /* data associated with BTA_MCE_MAS_DISCOVERY_COMP_EVT */
  53. typedef struct {
  54. tBTA_MCE_STATUS status;
  55. RawAddress remote_addr;
  56. int num_mas;
  57. tBTA_MCE_MAS_INFO mas[BTA_MCE_MAX_MAS_INSTANCES];
  58. } tBTA_MCE_MAS_DISCOVERY_COMP;
  59. /* union of data associated with MCE callback */
  60. typedef union {
  61. tBTA_MCE_STATUS status; /* BTA_MCE_ENABLE_EVT */
  62. tBTA_MCE_MAS_DISCOVERY_COMP
  63. mas_disc_comp; /* BTA_MCE_MAS_DISCOVERY_COMP_EVT */
  64. } tBTA_MCE;
  65. /* MCE DM Interface callback */
  66. typedef void(tBTA_MCE_DM_CBACK)(tBTA_MCE_EVT event, tBTA_MCE* p_data,
  67. void* user_data);
  68. /* MCE configuration structure */
  69. typedef struct {
  70. uint16_t sdp_db_size; /* The size of p_sdp_db */
  71. tSDP_DISCOVERY_DB* p_sdp_db; /* The data buffer to keep SDP database */
  72. } tBTA_MCE_CFG;
  73. /*****************************************************************************
  74. * External Function Declarations
  75. ****************************************************************************/
  76. /*******************************************************************************
  77. *
  78. * Function BTA_MceEnable
  79. *
  80. * Description Enable the MCE I/F service. When the enable
  81. * operation is complete the callback function will be
  82. * called with a BTA_MCE_ENABLE_EVT. This function must
  83. * be called before other functions in the MCE API are
  84. * called.
  85. *
  86. * Returns BTA_MCE_SUCCESS if successful.
  87. * BTA_MCE_FAIL if internal failure.
  88. *
  89. ******************************************************************************/
  90. extern tBTA_MCE_STATUS BTA_MceEnable(tBTA_MCE_DM_CBACK* p_cback);
  91. /*******************************************************************************
  92. *
  93. * Function BTA_MceGetRemoteMasInstances
  94. *
  95. * Description This function performs service discovery for the MAS service
  96. * by the given peer device. When the operation is completed
  97. * the tBTA_MCE_DM_CBACK callback function will be called with
  98. * a BTA_MCE_MAS_DISCOVERY_COMP_EVT.
  99. *
  100. * Returns BTA_MCE_SUCCESS, if the request is being processed.
  101. * BTA_MCE_FAILURE, otherwise.
  102. *
  103. ******************************************************************************/
  104. extern tBTA_MCE_STATUS BTA_MceGetRemoteMasInstances(const RawAddress& bd_addr);
  105. #endif /* BTA_MCE_API_H */