servers/servertcp.js
function _serverDebug(text, unitID, functionCode, responseBuffer) {
    // If no responseBuffer, then assume this is an error
    // o/w assume an action
    if (typeof responseBuffer === "undefined") {
        modbusSerialDebug({
            error: text,
            unitID: unitID,
            functionCode: functionCode
        });

    } else {
        modbusSerialDebug({
            action: text,
            unitID: unitID,
            functionCode: functionCode,
            responseBuffer: responseBuffer.toString("hex")
        });
    }
}
function _serverDebug(text, unitID, functionCode, responseBuffer) {
    // If no responseBuffer, then assume this is an error
    // o/w assume an action
    if (typeof responseBuffer === "undefined") {
        modbusSerialDebug({
            error: text,
            unitID: unitID,
            functionCode: functionCode
        });

    } else {
        modbusSerialDebug({
            action: text,
            unitID: unitID,
            functionCode: functionCode,
            responseBuffer: responseBuffer.toString("hex")
        });
    }
}
function _serverDebug ( text , unitID , functionCode , responseBuffer ) { // If no responseBuffer, then assume this is an error // o/w assume an action if ( typeof responseBuffer === "undefined" ) { modbusSerialDebug ( { error : text , unitID : unitID , functionCode : functionCode } ) ; } else { modbusSerialDebug ( { action : text , unitID : unitID , functionCode : functionCode , responseBuffer : responseBuffer . toString ( "hex" ) } ) ; } }
Helper function for sending debug objects.

@param {string} text - text of message, an error or an action
@param {int} unitID - Id of the requesting unit
@param {int} functionCode - a modbus function code.
@param {Buffer} requestBuffer - request Buffer from client
@returns undefined
@private
Helper function for sending debug objects .