Skip to content

Latest commit

 

History

History
865 lines (661 loc) · 35.7 KB

client.md

File metadata and controls

865 lines (661 loc) · 35.7 KB

S7Client

API - Control functions


S7Client.Connect([callback])

Connects the client to the PLC with the parameters specified in the previous call of ConnectTo() or SetConnectionParams().

  • The optional callback parameter will be executed after connection attempt

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.ConnectTo(ip, rack, slot[, callback])

Connects the client to the hardware at ip, rack, slot coordinates.

  • ip PLC/Equipment IPV4 Address ex. “192.168.1.12”
  • rack PLC Rack number
  • slot PLC Slot number
  • The optional callback parameter will be executed after connection attempt

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.SetConnectionParams(ip, localTSAP, remoteTSAP)

Sets internally ip, localTSAP, remoteTSAP coordinates.

  • ip PLC/Equipment IPv4 address ex. “192.168.1.12”
  • localTSAP Local TSAP (PC TSAP)
  • remoteTSAP Remote TSAP (PLC TSAP)

Returns true on success or false on error.

S7Client.SetConnectionType(type)

Sets the connection resource type, i.e the way in which the Clients connects to a PLC.

  • type
ConnectionType Value Description
S7Client.CONNTYPE_PG 0x01 PG
S7Client.CONNTYPE_OP 0x02 OP
S7Client.CONNTYPE_BASIC 0x03..0x10 S7 Basic

S7Client.Disconnect()

Disconnects “gracefully” the Client from the PLC.

Returns true on success or false on error.

S7Client.GetParam(paramNumber)

Reads an internal Client object parameter.

  • paramNumber One from the parameter list below
Name Value Description
S7Client.RemotePort 2 Socket remote Port
S7Client.PingTimeout 3 Client Ping timeout
S7Client.SendTimeout 4 Socket Send timeout
S7Client.RecvTimeout 5 Socket Recv timeout
S7Client.SrcRef 7 ISOTcp Source reference
S7Client.DstRef 8 ISOTcp Destination reference
S7Client.SrcTSap 9 ISOTcp Source TSAP
S7Client.PDURequest 10 Initial PDU length request

Returns the parameter value on success or false on error.

S7Client.SetParam(paramNumber, value)

Sets an internal Client object parameter.

  • paramNumber One from the parameter list above
  • value New parameter value

Returns true on success or false on error.

API - Data I/O functions


S7Client.ReadArea(area, dbNumber, start, amount, wordLen[, callback])

This is the main function to read data from a PLC. With it you can read DB, Inputs, Outputs, Merkers, Timers and Counters.

  • area Area identifier (see table below)
  • dbNumber DB number if area = S7AreaDB, otherwise ignored
  • start Offset to start
  • amount Amount of words to read
  • wordLen Word size (see table below)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.WriteArea(area, dbNumber, start, amount, wordLen, buffer[, callback])

This is the main function to write data into a PLC.

  • area Area identifier (see table below)
  • dbNumber DB number if area = S7AreaDB, otherwise ignored
  • start Offset to start
  • amount Amount of words to write
  • wordLen Word size (see table below)
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

Area Value Description
S7Client.S7AreaPE 0x81 Process inputs
S7Client.S7AreaPA 0x82 Process outputs
S7Client.S7AreaMK 0x83 Merkers
S7Client.S7AreaDB 0x84 DB
S7Client.S7AreaCT 0x1C Counters
S7Client.S7AreaTM 0x1D Timers

WordLen Value Description
S7Client.S7WLBit 0x01 Bit (inside a word)
S7Client.S7WLByte 0x02 Byte (8 bit)
S7Client.S7WLWord 0x04 Word (16 bit)
S7Client.S7WLDWord 0x06 Double Word (32 bit)
S7Client.S7WLReal 0x08 Real (32 bit float)
S7Client.S7WLCounter 0x1C Counter (16 bit)
S7Client.S7WLTimer 0x1D Timer (16 bit)

S7Client.DBRead(dbNumber, start, size[, callback])

This is a lean function of ReadArea() to read PLC DB. It simply internally calls ReadArea() with area = S7Client.S7AreaDB and wordLen = s7client.S7WLByte.

  • dbNumber DB number
  • start Offset to start
  • size Size to read (bytes)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.DBWrite(dbNumber, start, size, buffer[, callback])

This is a lean function of WriteArea() to write PLC DB. It simply internally calls WriteArea() with area = S7Client.S7AreaDB and wordLen = s7client.S7WLByte.

  • dbNumber DB number
  • start Offset to start
  • size Size to write (bytes)
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.ABRead(start, size[, callback])

