xref: /OK3568_Linux_fs/app/forlinx/flapp/src/libs/core/processhandler.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*进程读写接口,继承成此类,重写processMessage接口实现数据的读取
2  */
3 #ifndef PROCESSHANDLER_H
4 #define PROCESSHANDLER_H
5 #include "core_global.h"
6 #include <QProcess>
7 class CORE_LIBRARY ProcessHandler{
8 
9 public:
10     ProcessHandler();
11     virtual ~ProcessHandler();
12 protected:
13     void setProcessChannelMode(QProcess::InputChannelMode inputMode=QProcess::ManagedInputChannel,
14                                QProcess::ProcessChannelMode mode=QProcess::MergedChannels);
15 
16     void start(const QString &program,  QStringList arg=QStringList());
17 
18     void stop();
19 
20     void send(const QString &cmd);
21 
22     virtual void processMessage(const QString &info) =0;
23 
24 private:
25     QProcess *m_process;
26     QProcess::ProcessChannelMode m_mode;
27     QProcess::InputChannelMode m_inputMode;
28 };
29 #endif // PROCESSHANDLER_H
30