1、将工程从动态库变为命令行程序:修改pro文件、删除文件witmotiondll_global.h;
2、继承串口基类SerialPortBase实现串口类QtSerialport; 3、写维特惯导设置示例程序main.cpp;
This commit is contained in:
36
qtserialport.h
Normal file
36
qtserialport.h
Normal file
@ -0,0 +1,36 @@
|
||||
#ifndef QTSERIALPORT_H
|
||||
#define QTSERIALPORT_H
|
||||
|
||||
#include "serialportbase.h"
|
||||
|
||||
#include <QtSerialPort/QSerialPort>
|
||||
#include <QtSerialPort/QSerialPortInfo>
|
||||
#include <qdebug.h>
|
||||
#include <QDebug>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
class QtSerialport :public SerialPortBase
|
||||
{
|
||||
// Q_OBJECT
|
||||
|
||||
public:
|
||||
// QtSerialport();
|
||||
// ~QtSerialport();
|
||||
|
||||
|
||||
int OpenSerialPort(string portName, int baudrate);
|
||||
int CloseSerialPort();
|
||||
int SetBaudrate(int baudrate);
|
||||
int SendData(const char chrSendBuffer[],const unsigned short usLen);
|
||||
int SendData1(const char *data, const unsigned int len);
|
||||
int ReadData(char * receivedData);
|
||||
|
||||
protected:
|
||||
private:
|
||||
QSerialPort * m_serial;
|
||||
};
|
||||
|
||||
|
||||
#endif // QTSERIALPORT_H
|
Reference in New Issue
Block a user