This is a lean function of ReadArea() to read PLC process outputs. It simply internally calls ReadArea() with area = S7Client.S7AreaPA and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to read (bytes)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.ABWrite(start, size, buffer[, callback])

This is a lean function of WriteArea() to write PLC process outputs. It simply internally calls WriteArea() with area = S7Client.S7AreaPA and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to write (bytes)
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.EBRead(start, size[, callback])

This is a lean function of ReadArea() to read PLC process inputs. It simply internally calls ReadArea() with area = S7Client.S7AreaPE and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to read (bytes)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.EBWrite(start, size, buffer[, callback])

This is a lean function of WriteArea() to write PLC process inputs. It simply internally calls WriteArea() with area = S7Client.S7AreaPE and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to write (bytes)
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.MBRead(start, size[, callback])

This is a lean function of ReadArea() to read PLC Merkers. It simply internally calls ReadArea() with area = S7Client.S7AreaMK and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to read (bytes)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.MBWrite(start, size, buffer[, callback])

This is a lean function of WriteArea() to write PLC Merkers. It simply internally calls WriteArea() with area = S7Client.S7AreaMK and wordLen = s7client.S7WLByte.

  • start Offset to start
  • size Size to write (bytes)
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.TMRead(start, amount[, callback])

This is a lean function of ReadArea() to read PLC Timers. It simply internally calls ReadArea() with area = S7Client.S7AreaTM and wordLen = S7Client.S7WLTimer.

  • start Offset to start
  • amount Number of timers
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.TMWrite(start, amount, buffer[, callback])

This is a lean function of WriteArea() to write PLC Timers. It simply internally calls WriteArea() with area = S7Client.S7AreaTM and wordLen = S7Client.S7WLTimer.

  • start Offset to start
  • amount Number of timers
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.CTRead(start, amount[, callback])

This is a lean function of ReadArea() to read PLC Counters. It simply internally calls ReadArea() with area = S7Client.S7AreaCT and wordLen = S7Client.S7WLCounter.

  • start Offset to start
  • amount Number of counters
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns a buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.CTWrite(start, amount, buffer[, callback])

This is a lean function of WriteArea() to write PLC Counters. It simply internally calls WriteArea() with area = S7Client.S7AreaCT and wordLen = S7Client.S7WLCounter.

  • start Offset to start
  • amount Number of counters
  • buffer User buffer
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.ReadMultiVars(multiVars[, callback])

This is function allows to read different kind of variables from a PLC in a single call. With it you can read DB, Inputs, Outputs, Merkers, Timers and Counters.

  • multiVars Array of objects with read information (see structure below)
  • The optional callback parameter will be executed after read

If callback is not set the function is blocking and returns an array on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

// multiVars array structure
[
  {
    "Area": S7Client.S7AreaDB,
    "WordLen": S7Client.S7WLByte,
    "DBNumber": 1,
    "Start": 0,
    "Amount": 1
  },
  {
    "Area": S7Client.S7AreaCT,
    "WordLen": S7Client.S7WLCounter,
    "Start": 0,
    "Amount": 8
  },
  {
    "Area": S7Client.S7AreaPA,
    "WordLen": S7Client.S7WLByte,
    "Start": 0,
    "Amount": 16
  },
  ...
]
// result array
[
  {
    "Result": 0, // Error code
    "Data": ...  // Buffer object or null if Result <> 0
  },
  ...
]

Since could happen that some variables are read, some other not because maybe they don't exist in PLC. It is important to check the single item result.

Due the different kind of variables involved , there is no split feature available for this function, so the maximum data size must not exceed the PDU size. The advantage of this function becomes big when you have many small non-contiguous variables to be read.

S7Client.WriteMultiVars(multiVars[, callback])

This is function allows to write different kind of variables into a PLC in a single call. With it you can write DB, Inputs, Outputs, Merkers, Timers and Counters.

  • multiVars Array of objects with write information (see structure below)
  • The optional callback parameter will be executed after write

If callback is not set the function is blocking and returns an array on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

// multiVars array structure
[
  {
    "Area": S7Client.S7AreaDB,
    "WordLen": S7Client.S7WLByte,
    "DBNumber": 1,
    "Start": 0,
    "Amount": 1,
    "Data": buffer1 // Buffer variable
  },
  {
    "Area": S7Client.S7AreaCT,
    "WordLen": S7Client.S7WLCounter,
    "Start": 0,
    "Amount": 8,
    "Data": buffer2 // Buffer variable
  },
  {
    "Area": S7Client.S7AreaPA,
    "WordLen": S7Client.S7WLByte,
    "Start": 0,
    "Amount": 16,
    "Data": buffer3 // Buffer variable
  },
  ...
]
// result array
[
  {
    "Result": 0 // Error code
  },
  ...
]

