nodi s7 briq
This commit is contained in:
Generated
+24
@@ -0,0 +1,24 @@
|
||||
[[package]]
|
||||
name = "python-snap7"
|
||||
version = "1.1"
|
||||
description = "Python wrapper for the snap7 library"
|
||||
category = "main"
|
||||
optional = false
|
||||
python-versions = ">=3.6"
|
||||
|
||||
[package.extras]
|
||||
doc = ["sphinx", "sphinx-rtd-theme"]
|
||||
test = ["pytest", "pytest-asyncio", "mypy", "pycodestyle", "types-setuptools"]
|
||||
|
||||
[metadata]
|
||||
lock-version = "1.1"
|
||||
python-versions = "^3.9"
|
||||
content-hash = "3d111be4ca682f78c931e41917cd86b1659ff3c844220b973392dd844d411fd3"
|
||||
|
||||
[metadata.files]
|
||||
python-snap7 = [
|
||||
{file = "python-snap7-1.1.tar.gz", hash = "sha256:0fbb25d3c6cc1328ac5916aaf0d02f96c7939804bb387079d3b84ab44494a1f9"},
|
||||
{file = "python_snap7-1.1-py3-none-macosx_10_9_x86_64.whl", hash = "sha256:807b78d32b395ef30ff9a654c4d40468633c054f81defbcf1463eb5e3d894098"},
|
||||
{file = "python_snap7-1.1-py3-none-manylinux1_x86_64.whl", hash = "sha256:29c2ff855ff0da35f9b3c3ec454add8c8a73f68102bcc9aa395cdba2ede18df0"},
|
||||
{file = "python_snap7-1.1-py3-none-win_amd64.whl", hash = "sha256:b4e74a8a8a241ae12b4fb087a8291707bee03f5ae7cd328b9b768a524ff2519f"},
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
[tool.poetry]
|
||||
name = "red-s7-briq-testing"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["Pietro Brenna <pietro.brenna@briq.it>"]
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.9"
|
||||
python-snap7 = "^1.1"
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
@@ -0,0 +1,18 @@
|
||||
import snap7
|
||||
import time
|
||||
from snap7.types import Areas
|
||||
from ctypes import c_char, byref, sizeof
|
||||
|
||||
class MyServer(snap7.server.Server):
|
||||
pass
|
||||
|
||||
s = MyServer()
|
||||
area_m = (c_char * 160)()
|
||||
s.register_area(snap7.types.srvAreaMK, 0, area_m)
|
||||
s.start(tcpport=1102)
|
||||
while True:
|
||||
ev = s.pick_event()
|
||||
if ev is None:
|
||||
time.sleep(1)
|
||||
else:
|
||||
print(s.event_text(ev))
|
||||
Reference in New Issue
Block a user