65 lines
		
	
	
		
			779 B
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			65 lines
		
	
	
		
			779 B
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								#ifndef KEEP_LIVE_H
							 | 
						||
| 
								 | 
							
								#define KEEP_LIVE_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include <QObject>
							 | 
						||
| 
								 | 
							
								#include "prot/prot_pc.h"
							 | 
						||
| 
								 | 
							
								#include "QTimer"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class keep_live_checker : public HandlePc
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  keep_live_checker():HandlePc(){
							 | 
						||
| 
								 | 
							
								  
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  int dolater(int cmd,myarray data);
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class keep_live:public QObject
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  keep_live():QObject(){
							 | 
						||
| 
								 | 
							
								    timer_=nullptr;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  void init();
							 | 
						||
| 
								 | 
							
								public slots:
							 | 
						||
| 
								 | 
							
								  virtual void timeout_slot()=0;
							 | 
						||
| 
								 | 
							
								  void connected_slot();
							 | 
						||
| 
								 | 
							
								  void recv_slot();
							 | 
						||
| 
								 | 
							
								protected:
							 | 
						||
| 
								 | 
							
								  QTimer *timer_;
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class keep_checker:public keep_live
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  keep_checker():keep_live(){
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  void timeout_slot();
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								class keep_coder:public keep_live
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								  Q_OBJECT
							 | 
						||
| 
								 | 
							
								public:
							 | 
						||
| 
								 | 
							
								  keep_coder():keep_live(){
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  void timeout_slot();
							 | 
						||
| 
								 | 
							
								};
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								keep_live *KeepLive();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif // KEEP_LIVE_H
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 |