1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. 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, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 #ifndef H_BLE_HS_HCI_ 21 #define H_BLE_HS_HCI_ 22 23 /** 24 * @brief Bluetooth Host HCI utils 25 * @defgroup bt_host_hci Bluetooth Host HCI utils 26 * @ingroup bt_host 27 * @{ 28 */ 29 30 #include <stdint.h> 31 32 #ifdef __cplusplus 33 extern "C" { 34 #endif 35 36 /** 37 * Queries the controller for the channel map used with the specified 38 * connection. The channel map is represented as an array of five bytes, with 39 * each bit corresponding to an individual channel. The array is interpreted 40 * as little-endian, such that: 41 * map[0] & 0x01 --> Channel 0. 42 * map[0] & 0x02 --> Channel 1. 43 * ... 44 * map[1] & 0x01 --> Channel 8. 45 * 46 * As there are 37 channels, only the first 37 bits get written. 47 * 48 * If a bit is 1, the corresponding channel is used. Otherwise, the channel is 49 * unused. 50 * 51 * @param conn_handle The handle of the connection whose channel map 52 * is being read. 53 * @param out_chan_map On success, the retrieved channel map gets 54 * written here. This buffer must have a size 55 * >= 5 bytes. 56 * 57 * @return 0 on success; 58 * A BLE host HCI return code if the controller 59 * rejected the request; 60 * A BLE host core return code on unexpected 61 * error. 62 */ 63 int ble_hs_hci_read_chan_map(uint16_t conn_handle, uint8_t *out_chan_map); 64 65 /** 66 * Instructs the controller to use the specified channel map. The channel map 67 * is represented as an array of five bytes, with each bit corresponding to an 68 * individual channel. The array is interpreted as little-endian, such that: 69 * map[0] & 0x01 --> Channel 0. 70 * map[0] & 0x02 --> Channel 1. 71 * ... 72 * map[1] & 0x01 --> Channel 8. 73 * 74 * As there are 37 channels, only the first 37 bits should be written are used. 75 * 76 * If a bit is 1, the corresponding channel can be used. Otherwise, the 77 * channel should not be used. 78 * 79 * @param chan_map The channel map to configure. This buffer 80 * should have a size of 5 bytes. 81 * 82 * @return 0 on success; 83 * A BLE host HCI return code if the controller 84 * rejected the request; 85 * A BLE host core return code on unexpected 86 * error. 87 */ 88 int ble_hs_hci_set_chan_class(const uint8_t *chan_map); 89 90 #ifdef __cplusplus 91 } 92 #endif 93 94 /** 95 * @} 96 */ 97 98 #endif 99