ports/c701port.js
function _checkData(modbus, buf) {
    // check buffer size
    if (buf.length !== modbus._length && buf.length !== 5) return false;

    // calculate crc16
    var crcIn = buf.readUInt16LE(buf.length - 2);

    // check buffer unit-id, command and crc
    return (buf[0] === modbus._id &&
        (0x7f & buf[1]) === modbus._cmd &&
        crcIn === crc16(buf.slice(0, -2)));
}
function _checkData(modbus, buf) {
    // check buffer size
    if (buf.length !== modbus._length && buf.length !== 5) return false;

    // calculate crc16
    var crcIn = buf.readUInt16LE(buf.length - 2);

    // check buffer unit-id, command and crc
    return (buf[0] === modbus._id &&
        (0x7f & buf[1]) === modbus._cmd &&
        crcIn === crc16(buf.slice(0, -2)));
}
function _checkData ( modbus , buf ) { // check buffer size if ( buf . length !== modbus . _length && buf . length !== 5 ) return false ; // calculate crc16 var crcIn = buf . readUInt16LE ( buf . length - 2 ) ; // check buffer unit-id, command and crc return ( buf [ 0 ] === modbus . _id && ( 0x7f & buf [ 1 ] ) === modbus . _cmd && crcIn === crc16 ( buf . slice ( 0 , - 2 ) ) ) ; }
Check if a buffer chunk can be a Modbus answer or modbus exception.

@param {UdpPort} modbus
@param {Buffer} buf the buffer to check.
@return {boolean} if the buffer can be an answer
@private
Check if a buffer chunk can be a Modbus answer or modbus exception .