MythTV  master
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
ExternIO Class Reference

#include <ExternalStreamHandler.h>

Collaboration diagram for ExternIO:
Collaboration graph
[legend]

Public Member Functions

 ExternIO (const QString &app, const QStringList &args)
 
 ~ExternIO (void)
 
bool Ready (int fd, std::chrono::milliseconds timeout, const QString &what)
 
int Read (QByteArray &buffer, int maxlen, std::chrono::milliseconds timeout=2500ms)
 
QString GetStatus (std::chrono::milliseconds timeout=2500ms)
 
int Write (const QByteArray &buffer)
 
bool Run (void)
 
bool Error (void) const
 
QString ErrorString (void) const
 
void ClearError (void)
 

Static Public Member Functions

static bool KillIfRunning (const QString &cmd)
 

Private Member Functions

void Fork (void)
 

Private Attributes

QFileInfo m_app
 
QStringList m_args
 
int m_appIn {-1}
 
int m_appOut {-1}
 
int m_appErr {-1}
 
pid_t m_pid {-1}
 
QString m_error
 
int m_bufSize {0}
 
char * m_buffer {nullptr}
 
QString m_statusBuf
 
QTextStream m_status
 
int m_errCnt {0}
 

Static Private Attributes

static constexpr uint8_t kMaxErrorCnt { 20 }
 

Detailed Description

Definition at line 28 of file ExternalStreamHandler.h.

Constructor & Destructor Documentation

◆ ExternIO()

ExternIO::ExternIO ( const QString &  app,
const QStringList &  args 
)

Definition at line 36 of file ExternalStreamHandler.cpp.

◆ ~ExternIO()

ExternIO::~ExternIO ( void  )

Definition at line 65 of file ExternalStreamHandler.cpp.

Member Function Documentation

◆ Ready()

bool ExternIO::Ready ( int  fd,
std::chrono::milliseconds  timeout,
const QString &  what 
)

Definition at line 75 of file ExternalStreamHandler.cpp.

Referenced by GetStatus(), and Read().

◆ Read()

int ExternIO::Read ( QByteArray &  buffer,
int  maxlen,
std::chrono::milliseconds  timeout = 2500ms 
)

◆ GetStatus()

QString ExternIO::GetStatus ( std::chrono::milliseconds  timeout = 2500ms)

◆ Write()

int ExternIO::Write ( const QByteArray &  buffer)

◆ Run()

bool ExternIO::Run ( void  )

Definition at line 232 of file ExternalStreamHandler.cpp.

Referenced by ExternalStreamHandler::OpenApp().

◆ Error()

bool ExternIO::Error ( void  ) const
inline

◆ ErrorString()

QString ExternIO::ErrorString ( void  ) const
inline

◆ ClearError()

void ExternIO::ClearError ( void  )
inline

Definition at line 43 of file ExternalStreamHandler.h.

◆ KillIfRunning()

bool ExternIO::KillIfRunning ( const QString &  cmd)
static

Definition at line 243 of file ExternalStreamHandler.cpp.

Referenced by ExternalStreamHandler::CloseApp(), and Fork().

◆ Fork()

void ExternIO::Fork ( void  )
private

Definition at line 295 of file ExternalStreamHandler.cpp.

Referenced by Run().

Member Data Documentation

◆ kMaxErrorCnt

constexpr uint8_t ExternIO::kMaxErrorCnt { 20 }
staticconstexprprivate

Definition at line 30 of file ExternalStreamHandler.h.

Referenced by Read().

◆ m_app

QFileInfo ExternIO::m_app
private

Definition at line 50 of file ExternalStreamHandler.h.

Referenced by ExternIO(), and Fork().

◆ m_args

QStringList ExternIO::m_args
private

Definition at line 51 of file ExternalStreamHandler.h.

Referenced by ExternIO(), and Fork().

◆ m_appIn

int ExternIO::m_appIn {-1}
private

Definition at line 52 of file ExternalStreamHandler.h.

Referenced by Fork(), Write(), and ~ExternIO().

◆ m_appOut

int ExternIO::m_appOut {-1}
private

Definition at line 53 of file ExternalStreamHandler.h.

Referenced by Fork(), Read(), and ~ExternIO().

◆ m_appErr

int ExternIO::m_appErr {-1}
private

Definition at line 54 of file ExternalStreamHandler.h.

Referenced by Fork(), GetStatus(), and ~ExternIO().

◆ m_pid

pid_t ExternIO::m_pid {-1}
private

Definition at line 55 of file ExternalStreamHandler.h.

Referenced by Fork().

◆ m_error

QString ExternIO::m_error
private

◆ m_bufSize

int ExternIO::m_bufSize {0}
private

Definition at line 58 of file ExternalStreamHandler.h.

Referenced by Read().

◆ m_buffer

char* ExternIO::m_buffer {nullptr}
private

Definition at line 59 of file ExternalStreamHandler.h.

Referenced by Read(), and ~ExternIO().

◆ m_statusBuf

QString ExternIO::m_statusBuf
private

Definition at line 61 of file ExternalStreamHandler.h.

Referenced by ExternIO().

◆ m_status

QTextStream ExternIO::m_status
private

Definition at line 62 of file ExternalStreamHandler.h.

Referenced by ExternIO(), and GetStatus().

◆ m_errCnt

int ExternIO::m_errCnt {0}
private

Definition at line 63 of file ExternalStreamHandler.h.

Referenced by Read().


The documentation for this class was generated from the following files: