snap7
Not logged in

snap7 command

Name

snap7 - Tcl interface to the Snap7 library

Synopsis

package require Tcl 8.6
package require snap7
snap7::new cmd
cmd destroy
cmd connect addr port rack slot
cmd disconnect
cmd conntype type
cmd param ?name? ?value?
cmd isconnected
cmd pdulength
cmd dbread db start count
cmd dbreada db start count
cmd dbwrite db start data ...
cmd dbwritea db start bytes

Description

This package provides a Tcl interface to the Snap7 library (see http://snap7.sourceforge.net/) using Ffidl and TclOO.

Commands

snap7::new cmd

Creates a new command cmd which implements a Snap7 connection object. Further operations on that object are carried out by invoking methods on cmd.

cmd destroy

Destroys the connection object cmd, releases resources and closes communications links.

cmd connect addr port rack slot

Connects the connection object cmd to its peer using the IP address addr, the TCP port number port and further address information (rack and slot numbers).

cmd disconnect

Closes the connection of the connection object cmd.

cmd conntype type

Sets the connection type of the connection object cmd. Must be called before a connection is made using the connect method. Valid values for type are 1 (PG), 2 (OP), and 3 (basic).

cmd param ?name? ?value?

If invoked without arguments, returns a list of parameter names which can be queried or set on the connection object cmd. If name is provided, a query of this named parameter is performed. If both, name and value are provided, the named parameter is set to the value given.

cmd isconnected

Returns true or false depending on connection state of the connection object cmd.

cmd pdulength

Returns a two element list made up of requested and negotiated PDU length of the connection object cmd.

cmd dbread db start count

Reads count bytes beginning at start from the data block db using the connection object cmd. Data is returned as a list of integer numbers.

cmd dbreada db start count

Reads count bytes beginning at start from the data block db using the connection object cmd. Data is returned as a byte array.

cmd dbwrite db start data ...

Writes the numbers specified by data and following arguments as bytes beginning at start into the data block db using the connection object cmd.

cmd dbwritea db start bytes

Writes the byte array bytes beginning at start into the data block db using the connection object cmd.