转载请注明出处:http://blog.csdn.net/feng1790291543
Qt下的C++实现类中的属性和方法,主要是read、write、open等等的使用例子。其中串口的设置,主要是针对GPRS模块的进行设置的
串口头文件
serial.h
#ifndef _SERIAL_H_
#define _SERIAL_H_
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <termios.h>
#include <stdlib.h>
#include <errno.h>
class MySerial
{
public:
MySerial();
~MySerial();
public:
static int set_opt(int fd,int nSpeed, int nBits, char nEvent, int nStop);
static int open_port(int fd,int comport);
static int nwrite(int serialfd,const