diff --git a/lib/BluetoothSerial/BluetoothSerial.cpp b/lib/BluetoothSerial/BluetoothSerial.cpp index c25bc8b..24d83be 100644 --- a/lib/BluetoothSerial/BluetoothSerial.cpp +++ b/lib/BluetoothSerial/BluetoothSerial.cpp @@ -42,7 +42,7 @@ static TaskHandle_t _spp_task_handle = NULL; static EventGroupHandle_t _spp_event_group = NULL; static EventGroupHandle_t _bt_event_group = NULL; static boolean secondConnectionAttempt; -static esp_spp_cb_t * custom_spp_callback = NULL; +static esp_spp_cb_t custom_spp_callback = NULL; static BluetoothSerialDataCb custom_data_callback = NULL; static esp_bd_addr_t current_bd_addr; static ConfirmRequestCb confirm_request_callback = NULL; @@ -790,7 +790,7 @@ void BluetoothSerial::confirmReply(boolean confirm) } -esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t * callback) +esp_err_t BluetoothSerial::register_callback(esp_spp_cb_t callback) { custom_spp_callback = callback; return ESP_OK; diff --git a/lib/BluetoothSerial/BluetoothSerial.h b/lib/BluetoothSerial/BluetoothSerial.h index 7194ca6..937a26a 100644 --- a/lib/BluetoothSerial/BluetoothSerial.h +++ b/lib/BluetoothSerial/BluetoothSerial.h @@ -37,7 +37,7 @@ class BluetoothSerial: public Stream void flush(); void end(void); void onData(BluetoothSerialDataCb cb); - esp_err_t register_callback(esp_spp_cb_t * callback); + esp_err_t register_callback(esp_spp_cb_t callback); void onConfirmRequest(ConfirmRequestCb cb); void onAuthComplete(AuthCompleteCb cb); diff --git a/src/bluetoothSelect.h b/src/bluetoothSelect.h index 21cac95..ce8d073 100644 --- a/src/bluetoothSelect.h +++ b/src/bluetoothSelect.h @@ -9,7 +9,7 @@ class BTSerialInterface virtual bool begin(String deviceName, bool isMaster, uint16_t rxQueueSize, uint16_t txQueueSize) = 0; virtual void disconnect() = 0; virtual void end() = 0; - virtual esp_err_t register_callback(esp_spp_cb_t * callback) = 0; + virtual esp_err_t register_callback(esp_spp_cb_t callback) = 0; virtual void setTimeout(unsigned long timeout) = 0; virtual int available() = 0; @@ -44,7 +44,7 @@ class BTClassicSerial : public virtual BTSerialInterface, public BluetoothSerial BluetoothSerial::end(); } - esp_err_t register_callback(esp_spp_cb_t * callback) + esp_err_t register_callback(esp_spp_cb_t callback) { return BluetoothSerial::register_callback(callback); } @@ -110,7 +110,7 @@ class BTLESerial : public virtual BTSerialInterface, public BleSerial BleSerial::end(); } - esp_err_t register_callback(esp_spp_cb_t *callback) + esp_err_t register_callback(esp_spp_cb_t callback) { connectionCallback = callback; return ESP_OK; @@ -156,19 +156,20 @@ class BTLESerial : public virtual BTSerialInterface, public BleSerial { // bleConnected = true; Removed until PR is accepted if(connectionCallback){ - connectionCallback(ESP_SPP_SRV_OPEN_EVT, nullptr); + // connectionCallback(ESP_SPP_SRV_OPEN_EVT, nullptr); } } void onDisconnect(BLEServer *pServer) { // bleConnected = false; Removed until PR is accepted + esp_spp_cb_param_t* param = NULL; connectionCallback(ESP_SPP_CLOSE_EVT, nullptr); Server->startAdvertising(); } private: - esp_spp_cb_t *connectionCallback; + esp_spp_cb_t connectionCallback; }; #endif \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index df8756c..206e2af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1810,14 +1810,14 @@ void bluetoothStart() // else if (settings.bluetoothRadioType == BLUETOOTH_RADIO_BLE) // bluetoothSerial = new BTLESerial(); - if (bluetoothSerial->begin(deviceName) == false) - { - Serial.println("An error occurred initializing Bluetooth"); + // if (bluetoothSerial->begin(deviceName) == false) + // { + // Serial.println("An error occurred initializing Bluetooth"); - if (productVariant == RTK_SURVEYOR) - digitalWrite(pin_bluetoothStatusLED, LOW); - return; - } + // if (productVariant == RTK_SURVEYOR) + // digitalWrite(pin_bluetoothStatusLED, LOW); + // return; + // } //Set PIN to 1234 so we can connect to older BT devices, but not require a PIN for modern device pairing //See issue: https://github.com/sparkfun/SparkFun_RTK_Firmware/issues/5 @@ -1839,7 +1839,7 @@ void bluetoothStart() esp_bt_gap_set_pin(pin_type, 4, pin_code); //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- - bluetoothSerial->register_callback(bluetoothCallback); //Controls BT Status LED on Surveyor + // bluetoothSerial->register_callback(bluetoothCallback); //Controls BT Status LED on Surveyor bluetoothSerial->setTimeout(250); Serial.print("Bluetooth broadcasting as: ");