API - Directory functions


S7Client.ListBlocks([callback])

This function returns an object of the AG blocks amount divided by type.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an object (see below) on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "OBCount": 0,
  "FBCount": 0,
  "FCCount": 0,
  "SFBCount": 0,
  "SFCCount": 0,
  "DBCount": 0,
  "SDBCount": 0
}

S7Client.ListBlocksOfType(blockType[, callback])

This function returns an array of the AG list of a specified block type.

  • blockType Type of block (see table below)
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an array on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Each item of the result array will contain a block number.

BlockType Value Description
S7Client.Block_OB 0x38 OB
S7Client.Block_DB 0x41 DB
S7Client.Block_SDB 0x42 SDB
S7Client.Block_FC 0x43 FC
S7Client.Block_SFC 0x44 SFC
S7Client.Block_FB 0x45 FB
S7Client.Block_SFB 0x46 SFB

S7Client.GetAgBlockInfo(blockType, blockNum[, callback])

Returns an object with detailed information about a given AG block. This function is very useful if you need to read or write data in a DB which you do not know the size in advance (see MC7Size field)

  • blockType Type of block (see table above)
  • blockNum Number of block
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an object (see below) on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "BlkType": ,   // Block Type (see SubBlkType table)
  "BlkNumber": , // Block number
  "BlkLang": ,   // Block Language (see LangType Table)
  "BlkFlags": ,  // Block flags (bitmapped)
  "MC7Size": ,   // The real size in bytes
  "LoadSize": ,  // Load memory size
  "LocalData": , // Local data
  "SBBLength": , // SBB Length
  "CheckSum": ,  // Checksum
  "Version": ,   // Version (BCD 00<HI><LO>)
  "CodeDate": ,  // Code date
  "IntfDate": ,  // Interface date
  "Author": ,    // Author
  "Family": ,    // Family
  "Header":      // Header
}
SubBlockType Value Description
S7Client.SubBlk_OB 0x08 OB
S7Client.SubBlk_DB 0x0A DB
S7Client.SubBlk_SDB 0x0B SDB
S7Client.SubBlk_FC 0x0C FC
S7Client.SubBlk_SFC 0x0D SFC
S7Client.SubBlk_FB 0x0E FB
S7Client.SubBlk_SFB 0x0F SFB
LangType Value Description
S7Client.BlockLangAWL 0x01 AWL
S7Client.BlockLangKOP 0x02 KOP
S7Client.BlockLangFUP 0x03 FUP
S7Client.BlockLangSCL 0x04 SCL
S7Client.BlockLangDB 0x05 DB
S7Client.BlockLangGRAPH 0x06 GRAPH

S7Client.GetPgBlockInfo(buffer)

Returns detailed information about a block present in a user buffer. This function is usually used in conjunction with FullUpload(). An uploaded block saved to disk, could be loaded in a user buffer and checked with this function.

  • buffer User buffer

Returns an object (see example above) on success or falseon error.

API - Block oriented functions


S7Client.FullUpload(blockType, blockNum, size[, callback])

Uploads a block from AG. The whole block (including header and footer) is copied into the user buffer.

  • blockType Type of block (see table above)
  • blockNum Number of block
  • size Buffer size (if smaller than the data uploaded, only size bytes are copied and errCliPartialDataRead is returned)
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns a Buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.Upload(blockType, blockNum[, callback])

Uploads a block body from AG. Only the block body (but header and footer) is copied into the user buffer.

  • blockType Type of block (see table above)
  • blockNum Number of block
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns a Buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.Download(blockNum, buffer[, callback])

Downloads a block into AG. A whole block (including header and footer) must be available into the user buffer.

  • blockNum Number of block
  • buffer User buffer
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

If the parameter blockNum is -1, the block number is not changed else the block is downloaded with the provided number (just like a “Download As…”).

S7Client.Delete(blockType, blockNum[, callback])

Deletes a block into AG.

!!! There is no undo function available !!!
  • blockType Type of block (see table above)
  • blockNum Number of block
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.DBGet(dbNumber[, callback])

Uploads a DB from AG. This function is equivalent to Upload() with BlockType = Block_DB but it uses a different approach so it’s not subject to the security level set.

Only data is uploaded.

  • dbNumber DB number
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns a Buffer object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

This function first gathers the DB size via GetAgBlockInfo() then calls DBRead().

S7Client.DBFill(dbNumber, fillChar[, callback])

Fills a DB in AG with a given byte without the need of specifying its size.

  • dbNumber DB number
  • fillChar char or char code
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

API - Date/Time functions


S7Client.GetPlcDateTime([callback])

