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

Last change on this file since 12 was 2, checked in by Sanahuja Guillaume, 9 years ago

initial commit flaircore

File size: 2.1 KB
Line 
1// %flair:license{
2// This file is part of the Flair framework distributed under the
3// CECILL-C License, Version 1.0.
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
19namespace flair
20{
21namespace core
22{
23 /*! \class SerialPort
24 *
25 * \brief Base class for serial port
26 */
27 class SerialPort: public Object
28 {
29 public:
30 /*!
31 * \brief Constructor
32 *
33 * Construct a serial port.
34 *
35 * \param parent parent
36 * \param name name
37 */
38 SerialPort(const Object* parent,std::string name): Object(parent,name)
39 {}
40
41 /*!
42 * \brief Destructor
43 *
44 */
45 ~SerialPort(){};
46
47 /*!
48 * \brief Set baudrate
49 *
50 * \param baudrate baudrate
51 *
52 */
53 virtual void SetBaudrate(int baudrate)=0;
54
55 /*!
56 * \brief Set RX timeout
57 *
58 * Timeout for waiting datas.
59 *
60 * \param timeout_ns timeout in nano second
61 */
62 virtual void SetRxTimeout(Time timeout_ns)=0;
63
64 /*!
65 * \brief Write datas
66 *
67 * \param buf pointer to datas
68 * \param nbyte length of datas
69 *
70 * \return amount of written datas
71 */
72 virtual ssize_t Write(const void *buf,size_t nbyte)=0;
73
74 /*!
75 * \brief Read datas
76 *
77 * \param buf pointer to datas
78 * \param nbyte length of datas
79 *
80 * \return amount of read datas
81 */
82 virtual ssize_t Read(void *buf,size_t nbyte)=0;
83
84 /*!
85 * \brief Flush input datas
86 *
87 */
88 virtual void FlushInput(void)=0;
89
90 };
91} // end namespace core
92} // end namespace framework
93
94#endif // SERIALPORT_H
Note: See TracBrowser for help on using the repository browser.