- removed some debug messages
- fixed rowCountChanged not being emited on model clear
This commit is contained in:
parent
534277a198
commit
6ad924f426
2 changed files with 13 additions and 9 deletions
|
@ -177,7 +177,7 @@ void QBluetoothLeUartClient::handleDeviceDiscovered(const QBluetoothDeviceInfo &
|
|||
{
|
||||
// Is it a BLE device?
|
||||
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
|
||||
if(!device.serviceUuids().contains(QBluetoothUuid(this->uartServiceUUID)))
|
||||
return;
|
||||
|
@ -210,6 +210,8 @@ void QBluetoothLeUartClient::handleDeviceScanError(QBluetoothDeviceDiscoveryAgen
|
|||
emit this->scanningErrorOccured(InputOutputError);
|
||||
else
|
||||
emit this->scanningErrorOccured(UnknownError);
|
||||
|
||||
this->stopScanningForDevices();
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
|
@ -218,11 +220,11 @@ void QBluetoothLeUartClient::handleDeviceScanError(QBluetoothDeviceDiscoveryAgen
|
|||
|
||||
void QBluetoothLeUartClient::handleServiceDiscovered(const QBluetoothUuid &uuid){
|
||||
|
||||
qDebug() << "Found service with ID: " << uuid;
|
||||
//qDebug() << "Found service with ID: " << uuid;
|
||||
|
||||
if(uuid == QBluetoothUuid(QUuid(this->uartServiceUUID))){
|
||||
foundValidUARTService =true;
|
||||
qDebug() << "UART service found!";
|
||||
//qDebug() << "UART service found!";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,12 +234,12 @@ void QBluetoothLeUartClient::handleServiceScanDone(){
|
|||
bluetoothService=0;
|
||||
|
||||
if(foundValidUARTService){
|
||||
qDebug() << "Connecting to UART service...";
|
||||
//qDebug() << "Connecting to UART service...";
|
||||
bluetoothService = bluetoothController->createServiceObject(QBluetoothUuid(QUuid(this->uartServiceUUID)),this);
|
||||
}
|
||||
|
||||
if(!bluetoothService){
|
||||
qDebug() <<"UART service not found";
|
||||
//qDebug() <<"UART service not found";
|
||||
this->disconnectFromDevice();
|
||||
return;
|
||||
}
|
||||
|
@ -260,7 +262,7 @@ void QBluetoothLeUartClient::handleControllerError(QLowEnergyController::Error e
|
|||
|
||||
void QBluetoothLeUartClient::handleDeviceConnected()
|
||||
{
|
||||
qDebug() << "Device connected";
|
||||
//qDebug() << "Device connected";
|
||||
bluetoothController->discoverServices();
|
||||
setState(ScanningForService);
|
||||
}
|
||||
|
@ -268,7 +270,7 @@ void QBluetoothLeUartClient::handleDeviceConnected()
|
|||
void QBluetoothLeUartClient::handleDeviceDisconnected()
|
||||
{
|
||||
this->setState(Idle);
|
||||
qDebug() << "UART service disconnected";
|
||||
//qDebug() << "UART service disconnected";
|
||||
qWarning() << "Remote device disconnected";
|
||||
}
|
||||
|
||||
|
@ -287,7 +289,7 @@ void QBluetoothLeUartClient::handleServiceStateChange(QLowEnergyService::Service
|
|||
//looking for the RX characteristic
|
||||
const QLowEnergyCharacteristic TxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->rxUUID)));
|
||||
if (!TxChar.isValid()){
|
||||
qDebug() << "Rx characteristic not found";
|
||||
//qDebug() << "Rx characteristic not found";
|
||||
this->disconnectFromDevice();
|
||||
return;
|
||||
}
|
||||
|
@ -295,7 +297,7 @@ void QBluetoothLeUartClient::handleServiceStateChange(QLowEnergyService::Service
|
|||
//looking for the TX characteristic
|
||||
const QLowEnergyCharacteristic RxChar = bluetoothService->characteristic(QBluetoothUuid(QUuid(this->txUUID)));
|
||||
if (!RxChar.isValid()) {
|
||||
qDebug() << "Tx characteristic not found";
|
||||
//qDebug() << "Tx characteristic not found";
|
||||
this->disconnectFromDevice();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -68,4 +68,6 @@ void QBluetoothLeUartDeviceModel::clear() {
|
|||
this->availableDevices.clear();
|
||||
|
||||
this->endResetModel();
|
||||
|
||||
emit this->rowCountChanged();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue