Ejemplo n.º 1
0
    def __init__(self,
                 slave_id,
                 ipaddr,
                 ipport=502,
                 timeout=None,
                 ctx=None,
                 trace_func=None,
                 max_count=REQ_COUNT_MAX,
                 test=False):
        self.slave_id = slave_id
        self.ipaddr = ipaddr
        self.ipport = ipport
        self.timeout = timeout
        self.ctx = ctx
        self.socket = None
        self.trace_func = trace_func
        self.max_count = max_count

        if ipport is None:
            self.ipport = TCP_DEFAULT_PORT
        if timeout is None:
            self.timeout = TCP_DEFAULT_TIMEOUT

        if test:
            import sunspec.core.test.fake.socket as fake
            self.socket = fake.socket()
Ejemplo n.º 2
0
    def __init__(self, slave_id, ipaddr, ipport=502, timeout=None, ctx=None, trace_func=None, max_count=REQ_COUNT_MAX, test=False):
        self.slave_id = slave_id
        self.ipaddr = ipaddr
        self.ipport = ipport
        self.timeout = timeout
        self.ctx = ctx
        self.socket = None
        self.trace_func = trace_func
        self.max_count = max_count

        if ipport is None:
            self.ipport = TCP_DEFAULT_PORT
        if timeout is None:
            self.timeout = TCP_DEFAULT_TIMEOUT

        if test:
            import sunspec.core.test.fake.socket as fake
            self.socket = fake.socket()
Ejemplo n.º 3
0
    def __init__(self,
                 slave_id,
                 ipaddr,
                 ipport=502,
                 timeout=None,
                 ctx=None,
                 trace_func=None,
                 tls=False,
                 cafile=None,
                 certfile=None,
                 keyfile=None,
                 insecure_skip_tls_verify=False,
                 max_count=REQ_COUNT_MAX,
                 test=False):
        self.slave_id = slave_id
        self.ipaddr = ipaddr
        self.ipport = ipport
        self.timeout = timeout
        self.ctx = ctx
        self.socket = None
        self.trace_func = trace_func
        self.tls = tls
        self.cafile = cafile
        self.certfile = certfile
        self.keyfile = keyfile
        self.tls_verify = not insecure_skip_tls_verify
        self.max_count = max_count

        if ipport is None:
            self.ipport = TCP_DEFAULT_PORT
        if timeout is None:
            self.timeout = TCP_DEFAULT_TIMEOUT

        if test:
            import sunspec.core.test.fake.socket as fake
            self.socket = fake.socket()