srvc_eng_int.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /******************************************************************************
  2. *
  3. * Copyright 1999-2013 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. #ifndef SRVC_ENG_INT_H
  19. #define SRVC_ENG_INT_H
  20. #include "bt_target.h"
  21. #include "gatt_api.h"
  22. #include "srvc_api.h"
  23. #define SRVC_MAX_APPS GATT_CL_MAX_LCB
  24. #define SRVC_ID_NONE 0
  25. #define SRVC_ID_DIS 1
  26. #define SRVC_ID_MAX SRVC_ID_DIS
  27. #define SRVC_ACT_IGNORE 0
  28. #define SRVC_ACT_RSP 1
  29. #define SRVC_ACT_PENDING 2
  30. typedef struct {
  31. bool in_use;
  32. uint16_t conn_id;
  33. bool connected;
  34. RawAddress bda;
  35. uint32_t trans_id;
  36. uint8_t cur_srvc_id;
  37. tDIS_VALUE dis_value;
  38. } tSRVC_CLCB;
  39. /* service engine control block */
  40. typedef struct {
  41. tSRVC_CLCB clcb[SRVC_MAX_APPS]; /* connection link*/
  42. tGATT_IF gatt_if;
  43. bool enabled;
  44. } tSRVC_ENG_CB;
  45. /* Global GATT data */
  46. extern tSRVC_ENG_CB srvc_eng_cb;
  47. extern tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(uint16_t conn_id);
  48. extern tSRVC_CLCB* srvc_eng_find_clcb_by_bd_addr(const RawAddress& bda);
  49. extern uint16_t srvc_eng_find_conn_id_by_bd_addr(const RawAddress& bda);
  50. extern void srvc_eng_release_channel(uint16_t conn_id);
  51. extern bool srvc_eng_request_channel(const RawAddress& remote_bda,
  52. uint8_t srvc_id);
  53. extern void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP* p_rsp);
  54. extern void srvc_sr_notify(const RawAddress& remote_bda, uint16_t handle,
  55. uint16_t len, uint8_t* p_value);
  56. #endif