mirror of
https://github.com/Maschell/HIDtoVPADNetworkClient.git
synced 2024-11-29 09:14:14 +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.
|
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).
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>net.ash</groupId>
|
<groupId>net.ash</groupId>
|
||||||
<artifactId>HIDToVPADNetworkClient</artifactId>
|
<artifactId>HIDToVPADNetworkClient</artifactId>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<version>0.2</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<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.DeviceCommand;
|
||||||
import net.ash.HIDToVPADNetworkClient.network.commands.ReadCommand;
|
import net.ash.HIDToVPADNetworkClient.network.commands.ReadCommand;
|
||||||
import net.ash.HIDToVPADNetworkClient.util.HandleFoundry;
|
import net.ash.HIDToVPADNetworkClient.util.HandleFoundry;
|
||||||
|
import net.ash.HIDToVPADNetworkClient.util.Settings;
|
||||||
|
|
||||||
public class NetworkHIDDevice {
|
public class NetworkHIDDevice {
|
||||||
@Getter private final short vid;
|
@Getter private final short vid;
|
||||||
@ -76,7 +77,7 @@ public class NetworkHIDDevice {
|
|||||||
private byte[] lastdata = null;
|
private byte[] lastdata = null;
|
||||||
|
|
||||||
public void sendRead(byte[] data) {
|
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) {
|
synchronized (readCommandLock) {
|
||||||
setLatestRead(new ReadCommand(getHidHandle(), data, this)); // Only get the latest Value.
|
setLatestRead(new ReadCommand(getHidHandle(), data, this)); // Only get the latest Value.
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ public class NetworkManager implements Runnable {
|
|||||||
byte[] rawCommand;
|
byte[] rawCommand;
|
||||||
try {
|
try {
|
||||||
rawCommand = Protocol.getRawReadDataToSend(readCommands);
|
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));
|
System.out.println("UDP Packet sent: " + Utilities.ByteArrayToString(rawCommand));
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
@ -44,6 +44,8 @@ public class Settings {
|
|||||||
public static final int PING_INTERVAL = 1000;
|
public static final int PING_INTERVAL = 1000;
|
||||||
public static final int PROCESS_CMD_INTERVAL = 10;
|
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;
|
public static boolean AUTO_ACTIVATE_CONTROLLER = true;
|
||||||
|
|
||||||
@Getter @Setter private static String ipAddr = "192.168.0.35"; // @Maschell, you're welcome
|
@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");
|
Settings.ipAddr = prop.getProperty("ipAddr");
|
||||||
String autoActivatingControllerString = prop.getProperty("autoActivatingController");
|
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 != null) { // We don't combine the if statements to keep the default value.
|
||||||
if (autoActivatingControllerString.equals("true")) {
|
if (autoActivatingControllerString.equals("true")) {
|
||||||
@ -93,6 +96,13 @@ public class Settings {
|
|||||||
Settings.AUTO_ACTIVATE_CONTROLLER = false;
|
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!");
|
log.info("Loaded config successfully!");
|
||||||
}
|
}
|
||||||
@ -114,6 +124,7 @@ public class Settings {
|
|||||||
|
|
||||||
prop.setProperty("ipAddr", Settings.ipAddr);
|
prop.setProperty("ipAddr", Settings.ipAddr);
|
||||||
prop.setProperty("autoActivatingController", Boolean.toString(Settings.AUTO_ACTIVATE_CONTROLLER));
|
prop.setProperty("autoActivatingController", Boolean.toString(Settings.AUTO_ACTIVATE_CONTROLLER));
|
||||||
|
prop.setProperty("sendDataOnlyOnChanges", Boolean.toString(Settings.SEND_DATA_ONLY_ON_CHANGE));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
FileOutputStream outStream = new FileOutputStream(configFile);
|
FileOutputStream outStream = new FileOutputStream(configFile);
|
||||||
|
Loading…
Reference in New Issue
Block a user