bta_sdp_api.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /******************************************************************************
  2. *
  3. * Copyright 2015 The Android Open Source Project
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at:
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. ******************************************************************************/
  18. /******************************************************************************
  19. *
  20. * This is the public interface file for the BTA SDP I/F
  21. *
  22. ******************************************************************************/
  23. #ifndef BTA_SDP_API_H
  24. #define BTA_SDP_API_H
  25. #include <hardware/bt_sdp.h>
  26. #include "bt_target.h"
  27. #include "bt_types.h"
  28. #include "bta_api.h"
  29. #include "btm_api.h"
  30. using bluetooth::Uuid;
  31. /* status values */
  32. #define BTA_SDP_SUCCESS 0 /* Successful operation. */
  33. #define BTA_SDP_FAILURE 1 /* Generic failure. */
  34. #define BTA_SDP_BUSY 2 /* Temporarily can not handle this request. */
  35. typedef uint8_t tBTA_SDP_STATUS;
  36. /* SDP I/F callback events */
  37. /* events received by tBTA_SDP_DM_CBACK */
  38. #define BTA_SDP_ENABLE_EVT 0 /* SDP service i/f enabled*/
  39. #define BTA_SDP_SEARCH_EVT 1 /* SDP Service started */
  40. #define BTA_SDP_SEARCH_COMP_EVT 2 /* SDP search complete */
  41. #define BTA_SDP_CREATE_RECORD_USER_EVT 3 /* SDP search complete */
  42. #define BTA_SDP_REMOVE_RECORD_USER_EVT 4 /* SDP search complete */
  43. #define BTA_SDP_MAX_EVT 5 /* max number of SDP events */
  44. #define BTA_SDP_MAX_RECORDS 15
  45. typedef uint16_t tBTA_SDP_EVT;
  46. /* data associated with BTA_SDP_DISCOVERY_COMP_EVT */
  47. typedef struct {
  48. tBTA_SDP_STATUS status;
  49. RawAddress remote_addr;
  50. bluetooth::Uuid uuid;
  51. int record_count;
  52. bluetooth_sdp_record records[BTA_SDP_MAX_RECORDS];
  53. } tBTA_SDP_SEARCH_COMP;
  54. typedef union {
  55. tBTA_SDP_STATUS status; /* BTA_SDP_SEARCH_EVT */
  56. tBTA_SDP_SEARCH_COMP sdp_search_comp; /* BTA_SDP_SEARCH_COMP_EVT */
  57. } tBTA_SDP;
  58. /* SDP DM Interface callback */
  59. typedef void(tBTA_SDP_DM_CBACK)(tBTA_SDP_EVT event, tBTA_SDP* p_data,
  60. void* user_data);
  61. /* MCE configuration structure */
  62. typedef struct {
  63. uint16_t sdp_db_size; /* The size of p_sdp_db */
  64. tSDP_DISCOVERY_DB* p_sdp_db; /* The data buffer to keep SDP database */
  65. } tBTA_SDP_CFG;
  66. /*******************************************************************************
  67. *
  68. * Function BTA_SdpEnable
  69. *
  70. * Description Enable the SDP I/F service. When the enable
  71. * operation is complete the callback function will be
  72. * called with a BTA_SDP_ENABLE_EVT. This function must
  73. * be called before other functions in the MCE API are
  74. * called.
  75. *
  76. * Returns BTA_SDP_SUCCESS if successful.
  77. * BTA_SDP_FAIL if internal failure.
  78. *
  79. ******************************************************************************/
  80. extern tBTA_SDP_STATUS BTA_SdpEnable(tBTA_SDP_DM_CBACK* p_cback);
  81. /*******************************************************************************
  82. *
  83. * Function BTA_SdpSearch
  84. *
  85. * Description Start a search for sdp records for a specific BD_ADDR with a
  86. * specific profile uuid.
  87. * When the search operation is completed, the callback
  88. * function will be called with a BTA_SDP_SEARCH_EVT.
  89. * Returns BTA_SDP_SUCCESS if successful.
  90. * BTA_SDP_FAIL if internal failure.
  91. *
  92. ******************************************************************************/
  93. extern tBTA_SDP_STATUS BTA_SdpSearch(const RawAddress& bd_addr,
  94. const bluetooth::Uuid& uuid);
  95. /*******************************************************************************
  96. *
  97. * Function BTA_SdpCreateRecordByUser
  98. *
  99. * Description This function is used to request a callback to create a SDP
  100. * record. The registered callback will be called with event
  101. * BTA_SDP_CREATE_RECORD_USER_EVT.
  102. *
  103. * Returns BTA_SDP_SUCCESS, if the request is being processed.
  104. * BTA_SDP_FAILURE, otherwise.
  105. *
  106. ******************************************************************************/
  107. extern tBTA_SDP_STATUS BTA_SdpCreateRecordByUser(void* user_data);
  108. /*******************************************************************************
  109. *
  110. * Function BTA_SdpRemoveRecordByUser
  111. *
  112. * Description This function is used to request a callback to remove a SDP
  113. * record. The registered callback will be called with event
  114. * BTA_SDP_REMOVE_RECORD_USER_EVT.
  115. *
  116. * Returns BTA_SDP_SUCCESS, if the request is being processed.
  117. * BTA_SDP_FAILURE, otherwise.
  118. *
  119. ******************************************************************************/
  120. extern tBTA_SDP_STATUS BTA_SdpRemoveRecordByUser(void* user_data);
  121. #endif /* BTA_SDP_API_H */