Package modbuspal.slave

Examples of modbuspal.slave.ModbusPduProcessor


            modbusPalProject.notifyPDUnotServiced();
            return 0;
        }

        byte functionCode = buffer[offset+0];
        ModbusPduProcessor mspp = slave.getPduProcessor(functionCode);
        if( mspp == null )
        {
            System.err.println("Unsupported function code "+functionCode);
            int length = makeExceptionResponse(functionCode,XC_ILLEGAL_FUNCTION, buffer, offset);
            ModbusPalRecorder.recordOutgoing(slaveID,buffer,offset,length);
            modbusPalProject.notifyExceptionResponse();
            return length;
        }

        int length = mspp.processPDU(functionCode, slaveID, buffer, offset, modbusPalProject.isLeanModeEnabled());
        if(length<0)
        {
            System.err.println("Illegal function code "+functionCode);
            length = makeExceptionResponse(functionCode,XC_ILLEGAL_FUNCTION, buffer, offset);
        }
View Full Code Here


        // get the slave:
        ModbusSlave slave = modbusPalProject.getModbusSlave(slaveID);

        // retrive the pdu processor for the modbus function:
       
        ModbusPduProcessor mspp = slave.getPduProcessor(functionCode);
        if( mspp == null )
        {
            System.err.println("Unsupported function code "+functionCode);
            //int length = makeExceptionResponse(functionCode,XC_ILLEGAL_FUNCTION, buffer, offset);
            //ModbusPalRecorder.recordOutgoing(slaveID,buffer,offset,length);
            req.notifyExceptionResponse();
            modbusPalProject.notifyExceptionResponse();
            return -1;
        }

        int length = mspp.buildPDU(req, slaveID, buffer, offset, modbusPalProject.isLeanModeEnabled());
        if(length==-1)
        {
            System.err.println("Illegal function code "+functionCode);
            req.notifyPDUnotServiced();
            modbusPalProject.notifyPDUnotServiced();
View Full Code Here

        }

       
        // retrive the pdu processor for the modbus function:
       
        ModbusPduProcessor mspp = slave.getPduProcessor(functionCode);
        if( mspp == null )
        {
            System.err.println("Unsupported function code "+functionCode);
            //int length = makeExceptionResponse(functionCode,XC_ILLEGAL_FUNCTION, buffer, offset);
            //ModbusPalRecorder.recordOutgoing(slaveID,buffer,offset,length);
            req.notifyExceptionResponse();
            modbusPalProject.notifyExceptionResponse();
            return false;
        }

        boolean result = mspp.processPDU(req, slaveID, buffer, offset, modbusPalProject.isLeanModeEnabled());
        if(result==false)
        {
            System.err.println("Illegal function code "+functionCode);
            req.notifyPDUnotServiced();
            modbusPalProject.notifyPDUnotServiced();
View Full Code Here

TOP

Related Classes of modbuspal.slave.ModbusPduProcessor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.