Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ reviews:
review_status: true
collapse_walkthrough: false
changed_files_summary: false
sequence_diagrams: false
estimate_code_review_effort: false
auto_review:
enabled: true
Expand Down
Binary file added ModbusSim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ModbusTestSlave.png
Binary file not shown.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
# Build status
[![Build status](https://ci.appveyor.com/api/projects/status/v7ysjn9c2koy1tb8?svg=true)](https://ci.appveyor.com/project/jgeudens/modbustestslave)
<img src="./misc/icon/icon-256x256.png" alt="modbussim logo" title="ModbusSim" align="right" height="150" />

# What is ModbusTestSlave
ModbusTestSlave is an application that can be used to test a modbus master. The application consists of 2 main set of modules. A GUI-less part that contains all logic that can also be used in automated tests. The second part is a GUI that can be used for manual testing.
Build status: [![Build](https://github.com/ModbusScope/ModbusSim/actions/workflows/ccpp.yml/badge.svg?branch=master)](https://github.com/ModbusScope/ModbusSim/actions/workflows/ccpp.yml)

![ModbusTestSlave demo](ModbusTestSlave.png)
# What is ModbusSim
ModbusSim is a Modbus slave test application for validating Modbus master implementations.

Key features:

- Implements multiple configurable holding registers (values can be automatically incremented).
- Generates a sine-wave signal as register values.
- Can inject configurable communication errors to exercise master error handling.

![ModbusSim demo](ModbusSim.png)
33 changes: 18 additions & 15 deletions misc/icon/Icons8_flat_sim_card.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added misc/icon/icon-256x256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed misc/icon/icon-64x64.png
Binary file not shown.
2 changes: 1 addition & 1 deletion scripts/deploy_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -ex

# Copy assets
cp misc/ModbusSim.desktop release/bin/linux/
cp misc/icon/icon-64x64.png release/bin/linux/ModbusSim.png
cp misc/icon/icon-256x256.png release/bin/linux/ModbusSim.png
cd release/bin/linux/

# now, build AppImage using linuxdeploy and linuxdeploy-plugin-qt
Expand Down
14 changes: 5 additions & 9 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@

#include "ui_mainwindow.h"

#include <QDebug>
#include <QModbusTcpServer>
#include <QUrl>
#include <QDebug>

MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
_pUi(new Ui::MainWindow)
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), _pUi(new Ui::MainWindow)
{
_pUi->setupUi(this);

Expand Down Expand Up @@ -65,10 +63,8 @@ MainWindow::MainWindow(QWidget *parent) :
/** Setup registerView **/
_pUi->tblRegData->setModel(_pRegisterDataModel);
_pUi->tblRegData->verticalHeader()->show();
_pUi->tblRegData->horizontalHeader()->show(); // Not sure yet (show or not to show?)

/* Don't stretch columns, resize to contents */
_pUi->tblRegData->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
_pUi->tblRegData->horizontalHeader()->show();
_pUi->tblRegData->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);

QList<uint> registerList = QList<uint>() << 0 << 1 << 2 << 3 << 4;
_pSlaveData->setRegisterState(registerList, true);
Expand All @@ -80,7 +76,7 @@ MainWindow::MainWindow(QWidget *parent) :
_pSineGraph->setPeriod(10000);

QString windowCaption;
windowCaption = QString("ModbusTestSim");
windowCaption = QString("ModbusSim");

setWindowTitle(windowCaption);
}
Expand Down
17 changes: 8 additions & 9 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QButtonGroup>
#include <QMainWindow>

#include "testslavemodbus.h"
#include "testslavedata.h"
#include "testslavemodbus.h"

#include "registerdatamodel.h"
#include "incgraph.h"
#include "registerdatamodel.h"
#include "sinegraph.h"

namespace Ui {
Expand All @@ -20,7 +20,7 @@ class MainWindow : public QMainWindow
Q_OBJECT

public:
explicit MainWindow(QWidget *parent = nullptr);
explicit MainWindow(QWidget* parent = nullptr);
~MainWindow();

private slots:
Expand All @@ -34,8 +34,7 @@ private slots:
void handleRequestProcessed();

private:

Ui::MainWindow *_pUi;
Ui::MainWindow* _pUi;

bool _bAutoInc;

Expand All @@ -47,10 +46,10 @@ private slots:
QButtonGroup _exceptionGroup;
QButtonGroup _errorRecurrenceGroup;

TestSlaveModbus *_pSlaveModbus;
TestSlaveData *_pSlaveData;
TestSlaveModbus* _pSlaveModbus;
TestSlaveData* _pSlaveData;

RegisterDataModel *_pRegisterDataModel;
RegisterDataModel* _pRegisterDataModel;
};

#endif // MAINWINDOW_H
12 changes: 6 additions & 6 deletions src/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>700</width>
<width>1021</width>
<height>628</height>
</rect>
</property>
Expand All @@ -28,7 +28,7 @@
<item>
<widget class="QRadioButton" name="optErrorOnce">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::LayoutDirection::LeftToRight</enum>
</property>
<property name="text">
<string>Once</string>
Expand Down Expand Up @@ -97,7 +97,7 @@
<item row="0" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
Expand Down Expand Up @@ -125,7 +125,7 @@
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -185,7 +185,7 @@
<item row="1" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -231,7 +231,7 @@
<item row="1" column="0">
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<enum>Qt::Orientation::Horizontal</enum>
</property>
</widget>
</item>
Expand Down