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 "device_features.h"
25 #include "features.h"
26 #include "osi/include/allocator.h"
27 #include "version.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_white_list_size_response)(BT_HDR* response,
51                                                   uint8_t* white_list_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 
57   void (*parse_ble_read_supported_states_response)(
58       BT_HDR* response, uint8_t* supported_states,
59       size_t supported_states_size);
60 
61   void (*parse_ble_read_local_supported_features_response)(
62       BT_HDR* response, bt_device_features_t* supported_features);
63 
64   void (*parse_ble_read_resolving_list_size_response)(
65       BT_HDR* response, uint8_t* resolving_list_size_ptr);
66 
67   void (*parse_ble_read_suggested_default_data_length_response)(
68       BT_HDR* response, uint16_t* ble_default_packet_length_ptr);
69 
70   void (*parse_ble_read_maximum_data_length_response)(
71       BT_HDR* response, uint16_t* ble_supported_max_tx_octets,
72       uint16_t* ble_supported_max_tx_time,
73       uint16_t* ble_supported_max_rx_octets,
74       uint16_t* ble_supported_max_rx_time);
75 
76   void (*parse_ble_read_maximum_advertising_data_length)(
77       BT_HDR* response, uint16_t* ble_maximum_advertising_data_length_ptr);
78 
79   void (*parse_ble_read_number_of_supported_advertising_sets)(
80       BT_HDR* response, uint8_t* ble_number_of_supported_advertising_sets_ptr);
81 
82   void (*parse_read_local_supported_codecs_response)(
83       BT_HDR* response, uint8_t* number_of_local_supported_codecs,
84       uint8_t* local_supported_codecs);
85 
86 } hci_packet_parser_t;
87 
88 const hci_packet_parser_t* hci_packet_parser_get_interface();
89 
90 const hci_packet_parser_t* hci_packet_parser_get_test_interface(
91     allocator_t* buffer_allocator_interface);
92