ports/asciiport.js
function _checkData(modbus, buf) {
    // check buffer size
    if (buf.length !== modbus._length && buf.length !== 5) {
        modbusSerialDebug({ action: "length error", recive: buf.length, expected: modbus._length });

        return false;
    }

    // check buffer unit-id and command
    return (buf[0] === modbus._id &&
        (0x7f & buf[1]) === modbus._cmd);
}
function _checkData(modbus, buf) {
    // check buffer size
    if (buf.length !== modbus._length && buf.length !== 5) {
        modbusSerialDebug({ action: "length error", recive: buf.length, expected: modbus._length });

        return false;
    }

    // check buffer unit-id and command
    return (buf[0] === modbus._id &&
        (0x7f & buf[1]) === modbus._cmd);
}
function _checkData ( modbus , buf ) { // check buffer size if ( buf . length !== modbus . _length && buf . length !== 5 ) { modbusSerialDebug ( { action : "length error" , recive : buf . length , expected : modbus . _length } ) ; return false ; } // check buffer unit-id and command return ( buf [ 0 ] === modbus . _id && ( 0x7f & buf [ 1 ] ) === modbus . _cmd ) ; }
check if a buffer chunk can be a modbus answer
or modbus exception

@param {AsciiPort} 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