com.github.moaxcp.x11.protocol.xinput.DeviceStateAbsCalib Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of x11-protocol-xinput Show documentation
Show all versions of x11-protocol-xinput Show documentation
An implementation of the x11 xinput protocol in java
package com.github.moaxcp.x11.protocol.xinput;
import com.github.moaxcp.x11.protocol.X11Input;
import com.github.moaxcp.x11.protocol.X11Output;
import java.io.IOException;
import lombok.Builder;
import lombok.Value;
@Value
@Builder
public class DeviceStateAbsCalib implements DeviceState {
public static final String PLUGIN_NAME = "xinput";
private short controlId;
private short len;
public static DeviceStateAbsCalib readDeviceStateAbsCalib(short controlId, short len, X11Input in)
throws IOException {
DeviceStateAbsCalib.DeviceStateAbsCalibBuilder javaBuilder = DeviceStateAbsCalib.builder();
javaBuilder.controlId(controlId);
javaBuilder.len(len);
return javaBuilder.build();
}
@Override
public void write(X11Output out) throws IOException {
out.writeCard16(controlId);
out.writeCard16(len);
}
@Override
public int getSize() {
return 4;
}
public String getPluginName() {
return PLUGIN_NAME;
}
public static class DeviceStateAbsCalibBuilder {
public DeviceStateAbsCalib.DeviceStateAbsCalibBuilder controlId(DeviceControl controlId) {
this.controlId = (short) controlId.getValue();
return this;
}
public DeviceStateAbsCalib.DeviceStateAbsCalibBuilder controlId(short controlId) {
this.controlId = controlId;
return this;
}
public int getSize() {
return 4;
}
}
}