All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.qt.serialbus.QModbusPdu Maven / Gradle / Ivy

Go to download

Provides access to serial industrial bus interface. Currently the module supports the CAN bus and Modbus protocols.

There is a newer version: 6.7.2
Show newest version
package io.qt.serialbus;

import io.qt.*;


/**
 * 

Abstract container class containing the function code and payload that is stored inside a Modbus ADU

*

Java wrapper for Qt class QModbusPdu

*/ public class QModbusPdu extends QtObject implements java.lang.Cloneable { static { QtJambi_LibraryUtilities.initialize(); } /** *

Java wrapper for Qt enum QModbusPdu::ExceptionCode

*/ public enum ExceptionCode implements QtEnumerator { /** *

Representing QModbusPdu::IllegalFunction

*/ IllegalFunction(1), /** *

Representing QModbusPdu::IllegalDataAddress

*/ IllegalDataAddress(2), /** *

Representing QModbusPdu::IllegalDataValue

*/ IllegalDataValue(3), /** *

Representing QModbusPdu::ServerDeviceFailure

*/ ServerDeviceFailure(4), /** *

Representing QModbusPdu::Acknowledge

*/ Acknowledge(5), /** *

Representing QModbusPdu::ServerDeviceBusy

*/ ServerDeviceBusy(6), /** *

Representing QModbusPdu::NegativeAcknowledge

*/ NegativeAcknowledge(7), /** *

Representing QModbusPdu::MemoryParityError

*/ MemoryParityError(8), /** *

Representing QModbusPdu::GatewayPathUnavailable

*/ GatewayPathUnavailable(10), /** *

Representing QModbusPdu::GatewayTargetDeviceFailedToRespond

*/ GatewayTargetDeviceFailedToRespond(11), /** *

Representing QModbusPdu::ExtendedException

*/ ExtendedException(255); static { QtJambi_LibraryUtilities.initialize(); } private ExceptionCode(int value) { this.value = value; } /** * {@inheritDoc} */ @Override public int value() { return value; } /** * Returns the corresponding enum entry for the given value. * @param value * @return enum entry */ public static @NonNull ExceptionCode resolve(int value) { switch (value) { case 1: return IllegalFunction; case 2: return IllegalDataAddress; case 3: return IllegalDataValue; case 4: return ServerDeviceFailure; case 5: return Acknowledge; case 6: return ServerDeviceBusy; case 7: return NegativeAcknowledge; case 8: return MemoryParityError; case 10: return GatewayPathUnavailable; case 11: return GatewayTargetDeviceFailedToRespond; case 255: return ExtendedException; default: throw new QNoSuchEnumValueException(value); } } private final int value; } /** *

Java wrapper for Qt enum QModbusPdu::FunctionCode

*/ public enum FunctionCode implements QtEnumerator { /** *

Representing QModbusPdu::Invalid

*/ Invalid(0), /** *

Representing QModbusPdu::ReadCoils

*/ ReadCoils(1), /** *

Representing QModbusPdu::ReadDiscreteInputs

*/ ReadDiscreteInputs(2), /** *

Representing QModbusPdu::ReadHoldingRegisters

*/ ReadHoldingRegisters(3), /** *

Representing QModbusPdu::ReadInputRegisters

*/ ReadInputRegisters(4), /** *

Representing QModbusPdu::WriteSingleCoil

*/ WriteSingleCoil(5), /** *

Representing QModbusPdu::WriteSingleRegister

*/ WriteSingleRegister(6), /** *

Representing QModbusPdu::ReadExceptionStatus

*/ ReadExceptionStatus(7), /** *

Representing QModbusPdu::Diagnostics

*/ Diagnostics(8), /** *

Representing QModbusPdu::GetCommEventCounter

*/ GetCommEventCounter(11), /** *

Representing QModbusPdu::GetCommEventLog

*/ GetCommEventLog(12), /** *

Representing QModbusPdu::WriteMultipleCoils

*/ WriteMultipleCoils(15), /** *

Representing QModbusPdu::WriteMultipleRegisters

*/ WriteMultipleRegisters(16), /** *

Representing QModbusPdu::ReportServerId

*/ ReportServerId(17), /** *

Representing QModbusPdu::ReadFileRecord

*/ ReadFileRecord(20), /** *

Representing QModbusPdu::WriteFileRecord

*/ WriteFileRecord(21), /** *

Representing QModbusPdu::MaskWriteRegister

*/ MaskWriteRegister(22), /** *

Representing QModbusPdu::ReadWriteMultipleRegisters

*/ ReadWriteMultipleRegisters(23), /** *

Representing QModbusPdu::ReadFifoQueue

*/ ReadFifoQueue(24), /** *

Representing QModbusPdu::EncapsulatedInterfaceTransport

*/ EncapsulatedInterfaceTransport(43), /** *

Representing QModbusPdu::UndefinedFunctionCode

*/ UndefinedFunctionCode(256); static { QtJambi_LibraryUtilities.initialize(); } private FunctionCode(int value) { this.value = value; } /** * {@inheritDoc} */ @Override public int value() { return value; } /** * Returns the corresponding enum entry for the given value. * @param value * @return enum entry */ public static @NonNull FunctionCode resolve(int value) { switch (value) { case 0: return Invalid; case 1: return ReadCoils; case 2: return ReadDiscreteInputs; case 3: return ReadHoldingRegisters; case 4: return ReadInputRegisters; case 5: return WriteSingleCoil; case 6: return WriteSingleRegister; case 7: return ReadExceptionStatus; case 8: return Diagnostics; case 11: return GetCommEventCounter; case 12: return GetCommEventLog; case 15: return WriteMultipleCoils; case 16: return WriteMultipleRegisters; case 17: return ReportServerId; case 20: return ReadFileRecord; case 21: return WriteFileRecord; case 22: return MaskWriteRegister; case 23: return ReadWriteMultipleRegisters; case 24: return ReadFifoQueue; case 43: return EncapsulatedInterfaceTransport; case 256: return UndefinedFunctionCode; default: throw new QNoSuchEnumValueException(value); } } private final int value; } /** *

See QModbusPdu::QModbusPdu()

*/ public QModbusPdu(){ super((QPrivateConstructor)null); initialize_native(this); } private native static void initialize_native(QModbusPdu instance); /** *

See QModbusPdu::QModbusPdu(QModbusPdu)

*/ protected QModbusPdu(io.qt.serialbus.@NonNull QModbusPdu arg__1){ super((QPrivateConstructor)null); initialize_native(this, arg__1); } private native static void initialize_native(QModbusPdu instance, io.qt.serialbus.QModbusPdu arg__1); /** *

See QModbusPdu::QModbusPdu(QModbusPdu::FunctionCode,QByteArray)

*/ protected QModbusPdu(io.qt.serialbus.QModbusPdu.@NonNull FunctionCode code, io.qt.core.@NonNull QByteArray newData){ super((QPrivateConstructor)null); initialize_native(this, code, newData); } private native static void initialize_native(QModbusPdu instance, io.qt.serialbus.QModbusPdu.FunctionCode code, io.qt.core.QByteArray newData); /** *

See QModbusPdu::data()const

*/ @QtUninvokable public final io.qt.core.@NonNull QByteArray data(){ return data_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native io.qt.core.QByteArray data_native_constfct(long __this__nativeId); /** *

See QModbusPdu::dataSize()const

*/ @QtUninvokable public final short dataSize(){ return dataSize_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native short dataSize_native_constfct(long __this__nativeId); /** *

See QModbusPdu::exceptionCode()const

*/ @QtUninvokable public final io.qt.serialbus.QModbusPdu.@NonNull ExceptionCode exceptionCode(){ return io.qt.serialbus.QModbusPdu.ExceptionCode.resolve(exceptionCode_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this))); } @QtUninvokable private native int exceptionCode_native_constfct(long __this__nativeId); /** *

See QModbusPdu::functionCode()const

*/ @QtUninvokable public final io.qt.serialbus.QModbusPdu.@NonNull FunctionCode functionCode(){ return io.qt.serialbus.QModbusPdu.FunctionCode.resolve(functionCode_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this))); } @QtUninvokable private native int functionCode_native_constfct(long __this__nativeId); /** *

See QModbusPdu::isException()const

*/ @QtUninvokable public final boolean isException(){ return isException_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native boolean isException_native_constfct(long __this__nativeId); /** *

See QModbusPdu::isValid()const

*/ @QtUninvokable public final boolean isValid(){ return isValid_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native boolean isValid_native_constfct(long __this__nativeId); /** *

See operator<<(QDataStream&,QModbusPdu)

*/ @QtUninvokable public void writeTo(io.qt.core.@StrictNonNull QDataStream stream){ java.util.Objects.requireNonNull(stream, "Argument 'stream': null not expected."); writeTo_native_ref_QDataStream(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(stream)); } @QtUninvokable private native void writeTo_native_ref_QDataStream(long __this__nativeId, long stream); /** *

See QModbusPdu::operator=(QModbusPdu)

*/ @QtUninvokable protected final void assign(io.qt.serialbus.@NonNull QModbusPdu arg__1){ assign_native_cref_QModbusPdu(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(arg__1)); } @QtUninvokable private native void assign_native_cref_QModbusPdu(long __this__nativeId, long arg__1); /** *

See operator==(QModbusPdu,QModbusPdu)

*/ @QtUninvokable public final boolean equals(io.qt.serialbus.@NonNull QModbusPdu value2){ return equals_native_cref_QModbusPdu(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(value2)); } @QtUninvokable private native boolean equals_native_cref_QModbusPdu(long __this__nativeId, long value2); /** *

See QModbusPdu::setData(QByteArray)

*/ @QtUninvokable public final void setData(io.qt.core.@NonNull QByteArray newData){ setData_native_cref_QByteArray(QtJambi_LibraryUtilities.internal.nativeId(this), QtJambi_LibraryUtilities.internal.checkedNativeId(newData)); } @QtUninvokable private native void setData_native_cref_QByteArray(long __this__nativeId, long newData); /** *

See QModbusPdu::size()const

*/ @QtUninvokable public final short size(){ return size_native_constfct(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native short size_native_constfct(long __this__nativeId); /** *

See QModbusPdu::setFunctionCode(QModbusPdu::FunctionCode)

*/ @QtUninvokable public void setFunctionCode(io.qt.serialbus.QModbusPdu.@NonNull FunctionCode code){ setFunctionCode_native_QModbusPdu_FunctionCode(QtJambi_LibraryUtilities.internal.nativeId(this), code.value()); } @QtUninvokable private native void setFunctionCode_native_QModbusPdu_FunctionCode(long __this__nativeId, int code); /** *

See QModbusPdu::ExceptionByte

*/ private native static byte ExceptionByte(); /** *

See QModbusPdu::ExceptionByte

*/ public static final byte ExceptionByte = ExceptionByte(); /** * Constructor for internal use only. * @param p expected to be null. * @hidden */ @NativeAccess protected QModbusPdu(QPrivateConstructor p) { super(p); } /** *

See operator==(QModbusPdu,QModbusPdu)

*/ @Override @QtUninvokable public boolean equals(Object other) { if (other==null || other instanceof io.qt.serialbus.QModbusPdu) { return equals((io.qt.serialbus.QModbusPdu) other); } return false; } /** * Returns the objects's hash code computed by qHash(QModbusPdu). */ @QtUninvokable @Override public int hashCode() { return hashCode_native(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private native static int hashCode_native(long __this_nativeId); @QtUninvokable public void encodeData(Number...data) { io.qt.core.QByteArray byteArray = new io.qt.core.QByteArray(data()); io.qt.core.QDataStream stream = new io.qt.core.QDataStream(byteArray, io.qt.core.QIODevice.OpenModeFlag.WriteOnly); for (Number s : data) { if(s instanceof Byte) { stream.writeByte((Byte)s); }else if(s instanceof Short){ stream.writeShort((Short)s); }else { throw new IllegalArgumentException("Only byte and short supported."); } } stream.dispose(); setData(byteArray); } @QtUninvokable public void encodeData(short...data) { io.qt.core.QByteArray byteArray = new io.qt.core.QByteArray(data()); io.qt.core.QDataStream stream = new io.qt.core.QDataStream(byteArray, io.qt.core.QIODevice.OpenModeFlag.WriteOnly); for (short s : data) { stream.writeShort(s); } stream.dispose(); setData(byteArray); } @QtUninvokable public void encodeData(byte...data) { io.qt.core.QByteArray byteArray = new io.qt.core.QByteArray(data()); io.qt.core.QDataStream stream = new io.qt.core.QDataStream(byteArray, io.qt.core.QIODevice.OpenModeFlag.WriteOnly); for (byte s : data) { stream.writeByte(s); } stream.dispose(); setData(byteArray); } @QtUninvokable public void decodeData(byte[] data) { io.qt.core.QDataStream stream = new io.qt.core.QDataStream(data(), io.qt.core.QIODevice.OpenModeFlag.ReadOnly); for (int i = 0; i < data.length; ++i) { data[i] = stream.readByte(); } stream.dispose(); } @QtUninvokable public void decodeData(short[] data) { io.qt.core.QDataStream stream = new io.qt.core.QDataStream(data(), io.qt.core.QIODevice.OpenModeFlag.ReadOnly); for (int i = 0; i < data.length; ++i) { data[i] = stream.readShort(); } stream.dispose(); } @QtUninvokable public void decodeData(Number[][] data) { io.qt.core.QDataStream stream = new io.qt.core.QDataStream(data(), io.qt.core.QIODevice.OpenModeFlag.ReadOnly); for (int i = 0; i < data.length; ++i) { if(data[i] instanceof Byte[]) { ((Byte[])data[i])[0] = stream.readByte(); }else if(data[i] instanceof Short[]) { ((Short[])data[i])[0] = stream.readShort(); }else { stream.dispose(); throw new IllegalArgumentException("Only byte and short supported."); } } stream.dispose(); } /** *

See operator<<(QDebug,QModbusPdu)

*/ @QtUninvokable @Override public @NonNull String toString() { return toString_native(QtJambi_LibraryUtilities.internal.nativeId(this)); } @QtUninvokable private static native String toString_native(long __this_nativeId); /** *

Creates and returns a copy of this object.

*/ @QtUninvokable @Override public QModbusPdu clone() { return clone_native(QtJambi_LibraryUtilities.internal.nativeId(this)); } private static native QModbusPdu clone_native(long __this_nativeId); /** *

Overloaded constructor for {@link #QModbusPdu(io.qt.serialbus.QModbusPdu.FunctionCode, io.qt.core.QByteArray)}.

*/ protected QModbusPdu(io.qt.serialbus.QModbusPdu.@NonNull FunctionCode code, byte @NonNull[] newData) { this(code, new io.qt.core.QByteArray(newData)); } /** *

Overloaded function for {@link #setData(io.qt.core.QByteArray)}.

*/ @QtUninvokable public final void setData(byte @NonNull[] newData) { setData(new io.qt.core.QByteArray(newData)); } /** * @hidden *

Kotlin property getter. In Java use {@link #ExceptionByte()} instead.

*/ private static byte getExceptionByte() { return ExceptionByte(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy