Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.83 KB

README.rst

File metadata and controls

52 lines (40 loc) · 1.83 KB
https://travis-ci.org/AdvancedClimateSystems/Tolk.svg?branch=master https://coveralls.io/repos/AdvancedClimateSystems/Tolk/badge.svg?branch=master&service=github

Tolk

Tolk exposes a JSON-RPC API to talk Modbus over RTU or TCP and is written in Python. The source can be found on GitHub. Documentation is available at Read the Docs.

Quickstart

Below you can find sample code how to start Tolk listening at a Unix Domain Socket for JSON-RPC request. Tolk will delegate the requests via the :class:`Dispatcher` to the :class:`modbus_tk.modbus_tcp.TcpMaster` which in turn will request a Modbus slave at localhost:502.

from modbus_tk.modbus_tcp import TcpMaster
from SocketServer import UnixStreamServer

from tolk import Dispatcher, Handler

# The TcpMaster will fire requests to a Modbus slave at localhost:502.
modbus_master = TcpMaster('localhost', 502)
dispatcher = Dispatcher(modbus_master)

server = UnixStreamServer('/tmp/tolk.sock', Handler)
server.dispatcher = dispatcher

server.serve_forever()

License

This software is licensed under Mozilla Public License. © 2015 Advanced Climate Systems.