OVMS3-idf/examples/bluetooth/esp_ble_mesh/ble_mesh_console/ble_mesh_node/main/register_bluetooth.c
Hrishikesh Dhayagude cba69dd088 Bluetooth examples restructuring
The existing Bluetooth examples are split as:

1. examples/bluetooth/bluedroid - Bluedroid Host (BT + BLE) examples
   a. examples/bluetooth/bluedroid/classic_bt - Classic BT examples
   b. examples/bluetooth/bluedroid/ble - BLE examples
   c. examples/bluetooth/bluedroid/coex - Classic BT and BLE coex examples
   d. examples/bluetooth/bluedroid/hci - VHCI and HCI UART examples
      i. Rename ble_adv to controller_vhci_ble_adv and move it in hci folder
2. examples/bluetooth/nimble - NimBLE BLE Host + NimBLE Mesh examples
3. examples/bluetooth/esp_ble_mesh - ESP BLE Mesh examples
4. Update documentation references
2019-07-01 19:21:57 +08:00

46 lines
1.2 KiB
C

// Copyright 2017-2018 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 "esp_console.h"
#define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
#define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
void register_ble_address();
void register_bluetooth()
{
register_ble_address();
}
int bt_mac()
{
const uint8_t *mac = esp_bt_dev_get_address();
printf("+BTMAC:"MACSTR"\n", MAC2STR(mac));
return 0;
}
void register_ble_address()
{
const esp_console_cmd_t cmd = {
.command = "btmac",
.help = "get BT mac address",
.hint = NULL,
.func = (esp_console_cmd_func_t)&bt_mac,
};
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));
}