• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 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 
19 #pragma once
20 
21 #include <stdint.h>
22 
23 #include "bt_types.h"
24 #include "btcore/include/device_features.h"
25 #include "btcore/include/version.h"
26 #include "features.h"
27 #include "osi/include/allocator.h"
28 
29 typedef struct {
30   void (*parse_generic_command_complete)(BT_HDR* response);
31 
32   void (*parse_read_buffer_size_response)(BT_HDR* response,
33                                           uint16_t* data_size_ptr,
34                                           uint16_t* acl_buffer_count_ptr);
35 
36   void (*parse_read_local_version_info_response)(BT_HDR* response,
37                                                  bt_version_t* bt_version_ptr);
38 
39   void (*parse_read_bd_addr_response)(BT_HDR* response,
40                                       RawAddress* address_ptr);
41 
42   void (*parse_read_local_supported_commands_response)(
43       BT_HDR* response, uint8_t* supported_commands_ptr,
44       size_t supported_commands_length);
45 
46   void (*parse_read_local_extended_features_response)(
47       BT_HDR* response, uint8_t* page_number_ptr, uint8_t* max_page_number_ptr,
48       bt_device_features_t* feature_pages, size_t feature_pages_count);
49 
50   void (*parse_ble_read_acceptlist_size_response)(BT_HDR* response,
51                                                   uint8_t* acceptlist_size_ptr);
52 
53   void (*parse_ble_read_buffer_size_response)(BT_HDR* response,
54                                               uint16_t* data_size_ptr,
55                                               uint8_t* acl_buffer_count_ptr);
56   void (*parse_ble_read_buffer_size_v2_response)(BT_HDR* response,
57                                                  uint16_t* acl_data_size_ptr,
58                                                  uint8_t* acl_buffer_count_ptr,
59                                                  uint16_t* iso_data_size_ptr,
60                                                  uint8_t* iso_buffer_count_ptr);
61 
62   void (*parse_ble_read_supported_states_response)(
63       BT_HDR* response, uint8_t* supported_states,
64       size_t supported_states_size);
65 
66   void (*parse_ble_read_local_supported_features_response)(
67       BT_HDR* response, bt_device_features_t* supported_features);
68 
69   void (*parse_ble_read_resolving_list_size_response)(
70       BT_HDR* response, uint8_t* resolving_list_size_ptr);
71 
72   void (*parse_ble_read_suggested_default_data_length_response)(
73       BT_HDR* response, uint16_t* ble_default_packet_length_ptr);
74 
75   void (*parse_ble_read_maximum_data_length_response)(
76       BT_HDR* response, uint16_t* ble_supported_max_tx_octets,
77       uint16_t* ble_supported_max_tx_time,
78       uint16_t* ble_supported_max_rx_octets,
79       uint16_t* ble_supported_max_rx_time);
80 
81   void (*parse_ble_read_maximum_advertising_data_length)(
82       BT_HDR* response, uint16_t* ble_maximum_advertising_data_length_ptr);
83 
84   void (*parse_ble_read_number_of_supported_advertising_sets)(
85       BT_HDR* response, uint8_t* ble_number_of_supported_advertising_sets_ptr);
86 
87   void (*parse_ble_read_size_of_advertiser_list)(
88       BT_HDR* response, uint8_t* ble_size_of_advertiser_list_ptr);
89 
90   void (*parse_read_local_supported_codecs_response)(
91       BT_HDR* response, uint8_t* number_of_local_supported_codecs,
92       uint8_t* local_supported_codecs);
93 
94 } hci_packet_parser_t;
95 
96 const hci_packet_parser_t* hci_packet_parser_get_interface();
97 
98 const hci_packet_parser_t* hci_packet_parser_get_test_interface(
99     allocator_t* buffer_allocator_interface);
100