mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	qt-ble: only connect the signals to the preferred service
We used to just find all services and connect the characteristics change signal etc to them all, but we really only care about the actual preferred service that we'll be using. So move the qt ble signal connection to after we've selected the preferred service that we will actually be enabling notifications on and do the writes to. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									b19fe27e19
								
							
						
					
					
						commit
						0ba105d2a7
					
				
					 1 changed files with 5 additions and 4 deletions
				
			
		|  | @ -100,10 +100,6 @@ void BLEObject::addService(const QBluetoothUuid &newService) | |||
| 	qDebug() << " .. created service object" << service; | ||||
| 	if (service) { | ||||
| 		services.append(service); | ||||
| 		connect(service, &QLowEnergyService::stateChanged, this, &BLEObject::serviceStateChanged); | ||||
| 		connect(service, &QLowEnergyService::characteristicChanged, this, &BLEObject::characteristcStateChanged); | ||||
| 		connect(service, &QLowEnergyService::characteristicWritten, this, &BLEObject::characteristicWritten); | ||||
| 		connect(service, &QLowEnergyService::descriptorWritten, this, &BLEObject::writeCompleted); | ||||
| 		service->discoverDetails(); | ||||
| 	} | ||||
| } | ||||
|  | @ -285,6 +281,11 @@ dc_status_t BLEObject::select_preferred_service(void) | |||
| 		return DC_STATUS_IO; | ||||
| 	} | ||||
| 
 | ||||
| 	connect(preferred, &QLowEnergyService::stateChanged, this, &BLEObject::serviceStateChanged); | ||||
| 	connect(preferred, &QLowEnergyService::characteristicChanged, this, &BLEObject::characteristcStateChanged); | ||||
| 	connect(preferred, &QLowEnergyService::characteristicWritten, this, &BLEObject::characteristicWritten); | ||||
| 	connect(preferred, &QLowEnergyService::descriptorWritten, this, &BLEObject::writeCompleted); | ||||
| 
 | ||||
| 	return DC_STATUS_SUCCESS; | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue