1 /******************************************************************************
2  *
3  *  Copyright (c) 2016, The Linux Foundation.
4  *  Copyright (C) 2014 Google, Inc.
5  *
6  *  Licensed under the Apache License, Version 2.0 (the "License");
7  *  you may not use this file except in compliance with the License.
8  *  You may obtain a copy of the License at:
9  *
10  *  http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *  Unless required by applicable law or agreed to in writing, software
13  *  distributed under the License is distributed on an "AS IS" BASIS,
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *  See the License for the specific language governing permissions and
16  *  limitations under the License.
17  *
18  ******************************************************************************/
19 
20 #pragma once
21 
22 #include <stdbool.h>
23 
24 #include "device/include/interop.h"
25 
26 typedef uint16_t UINT16;
27 
28 // API's for adding entries to dynamic interop database
29 void interop_database_add_addr(const uint16_t feature, const RawAddress* addr,
30                                size_t length);
31 void interop_database_add_name(const uint16_t feature, const char* name);
32 void interop_database_add_manufacturer(const interop_feature_t feature,
33                                        uint16_t manufacturer);
34 void interop_database_add_vndr_prdt(const interop_feature_t feature,
35                                     uint16_t vendor_id, uint16_t product_id);
36 void interop_database_add_addr_max_lat(const interop_feature_t feature,
37                                        const RawAddress* addr,
38                                        uint16_t max_lat);
39 void interop_database_add_version(const interop_feature_t feature,
40                                   uint16_t version);
41 void interop_database_add_addr_lmp_version(const interop_feature_t feature,
42                                            const RawAddress* addr,
43                                            uint8_t lmp_ver,
44                                            uint16_t lmp_sub_ver);
45 
46 // API's for removing entries from dynamic interop database
47 bool interop_database_remove_addr(const interop_feature_t feature,
48                                   const RawAddress* addr);
49 bool interop_database_remove_name(const interop_feature_t feature,
50                                   const char* name);
51 bool interop_database_remove_manufacturer(const interop_feature_t feature,
52                                           uint16_t manufacturer);
53 bool interop_database_remove_vndr_prdt(const interop_feature_t feature,
54                                        uint16_t vendor_id, uint16_t product_id);
55 bool interop_database_remove_addr_max_lat(const interop_feature_t feature,
56                                           const RawAddress* addr,
57                                           uint16_t max_lat);
58 bool interop_database_remove_version(const interop_feature_t feature,
59                                      uint16_t version);
60 bool interop_database_remove_feature(const interop_feature_t feature);
61 bool interop_database_remove_addr_lmp_version(const interop_feature_t feature,
62                                               const RawAddress* addr,
63                                               uint8_t lmp_ver,
64                                               uint16_t lmp_sub_ver);
65 
66 // API's to match entries with in dynamic interop database
67 bool interop_database_match_addr(const interop_feature_t feature,
68                                  const RawAddress* addr);
69 bool interop_database_match_name(const interop_feature_t feature,
70                                  const char* name);
71 bool interop_database_match_manufacturer(const interop_feature_t feature,
72                                          uint16_t manufacturer);
73 bool interop_database_match_vndr_prdt(const interop_feature_t feature,
74                                       uint16_t vendor_id, uint16_t product_id);
75 bool interop_database_match_addr_get_max_lat(const interop_feature_t feature,
76                                              const RawAddress* addr,
77                                              uint16_t* max_lat);
78 bool interop_database_match_version(const interop_feature_t feature,
79                                     uint16_t version);
80 bool interop_database_match_addr_get_lmp_ver(const interop_feature_t feature,
81                                              const RawAddress* addr,
82                                              uint8_t* lmp_ver,
83                                              uint16_t* lmp_sub_ver);
84