| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -9,6 +9,7 @@ class TestSound : public Sound { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					public: | 
					 | 
					 | 
					 | 
					public: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  TestSound() : Sound() { | 
					 | 
					 | 
					 | 
					  TestSound() : Sound() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (auto i = sounds.constBegin(); i != sounds.constEnd(); ++i) { | 
					 | 
					 | 
					 | 
					    for (auto i = sounds.constBegin(); i != sounds.constEnd(); ++i) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      sound_stats[i.key()] = {0, 0}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      QObject::connect(i.value().first, &QSoundEffect::playingChanged, [=, s = i.value().first, a = i.key()]() { | 
					 | 
					 | 
					 | 
					      QObject::connect(i.value().first, &QSoundEffect::playingChanged, [=, s = i.value().first, a = i.key()]() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (s->isPlaying()) { | 
					 | 
					 | 
					 | 
					        if (s->isPlaying()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          sound_stats[a].first++; | 
					 | 
					 | 
					 | 
					          sound_stats[a].first++; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -23,7 +24,11 @@ public: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}; | 
					 | 
					 | 
					 | 
					}; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					void controls_thread(int loop_cnt) { | 
					 | 
					 | 
					 | 
					void controls_thread(int loop_cnt) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  PubMaster pm({"controlsState"}); | 
					 | 
					 | 
					 | 
					  PubMaster pm({"controlsState", "deviceState"}); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  MessageBuilder deviceStateMsg; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  auto deviceState = deviceStateMsg.initEvent().initDeviceState(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  deviceState.setStarted(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const int DT_CTRL = 10;  // ms
 | 
					 | 
					 | 
					 | 
					  const int DT_CTRL = 10;  // ms
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  for (int i = 0; i < loop_cnt; ++i) { | 
					 | 
					 | 
					 | 
					  for (int i = 0; i < loop_cnt; ++i) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    for (auto &[alert, fn, loops] : sound_list) { | 
					 | 
					 | 
					 | 
					    for (auto &[alert, fn, loops] : sound_list) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -34,6 +39,7 @@ void controls_thread(int loop_cnt) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cs.setAlertSound(alert); | 
					 | 
					 | 
					 | 
					        cs.setAlertSound(alert); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        cs.setAlertType(fn.toStdString()); | 
					 | 
					 | 
					 | 
					        cs.setAlertType(fn.toStdString()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        pm.send("controlsState", msg); | 
					 | 
					 | 
					 | 
					        pm.send("controlsState", msg); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        pm.send("deviceState", deviceStateMsg); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        QThread::msleep(DT_CTRL); | 
					 | 
					 | 
					 | 
					        QThread::msleep(DT_CTRL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      } | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |