Merge branch 'feature/btdm_common_api' into 'master'
component/bt : add bt device api 1. add get bd_addr function later, will add other functions reference with bluetooth device. See merge request !380
This commit is contained in:
commit
0106feeeda
6 changed files with 115 additions and 0 deletions
22
components/bt/bluedroid/api/esp_bt_device.c
Normal file
22
components/bt/bluedroid/api/esp_bt_device.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
#include "esp_bt_device.h"
|
||||
#include "controller.h"
|
||||
|
||||
const uint8_t *esp_bt_dev_get_address(void)
|
||||
{
|
||||
return controller_get_interface()->get_address()->address;
|
||||
}
|
|
@ -96,6 +96,9 @@ typedef enum {
|
|||
/// Maximum of the application id
|
||||
#define ESP_APP_ID_MAX 0x7fff
|
||||
|
||||
#define ESP_BD_ADDR_STR "%02x:%02x:%02x:%02x:%02x:%02x"
|
||||
#define ESP_BD_ADDR_HEX(addr) addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
38
components/bt/bluedroid/api/include/esp_bt_device.h
Normal file
38
components/bt/bluedroid/api/include/esp_bt_device.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef __ESP_BT_DEVICE_H__
|
||||
#define __ESP_BT_DEVICE_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
*
|
||||
* @brief Get bluetooth device address. Must use after "esp_bluedroid_enable".
|
||||
*
|
||||
* @return bluetooth device address (six bytes)
|
||||
*/
|
||||
const uint8_t *esp_bt_dev_get_address(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __ESP_BT_DEVICE_H__ */
|
|
@ -6,3 +6,4 @@ BT COMMON
|
|||
|
||||
Bluetooth DEFINE <esp_bt_defs>
|
||||
Bluetooth MAIN <esp_bt_main>
|
||||
Bluetooth DEVICE <esp_bt_device>
|
||||
|
|
48
docs/api/esp_bt_device.rst
Normal file
48
docs/api/esp_bt_device.rst
Normal file
|
@ -0,0 +1,48 @@
|
|||
BT DEVICE APIs
|
||||
===============
|
||||
|
||||
Overview
|
||||
--------
|
||||
|
||||
Bluetooth device reference APIs.
|
||||
|
||||
`Instructions`_
|
||||
|
||||
Application Example
|
||||
-------------------
|
||||
|
||||
`Instructions`_
|
||||
|
||||
.. _Instructions: template.html
|
||||
|
||||
|
||||
API Reference
|
||||
-------------
|
||||
|
||||
Header Files
|
||||
^^^^^^^^^^^^
|
||||
|
||||
* `bt/bluedroid/api/include/esp_bt_device.h <https://github.com/espressif/esp-idf/blob/master/components/bt/bluedroid/api/include/esp_bt_device.h>`_
|
||||
|
||||
|
||||
Macros
|
||||
^^^^^^
|
||||
|
||||
|
||||
Type Definitions
|
||||
^^^^^^^^^^^^^^^^
|
||||
|
||||
|
||||
Enumerations
|
||||
^^^^^^^^^^^^
|
||||
|
||||
|
||||
Structures
|
||||
^^^^^^^^^^
|
||||
|
||||
|
||||
Functions
|
||||
^^^^^^^^^
|
||||
|
||||
.. doxygenfunction:: esp_bt_dev_get_address
|
||||
|
|
@ -29,6 +29,7 @@
|
|||
#include "esp_bt_defs.h"
|
||||
#include "esp_gap_ble_api.h"
|
||||
#include "esp_bt_main.h"
|
||||
#include "esp_bt_device.h"
|
||||
#include "blufi_demo.h"
|
||||
|
||||
static void blufi_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_param_t *param);
|
||||
|
@ -328,6 +329,8 @@ void app_main()
|
|||
return;
|
||||
}
|
||||
|
||||
BLUFI_INFO("BD ADDR: "ESP_BD_ADDR_STR"\n", ESP_BD_ADDR_HEX(esp_bt_dev_get_address()));
|
||||
|
||||
BLUFI_INFO("BLUFI VERSION %04x\n", esp_blufi_get_version());
|
||||
|
||||
blufi_security_init();
|
||||
|
|
Loading…
Reference in a new issue