除了在 ESP32 藍牙(Bluetooth)的內置首先是介紹主要(Bluetooth Main API)的 API,還有設備(Bluetooth Device API)的 API 函數,也是常用的藍牙(Bluetooth)API,一般應用時都會使用。
功能 - esp_bt_dev_get_address
原型:const uint8_t *esp_bt_dev_get_address(void)
參數:
返回:bluetooth device address (six bytes), or NULL if
bluetooth stack is not enabled
說明:Get bluetooth device address. Must use after
“esp_bluedroid_enable”.
範例:ESP_BD_ADDR_HEX(esp_bt_dev_get_address());
功能 - esp_bt_dev_set_device_name
原型:esp_err_t esp_bt_dev_set_device_name(const char
*name)
參數:name: : device name to be set
返回:ESP_OK : Succeed
ESP_ERR_INVALID_ARG : if name is NULL
pointer or empty, or string length out of limit
ESP_ERR_INVALID_STATE : if bluetooth stack
is not yet enabled
ESP_FAIL : others
說明:Set bluetooth device name. This function should be
called after esp_bluedroid_enable() completes successfully. A BR/EDR/LE device
type shall have a single Bluetooth device name which shall be identical
irrespective of the physical channel used to perform the name discovery
procedure.
範例:char *dev_name = "ESP_GAP_INQRUIY";
esp_bt_dev_set_device_name(dev_name);
esp_bt_dev_set_device_name(dev_name);
Header File:bt/bluedroid/api/include/api/esp_bt_device.h
參考網址:https://docs.espressif.com/projects/esp-idf/en/latest/api-reference/bluetooth/esp_bt_device.html
2019年 1月 13日 天氣報告
氣溫:19.2度 @ 20:00
相對濕度:百分之 84%
天氣:多雲
沒有留言:
張貼留言