mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	BLE: helper function to get QBtDeviceInfo from UUID
Right now this will only work if you scan for your BLE dive computer every time. Ideally we should simply initiate a scan and look for that address if it's not found in the hash. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									e5b7fb74b4
								
							
						
					
					
						commit
						db38a7023d
					
				
					 2 changed files with 17 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -307,4 +307,18 @@ bool BTDiscovery::checkException(const char* method, const QAndroidJniObject *ob
 | 
			
		|||
}
 | 
			
		||||
#endif // Q_OS_ANDROID
 | 
			
		||||
 | 
			
		||||
QHash<QString, QBluetoothDeviceInfo> btDeviceInfo;
 | 
			
		||||
 | 
			
		||||
void saveBtDeviceInfo(const char* devaddr, QBluetoothDeviceInfo deviceInfo)
 | 
			
		||||
{
 | 
			
		||||
	btDeviceInfo[devaddr] = deviceInfo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QBluetoothDeviceInfo getBtDeviceInfo(const char* devaddr)
 | 
			
		||||
{
 | 
			
		||||
	if (btDeviceInfo.contains(devaddr))
 | 
			
		||||
		return btDeviceInfo[devaddr];
 | 
			
		||||
	qDebug() << "need to scan for" << devaddr;
 | 
			
		||||
	return QBluetoothDeviceInfo();
 | 
			
		||||
}
 | 
			
		||||
#endif // BT_SUPPORT
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,9 @@
 | 
			
		|||
#include <QAndroidJniEnvironment>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
void saveBtDeviceInfo(const char* devaddr, QBluetoothDeviceInfo deviceInfo);
 | 
			
		||||
QBluetoothDeviceInfo getBtDeviceInfo(const char* devaddr);
 | 
			
		||||
 | 
			
		||||
class ConnectionListModel : public QAbstractListModel {
 | 
			
		||||
	Q_OBJECT
 | 
			
		||||
public:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue