You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
583 B
C++

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#ifndef _SERIALMSGHANDLER_HPP_
#define _SERIALMSGHANDLER_HPP_
#include <string>
#include <cstdint>
#include <iostream>
#include <termios.h>
#include "MsgHandler.hpp"
class SerialMsgHandler : public MsgHandler
{
public:
SerialMsgHandler();
~SerialMsgHandler();
// 打开串口
bool OpenPort(const std::string& port, const std::string& baudrate);
// 设置串口参数
bool setPortAttributes(int baudrate);
bool refreshPort();
private:
speed_t baudrate_; // 新增保存波特率speed_t 类型)
};
#endif // _SERIALMSGHANDLER_HPP_