|  |  | @ -10,7 +10,7 @@ import kotlinx.coroutines.launch | 
			
		
	
		
		
			
				
					
					|  |  |  | @OptIn(DelicateCoroutinesApi::class) |  |  |  | @OptIn(DelicateCoroutinesApi::class) | 
			
		
	
		
		
			
				
					
					|  |  |  | object GasCache { |  |  |  | object GasCache { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private val statusCache = HashMap<String, String>() |  |  |  |     private val statusCache = HashMap<String, String>() | 
			
		
	
		
		
			
				
					
					|  |  |  |     private val nicknameCache = HashMap<String, String>() |  |  |  |     private val nicknameCache = HashMap<String, String?>() | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     init { |  |  |  |     init { | 
			
		
	
		
		
			
				
					
					|  |  |  |         GlobalScope.launch(Dispatchers.IO) { |  |  |  |         GlobalScope.launch(Dispatchers.IO) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -18,21 +18,21 @@ object GasCache { | 
			
		
	
		
		
			
				
					
					|  |  |  |             val all = typeDao.getAll() |  |  |  |             val all = typeDao.getAll() | 
			
		
	
		
		
			
				
					
					|  |  |  |             val context = CommonApplication.getContext() |  |  |  |             val context = CommonApplication.getContext() | 
			
		
	
		
		
			
				
					
					|  |  |  |             all.forEach { |  |  |  |             all.forEach { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 setNickname(it.type, it.nickName ?: "") |  |  |  |                 setNickname(it.type, it.nickName ?: "${it.type}传感器") | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 setStatus(it.type, getShowStatus(context, it.status)) |  |  |  |                 setStatus(it.type, getShowStatus(context, it.status)) | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     fun getNickname(gas: String): String { |  |  |  |     fun getNickname(gas: String): String { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return nicknameCache[gas] ?: "" |  |  |  |         return nicknameCache[gas] ?: "${gas}传感器" | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     fun getStatus(gas: String): String { |  |  |  |     fun getStatus(gas: String): String { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return statusCache[gas] ?: "" |  |  |  |         return statusCache[gas] ?: "" | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     fun setNickname(gas: String, nickname: String) { |  |  |  |     fun setNickname(gas: String, nickname: String?) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         nicknameCache[gas] = nickname |  |  |  |         nicknameCache[gas] = nickname | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |