hid_int.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2016 The Android Open Source Project
  4. * Copyright (C) 2002-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 file contains HID DEVICE internal definitions
  22. *
  23. ******************************************************************************/
  24. #ifndef HID_INT_H
  25. #define HID_INT_H
  26. #include "hid_conn.h"
  27. #include "stack/l2c_api.h"
  28. #if (BT_HID_INCLUDED == TRUE)
  29. #if (HID_HOST_INCLUDED == TRUE)
  30. #include "stack/hidh_api.h"
  31. enum { HID_DEV_NO_CONN, HID_DEV_CONNECTED };
  32. typedef struct per_device_ctb {
  33. BOOLEAN in_use;
  34. BOOLEAN delay_remove;
  35. BD_ADDR addr; /* BD-Addr of the host device */
  36. UINT16 attr_mask; /* 0x01- virtual_cable; 0x02- normally_connectable; 0x03- reconn_initiate;
  37. 0x04- sdp_disable; */
  38. UINT8 state; /* Device state if in HOST-KNOWN mode */
  39. UINT8 conn_substate;
  40. UINT8 conn_tries; /* Remembers to the number of connection attempts while CONNECTING */
  41. tHID_CONN conn; /* L2CAP channel info */
  42. } tHID_HOST_DEV_CTB;
  43. typedef struct host_ctb {
  44. tHID_HOST_DEV_CTB devices[HID_HOST_MAX_DEVICES];
  45. tHID_HOST_DEV_CALLBACK *callback; /* Application callbacks */
  46. tL2CAP_CFG_INFO l2cap_cfg;
  47. #define MAX_SERVICE_DB_SIZE 4000
  48. BOOLEAN sdp_busy;
  49. tHID_HOST_SDP_CALLBACK *sdp_cback;
  50. tSDP_DISCOVERY_DB *p_sdp_db;
  51. tHID_DEV_SDP_INFO sdp_rec;
  52. BOOLEAN reg_flag;
  53. UINT8 trace_level;
  54. } tHID_HOST_CTB;
  55. extern tHID_STATUS hidh_conn_snd_data(UINT8 dhandle, UINT8 trans_type, UINT8 param, \
  56. UINT16 data, UINT8 rpt_id, BT_HDR *buf);
  57. extern tHID_STATUS hidh_conn_reg (void);
  58. extern void hidh_conn_dereg( void );
  59. extern tHID_STATUS hidh_conn_disconnect (UINT8 dhandle);
  60. extern tHID_STATUS hidh_conn_initiate (UINT8 dhandle);
  61. extern void hidh_proc_repage_timeout (TIMER_LIST_ENT *p_tle);
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65. /******************************************************************************
  66. * Main Control Block
  67. ******************************************************************************/
  68. #if HID_DYNAMIC_MEMORY == FALSE
  69. extern tHID_HOST_CTB hh_cb;
  70. #else
  71. extern tHID_HOST_CTB *hidh_cb_ptr;
  72. #define hh_cb (*hidh_cb_ptr)
  73. #endif
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* HID_HOST_INCLUDED == TRUE */
  78. #if (HID_DEV_INCLUDED == TRUE)
  79. #include "stack/hidd_api.h"
  80. enum { HIDD_DEV_NO_CONN, HIDD_DEV_CONNECTED };
  81. typedef struct device_ctb {
  82. bool in_use;
  83. BD_ADDR addr;
  84. uint8_t state;
  85. tHID_CONN conn;
  86. bool boot_mode;
  87. uint8_t idle_time;
  88. } tHID_DEV_DEV_CTB;
  89. typedef struct dev_ctb {
  90. tHID_DEV_DEV_CTB device;
  91. tHID_DEV_HOST_CALLBACK *callback;
  92. tL2CAP_CFG_INFO l2cap_cfg;
  93. tL2CAP_CFG_INFO l2cap_intr_cfg;
  94. bool use_in_qos;
  95. FLOW_SPEC in_qos;
  96. bool reg_flag;
  97. uint8_t trace_level;
  98. bool allow_incoming;
  99. BT_HDR *pending_data;
  100. bool pending_vc_unplug;
  101. } tHID_DEV_CTB;
  102. extern tHID_STATUS hidd_conn_reg(void);
  103. extern void hidd_conn_dereg(void);
  104. extern tHID_STATUS hidd_conn_initiate(void);
  105. extern tHID_STATUS hidd_conn_disconnect(void);
  106. extern tHID_STATUS hidd_conn_send_data(uint8_t channel, uint8_t msg_type, uint8_t param, uint8_t data, uint16_t len,
  107. uint8_t *p_data);
  108. #ifdef __cplusplus
  109. extern "C" {
  110. #endif
  111. /******************************************************************************
  112. * Main Control Block
  113. ******************************************************************************/
  114. #if HID_DYNAMIC_MEMORY == FALSE
  115. extern tHID_DEV_CTB hd_cb;
  116. #else
  117. extern tHID_DEV_CTB *hidd_cb_ptr;
  118. #define hd_cb (*hidd_cb_ptr)
  119. #endif
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif /* HID_DEV_INCLUDED == TRUE */
  124. #endif /* BT_HID_INCLUDED == TRUE */
  125. #endif /* HID_INT_H */