⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 serial.h~

📁 linux下用QT 做的串口编程工具,在linux下做串口调试有一定的参考价值
💻 H~
字号:
#ifndef __SERIAL_H_#define __SERIAL_H_#include     <stdio.h>#include     <unistd.h>    #include     <sys/types.h>  #include     <sys/stat.h> #include     <sys/ioctl.h> #include     <fcntl.h>     #include     <termios.h>    #include     <errno.h>      #include     <pthread.h>typedef struct tty_info_t{    int fd;                  pthread_mutex_t mt;       char name[24];           struct termios ntm;        struct termios otm;    } TTY_INFO;class Serial{ public:    Serial( );    ~Serial( );        bool readyTTY(int fd);     int cleanTTY();        int setTTYSpeed(int speed);     int setTTYParity(int databits,int parity,int stopbits);    int recvnTTY(char *pbuf,int size);    int sendnTTY(char *pbuf,int size);    int unlockTTY(TTY_INFO *ptty);    int lockTTY();   private:            TTY_INFO pttyInfo;      TTY_INFO *ptty;};#endif //__SERIAL_H_

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -