libtasks Documentation  1.6
serial_io_task.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013-2015 ADTECH GmbH
3  * Licensed under MIT (https://github.com/adtechlabs/libtasks/blob/master/COPYING)
4  *
5  * Author: Andreas Pohl
6  */
7 
8 #include <tasks/serial_io_task.h>
9 #include <tasks/logging.h>
10 
11 namespace tasks {
12 
14  m_term = term;
15  if (-1 != m_term.fd()) {
16  init_watcher();
17  }
18 }
19 
21  if (m_auto_close) {
22  tdbg("serial_io_task: closing terminal" << std::endl);
23  m_term.close();
24  }
25 }
26 
27 } // tasks
void close()
Close the terminal.
Definition: term.cpp:130
#define tdbg(m)
Definition: logging.h:54
virtual void init_watcher()
Initialize the watcher.
serial::term & term()
Provide access to the underlying term object.
int fd() const
Definition: io_base.h:22
serial_io_task(int events)
The serial_io_task implements the base tasks that implement serial communication. ...
A class that allows to read and write from/to terminal devices.
Definition: term.h:35