- removed some debug messages

- fixed rowCountChanged not being emited on model clear
This commit is contained in:
Dorian Zedler 2020-10-18 01:37:09 +02:00
parent 534277a198
commit 6ad924f426
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
2 changed files with 13 additions and 9 deletions

View file

@ -177,7 +177,7 @@ void QBluetoothLeUartClient::handleDeviceDiscovered(const QBluetoothDeviceInfo &
{ {
// Is it a BLE device? // Is it a BLE device?
if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) { if (device.coreConfigurations() & QBluetoothDeviceInfo::LowEnergyCoreConfiguration) {
qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString() << " UUIDs: " << device.serviceUuids(); //qWarning() << "Discovered BLE Device: name: " << device.name() << " Address: " << device.address().toString() << " UUIDs: " << device.serviceUuids();
// ignore all devices that to not support our service // ignore all devices that to not support our service
if(!device.serviceUuids().contains(QBluetoothUuid(this->uartServiceUUID))) if(!device.serviceUuids().contains(QBluetoothUuid(this->uartServiceUUID)))
return; return;
@ -210,6 +210,8 @@ void QBluetoothLeUartClient::handleDeviceScanError(QBluetoothDeviceDiscoveryAgen
emit this->scanningErrorOccured(InputOutputError); emit this->scanningErrorOccured(InputOutputError);
else else
emit this->scanningErrorOccured(UnknownError); emit this->scanningErrorOccured(UnknownError);
this->stopScanningForDevices();
} }
// ---------------------------------- // ----------------------------------
@ -218,11 +220,11 @@ void QBluetoothLeUartClient::handleDeviceScanError(QBluetoothDeviceDiscoveryAgen
void QBluetoothLeUartClient::handleServiceDiscovered(const QBluetoothUuid &uuid){ void QBluetoothLeUartClient::handleServiceDiscovered(const QBluetoothUuid &uuid){
qDebug() << "Found service with ID: " << uuid; //qDebug() << "Found service with ID: " << uuid;
if(uuid == QBluetoothUuid(QUuid(this->uartServiceUUID))){ if(uuid == QBluetoothUuid(QUuid(this->uartServiceUUID))){
foundValidUARTService =true; foundValidUARTService =true;
qDebug() << "UART service found!"; //qDebug() << "UART service found!";
} }
} }
@ -232,12 +234,12 @@ void QBluetoothLeUartClient::handleServiceScanDone(){
bluetoothService=0; bluetoothService=0;
if(foundValidUARTService){ if(foundValidUARTService){
qDebug() << "Connecting to UART service..."; //qDebug() << "Connecting to UART service...";
bluetoothService = bluetoothController->createServiceObject(QBluetoothUuid(QUuid(this->uartServiceUUID)),this); bluetoothService = bluetoothController->createServiceObject(QBluetoothUuid(QUuid(this->uartServiceUUID)),this);
} }
if(!bluetoothService){ if(!bluetoothService){
qDebug() <<"UART service not found"; //qDebug() <<"UART service not found";
this->disconnectFromDevice(); this->disconnectFromDevice();
return; return;
} }
@ -260,7 +262,7 @@ void QBluetoothLeUartClient::handleControllerError(QLowEnergyController::Error e
void QBluetoothLeUartClient::handleDeviceConnected() void QBluetoothLeUartClient::handleDeviceConnected()
{ {
qDebug() << "Device connected"; //qDebug() << "Device connected";
bluetoothController->discoverServices(); bluetoothController->discoverServices();
setState(ScanningForService); setState(ScanningForService);
} }
@ -268,7 +270,7 @@ void QBluetoothLeUartClient::handleDeviceConnected()
void QBluetoothLeUartClient::handleDeviceDisconnected() void QBluetoothLeUartClient::handleDeviceDisconnected()
{ {
this->setState(Idle); this->setState(Idle);
qDebug() << "UART service disconnected"; //qDebug() << "UART service disconnected";
qWarning() << "Remote device disconnected"; qWarning() << "Remote device disconnected";
} }
@ -287,7 +289,7 @@ void QBluetoothLeUartClient::handleServiceStateChange(QLowEnergyService::Service
//looking for the RX characteristic //looking for the RX characteristic
const QLowEnergyCharacteristic TxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID))); const QLowEnergyCharacteristic TxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID)));
if (!TxChar.isValid()){ if (!TxChar.isValid()){
qDebug() << "Rx characteristic not found"; //qDebug() << "Rx characteristic not found";
this->disconnectFromDevice(); this->disconnectFromDevice();
return; return;
} }
@ -295,7 +297,7 @@ void QBluetoothLeUartClient::handleServiceStateChange(QLowEnergyService::Service
//looking for the TX characteristic //looking for the TX characteristic
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID))); const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID)));
if (!RxChar.isValid()) { if (!RxChar.isValid()) {
qDebug() << "Tx characteristic not found"; //qDebug() << "Tx characteristic not found";
this->disconnectFromDevice(); this->disconnectFromDevice();
return; return;
} }

View file

@ -68,4 +68,6 @@ void QBluetoothLeUartDeviceModel::clear() {
this->availableDevices.clear(); this->availableDevices.clear();
this->endResetModel(); this->endResetModel();
emit this->rowCountChanged();
} }