Package modbuspal.slave

Examples of modbuspal.slave.ModbusSlaveAddress


                        {
                            Thread.sleep( timestamp - prev_timestamp );
                        }
                        prev_timestamp = timestamp;

                        ModbusSlaveAddress slaveId = record.getSlaveID();
                        byte[] data = record.getData();
                        int pduLength = processPDU(slaveId, data, 0, record.getDataLength() );
                    }
                }
            }
View Full Code Here


            Node parentSlave = XMLTools.findParent(parentRegister, "slave");
           
            String slaveAddress = XMLTools.getAttribute(ModbusPalXML.XML_SLAVE_ID2_ATTRIBUTE, parentSlave);
            if( slaveAddress!= null )
            {
                ModbusSlaveAddress msa = ModbusSlaveAddress.parse(slaveAddress);
                slave = getModbusSlave(msa);
            }
            else
            {
                slaveAddress = XMLTools.getAttribute(ModbusPalXML.XML_SLAVE_ID_ATTRIBUTE, parentSlave);
                int slaveId = Integer.parseInt(slaveAddress);
                ModbusSlaveAddress msa = new ModbusSlaveAddress(slaveId);
                slave = getModbusSlave(msa);
            }
        }

        // bind the register and the automation
View Full Code Here

     * @param slave the new modbus slave to add
     * @return true if added successfully, false otherwise.
     */
    public boolean addModbusSlave(ModbusSlave slave)
    {
        ModbusSlaveAddress slaveID = slave.getSlaveId();

        // check if slaveID is already assigned:
        if( getModbusSlave(slaveID) != null )
        {
            return false;
View Full Code Here

     * @return a reference on the new or existing modbus slave, depending on the
     * user's choice. null if an error occured.
     */
    public ModbusSlave submitModbusSlave(ModbusSlave slave)
    {
        ModbusSlaveAddress slaveID = slave.getSlaveId();

        // check if slaveID is already assigned:
        if( getModbusSlave(slaveID) != null )
        {
            // show a dialog to let the user decide
View Full Code Here

     * Removes the specified MODBUS  slave from the project.
     * @param slave the modbus slave to remove from the project.
     */
    public void removeModbusSlave(ModbusSlave slave)
    {
        ModbusSlaveAddress slaveID = slave.getSlaveId();
        removeModbusSlave(slaveID);
    }
View Full Code Here

                    // if CRC are ok, then process the pdu
                    if( receivedCRC == computedCRC )
                    {
                        //System.out.println("read "+ totalLen + " bytes");
                        pduLength = processPDU(new ModbusSlaveAddress(slaveID), buffer, 1, pduLength);
                    }

                    else
                    {
                        // handle CRC error with exception code
View Full Code Here

                {
                    throw new IOException("received "+recv+" bytes instead of "+pduLength);
                }

                // interpret PDU and get result:
                pduLength = processPDU( new ModbusSlaveAddress(slaveSocket.getInetAddress(), uID), buffer, 7, pduLength);

                if( pduLength > 0 )
                {
                    // change length in MBAP
                    ModbusTools.setUint16(buffer,4,pduLength+1);
View Full Code Here

    // matching Rtu address.
    // 4/ As a last resort, a MODBUS address with an InetAddress corresponding
    // to a local network interface and no specified Rtu address would be ok.   
    private ModbusSlaveAddress getMatchingTcpAddress(ModbusSlaveAddress id)
    {
        ModbusSlaveAddress bestMatch = null;
        int matchRate = Integer.MAX_VALUE;
       
        Set<ModbusSlaveAddress> addresses = knownSlaves.keySet();
        for(ModbusSlaveAddress address : addresses )
        {
View Full Code Here

   
   
   
    private ModbusSlaveAddress getMatchingRtuAddress(ModbusSlaveAddress id)
    {
        ModbusSlaveAddress bestMatch = null;
        int matchRate = Integer.MAX_VALUE;
       
        Set<ModbusSlaveAddress> addresses = knownSlaves.keySet();
        for(ModbusSlaveAddress address : addresses )
        {
View Full Code Here

     */
    public ModbusSlave getModbusSlave(ModbusSlaveAddress id, boolean createIfNotExist)
    {
        synchronized(knownSlaves)
        {
            ModbusSlaveAddress matchedId = getMatchingSlaveAddress(id);
            if( (matchedId!=null) && (knownSlaves.get(matchedId)!=null) )
            {
                return knownSlaves.get(matchedId);
            }
            else if( createIfNotExist==true )
View Full Code Here

TOP

Related Classes of modbuspal.slave.ModbusSlaveAddress

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.