source: flair-dev/trunk/include/FlairCore/SerialPort.h @ 13

Last change on this file since 13 was 13, checked in by Bayard Gildas, 5 years ago

formatting script + include reformatted

File size: 1.6 KB
RevLine 
[2]1// %flair:license{
[13]2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
[2]4// %flair:license}
5/*!
6 * \file SerialPort.h
7 * \brief Base class for serial port
8 * \author Guillaume Sanahuja, Copyright Heudiasyc UMR UTC/CNRS 7253
9 * \date 2014/04/25
10 * \version 4.0
11 */
12
13#ifndef SERIALPORT_H
14#define SERIALPORT_H
15
16#include <Object.h>
17#include <stdint.h>
18
[13]19namespace flair {
20namespace core {
21/*! \class SerialPort
22*
23* \brief Base class for serial port
24*/
25class SerialPort : public Object {
26public:
27  /*!
28  * \brief Constructor
29  *
30  * Construct a serial port.
31  *
32  * \param parent parent
33  * \param name name
34  */
35  SerialPort(const Object *parent, std::string name) : Object(parent, name) {}
[2]36
[13]37  /*!
38  * \brief Destructor
39  *
40  */
41  ~SerialPort(){};
[2]42
[13]43  /*!
44  * \brief Set baudrate
45  *
46  * \param baudrate baudrate
47  *
48  */
49  virtual void SetBaudrate(int baudrate) = 0;
[2]50
[13]51  /*!
52  * \brief Set RX timeout
53  *
54  * Timeout for waiting datas.
55  *
56  * \param timeout_ns timeout in nano second
57  */
58  virtual void SetRxTimeout(Time timeout_ns) = 0;
[2]59
[13]60  /*!
61  * \brief Write datas
62  *
63  * \param buf pointer to datas
64  * \param nbyte length of datas
65  *
66  * \return amount of written datas
67  */
68  virtual ssize_t Write(const void *buf, size_t nbyte) = 0;
[2]69
[13]70  /*!
71  * \brief Read datas
72  *
73  * \param buf pointer to datas
74  * \param nbyte length of datas
75  *
76  * \return amount of read datas
77  */
78  virtual ssize_t Read(void *buf, size_t nbyte) = 0;
[2]79
[13]80  /*!
81  * \brief Flush input datas
82  *
83  */
84  virtual void FlushInput(void) = 0;
85};
[2]86} // end namespace core
87} // end namespace framework
88
89#endif // SERIALPORT_H
Note: See TracBrowser for help on using the repository browser.