New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

s7client-ts

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s7client-ts

Step7 client based on node-step7 and inspired by s7client, Typescript ready

latest
npmnpm
Version
0.0.3
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

S7Client-ts

Typescript port of S7Client, the Hi-Level API for node-snap7 to communicate with Siemens S7 PCLs (See compatibility).

  • Typescript
  • Promise based, async/await support
  • Returns javascript objects with parsed var objects
  • EventEmitter: (connect, disconnect, connect_error, value)
  • Optional auto reconnect

Api Documentation

// TODO

Usage

npm install s7client-ts
import { S7Client, S7DbVarAreaDbRead } from 's7client-ts';

// PLC Connection Settings
const plcSettings = {
  name: "LocalPLC",
  host: 'localhost',
  port: 9102,
  rack: 0,
  slot: 2
};


// DBA to read
const dbNr = 102;
const dbVars: S7DbVarAreaDbRead[] = [
  // { type: "CHAR", start: 0 },
  { type: "BOOL", start: 4, bit: 2 },
  { type: 'INT', start: 13 }
];

const client = new S7Client(plcSettings);
client.on('error', console.error);

(async function () {
  console.log("connectind");
  await client.connect().catch((e) => console.log(e));
  console.log("connected", client.isConnected());

  // Read DB
  const res: S7DbVarAreaDbRead[] = await client.readDB(dbNr, dbVars);
  console.log(res);

  // Write multiple Vars
  await client.writeVars([{
    area: 'db', dbnr: 1, type: 'BOOL',
    start: 5, bit: 2,
    value: true
  }]);

  client.disconnect();
})();

Special thanks to

  • Davide Nardella for creating snap7
  • Mathias Küsel for creating node-snap7
  • Christoph Wiechert for creating s7client

Keywords

step7

FAQs

Package last updated on 15 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts