bta_dm_ci.c 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2003-2012 Broadcom Corporation
  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 API implementation file for the BTA device manager.
  21. *
  22. ******************************************************************************/
  23. #include "bta/bta_sys.h"
  24. #include "bta/bta_api.h"
  25. #include "bta_dm_int.h"
  26. #include <string.h>
  27. #include "bta/bta_dm_ci.h"
  28. #include "osi/allocator.h"
  29. #if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
  30. /*******************************************************************************
  31. **
  32. ** Function bta_dm_ci_io_req
  33. **
  34. ** Description This function must be called in response to function
  35. ** bta_dm_co_io_req(), if *p_oob_data to BTA_OOB_UNKNOWN
  36. ** by bta_dm_co_io_req().
  37. **
  38. ** Returns void
  39. **
  40. *******************************************************************************/
  41. void bta_dm_ci_io_req(BD_ADDR bd_addr, tBTA_IO_CAP io_cap, tBTA_OOB_DATA oob_data,
  42. tBTA_AUTH_REQ auth_req)
  43. {
  44. tBTA_DM_CI_IO_REQ *p_msg;
  45. if ((p_msg = (tBTA_DM_CI_IO_REQ *) osi_malloc(sizeof(tBTA_DM_CI_IO_REQ))) != NULL) {
  46. p_msg->hdr.event = BTA_DM_CI_IO_REQ_EVT;
  47. bdcpy(p_msg->bd_addr, bd_addr);
  48. p_msg->io_cap = io_cap;
  49. p_msg->oob_data = oob_data;
  50. p_msg->auth_req = auth_req;
  51. bta_sys_sendmsg(p_msg);
  52. }
  53. }
  54. /*******************************************************************************
  55. **
  56. ** Function bta_dm_ci_rmt_oob
  57. **
  58. ** Description This function must be called in response to function
  59. ** bta_dm_co_rmt_oob() to provide the OOB data associated
  60. ** with the remote device.
  61. **
  62. ** Returns void
  63. **
  64. *******************************************************************************/
  65. void bta_dm_ci_rmt_oob(BOOLEAN accept, BD_ADDR bd_addr, BT_OCTET16 c, BT_OCTET16 r)
  66. {
  67. tBTA_DM_CI_RMT_OOB *p_msg;
  68. if ((p_msg = (tBTA_DM_CI_RMT_OOB *) osi_malloc(sizeof(tBTA_DM_CI_RMT_OOB))) != NULL) {
  69. p_msg->hdr.event = BTA_DM_CI_RMT_OOB_EVT;
  70. bdcpy(p_msg->bd_addr, bd_addr);
  71. p_msg->accept = accept;
  72. memcpy(p_msg->c, c, BT_OCTET16_LEN);
  73. memcpy(p_msg->r, r, BT_OCTET16_LEN);
  74. bta_sys_sendmsg(p_msg);
  75. }
  76. }
  77. #endif /* BTM_OOB_INCLUDED */