mirror of
https://github.com/Maschell/HIDtoVPADNetworkClient.git
synced 2024-11-22 14:09:17 +01:00
Bumped Version and sending now data permanently not only on changes
This commit is contained in:
parent
8b6e53ed7a
commit
4066013e37
@ -11,3 +11,8 @@ Using this client, you can use unsuported devices such as XInput and Bluetooth c
|
||||
Please check the releases page for the latest feature list.
|
||||
|
||||
Configuration files for HID to VPAD can be found [here](https://github.com/Maschell/controller_patcher_configs).
|
||||
|
||||
## Used Libraries
|
||||
Lombok - https://projectlombok.org/index.html
|
||||
purejavahidapi - https://github.com/nyholku/purejavahidapi
|
||||
JXInput - https://github.com/StrikerX3/JXInput
|
||||
|
2
pom.xml
2
pom.xml
@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>net.ash</groupId>
|
||||
<artifactId>HIDToVPADNetworkClient</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>0.2</version>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
@ -35,6 +35,7 @@ import net.ash.HIDToVPADNetworkClient.network.commands.DetachCommand;
|
||||
import net.ash.HIDToVPADNetworkClient.network.commands.DeviceCommand;
|
||||
import net.ash.HIDToVPADNetworkClient.network.commands.ReadCommand;
|
||||
import net.ash.HIDToVPADNetworkClient.util.HandleFoundry;
|
||||
import net.ash.HIDToVPADNetworkClient.util.Settings;
|
||||
|
||||
public class NetworkHIDDevice {
|
||||
@Getter private final short vid;
|
||||
@ -76,7 +77,7 @@ public class NetworkHIDDevice {
|
||||
private byte[] lastdata = null;
|
||||
|
||||
public void sendRead(byte[] data) {
|
||||
if (!Arrays.equals(lastdata, data) || isNeedFirstData()) {
|
||||
if (!Settings.SEND_DATA_ONLY_ON_CHANGE || !Arrays.equals(lastdata, data) && Settings.SEND_DATA_ONLY_ON_CHANGE || isNeedFirstData()) {
|
||||
synchronized (readCommandLock) {
|
||||
setLatestRead(new ReadCommand(getHidHandle(), data, this)); // Only get the latest Value.
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ public class NetworkManager implements Runnable {
|
||||
byte[] rawCommand;
|
||||
try {
|
||||
rawCommand = Protocol.getRawReadDataToSend(readCommands);
|
||||
if (sendUDP(rawCommand) == true) {
|
||||
if (sendUDP(rawCommand) == true && Settings.DEBUG_UDP_OUTPUT) {
|
||||
System.out.println("UDP Packet sent: " + Utilities.ByteArrayToString(rawCommand));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
|
@ -44,6 +44,8 @@ public class Settings {
|
||||
public static final int PING_INTERVAL = 1000;
|
||||
public static final int PROCESS_CMD_INTERVAL = 10;
|
||||
|
||||
public static boolean DEBUG_UDP_OUTPUT = false;
|
||||
public static boolean SEND_DATA_ONLY_ON_CHANGE = false;
|
||||
public static boolean AUTO_ACTIVATE_CONTROLLER = true;
|
||||
|
||||
@Getter @Setter private static String ipAddr = "192.168.0.35"; // @Maschell, you're welcome
|
||||
@ -85,6 +87,7 @@ public class Settings {
|
||||
|
||||
Settings.ipAddr = prop.getProperty("ipAddr");
|
||||
String autoActivatingControllerString = prop.getProperty("autoActivatingController");
|
||||
String sendDataOnlyOnChanges = prop.getProperty("sendDataOnlyOnChanges");
|
||||
|
||||
if (autoActivatingControllerString != null) { // We don't combine the if statements to keep the default value.
|
||||
if (autoActivatingControllerString.equals("true")) {
|
||||
@ -93,6 +96,13 @@ public class Settings {
|
||||
Settings.AUTO_ACTIVATE_CONTROLLER = false;
|
||||
}
|
||||
}
|
||||
if (sendDataOnlyOnChanges != null) { // We don't combine the if statements to keep the default value.
|
||||
if (sendDataOnlyOnChanges.equals("true")) {
|
||||
Settings.SEND_DATA_ONLY_ON_CHANGE = true;
|
||||
} else {
|
||||
Settings.SEND_DATA_ONLY_ON_CHANGE = false;
|
||||
}
|
||||
}
|
||||
|
||||
log.info("Loaded config successfully!");
|
||||
}
|
||||
@ -114,6 +124,7 @@ public class Settings {
|
||||
|
||||
prop.setProperty("ipAddr", Settings.ipAddr);
|
||||
prop.setProperty("autoActivatingController", Boolean.toString(Settings.AUTO_ACTIVATE_CONTROLLER));
|
||||
prop.setProperty("sendDataOnlyOnChanges", Boolean.toString(Settings.SEND_DATA_ONLY_ON_CHANGE));
|
||||
|
||||
try {
|
||||
FileOutputStream outStream = new FileOutputStream(configFile);
|
||||
|
Loading…
Reference in New Issue
Block a user