src/Stack/Packets/PCCCPacket.js
function logicalASCIIAddressInfo(address) {
  const splitString = address.split(':');
  const prefix = splitString[0].replace(/[0-9]/gi, '');
  const info = {};
  switch (prefix) {
  	case "S":
  	case "I":
  	case "N":
  	case "O":
  	case "B":
  		info.addrtype = prefix;
  		info.datatype = "INT";
  		info.size = 2;
      info.dataType = 4;
      info.writeFunction = (buffer, offset, value) => buffer.writeInt16LE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readInt16LE(offset);
  		break;
  	case "L": // Micrologix Only
  		info.addrtype = prefix;
  		info.datatype = "DINT";
  		info.size = 4;
      info.writeFunction = (buffer, offset, value) => buffer.writeInt32LE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readInt32LE(offset);
  		break;
  	case "F":
  		info.addrtype = prefix;
  		info.datatype = "REAL";
  		info.size = 4;
      info.dataType = 8;
      info.writeFunction = (buffer, offset, value) => buffer.writeFloatLE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readFloatLE(offset);
  		break;
  	case "T":
  		info.addrtype = prefix;
  		info.datatype = "TIMER";
  		info.size = 6;
  		break;
  	case "C":
  		info.addrtype = prefix;
  		info.datatype = "COUNTER";
  		info.size = 6;
  		break;
  	case "ST":
  		info.addrtype = prefix;
  		info.datatype = "STRING";
  		info.size = 84;
  		break;
  	case "NST": // N as string - special type to read strings moved into an integer array to support CompactLogix read-only.
  		info.addrtype = prefix;
  		info.datatype = "NSTRING";
  		info.size = 44;
  		break;
  	case "R":
  		theItem.addrtype = prefix;
  		theItem.datatype = "CONTROL";
  		theItem.size = 6;
  		break;
  	case "A":	// TODO - support this.
  	default:
  		outputLog('Failed to find a match for ' + splitString[0] + ' possibly because ' + prefix + ' type is not supported yet.');
  		return undefined;
	}
  return info;
}
function logicalASCIIAddressInfo(address) {
  const splitString = address.split(':');
  const prefix = splitString[0].replace(/[0-9]/gi, '');
  const info = {};
  switch (prefix) {
  	case "S":
  	case "I":
  	case "N":
  	case "O":
  	case "B":
  		info.addrtype = prefix;
  		info.datatype = "INT";
  		info.size = 2;
      info.dataType = 4;
      info.writeFunction = (buffer, offset, value) => buffer.writeInt16LE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readInt16LE(offset);
  		break;
  	case "L": // Micrologix Only
  		info.addrtype = prefix;
  		info.datatype = "DINT";
  		info.size = 4;
      info.writeFunction = (buffer, offset, value) => buffer.writeInt32LE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readInt32LE(offset);
  		break;
  	case "F":
  		info.addrtype = prefix;
  		info.datatype = "REAL";
  		info.size = 4;
      info.dataType = 8;
      info.writeFunction = (buffer, offset, value) => buffer.writeFloatLE(value, offset);
      info.readFunction = (buffer, offset) => buffer.readFloatLE(offset);
  		break;
  	case "T":
  		info.addrtype = prefix;
  		info.datatype = "TIMER";
  		info.size = 6;
  		break;
  	case "C":
  		info.addrtype = prefix;
  		info.datatype = "COUNTER";
  		info.size = 6;
  		break;
  	case "ST":
  		info.addrtype = prefix;
  		info.datatype = "STRING";
  		info.size = 84;
  		break;
  	case "NST": // N as string - special type to read strings moved into an integer array to support CompactLogix read-only.
  		info.addrtype = prefix;
  		info.datatype = "NSTRING";
  		info.size = 44;
  		break;
  	case "R":
  		theItem.addrtype = prefix;
  		theItem.datatype = "CONTROL";
  		theItem.size = 6;
  		break;
  	case "A":	// TODO - support this.
  	default:
  		outputLog('Failed to find a match for ' + splitString[0] + ' possibly because ' + prefix + ' type is not supported yet.');
  		return undefined;
	}
  return info;
}
function logicalASCIIAddressInfo ( address ) { const splitString = address . split ( ':' ) ; const prefix = splitString [ 0 ] . replace ( / [0-9] / gi , '' ) ; const info = { } ; switch ( prefix ) { case "S" : case "I" : case "N" : case "O" : case "B" : info . addrtype = prefix ; info . datatype = "INT" ; info . size = 2 ; info . dataType = 4 ; info . writeFunction = ( buffer , offset , value ) => buffer . writeInt16LE ( value , offset ) ; info . readFunction = ( buffer , offset ) => buffer . readInt16LE ( offset ) ; break ; case "L" : // Micrologix Only info . addrtype = prefix ; info . datatype = "DINT" ; info . size = 4 ; info . writeFunction = ( buffer , offset , value ) => buffer . writeInt32LE ( value , offset ) ; info . readFunction = ( buffer , offset ) => buffer . readInt32LE ( offset ) ; break ; case "F" : info . addrtype = prefix ; info . datatype = "REAL" ; info . size = 4 ; info . dataType = 8 ; info . writeFunction = ( buffer , offset , value ) => buffer . writeFloatLE ( value , offset ) ; info . readFunction = ( buffer , offset ) => buffer . readFloatLE ( offset ) ; break ; case "T" : info . addrtype = prefix ; info . datatype = "TIMER" ; info . size = 6 ; break ; case "C" : info . addrtype = prefix ; info . datatype = "COUNTER" ; info . size = 6 ; break ; case "ST" : info . addrtype = prefix ; info . datatype = "STRING" ; info . size = 84 ; break ; case "NST" : // N as string - special type to read strings moved into an integer array to support CompactLogix read-only. info . addrtype = prefix ; info . datatype = "NSTRING" ; info . size = 44 ; break ; case "R" : theItem . addrtype = prefix ; theItem . datatype = "CONTROL" ; theItem . size = 6 ; break ; case "A" : // TODO - support this. default : outputLog ( 'Failed to find a match for ' + splitString [ 0 ] + ' possibly because ' + prefix + ' type is not supported yet.' ) ; return undefined ; } return info ; }
Help from https://github.com/plcpeople/nodepccc/blob/00b4824972baec636deb0906454f841d8b832797/nodePCCC.js
Help from https : // github . com / plcpeople / nodepccc / blob / 00b4824972baec636deb0906454f841d8b832797 / nodePCCC . js