linux progress

This commit is contained in:
rusefillc 2024-01-12 23:48:11 -05:00
parent 9364e0ee0a
commit 40fa6e8574
1 changed files with 8 additions and 8 deletions

View File

@ -28,13 +28,9 @@ public class SocketCANHelper {
return socket; return socket;
} }
public static void send(int id, byte[] payload, RawCanChannel channel) { public static void send(int id, byte[] payload, RawCanChannel channel) throws IOException {
CanFrame packet = CanFrame.create(id, FD_NO_FLAGS, payload); CanFrame packet = CanFrame.create(id, FD_NO_FLAGS, payload);
try { channel.write(packet);
channel.write(packet);
} catch (IOException e) {
throw new IllegalStateException(e);
}
} }
public static CanSender create() { public static CanSender create() {
@ -42,8 +38,12 @@ public class SocketCANHelper {
return new CanSender() { return new CanSender() {
@Override @Override
public boolean send(int id, byte[] payload) { public boolean send(int id, byte[] payload) {
SocketCANHelper.send(id, payload, canChannel); try {
return true; SocketCANHelper.send(id, payload, canChannel);
return true;
} catch (IOException e) {
return false;
}
} }
}; };
} }