Reorganized the main window to properly resize. Added baud rate setting. Added ability to send frames from this application.
This commit is contained in:
+10
-9
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 3.4.0, 2015-05-05T23:03:39. -->
|
<!-- Written by QtCreator 3.4.0, 2015-05-06T22:38:23. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||||
<value type="int">0</value>
|
<value type="int">1</value>
|
||||||
</data>
|
</data>
|
||||||
<data>
|
<data>
|
||||||
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
<variable>ProjectExplorer.Project.EditorSettings</variable>
|
||||||
@@ -413,15 +413,16 @@
|
|||||||
<value type="int">13</value>
|
<value type="int">13</value>
|
||||||
<value type="int">14</value>
|
<value type="int">14</value>
|
||||||
</valuelist>
|
</valuelist>
|
||||||
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
|
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
|
||||||
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
|
||||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">SavvyCAN</value>
|
||||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
|
|
||||||
<value type="bool" key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal">false</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
|
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
|
||||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
|
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:C:/Users/Collin/Desktop/SavvyCAN/SavvyCAN.pro</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments"></value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">SavvyCAN.pro</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix">false</value>
|
||||||
|
<value type="bool" key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal">false</value>
|
||||||
|
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory"></value>
|
||||||
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
|
||||||
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
|
||||||
|
|||||||
+63
-3
@@ -45,13 +45,25 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->cbSerialPorts->addItem(ports[i].portName());
|
ui->cbSerialPorts->addItem(ports[i].portName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->cbSpeed1->addItem(tr("Disabled"));
|
||||||
|
ui->cbSpeed1->addItem(tr("125000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("250000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("500000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("1000000"));
|
||||||
|
ui->cbSpeed1->addItem(tr("33333"));
|
||||||
|
ui->cbSpeed2->addItem(tr("Disabled"));
|
||||||
|
ui->cbSpeed2->addItem(tr("125000"));
|
||||||
|
ui->cbSpeed2->addItem(tr("250000"));
|
||||||
|
ui->cbSpeed2->addItem(tr("500000"));
|
||||||
|
ui->cbSpeed2->addItem(tr("1000000"));
|
||||||
|
ui->cbSpeed2->addItem(tr("33333"));
|
||||||
|
|
||||||
SerialWorker *worker = new SerialWorker();
|
SerialWorker *worker = new SerialWorker();
|
||||||
worker->moveToThread(&serialWorkerThread);
|
worker->moveToThread(&serialWorkerThread);
|
||||||
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
connect(&serialWorkerThread, &QThread::finished, worker, &QObject::deleteLater);
|
||||||
//connect(this, &Controller::operate, worker, &Worker::doWork);
|
|
||||||
//connect(worker, &Worker::resultReady, this, &Controller::handleResults);
|
|
||||||
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
|
connect(this, &MainWindow::sendSerialPort, worker, &SerialWorker::setSerialPort, Qt::QueuedConnection);
|
||||||
connect(worker, &SerialWorker::receivedFrame, this, &MainWindow::gotFrame, Qt::QueuedConnection);
|
connect(worker, &SerialWorker::receivedFrame, this, &MainWindow::gotFrame, Qt::QueuedConnection);
|
||||||
|
connect(this, &MainWindow::updateBaudRates, worker, &SerialWorker::updateBaudRates, Qt::QueuedConnection);
|
||||||
serialWorkerThread.start();
|
serialWorkerThread.start();
|
||||||
|
|
||||||
graphingWindow = NULL;
|
graphingWindow = NULL;
|
||||||
@@ -65,7 +77,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(ui->btnClearFrames, SIGNAL(clicked(bool)), this, SLOT(clearFrames()));
|
connect(ui->btnClearFrames, SIGNAL(clicked(bool)), this, SLOT(clearFrames()));
|
||||||
connect(ui->actionSave_Log_File, SIGNAL(triggered(bool)), this, SLOT(handleSaveFile()));
|
connect(ui->actionSave_Log_File, SIGNAL(triggered(bool)), this, SLOT(handleSaveFile()));
|
||||||
connect(ui->action_Playback, SIGNAL(triggered(bool)), this, SLOT(showPlaybackWindow()));
|
connect(ui->action_Playback, SIGNAL(triggered(bool)), this, SLOT(showPlaybackWindow()));
|
||||||
|
connect(ui->btnBaudSet, SIGNAL(clicked(bool)), this, SLOT(changeBaudRates()));
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@@ -101,6 +113,54 @@ void MainWindow::clearFrames()
|
|||||||
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
ui->lbNumFrames->setText(QString::number(model->rowCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::changeBaudRates()
|
||||||
|
{
|
||||||
|
int Speed1 = 0, Speed2 = 0;
|
||||||
|
|
||||||
|
switch (ui->cbSpeed1->currentIndex())
|
||||||
|
{
|
||||||
|
case 0: //disable
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Speed1 = 125000;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Speed1 = 250000;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Speed1 = 500000;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Speed1 = 1000000;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
Speed1 = 33333;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch (ui->cbSpeed2->currentIndex())
|
||||||
|
{
|
||||||
|
case 0: //disable
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Speed2 = 125000;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
Speed2 = 250000;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
Speed2 = 500000;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Speed2 = 1000000;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
Speed2 = 33333;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit updateBaudRates(Speed1, Speed2);
|
||||||
|
}
|
||||||
|
|
||||||
//CRTD format from Mark Webb-Johnson / OVMS project
|
//CRTD format from Mark Webb-Johnson / OVMS project
|
||||||
/*
|
/*
|
||||||
Sample data in CRTD format
|
Sample data in CRTD format
|
||||||
|
|||||||
@@ -29,12 +29,14 @@ private slots:
|
|||||||
void showFrameDataAnalysis();
|
void showFrameDataAnalysis();
|
||||||
void clearFrames();
|
void clearFrames();
|
||||||
void showPlaybackWindow();
|
void showPlaybackWindow();
|
||||||
|
void changeBaudRates();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void gotFrame(CANFrame *frame);
|
void gotFrame(CANFrame *frame);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void sendSerialPort(QString portName);
|
void sendSerialPort(QString portName);
|
||||||
|
void updateBaudRates(int, int);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|||||||
+161
-116
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>927</width>
|
<width>800</width>
|
||||||
<height>500</height>
|
<height>500</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -26,127 +26,172 @@
|
|||||||
<string>SavvyCAN</string>
|
<string>SavvyCAN</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<widget class="QTableView" name="canFramesView">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QTableView" name="canFramesView">
|
||||||
<x>20</x>
|
<property name="font">
|
||||||
<y>10</y>
|
<font>
|
||||||
<width>675</width>
|
<pointsize>11</pointsize>
|
||||||
<height>421</height>
|
<weight>50</weight>
|
||||||
</rect>
|
<bold>false</bold>
|
||||||
</property>
|
</font>
|
||||||
<property name="font">
|
</property>
|
||||||
<font>
|
<property name="alternatingRowColors">
|
||||||
<pointsize>11</pointsize>
|
<bool>true</bool>
|
||||||
<weight>50</weight>
|
</property>
|
||||||
<bold>false</bold>
|
<property name="wordWrap">
|
||||||
</font>
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
</widget>
|
||||||
<bool>true</bool>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="wordWrap">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<bool>false</bool>
|
<item alignment="Qt::AlignHCenter">
|
||||||
</property>
|
<widget class="QLabel" name="label_3">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
<widget class="QLabel" name="label">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<property name="geometry">
|
<horstretch>0</horstretch>
|
||||||
<rect>
|
<verstretch>0</verstretch>
|
||||||
<x>720</x>
|
</sizepolicy>
|
||||||
<y>20</y>
|
</property>
|
||||||
<width>71</width>
|
<property name="text">
|
||||||
<height>16</height>
|
<string>Serial Port</string>
|
||||||
</rect>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>Serial Port</string>
|
<item>
|
||||||
</property>
|
<widget class="QComboBox" name="cbSerialPorts"/>
|
||||||
</widget>
|
</item>
|
||||||
<widget class="QComboBox" name="cbSerialPorts">
|
<item>
|
||||||
<property name="geometry">
|
<widget class="QPushButton" name="btnConnect">
|
||||||
<rect>
|
<property name="text">
|
||||||
<x>790</x>
|
<string>Connect To Dongle</string>
|
||||||
<y>20</y>
|
</property>
|
||||||
<width>131</width>
|
</widget>
|
||||||
<height>22</height>
|
</item>
|
||||||
</rect>
|
<item alignment="Qt::AlignHCenter">
|
||||||
</property>
|
<widget class="QLabel" name="label_2">
|
||||||
</widget>
|
<property name="sizePolicy">
|
||||||
<widget class="QPushButton" name="btnConnect">
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<property name="geometry">
|
<horstretch>0</horstretch>
|
||||||
<rect>
|
<verstretch>0</verstretch>
|
||||||
<x>720</x>
|
</sizepolicy>
|
||||||
<y>50</y>
|
</property>
|
||||||
<width>201</width>
|
<property name="text">
|
||||||
<height>28</height>
|
<string>CANBus Speeds:</string>
|
||||||
</rect>
|
</property>
|
||||||
</property>
|
</widget>
|
||||||
<property name="text">
|
</item>
|
||||||
<string>Connect To Dongle</string>
|
<item>
|
||||||
</property>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</widget>
|
<property name="sizeConstraint">
|
||||||
<widget class="QLabel" name="label_2">
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
<property name="geometry">
|
</property>
|
||||||
<rect>
|
<item>
|
||||||
<x>720</x>
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<y>160</y>
|
<item>
|
||||||
<width>71</width>
|
<widget class="QLabel" name="label_5">
|
||||||
<height>16</height>
|
<property name="sizePolicy">
|
||||||
</rect>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
</property>
|
<horstretch>0</horstretch>
|
||||||
<property name="text">
|
<verstretch>0</verstretch>
|
||||||
<string># of frames:</string>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="textFormat">
|
<property name="text">
|
||||||
<enum>Qt::PlainText</enum>
|
<string>First Bus:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="btnClearFrames">
|
</item>
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QComboBox" name="cbSpeed1"/>
|
||||||
<x>710</x>
|
</item>
|
||||||
<y>180</y>
|
</layout>
|
||||||
<width>201</width>
|
</item>
|
||||||
<height>28</height>
|
<item>
|
||||||
</rect>
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
</property>
|
<property name="spacing">
|
||||||
<property name="text">
|
<number>7</number>
|
||||||
<string>Clear Frames</string>
|
</property>
|
||||||
</property>
|
<property name="sizeConstraint">
|
||||||
</widget>
|
<enum>QLayout::SetDefaultConstraint</enum>
|
||||||
<widget class="QLabel" name="lbNumFrames">
|
</property>
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QLabel" name="label_4">
|
||||||
<x>810</x>
|
<property name="sizePolicy">
|
||||||
<y>160</y>
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
<width>55</width>
|
<horstretch>0</horstretch>
|
||||||
<height>16</height>
|
<verstretch>0</verstretch>
|
||||||
</rect>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string>Second Bus:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="cbAutoScroll">
|
</item>
|
||||||
<property name="geometry">
|
<item>
|
||||||
<rect>
|
<widget class="QComboBox" name="cbSpeed2"/>
|
||||||
<x>710</x>
|
</item>
|
||||||
<y>250</y>
|
</layout>
|
||||||
<width>201</width>
|
</item>
|
||||||
<height>20</height>
|
</layout>
|
||||||
</rect>
|
</item>
|
||||||
</property>
|
<item>
|
||||||
<property name="text">
|
<widget class="QPushButton" name="btnBaudSet">
|
||||||
<string>Auto scroll window</string>
|
<property name="text">
|
||||||
</property>
|
<string>Set Baud Rates</string>
|
||||||
</widget>
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string># Of Frames:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item alignment="Qt::AlignHCenter">
|
||||||
|
<widget class="QLabel" name="lbNumFrames">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="cbAutoScroll">
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto Scroll Window</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="btnClearFrames">
|
||||||
|
<property name="text">
|
||||||
|
<string>Clear Frames</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menuBar">
|
<widget class="QMenuBar" name="menuBar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>927</width>
|
<width>800</width>
|
||||||
<height>26</height>
|
<height>26</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|||||||
@@ -50,6 +50,54 @@ void SerialWorker::readSerialData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SerialWorker::sendFrame(CANFrame *frame, int bus = 0)
|
||||||
|
{
|
||||||
|
QByteArray buffer;
|
||||||
|
int c;
|
||||||
|
int ID;
|
||||||
|
|
||||||
|
ID = frame->ID;
|
||||||
|
if (frame->extended) ID |= 1 << 31;
|
||||||
|
|
||||||
|
buffer[0] = 0xF1; //start of a command over serial
|
||||||
|
buffer[1] = 0; //command ID for sending a CANBUS frame
|
||||||
|
buffer[2] = (unsigned char)(ID & 0xFF); //four bytes of ID LSB first
|
||||||
|
buffer[3] = (unsigned char)(ID >> 8);
|
||||||
|
buffer[4] = (unsigned char)(ID >> 16);
|
||||||
|
buffer[5] = (unsigned char)(ID >> 24);
|
||||||
|
buffer[6] = (unsigned char)(bus & 1);
|
||||||
|
buffer[7] = (unsigned char)frame->len;
|
||||||
|
for (c = 0; c < frame->len; c++)
|
||||||
|
{
|
||||||
|
buffer[8 + c] = frame->data[c];
|
||||||
|
}
|
||||||
|
buffer[8 + frame->len] = 0;
|
||||||
|
|
||||||
|
if (serial == NULL) return;
|
||||||
|
if (!serial->isOpen()) return;
|
||||||
|
serial->write(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SerialWorker::updateBaudRates(int Speed1, int Speed2)
|
||||||
|
{
|
||||||
|
QByteArray buffer;
|
||||||
|
qDebug() << "Got signal to update bauds. 1: " << Speed1 <<" 2: " << Speed2;
|
||||||
|
buffer[0] = 0xF1; //start of a command over serial
|
||||||
|
buffer[1] = 5; //setup canbus
|
||||||
|
buffer[2] = (unsigned char)(Speed1 & 0xFF); //four bytes of ID LSB first
|
||||||
|
buffer[3] = (unsigned char)(Speed1 >> 8);
|
||||||
|
buffer[4] = (unsigned char)(Speed1 >> 16);
|
||||||
|
buffer[5] = (unsigned char)(Speed1 >> 24);
|
||||||
|
buffer[6] = (unsigned char)(Speed2 & 0xFF); //four bytes of ID LSB first
|
||||||
|
buffer[7] = (unsigned char)(Speed2 >> 8);
|
||||||
|
buffer[8] = (unsigned char)(Speed2 >> 16);
|
||||||
|
buffer[9] = (unsigned char)(Speed2 >> 24);
|
||||||
|
buffer[10] = 0;
|
||||||
|
if (serial == NULL) return;
|
||||||
|
if (!serial->isOpen()) return;
|
||||||
|
serial->write(buffer);
|
||||||
|
}
|
||||||
|
|
||||||
void SerialWorker::procRXChar(unsigned char c)
|
void SerialWorker::procRXChar(unsigned char c)
|
||||||
{
|
{
|
||||||
switch (rx_state)
|
switch (rx_state)
|
||||||
|
|||||||
+8
-5
@@ -26,14 +26,17 @@ public:
|
|||||||
~SerialWorker();
|
~SerialWorker();
|
||||||
|
|
||||||
signals: //we emit signals
|
signals: //we emit signals
|
||||||
void error(const QString &s);
|
void error(const QString &);
|
||||||
void receivedFrame(CANFrame *frame);
|
void receivedFrame(CANFrame *);
|
||||||
|
|
||||||
private slots: //we receive things in slots
|
private slots: //we receive things in slots
|
||||||
void readSerialData();
|
void readSerialData();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setSerialPort(QString portName);
|
void setSerialPort(QString);
|
||||||
|
void sendFrame(CANFrame *, int);
|
||||||
|
void updateBaudRates(int, int);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString portName;
|
QString portName;
|
||||||
@@ -43,7 +46,7 @@ private:
|
|||||||
int rx_step;
|
int rx_step;
|
||||||
CANFrame *buildFrame;
|
CANFrame *buildFrame;
|
||||||
|
|
||||||
void procRXChar(unsigned char c);
|
void procRXChar(unsigned char);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SERIALTHREAD_H
|
#endif // SERIALTHREAD_H
|
||||||
|
|||||||
Reference in New Issue
Block a user