Package modbuspal.slave

Examples of modbuspal.slave.ModbusSlave


       
        byte functionCode = req.getFunctionCode();
       
       
        // 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);
View Full Code Here


            modbusPalProject.notifyPDUnotServiced();
            return false;
        }

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

        byte functionCode = buffer[offset+0];
       
        //
        if( isExceptionResponse(buffer,offset)==true )
        {
            req.notifyExceptionResponse();
            modbusPalProject.notifyExceptionResponse();
            return false;
        }

       
        // 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);
View Full Code Here

            {
                return knownSlaves.get(matchedId);
            }
            else if( createIfNotExist==true )
            {
                setModbusSlave( id, new ModbusSlave(id) );
                return knownSlaves.get(id);
            }
            else
            {
                return null;
View Full Code Here

     */
    protected ModbusSlave setModbusSlave(ModbusSlaveAddress id, ModbusSlave s)
    {
        synchronized(knownSlaves)
        {
            ModbusSlave old = knownSlaves.get(id);
            knownSlaves.put(id, s);
            if(s!=null)
            {
                notifySlaveAdded(s);
            }
View Full Code Here

            ModbusSlaveAddress ids[] = dialog.getTargetList();
            String name = dialog.getTargetName();
            for( int i=0; i<ids.length; i++ )
            {
                ModbusSlave slave = new ModbusSlave(ids[i]);
                slave.setName(name);
                modbusPalProject.addModbusSlave(slave);
            }
        }
    }//GEN-LAST:event_addModbusSlaveButtonActionPerformed
View Full Code Here

     * @param id the MODBUS id of the slave
     * @param enabled true to enable the slave, false to disable it
     */
    public void setModbusSlaveEnabled(ModbusSlaveAddress id, boolean enabled)
    {
        ModbusSlave slave = modbusPalProject.getModbusSlave(id, modbusPalProject.isLeanModeEnabled());
        if( slave!=null )
        {
            slave.setEnabled(enabled);
        }
    }
View Full Code Here

     * located in the "modbus slaves" frame.
     * @param evt
     */
    private void enableAllSlavesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enableAllSlavesButtonActionPerformed

        ModbusSlave slaves[] = modbusPalProject.getModbusSlaves();
        for(int i=0; i<slaves.length; i++)
        {
            if( slaves[i] != null )
            {
                slaves[i].setEnabled(true);
View Full Code Here

        startAllAutomations();
}//GEN-LAST:event_startAllAutomationsButtonActionPerformed

    private void disableAllSlavesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disableAllSlavesButtonActionPerformed

        ModbusSlave slaves[] = modbusPalProject.getModbusSlaves();
        for(int i=0; i<slaves.length; i++)
        {
            if( slaves[i] != null )
            {
                slaves[i].setEnabled(false);
View Full Code Here

TOP

Related Classes of modbuspal.slave.ModbusSlave

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.