Files
witmotionDll/main.cpp
tangchao0503 3c0ba621ac 1、将工程从动态库变为命令行程序:修改pro文件、删除文件witmotiondll_global.h;
2、继承串口基类SerialPortBase实现串口类QtSerialport;
3、写维特惯导设置示例程序main.cpp;
2022-06-20 15:30:16 +08:00

59 lines
1.3 KiB
C++

#include <QCoreApplication>
#include <QThread>
#include "witmotiondll.h"
#include "qtserialport.h"
void delay_tc(uint32_t millisecond)
{
QThread::sleep(millisecond/1000);
std::cout<<"This is delay_tc!!!!!!!!!!"<<std::endl;
}
void printf_tc(const char* text)
{
printf(text);
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
SerialPortBase * serialPort = new QtSerialport();
// SerialPortBase * serialPort = new windowsSerialPort();
serialPort->OpenSerialPort("COM15", 9600);
WitmotionDll * tmp = new WitmotionDll(serialPort);
tmp->delayMsRegister(delay_tc);
tmp->printfRegister(printf_tc);
tmp->setDelayTimeMs(1000);
tmp->installationOrientation(ORIENT_VERTICAL);
// tmp->algorithm(ALGROITHM9);
// tmp->setTimeZone(UTC_P12);
// tmp->SetBaudrate(WIT_BAUD_115200);
// tmp->SetReturnRate(RRATE_20HZ);
// tmp->SetDeviceAddress(124);
// tmp->setD0Model(DOL);
// tmp->setD0HighLevelPulseWidth(20);
// tmp->setD0Period(5);
// RETURN_CONTENT_STRUCT content;
// content.time = true;
// content.angular_velocity = true;
// content.euler_angle = true;
// content.ground_velocity = true;
// content.quaternion = true;
// tmp->setContent(content);
// tmp->recordData();
serialPort->CloseSerialPort();
// return a.exec();
}