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 
19 #pragma once
20 
21 #include <stdint.h>
22 
23 #include "allocator.h"
24 #include "bdaddr.h"
25 #include "bt_types.h"
26 #include "device_features.h"
27 #include "features.h"
28 #include "version.h"
29 
30 typedef struct {
31   void (*parse_generic_command_complete)(BT_HDR *response);
32 
33   void (*parse_read_buffer_size_response)(
34     BT_HDR *response,
35     uint16_t *data_size_ptr,
36     uint16_t *acl_buffer_count_ptr
37   );
38 
39   void (*parse_read_local_version_info_response)(
40     BT_HDR *response,
41     bt_version_t *bt_version_ptr
42   );
43 
44   void (*parse_read_bd_addr_response)(
45     BT_HDR *response,
46     bt_bdaddr_t *address_ptr
47   );
48 
49   void (*parse_read_local_supported_commands_response)(
50     BT_HDR *response,
51     uint8_t *supported_commands_ptr,
52     size_t supported_commands_length
53   );
54 
55   void (*parse_read_local_extended_features_response)(
56     BT_HDR *response,
57     uint8_t *page_number_ptr,
58     uint8_t *max_page_number_ptr,
59     bt_device_features_t *feature_pages,
60     size_t feature_pages_count
61   );
62 
63   void (*parse_ble_read_white_list_size_response)(
64     BT_HDR *response,
65     uint8_t *white_list_size_ptr
66   );
67 
68   void (*parse_ble_read_buffer_size_response)(
69     BT_HDR *response,
70     uint16_t *data_size_ptr,
71     uint8_t *acl_buffer_count_ptr
72   );
73 
74   void (*parse_ble_read_supported_states_response)(
75     BT_HDR *response,
76     uint8_t *supported_states,
77     size_t supported_states_size
78   );
79 
80   void (*parse_ble_read_local_supported_features_response)(
81     BT_HDR *response,
82     bt_device_features_t *supported_features
83   );
84 
85   void (*parse_ble_read_resolving_list_size_response) (
86     BT_HDR *response,
87     uint8_t *resolving_list_size_ptr
88   );
89 
90   void (*parse_ble_read_suggested_default_data_length_response)(
91     BT_HDR *response,
92     uint16_t *ble_default_packet_length_ptr
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 );
101