https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/bluetooth.html
ESP32 Bluetooth

Controller
- 하드웨어와 low-level 블루투스 프토토콜과 직접 상호작용(통신 등)하는 레이어
Hosts
- 어떤 방식의 software architecture를 사용할 것인지 정할수 있는 레이어
- Bluedroid을 기반으로 만든 ESP-Bluedroid와 NimBLE을 기반으로 만든 ESP-NimBLE 존재
* Bluedroid와 Nimble은 호스트 스택을 구성하는 종류
* Bluetooth Classic과 BLE는 블루투스 Protocol의 종류
- Bluedroid 호스트 스택은 Bluetooth Classic, BLE 모두 지원, Nimble은 BLE만 지원
ESP-Bluedroid
ESP-Bluedroid is a modified version of the native Android Bluetooth stack, Bluedroid. It consists of two layers:
- Bluetooth Upper Layer (BTU)
The BTU layer is responsible for processing bottom layer Bluetooth protocols such as
L2CAP, GATT/ATT, SMP, GAP, and other profiles.
The BTU layer provides an interface prefixed with "bta".
- Bluetooth Transport Controller layer (BTC)
The BTC layer is mainly responsible for providing a supported interface, prefixed with "esp",
to the application layer, processing GATT-based profiles and handling miscellaneous tasks.
All the APIs are located in the ESP_API layer.
Developers should use the Bluetooth APIs prefixed with "esp".
-> BTC와 관련된 코드를 HID example에서 다음과 같이 볼 수 있다.
esp_err_t esp_bt_hid_device_init(void)
{
ESP_BLUEDROID_STATUS_CHECK(ESP_BLUEDROID_STATUS_ENABLED);
btc_msg_t msg;
msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_HD;
msg.act = BTC_HD_INIT_EVT;
/* Switch to BTC context */
bt_status_t stat = btc_transfer_context(&msg, NULL, 0, NULL, NULL);
return (stat == BT_STATUS_SUCCESS) ? ESP_OK : ESP_FAIL;
}