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 #ifndef _HCI_PACKET_PARSER_H_
20 #define _HCI_PACKET_PARSER_H_
21 
22 #include <stdint.h>
23 
24 #include "osi/allocator.h"
25 #include "device/bdaddr.h"
26 #include "stack/bt_types.h"
27 #include "device/device_features.h"
28 //#include "features.h"
29 #include "device/version.h"
30 
31 typedef struct {
32     void (*parse_generic_command_complete)(BT_HDR *response);
33 
34     void (*parse_read_buffer_size_response)(
35         BT_HDR *response,
36         uint16_t *acl_data_size_ptr,
37         uint16_t *acl_buffer_count_ptr,
38         uint8_t *sco_data_size_ptr,
39         uint16_t *sco_buffer_count_ptr
40     );
41 
42     void (*parse_read_local_version_info_response)(
43         BT_HDR *response,
44         bt_version_t *bt_version_ptr
45     );
46 
47     void (*parse_read_bd_addr_response)(
48         BT_HDR *response,
49         bt_bdaddr_t *address_ptr
50     );
51 
52     void (*parse_read_local_supported_commands_response)(
53         BT_HDR *response,
54         uint8_t *supported_commands_ptr,
55         size_t supported_commands_length
56     );
57 
58     void (*parse_read_local_supported_features_response)(
59         BT_HDR *response,
60         bt_device_features_t *feature_pages
61     );
62 
63     void (*parse_read_local_extended_features_response)(
64         BT_HDR *response,
65         uint8_t *page_number_ptr,
66         uint8_t *max_page_number_ptr,
67         bt_device_features_t *feature_pages,
68         size_t feature_pages_count
69     );
70 
71     void (*parse_ble_read_white_list_size_response)(
72         BT_HDR *response,
73         uint8_t *white_list_size_ptr
74     );
75 
76     void (*parse_ble_read_buffer_size_response)(
77         BT_HDR *response,
78         uint16_t *data_size_ptr,
79         uint8_t *acl_buffer_count_ptr
80     );
81 
82     void (*parse_ble_read_supported_states_response)(
83         BT_HDR *response,
84         uint8_t *supported_states,
85         size_t supported_states_size
86     );
87 
88     void (*parse_ble_read_local_supported_features_response)(
89         BT_HDR *response,
90         bt_device_features_t *supported_features
91     );
92 
93     void (*parse_ble_read_resolving_list_size_response) (
94         BT_HDR *response,
95         uint8_t *resolving_list_size_ptr
96     );
97 #if (BLE_50_FEATURE_SUPPORT == TRUE)
98     void (*parse_ble_read_adv_max_len_response) (
99         BT_HDR *respone,
100         uint16_t *ble_ext_adv_data_max_len_ptr
101     );
102 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
103     void (*parse_ble_read_suggested_default_data_length_response)(
104         BT_HDR *response,
105         uint16_t *ble_default_packet_length_ptr,
106         uint16_t *ble_default_packet_txtime_ptr
107     );
108 } hci_packet_parser_t;
109 
110 const hci_packet_parser_t *hci_packet_parser_get_interface(void);
111 
112 #endif /*_HCI_PACKET_PARSER_H_*/
113