VitaliySh / modbus_mdp

MDP Service supporting Modbus over Serial Line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MDP Service with support for Modbus over Serial Line protocol

Building

git clone --recurse-submodules https://github.com/wdl83/modbus_mdp
cd modbus_mdp
RELEASE=1 make

Build artifacts will be placed in obj dir, if you have not defined OBJ_DIR.

Installing

DST_DIR variable can be used to define prefix (must be absolute) path for:

RELEASE=1 DST_DIR=$HOME make install

Usage

Worker requires the MDP Broker address.

Running manually from console (register service with SERVICE_NAME).

master_worker -a tcp://BROKER_IP:BROKER_PORT -d /dev/ttyUSB0 -s SERVICE_NAME

Running as systemd service. Create .config/systemd/user/SERVICE_NAME.service

[Unit]
Description=MDP Service, Modbus over Serial Line

[Service]
Environment=TRACE_LEVEL=2
Environment=LD_LIBRARY_PATH=$HOME/lib/:$LD_LIBRARY_PATH
ExecStart=$HOME/bin/master_worker -a tcp://BROKER_IP:BROKER_PORT -d /dev/ttyUSB? -s SERVICE_NAME
Restart=on-failure
RestartSec=10s

[Install]
WantedBy=default.target

After systemd service file is created enable it:

systemctl --user enable SERVICE_NAME.service

and start

systemctl --user start SERVICE_NAME.service

Enable systemd to start $USER services at boot (no $USER login required)

loginctl enable-linger $USER

About

MDP Service supporting Modbus over Serial Line

License:GNU General Public License v3.0


Languages

Language:C++ 76.8%Language:Makefile 23.2%