2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								# include  "downloadfromdcthread.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "core/libdivecomputer.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 23:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/qthelper.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 11:54:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/settings/qPrefDiveComputer.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2019-07-15 23:44:39 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  "core/divelist.h" 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-26 14:07:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# include  <QDebug> 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-08 19:45:40 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if defined(Q_OS_ANDROID) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# include  "core/subsurface-string.h" 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QStringList  vendorList ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QHash < QString ,  QStringList >  productList ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  QHash < QString ,  QStringList >  mobileProductList ;  // BT, BLE or FTDI supported DCs for mobile
 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QMap < QString ,  dc_descriptor_t  * >  descriptorLookup ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-16 21:49:11 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								ConnectionListModel  connectionListModel ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								static  QString  str_error ( const  char  * fmt ,  . . . ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									va_list  args ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									va_start ( args ,  fmt ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									const  QString  str  =  QString ( ) . vsprintf ( fmt ,  args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									va_end ( args ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  str ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 15:41:28 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  updateRememberedDCs ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-02 19:54:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									QString  current  =  qPrefDiveComputer : : vendor ( )  +  "  -  "  +  qPrefDiveComputer : : product ( )  +  "  -  "  +  qPrefDiveComputer : : device ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 15:41:28 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									QStringList  dcs  =  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-02 19:54:54 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : vendor1 ( )  +  "  -  "  +  qPrefDiveComputer : : product1 ( )  +  "  -  "  +  qPrefDiveComputer : : device1 ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : vendor2 ( )  +  "  -  "  +  qPrefDiveComputer : : product2 ( )  +  "  -  "  +  qPrefDiveComputer : : device2 ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : vendor3 ( )  +  "  -  "  +  qPrefDiveComputer : : product3 ( )  +  "  -  "  +  qPrefDiveComputer : : device3 ( ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : vendor4 ( )  +  "  -  "  +  qPrefDiveComputer : : product4 ( )  +  "  -  "  +  qPrefDiveComputer : : device4 ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 15:41:28 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( dcs . contains ( current ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										// already in the list
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// add the current one as the first remembered one and drop the 4th one
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// don't get confused by 0-based and 1-based indices!
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( dcs [ 2 ]  ! =  "  -  " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_vendor4 ( qPrefDiveComputer : : vendor3 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_product4 ( qPrefDiveComputer : : product3 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_device4 ( qPrefDiveComputer : : device3 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( dcs [ 1 ]  ! =  "  -  " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_vendor3 ( qPrefDiveComputer : : vendor2 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_product3 ( qPrefDiveComputer : : product2 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_device3 ( qPrefDiveComputer : : device2 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( dcs [ 0 ]  ! =  "  -  " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_vendor2 ( qPrefDiveComputer : : vendor1 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_product2 ( qPrefDiveComputer : : product1 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qPrefDiveComputer : : set_device2 ( qPrefDiveComputer : : device1 ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_vendor1 ( qPrefDiveComputer : : vendor ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_product1 ( qPrefDiveComputer : : product ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_device1 ( qPrefDiveComputer : : device ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-12-10 14:49:32 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DownloadThread : : DownloadThread ( )  :  downloadTable ( {  0  } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 22:45:17 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									diveSiteTable ( {  0  } ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-10 14:49:32 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									m_data ( DCDeviceData : : instance ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DownloadThread : : run ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-26 16:40:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									auto  internalData  =  m_data - > internalData ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									internalData - > descriptor  =  descriptorLookup [ m_data - > vendor ( )  +  m_data - > product ( ) ] ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									internalData - > download_table  =  & downloadTable ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 22:45:17 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									internalData - > sites  =  & diveSiteTable ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-06 11:23:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									internalData - > btname  =  strdup ( m_data - > devBluetoothName ( ) . toUtf8 ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-10 10:01:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! internalData - > descriptor )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qDebug ( )  < <  " No download possible when DC type is unknown " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-29 15:05:46 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									qDebug ( )  < <  " Starting download from  "  < <  ( internalData - > bluetooth_mode  ?  " BT "  :  internalData - > devname ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-05-05 16:07:15 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									qDebug ( )  < <  " downloading "  < <  ( internalData - > force_download  ?  " all "  :  " only new " )  < <  " dives " ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-04 20:59:08 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									clear_dive_table ( & downloadTable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-02-28 22:45:17 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									clear_dive_site_table ( & diveSiteTable ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-26 16:40:50 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Q_ASSERT ( internalData - > download_table  ! =  nullptr ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									const  char  * errorText ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									import_thread_cancelled  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-24 00:27:52 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									error . clear ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( ! strcmp ( internalData - > vendor ,  " Uemis " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										errorText  =  do_uemis_import ( internalData ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
									else 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										errorText  =  do_libdivecomputer_import ( internalData ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 15:50:11 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									if  ( errorText )  { 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										error  =  str_error ( errorText ,  internalData - > devname ,  internalData - > vendor ,  internalData - > product ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 15:50:11 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										qDebug ( )  < <  " Finishing download thread: "  < <  error ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									}  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-10-04 18:34:30 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! downloadTable . nr ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											error  =  tr ( " No new dives downloaded from dive computer " ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-21 15:50:11 +09:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										qDebug ( )  < <  " Finishing download thread: "  < <  downloadTable . nr  < <  " dives downloaded " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-15 11:54:37 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_vendor ( internalData - > vendor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_product ( internalData - > product ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_device ( internalData - > devname ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									qPrefDiveComputer : : set_device_name ( m_data - > devBluetoothName ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-09-21 15:41:28 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									updateRememberedDCs ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-18 19:14:03 +02:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  void  fill_supported_mobile_list ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if defined(Q_OS_ANDROID) 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* USB or FTDI devices that are supported on Android - this does NOT include the BLE or BT only devices */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Aeris " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " 500 AI " } ,  { " A300 " } ,  { " A300 AI " } ,  { " A300CS " } ,  { " Atmos 2 " } ,  { " Atmos AI " } ,  { " Atmos AI 2 " } ,  { " Compumask " } ,  { " Elite " } ,  { " Elite T3 " } ,  { " Epic " } ,  { " F10 " } ,  { " F11 " } ,  { " Manta " } ,  { " XR-1 NX " } ,  { " XR-2 " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Aqualung " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " i200 " } ,  { " i300 " } ,  { " i450T " } ,  { " i550 " } ,  { " i750TC " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Beuchat " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Mundial 2 " } ,  { " Mundial 3 " } ,  { " Voyager 2G " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-06 08:35:39 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Cochran " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Commander I " } ,  { " Commander II " } ,  { " Commander TM " } ,  { " EMC-14 " } ,  { " EMC-16 " } ,  { " EMC-20H " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-27 16:09:15 +10:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Cressi " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2019-06-15 11:35:32 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Leonardo " } ,  { " Giotto " } ,  { " Newton " } ,  { " Drake " } ,  { " Cartesio " } ,  { " Goa " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-12 18:18:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " DiveSystem " ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QStringList ( { { " Orca " } ,  { " iDive Pro " } ,  { " iDive DAN " } ,  { " iDive Tech " } ,  { " iDive Reb " } ,  { " iDive Stealth " } ,  { " iDive Free " } ,  { " iDive Easy " } ,  { " iDive X3M " } ,  { " iDive Deep " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Genesis " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " React Pro " } ,  { " React Pro White " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Heinrichs Weikamp " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2018-03-14 01:03:31 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Frog " } ,  { " OSTC " } ,  { " OSTC 2 " } ,  { " OSTC 2C " } ,  { " OSTC 2N " } ,  { " OSTC 3 " } ,  { " OSTC 3+ " } ,  { " OSTC 4 " } ,  { " OSTC Mk2 " } ,  { " OSTC Plus " } ,  { " OSTC Sport " } ,  { " OSTC cR " } ,  { " OSTC 2 TR " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Hollis " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " DG02 " } ,  { " DG03 " } ,  { " TX1 " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-12 21:14:23 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Mares " ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QStringList ( { { " Puck Pro " } ,  { " Smart " } ,  { " Quad " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Oceanic " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Atom 1.0 " } ,  { " Atom 2.0 " } ,  { " Atom 3.0 " } ,  { " Atom 3.1 " } ,  { " Datamask " } ,  { " F10 " } ,  { " F11 " } ,  { " Geo " } ,  { " Geo 2.0 " } ,  { " OC1 " } ,  { " OCS " } ,  { " OCi " } ,  { " Pro Plus 2 " } ,  { " Pro Plus 2.1 " } ,  { " Pro Plus 3 " } ,  { " VT 4.1 " } ,  { " VT Pro " } ,  { " VT3 " } ,  { " VT4 " } ,  { " VTX " } ,  { " Veo 1.0 " } ,  { " Veo 180 " } ,  { " Veo 2.0 " } ,  { " Veo 200 " } ,  { " Veo 250 " } ,  { " Veo 3.0 " } ,  { " Versa Pro " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-12 18:18:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Ratio " ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QStringList ( { { " iX3M Pro Fancy " } ,  { " iX3M Pro Easy " } ,  { " iX3M Pro Pro " } ,  { " iX3M Pro Deep " } ,  { " iX3M Pro Tech+ " } ,  { " iX3M Pro Reb " } ,  { " iDive Free " } ,  { " iDive Fancy " } ,  { " iDive Easy " } ,  { " iDive Pro " } ,  { " iDive Deep " } ,  { " iDive Tech+ " } ,  { " iDive Reb " } ,  { " iDive Color Free " } ,  { " iDive Color Fancy " } ,  { " iDive Color Easy " } ,  { " iDive Color Pro " } ,  { " iDive Color Deep " } ,  { " iDive Color Tech+ " } ,  { " iDive Color Reb " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-02 21:57:08 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Scubapro " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Aladin Square " } ,  { " G2 " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-09-12 18:18:29 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Seac " ]  = 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QStringList ( { { " Jack " } ,  { " Guru " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Seemann " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " XP5 " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Sherwood " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Amphos " } ,  { " Amphos Air " } ,  { " Insight " } ,  { " Insight 2 " } ,  { " Vision " } ,  { " Wisdom " } ,  { " Wisdom 2 " } ,  { " Wisdom 3 " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Subgear " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " XP-Air " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Suunto " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Cobra " } ,  { " Cobra 2 " } ,  { " Cobra 3 " } ,  { " D3 " } ,  { " D4 " } ,  { " D4f " } ,  { " D4i " } ,  { " D6 " } ,  { " D6i " } ,  { " D9 " } ,  { " D9tx " } ,  { " DX " } ,  { " EON Core " } ,  { " EON Steel " } ,  { " Eon " } ,  { " Gekko " } ,  { " HelO2 " } ,  { " Mosquito " } ,  { " Solution " } ,  { " Solution Alpha " } ,  { " Solution Nitrox " } ,  { " Spyder " } ,  { " Stinger " } ,  { " Vyper " } ,  { " Vyper 2 " } ,  { " Vyper Air " } ,  { " Vyper Novo " } ,  { " Vytec " } ,  { " Zoop " } ,  { " Zoop Novo " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Tusa " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Element II (IQ-750) " } ,  { " Zen (IQ-900) " } ,  { " Zen Air (IQ-950) " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-08 16:06:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Uwatec " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Aladin Air Twin " } ,  { " Aladin Air Z " } ,  { " Aladin Air Z Nitrox " } ,  { " Aladin Air Z O2 " } ,  { " Aladin Pro " } ,  { " Aladin Pro Ultra " } ,  { " Aladin Sport Plus " } ,  { " Memomouse " } } ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-10-15 13:09:44 -04:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mobileProductList [ " Atomic Aquatics " ]  = 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-26 22:20:17 -08:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										QStringList ( { { " Cobalt " } ,  { " Cobalt 2 " } } ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  fill_computer_list ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dc_iterator_t  * iterator  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dc_descriptor_t  * descriptor  =  NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 15:51:35 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  int  transportMask  =  get_supported_transports ( NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-18 21:19:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									fill_supported_mobile_list ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									dc_descriptor_iterator ( & iterator ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									while  ( dc_iterator_next ( iterator ,  & descriptor )  = =  DC_STATUS_SUCCESS )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										// mask out the transports that aren't supported
 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-25 15:51:35 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										unsigned  int  transports  =  dc_descriptor_get_transports ( descriptor )  &  transportMask ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( transports  = =  0 ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-18 21:19:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// none of the transports are available, skip
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											continue ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										const  char  * vendor  =  dc_descriptor_get_vendor ( descriptor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										const  char  * product  =  dc_descriptor_get_product ( descriptor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if defined(Q_OS_ANDROID) 
 
							 
						 
					
						
							
								
									
										
										
										
											2020-03-05 22:39:11 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ( transports  &  ~ ( DC_TRANSPORT_USB  |  DC_TRANSPORT_USBHID ) )  = =  0 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											// if the only available transports are USB, then check against
 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											// the ones that we explicitly support on Android
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											if  ( ! mobileProductList . contains ( vendor )  | |  ! mobileProductList [ vendor ] . contains ( product ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
												continue ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										if  ( ! vendorList . contains ( vendor ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											vendorList . append ( vendor ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( ! productList [ vendor ] . contains ( product ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 03:15:49 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											productList [ vendor ] . append ( product ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										descriptorLookup [ QString ( vendor )  +  QString ( product ) ]  =  descriptor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									dc_iterator_free ( iterator ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 20:21:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Q_FOREACH  ( QString  vendor ,  vendorList )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										auto  & l  =  productList [ vendor ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										std : : sort ( l . begin ( ) ,  l . end ( ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									/* currently suppress the Uemis Zurich on Q_OS_ANDROID and Q_OS_IOS,
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									 *  as  it  is  no  BT  device  */ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									/* and add the Uemis Zurich which we are handling internally
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  THIS  IS  A  HACK  as  we  magically  have  a  data  structure  here  that 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  happens  to  match  a  data  structure  that  is  internal  to  libdivecomputer ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  this  WILL  BREAK  if  libdivecomputer  changes  the  dc_descriptor  struct . . . 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									  eventually  the  UEMIS  code  needs  to  move  into  libdivecomputer ,  I  guess  */ 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-19 06:14:18 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									struct  mydescriptor  * mydescriptor  =  ( struct  mydescriptor  * ) malloc ( sizeof ( struct  mydescriptor ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mydescriptor - > vendor  =  " Uemis " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mydescriptor - > product  =  " Zurich " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mydescriptor - > type  =  DC_FAMILY_NULL ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									mydescriptor - > model  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-27 10:32:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									mydescriptor - > transports  =  DC_TRANSPORT_USBSTORAGE ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! vendorList . contains ( " Uemis " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										vendorList . append ( " Uemis " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! productList [ " Uemis " ] . contains ( " Zurich " ) ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										productList [ " Uemis " ] . push_back ( " Zurich " ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									descriptorLookup [ " UemisZurich " ]  =  ( dc_descriptor_t  * ) mydescriptor ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-22 11:27:51 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2019-04-03 20:21:53 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									std : : sort ( vendorList . begin ( ) ,  vendorList . end ( ) ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-04-27 20:24:14 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-08-27 10:32:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# define NUMTRANSPORTS 7 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-12 11:22:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								static  QString  transportStringTable [ NUMTRANSPORTS ]  =  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " SERIAL " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " USB " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " USBHID " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " IRDA " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " BT " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-08-27 10:32:14 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									QStringLiteral ( " BLE " ) , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QStringLiteral ( " USBSTORAGE " ) , 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-12 11:22:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								static  QString  getTransportString ( unsigned  int  transport ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									QString  ts ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									for  ( int  i  =  0 ;  i  <  NUMTRANSPORTS ;  i + + )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( transport  &  1  < <  i ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											ts  + =  transportStringTable [ i ]  +  " ,  " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									ts . chop ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  ts ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 06:37:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  show_computer_list ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-12 11:22:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									unsigned  int  transportMask  =  get_supported_transports ( NULL ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 06:37:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									qDebug ( )  < <  " Supported dive computers: " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									Q_FOREACH  ( QString  vendor ,  vendorList )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										QString  msg  =  vendor  +  " :  " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										Q_FOREACH  ( QString  product ,  productList [ vendor ] )  { 
							 
						 
					
						
							
								
									
										
										
										
											2018-05-12 11:22:54 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											dc_descriptor_t  * descriptor  =  descriptorLookup [ vendor  +  product ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											unsigned  int  transport  =  dc_descriptor_get_transports ( descriptor )  &  transportMask ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QString  transportString  =  getTransportString ( transport ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											msg  + =  product  +  "  ( "  +  transportString  +  " ),  " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-04-19 06:37:13 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										msg . chop ( 2 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										qDebug ( )  < <  msg ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 16:59:02 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DCDeviceData : : DCDeviceData ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									memset ( & data ,  0 ,  sizeof ( data ) ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . download_table  =  nullptr ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . diveid  =  0 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . deviceid  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 02:23:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if defined(BT_SUPPORT) 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 16:46:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . bluetooth_mode  =  true ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-07-29 02:23:48 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . bluetooth_mode  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 16:46:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . force_download  =  false ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . libdc_dump  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-27 16:00:31 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# if defined(SUBSURFACE_MOBILE) 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . libdc_log  =  true ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# else 
 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 16:46:19 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . libdc_log  =  false ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-27 16:00:31 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DCDeviceData  * DCDeviceData : : instance ( ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-12-10 15:21:50 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									static  DCDeviceData  self ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  & self ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QStringList  DCDeviceData : : getProductListFromVendor ( const  QString  & vendor ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  productList [ vendor ] ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-16 21:49:11 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  DCDeviceData : : getMatchingAddress ( const  QString  & vendor ,  const  QString  & product ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2019-03-20 07:31:24 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									Q_UNUSED ( vendor ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  connectionListModel . indexOf ( product ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-16 21:49:11 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								DCDeviceData  * DownloadThread : : data ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  m_data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  DCDeviceData : : vendor ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . vendor ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QString  DCDeviceData : : product ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . product ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								QString  DCDeviceData : : devName ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . devname ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-11-12 12:33:20 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  DCDeviceData : : devBluetoothName ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  m_devBluetoothName ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								QString  DCDeviceData : : descriptor ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  " " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  DCDeviceData : : bluetoothMode ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . bluetooth_mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  DCDeviceData : : forceDownload ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . force_download ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  DCDeviceData : : deviceId ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . deviceid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								int  DCDeviceData : : diveId ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . diveid ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setVendor ( const  QString  & vendor ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 23:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . vendor  =  copy_qstring ( vendor ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setProduct ( const  QString  & product ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 23:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . product  =  copy_qstring ( product ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setDevName ( const  QString  & devName ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 12:10:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// This is a workaround for bug #1002. A string of the form "devicename (deviceaddress)"
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// or "deviceaddress (devicename)" may have found its way into the preferences.
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Try to fetch the address from such a string
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// TODO: Remove this code in due course
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( data . bluetooth_mode )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  idx1  =  devName . indexOf ( ' ( ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										int  idx2  =  devName . lastIndexOf ( ' ) ' ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										if  ( idx1  > =  0  & &  idx2  > =  0  & &  idx2  >  idx1 )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QString  front  =  devName . left ( idx1 ) . trimmed ( ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QString  back  =  devName . mid ( idx1  +  1 ,  idx2  -  idx1  -  1 ) ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											QString  newDevName  =  back . indexOf ( ' : ' )  > =  0  ?  back  :  front ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
											qWarning ( )  < <  " Found invalid bluetooth device "  < <  devName  < <  " corrected to "  < <  newDevName  < <  " . " ; 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 23:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											data . devname  =  copy_qstring ( newDevName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-12-31 12:10:37 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
											return ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
										} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									} 
							 
						 
					
						
							
								
									
										
										
										
											2018-02-28 23:37:09 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									data . devname  =  copy_qstring ( devName ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setDevBluetoothName ( const  QString  & name ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-11-12 12:33:20 +01:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									m_devBluetoothName  =  name ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-05-12 19:18:20 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setBluetoothMode ( bool  mode ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . bluetooth_mode  =  mode ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setForceDownload ( bool  force ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . force_download  =  force ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setDeviceId ( int  deviceId ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . deviceid  =  deviceId ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setDiveId ( int  diveId ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . diveid  =  diveId ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setSaveDump ( bool  save ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . libdc_dump  =  save ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  DCDeviceData : : saveDump ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . libdc_dump ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								void  DCDeviceData : : setSaveLog ( bool  saveLog ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									data . libdc_log  =  saveLog ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								bool  DCDeviceData : : saveLog ( )  const 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  data . libdc_log ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2018-06-09 12:31:31 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2018-07-25 18:43:55 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								device_data_t  * DCDeviceData : : internalData ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-05-19 11:23:11 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  & data ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-26 12:27:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  DCDeviceData : : getDetectedVendorIndex ( ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if defined(BT_SUPPORT) 
 
							 
						 
					
						
							
								
									
										
										
											
												Mobile: wrap up fixes for BT download on Android
Major functional change in this commit is the addition of found static BT devices
to the internal administration (on Android), in a way that is equivalent to
mobile-on-desktop. So, in both cases, the list of devices in the app are
as in the list of devices on the host OS (Linux or Android). To minimize code
duplication, the btDeviceDiscovered slot is split in two parts, the part to
act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and
the part only needed for Android.
Remaining to be fixed: the correct handling of the QML UI selection of
vendor/product. The first default dive computer is correctly detected,
all paired devices from the virtual vendow can be selected, but clicking
through vendors results in non logical selections. It is obvious why
this is, but a fix is not straigforward at this point.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
											 
										 
										
											2017-06-12 10:38:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									QList < BTDiscovery : : btVendorProduct >  btDCs  =  BTDiscovery : : instance ( ) - > getBtDcs ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-10 10:09:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-07-17 07:43:31 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// Pick the vendor of the first confirmed find of a DC (if any)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! btDCs . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  btDCs . first ( ) . vendorIdx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2017-08-26 12:27:12 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								int  DCDeviceData : : getDetectedProductIndex ( const  QString  & currentVendorText ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# if defined(BT_SUPPORT) 
 
							 
						 
					
						
							
								
									
										
										
											
												Mobile: wrap up fixes for BT download on Android
Major functional change in this commit is the addition of found static BT devices
to the internal administration (on Android), in a way that is equivalent to
mobile-on-desktop. So, in both cases, the list of devices in the app are
as in the list of devices on the host OS (Linux or Android). To minimize code
duplication, the btDeviceDiscovered slot is split in two parts, the part to
act as slot for the Qt BT discovery agent (Linux, so mobile-on-desktop), and
the part only needed for Android.
Remaining to be fixed: the correct handling of the QML UI selection of
vendor/product. The first default dive computer is correctly detected,
all paired devices from the virtual vendow can be selected, but clicking
through vendors results in non logical selections. It is obvious why
this is, but a fix is not straigforward at this point.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
											 
										 
										
											2017-06-12 10:38:24 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									QList < BTDiscovery : : btVendorProduct >  btDCs  =  BTDiscovery : : instance ( ) - > getBtDcs ( ) ; 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-10 10:09:56 +02:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// Display in the QML UI, the first found dive computer that is been
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									// detected as a possible real dive computer (and not some other paired
 
							 
						 
					
						
							
								
									
										
										
										
											2017-07-17 07:43:31 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
									// BT device)
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									if  ( ! btDCs . isEmpty ( ) ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-06-05 19:41:57 -07:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
										return  btDCs . first ( ) . productIdx ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								# endif 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									return  - 1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								}