@st-one-io/nodes7
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "@st-one-io/nodes7", | ||
"description": "A javascript library to communicate with Siemens S7 PLCs", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"author": "Guilherme Francescon <guilherme@st-one.io>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -99,2 +99,7 @@ //@ts-check | ||
case "REAL": | ||
case "RINT": | ||
case "RDINT": | ||
case "RWORD": | ||
case "RDWORD": | ||
case "RREAL": | ||
case "DT": | ||
@@ -131,2 +136,18 @@ case "DTZ": | ||
break; | ||
case "RI": | ||
dataType = "RINT"; | ||
break; | ||
case "RDI": | ||
dataType = "RDINT"; | ||
break; | ||
case "RW": | ||
dataType = "RWORD"; | ||
break; | ||
case "RD": | ||
case "RDW": | ||
dataType = "RDWORD"; | ||
break; | ||
case "RR": | ||
dataType = "RREAL"; | ||
break; | ||
default: | ||
@@ -194,2 +215,18 @@ throw new NodeS7Error('ERR_PARSE_DB_DATATYPE', `Unknown DB data type "${match_area}" for address "${address}"`, { item: address }); | ||
break; | ||
case "RI": | ||
dataType = "RINT"; | ||
break; | ||
case "RDI": | ||
dataType = "RDINT"; | ||
break; | ||
case "RW": | ||
dataType = "RWORD"; | ||
break; | ||
case "RD": | ||
case "RDW": | ||
dataType = "RDWORD"; | ||
break; | ||
case "RR": | ||
dataType = "RREAL"; | ||
break; | ||
default: | ||
@@ -262,2 +299,5 @@ throw new NodeS7Error('ERR_PARSE_DATATYPE', `Unknown data type "${dataType}" for address "${address}"`, { item: address }); | ||
case "DINT": | ||
case "RREAL": | ||
case "RDWORD": | ||
case "RDINT": | ||
dataTypeLength = 4; | ||
@@ -267,2 +307,4 @@ break; | ||
case "WORD": | ||
case "RINT": | ||
case "RWORD": | ||
case "TIMER": | ||
@@ -269,0 +311,0 @@ case "COUNTER": |
@@ -343,2 +343,13 @@ //@ts-check | ||
return new Date(Date.UTC(year, month - 1, day, hour, min, sec, ns / 1e6)); | ||
/** Reversed datatypes (little-endian) */ | ||
case "RREAL": | ||
return buffer.readFloatLE(offset); | ||
case "RDWORD": | ||
return buffer.readUInt32LE(offset); | ||
case "RWORD": | ||
return buffer.readUInt16LE(offset); | ||
case "RDINT": | ||
return buffer.readInt32LE(offset); | ||
case "RINT": | ||
return buffer.readInt16LE(offset); | ||
default: | ||
@@ -369,2 +380,7 @@ throw new Error(`Cannot parse data of unknown type "${this._props.datatype}" for item "${this._string}"`); | ||
case "WORD": | ||
case "RREAL": | ||
case "RDWORD": | ||
case "RDINT": | ||
case "RINT": | ||
case "RWORD": | ||
case "BYTE": | ||
@@ -473,2 +489,13 @@ if (typeof data !== 'number') throw new NodeS7Error('ERR_INVALID_ARGUMENT', `Data for item of type '${type}' must be a number`); | ||
break; | ||
/** Reversed datatypes (little-endian) */ | ||
case "RREAL": | ||
return buffer.writeFloatLE(data, offset); | ||
case "RDWORD": | ||
return buffer.writeUInt32LE(data, offset); | ||
case "RDINT": | ||
return buffer.writeInt32LE(data, offset); | ||
case "RINT": | ||
return buffer.writeInt16LE(data, offset); | ||
case "RWORD": | ||
return buffer.writeUInt16LE(data, offset); | ||
default: | ||
@@ -475,0 +502,0 @@ throw new Error(`Cannot parse data of unknown type "${this._props.datatype}" for item "${this._string}"`); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
382620
7536
1