Exemplo n.º 1
0
    def connect(self, address, rack, slot, tcpport=102):
        """
        Connect to a S7 server.

        :param address: IP address of server
        :param rack: rack on server
        :param slot: slot on server.
        """
        logger.info("connecting to %s:%s rack %s slot %s" % (address, tcpport,
                                                             rack, slot))

        self.set_param(snap7.snap7types.RemotePort, tcpport)
        return self.library.Cli_ConnectTo(self.pointer, c_char_p(six.b(address)),
                                          c_int(rack), c_int(slot))
Exemplo n.º 2
0
    def connect(self, address, rack, slot, tcpport=102):
        """
        Connect to a S7 server.

        :param address: IP address of server
        :param rack: rack on server
        :param slot: slot on server.
        """
        logger.info("connecting to %s:%s rack %s slot %s" %
                    (address, tcpport, rack, slot))

        self.set_param(snap7.snap7types.RemotePort, tcpport)
        return self.library.Cli_ConnectTo(self.pointer,
                                          c_char_p(six.b(address)),
                                          c_int(rack), c_int(slot))
Exemplo n.º 3
0
 def set_session_password(self, password):
     """Send the password to the PLC to meet its security level."""
     assert len(password) <= 8, 'maximum password length is 8'
     return self.library.Cli_SetSessionPassword(self.pointer,
                                                c_char_p(six.b(password)))
Exemplo n.º 4
0
 def set_session_password(self, password):
     """Send the password to the PLC to meet its security level."""
     assert len(password) <= 8, 'maximum password length is 8'
     return self.library.Cli_SetSessionPassword(self.pointer,
                                                c_char_p(six.b(password)))