Class Utils


  • public class Utils
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Utils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.ghgande.j2mod.modbus.msg.ModbusResponse getResponse​(com.ghgande.j2mod.modbus.msg.ModbusRequest request, int unitId, AbstractModbusBridge bridge)
      Build a ModbusResponse from a ModbusRequest.
      static java.lang.String toBitString​(byte[] bs)
      Converts an array of bytes to a String.
      static java.lang.String toBitString​(com.ghgande.j2mod.modbus.procimg.InputRegister[] registers)
      Converts an array of InputRegisters to a String.
      static java.lang.Boolean[] toBooleanArray​(byte[] bytes)
      Convert a byte array to a Boolean array.
      static java.lang.Boolean[] toBooleanArray​(com.ghgande.j2mod.modbus.util.BitVector v)
      Convert a BitVector to a Boolean array.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Utils

        public Utils()
    • Method Detail

      • toBooleanArray

        public static java.lang.Boolean[] toBooleanArray​(com.ghgande.j2mod.modbus.util.BitVector v)
        Convert a BitVector to a Boolean array.
        Parameters:
        v - the BitVector
        Returns:
        the Boolean array
      • toBooleanArray

        public static java.lang.Boolean[] toBooleanArray​(byte[] bytes)
        Convert a byte array to a Boolean array.
        Parameters:
        bytes - the byte array
        Returns:
        the Boolean array
      • getResponse

        public static com.ghgande.j2mod.modbus.msg.ModbusResponse getResponse​(com.ghgande.j2mod.modbus.msg.ModbusRequest request,
                                                                              int unitId,
                                                                              AbstractModbusBridge bridge)
                                                                       throws OpenemsException,
                                                                              com.ghgande.j2mod.modbus.ModbusException
        Build a ModbusResponse from a ModbusRequest.
        Parameters:
        request - the ModbusRequest
        unitId - the Modbus Unit-ID
        bridge - the AbstractModbusBridge
        Returns:
        the ModbusResponse
        Throws:
        OpenemsException
        com.ghgande.j2mod.modbus.ModbusException
      • toBitString

        public static java.lang.String toBitString​(com.ghgande.j2mod.modbus.procimg.InputRegister[] registers)
        Converts an array of InputRegisters to a String.
        Parameters:
        registers - the InputRegister array
        Returns:
        the String
      • toBitString

        public static java.lang.String toBitString​(byte[] bs)
        Converts an array of bytes to a String.
        Parameters:
        bs - the byte array
        Returns:
        the String