hid_int.h 4.5 KB

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