--- a/runtime/ServicePublisher.py Wed Oct 16 12:18:14 2024 +0200
+++ b/runtime/ServicePublisher.py Wed Nov 13 23:10:36 2024 +0100
@@ -34,7 +34,6 @@
class ServicePublisher(object):
def __init__(self, protocol):
- # type: fully qualified service type name
self.serviceproperties = {
'description': 'Beremiz remote PLC',
'protocol': protocol
@@ -50,12 +49,12 @@
def RegisterService(self, name, ip, port):
try:
self._RegisterService(name, ip, port)
- except Exception:
+ except Exception as e:
+ print(f"Failed to register service ({str(e)}), retrying in 2 seconds")
self.retrytimer = threading.Timer(2, self.RegisterService, [name, ip, port])
self.retrytimer.start()
def _RegisterService(self, name, ip, port):
- # name: fully qualified service name
self.service_name = '%s.%s' % (name, service_type)
self.name = name
self.port = port
@@ -75,8 +74,8 @@
self.server.register_service(
zeroconf.ServiceInfo(service_type,
self.service_name,
- self.ip_32b,
self.port,
+ addresses=[self.ip_32b],
properties=self.serviceproperties))
self.retrytimer = None
--- a/runtime/eRPCServer.py Wed Oct 16 12:18:14 2024 +0200
+++ b/runtime/eRPCServer.py Wed Nov 13 23:10:36 2024 +0100
@@ -85,7 +85,7 @@
self.transport = None
self.servicename = servicename
self.ip_addr = ip_addr
- self.port = port
+ self.port = int(port)
self.servicepublisher = None
def _to_be_published(self):
@@ -118,7 +118,7 @@
# transport = erpc.transport.SerialTransport(device, baudrate)
# initialize TCP transport layer
- self.transport = erpc.transport.TCPTransport(self.ip_addr, int(self.port), True)
+ self.transport = erpc.transport.TCPTransport(self.ip_addr, self.port, True)
self.server = erpc.simple_server.SimpleServer(self.transport, erpc.basic_codec.BasicCodec)
self.server.add_service(service)