Reads PLC date and time.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns a javascript Date() object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.SetPlcDateTime(dateTime[, callback])

Sets the PLC date and time.

  • dateTime
  • The optional callback parameter will be executed after completion

The dateTime argument can be a javascript Date() object or an object with the structure below.

{
  "year": 2015,  // year
  "month": 4,    // months since January     0-11
  "day": 3,      // day of the month         1-31
  "hours": 19,   // hours since midnight     0-23
  "minutes": 37, // minutes after the hour   0-59
  "seconds": 0   // seconds after the minute 0-59
}

If callback is not set the function is blocking and returns a true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.SetPlcSystemDateTime([callback])

Sets the PLC date and time in accord to the PC system Date/Time.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

API - System info functions


S7Client.ReadSZL(id, index[, callback])

Reads a partial list of given idand index.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns a buffer on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.ReadSZLList([callback])

Reads the directory of the partial lists.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an array on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

S7Client.GetOrderCode([callback])

Gets CPU order code and version info.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "Code": , // Order Code
  "V1": ,   // Version V1.V2.V3
  "V2": ,
  "V3":
}

S7Client.GetCpuInfo([callback])

Gets CPU module name, serial number and other info.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "ModuleTypeName": ,
  "SerialNumber": ,
  "ASName": ,
  "Copyright": ,
  "ModuleName":
}

S7Client.GetCpInfo([callback])

Gets CP (communication processor) info.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns an object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "MaxPduLength": ,
  "MaxConnections": ,
  "MaxMpiRate": ,
  "MaxBusRate":
}

API - PLC control functions


S7Client.PlcHotStart([callback])

Puts the CPU in RUN mode performing an HOT START.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.PlcColdStart([callback])

Puts the CPU in RUN mode performing a COLD START.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.PlcStop([callback])

Puts the CPU in STOP mode.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.CopyRamToRom(timeout[, callback])

Performs the Copy Ram to Rom action.

  • timeout Maximum time expected to complete the operation (ms)
  • The optional callback parameter will be executed after completion or on timeout

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

Not all CPUs support this operation. The CPU must be in STOP mode.

S7Client.Compress(timeout[, callback])

Performs the Memory compress action.

  • timeout Maximum time expected to complete the operation (ms)
  • The optional callback parameter will be executed after completion or on timeout

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

API - Security functions


S7Client.SetSessionPassword(password[, callback])

Send the password to the PLC to meet its security level.

  • password Password
  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

A password accepted by a PLC is an 8 chars string, a longer password will be trimmed, and a shorter one will be "right space padded".

S7Client.ClearSessionPassword([callback])

Clears the password set for the current session (logout).

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns true on success or false on error.
If callback is set the function is non-blocking and an error argument is given to the callback.

S7Client.GetProtection([callback])

Gets the CPU protection level info.

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns the protection object on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Example:

{
  "sch_schal": 1,
  "sch_par": 0,
  "sch_rel": 0,
  "bart_sch": 1,
  "anl_sch": 0
}
S7Protection Values Description
sch_schal 1,2,3 Protection level set with the mode selector
sch_par 0,1,2,3 Password level, 0 : no password
sch_rel 0,1,2,3 Valid protection level of the CPU
bart_sch 1,2,3,4 Mode selector setting (1:RUN, 2:RUN-P, 3:STOP, :MRES, 0:undefined or cannot be determined)
anl_sch 0,1,2 Startup switch setting (1:CRST, 2:WRST, 0:undefined, does not exist of cannot be determined)

API - Properties


S7Client.ExecTime()

Returns the last job execution time in milliseconds or falseon error.

S7Client.LastError()

Returns the last job result.

S7Client.PDURequested()

Returns the PDU length requested by the client or false on error. The requested PDU length can be modified with SetParam().

S7Client.PDULength()

Returns the PDU length negotiated between the client and the PLC during the connection or false on error.

It’s useful to know the PDU negotiated when we need to call ReadMultivar() or WriteMultiVar(). All other data transfer functions handle this information by themselves and split the telegrams automatically if needed.

S7Client.PlcStatus([callback])

Returns the CPU status (running/stopped).

  • The optional callback parameter will be executed after completion

If callback is not set the function is blocking and returns the CPU status on success or false on error.
If callback is set the function is non-blocking and an error and result argument is given to the callback.

Status Value Description
S7Client.S7CpuStatusUnknown 0x00 The CPU status is unknown
S7Client.S7CpuStatusRun 0x08 The CPU is running
S7Client.S7CpuStatusStop 0x04 The CPU is stopped

S7Client.Connected()

Returns the connection status.

S7Client.ErrorText(errNum)

Returns a textual explanation of a given error number.

  • errNum Error number