controller.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2014 Google, Inc.
  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 _CONTROLLER_H_
  19. #define _CONTROLLER_H_
  20. #include <stdbool.h>
  21. #include <stdint.h>
  22. #include "bt_target.h"
  23. #include "bdaddr.h"
  24. #include "device_features.h"
  25. #include "hci_layer.h"
  26. #include "hci_packet_factory.h"
  27. #include "hci_packet_parser.h"
  28. typedef struct controller_t {
  29. void (*start_up)(void);
  30. void (*shut_down)(void);
  31. bool (*get_is_ready)(void);
  32. const bt_bdaddr_t *(*get_address)(void);
  33. const bt_version_t *(*get_bt_version)(void);
  34. const bt_device_features_t *(*get_features_classic)(int index);
  35. uint8_t (*get_last_features_classic_index)(void);
  36. const bt_device_features_t *(*get_features_ble)(void);
  37. const uint8_t *(*get_ble_supported_states)(void);
  38. bool (*supports_simple_pairing)(void);
  39. bool (*supports_secure_connections)(void);
  40. bool (*supports_simultaneous_le_bredr)(void);
  41. bool (*supports_reading_remote_extended_features)(void);
  42. bool (*supports_interlaced_inquiry_scan)(void);
  43. bool (*supports_rssi_with_inquiry_results)(void);
  44. bool (*supports_extended_inquiry_response)(void);
  45. bool (*supports_master_slave_role_switch)(void);
  46. bool (*supports_ble)(void);
  47. bool (*supports_ble_packet_extension)(void);
  48. bool (*supports_ble_connection_parameters_request)(void);
  49. bool (*supports_ble_privacy)(void);
  50. // Get the cached acl data sizes for the controller.
  51. uint16_t (*get_acl_data_size_classic)(void);
  52. uint16_t (*get_acl_data_size_ble)(void);
  53. // Get the cached acl packet sizes for the controller.
  54. // This is a convenience function for the respective
  55. // acl data size + size of the acl header.
  56. uint16_t (*get_acl_packet_size_classic)(void);
  57. uint16_t (*get_acl_packet_size_ble)(void);
  58. uint16_t (*get_ble_default_data_packet_length)(void);
  59. // Get the number of acl packets the controller can buffer.
  60. uint16_t (*get_acl_buffer_count_classic)(void);
  61. uint8_t (*get_acl_buffer_count_ble)(void);
  62. uint8_t (*get_ble_white_list_size)(void);
  63. uint8_t (*get_ble_resolving_list_max_size)(void);
  64. void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
  65. } controller_t;
  66. const controller_t *controller_get_interface();
  67. #endif /*_CONTROLLER_H_*/