From 7c76c77610fb1d792adff6ab95f5a2eb5a68b23d Mon Sep 17 00:00:00 2001 From: gohai Date: Thu, 28 Jun 2018 13:24:23 -0700 Subject: [PATCH] BluetoothSerial: set COD to be compatible with macOS (#1304) --- libraries/BluetoothSerial/src/BluetoothSerial.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libraries/BluetoothSerial/src/BluetoothSerial.cpp b/libraries/BluetoothSerial/src/BluetoothSerial.cpp index c0b4d5e61d9..a71bd294dd6 100644 --- a/libraries/BluetoothSerial/src/BluetoothSerial.cpp +++ b/libraries/BluetoothSerial/src/BluetoothSerial.cpp @@ -136,6 +136,16 @@ static bool _init_bt(const char *deviceName) } esp_bt_dev_set_device_name(deviceName); + // the default BTA_DM_COD_LOUDSPEAKER does not work with the macOS BT stack + esp_bt_cod_t cod; + cod.major = 0b00001; + cod.minor = 0b000100; + cod.service = 0b00000010110; + if (esp_bt_gap_set_cod(cod, ESP_BT_INIT_COD) != ESP_OK) { + log_e("%s set cod failed\n", __func__); + return false; + } + return true; }