1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 #ifndef __ESP_BT_DEVICE_H__ 16 #define __ESP_BT_DEVICE_H__ 17 18 #include <stdint.h> 19 #include <stdbool.h> 20 #include "esp_err.h" 21 #include "esp_bt_defs.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * 29 * @brief Get bluetooth device address. Must use after "esp_bluedroid_enable". 30 * 31 * @return bluetooth device address (six bytes), or NULL if bluetooth stack is not enabled 32 */ 33 const uint8_t *esp_bt_dev_get_address(void); 34 35 36 /** 37 * @brief Set bluetooth device name. This function should be called after esp_bluedroid_enable() 38 * completes successfully. 39 * 40 * A BR/EDR/LE device type shall have a single Bluetooth device name which shall be 41 * identical irrespective of the physical channel used to perform the name discovery procedure. 42 * 43 * @param[in] name : device name to be set 44 * 45 * @return 46 * - ESP_OK : Succeed 47 * - ESP_ERR_INVALID_ARG : if name is NULL pointer or empty, or string length out of limit 48 * - ESP_ERR_INVALID_STATE : if bluetooth stack is not yet enabled 49 * - ESP_FAIL : others 50 */ 51 esp_err_t esp_bt_dev_set_device_name(const char *name); 52 53 #ifdef __cplusplus 54 } 55 #endif 56 57 58 #endif /* __ESP_BT_DEVICE_H__ */ 59