mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Change dive computer family detection
Following suggestions on the mailing list, this changes the method used to detect the dive computer family. Detection is now done using: dc_device_get_type. Signed-off-by: Joseph W. Joshua <joejoshw@gmail.com> Signed-off-by: Thiago Macieira <thiago@macieira.org>
This commit is contained in:
		
							parent
							
								
									3e127a059f
								
							
						
					
					
						commit
						a08d239af5
					
				
					 1 changed files with 9 additions and 7 deletions
				
			
		|  | @ -83,13 +83,12 @@ ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data) | |||
| 
 | ||||
| void ReadSettingsThread::run() | ||||
| { | ||||
| 	QString vendor = data->vendor; | ||||
| 	dc_status_t rc; | ||||
| 	rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); | ||||
| 	if (rc == DC_STATUS_SUCCESS) { | ||||
| 		if (vendor.trimmed() == "Heinrichs Weikamp") { | ||||
| 		if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) { | ||||
| 			unsigned char hw_data[10]; | ||||
| 			hw_frog_device_version(data->device, hw_data, 10); | ||||
| 			hw_ostc3_device_version(data->device, hw_data, 10); | ||||
| 			QTextStream (&result) << "Device Version: " << hw_data; //just a test. I will work on decoding this
 | ||||
| 		} else { | ||||
| 			lastError = tr("This feature is not yet available for the selected dive computer."); | ||||
|  | @ -112,18 +111,21 @@ void WriteSettingsThread::run() | |||
| { | ||||
| 	bool supported = false; | ||||
| 	dc_status_t rc; | ||||
| 	QString product = data->product; | ||||
| 	QString vendor = data->vendor; | ||||
| 	rc = dc_device_open(&data->device, data->context, data->descriptor, data->devname); | ||||
| 	if (rc == DC_STATUS_SUCCESS) { | ||||
| 		dc_status_t result; | ||||
| 		if (product.trimmed() == "OSTC 3") { | ||||
| 		if (dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3) { | ||||
| 			if (m_settingName == "Name") { | ||||
| 				supported = true; | ||||
| 				result = hw_ostc3_device_customtext(data->device, m_settingValue.toByteArray().data()); | ||||
| 			} | ||||
| 		} else if ( dc_device_get_type(data->device) == DC_FAMILY_HW_FROG ) { | ||||
| 			if (m_settingName == "Name") { | ||||
| 				supported = true; | ||||
| 				result = hw_frog_device_customtext(data->device, m_settingValue.toByteArray().data()); | ||||
| 			} | ||||
| 		} | ||||
| 		if (vendor.trimmed() == "Heinrichs Weikamp" && m_settingName == "DateAndTime") { | ||||
| 		if ( dc_device_get_type(data->device) == DC_FAMILY_HW_OSTC3 && m_settingName == "DateTime" ) { | ||||
| 			supported = true; | ||||
| 			QDateTime timeToSet = m_settingValue.toDateTime(); | ||||
| 			dc_datetime_t time; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue