Skip to content

Commit

Permalink
linux progress
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed Jan 13, 2024
1 parent 9364e0e commit 40fa6e8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions playback/src/main/java/com/rusefi/io/can/SocketCANHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,22 @@ public static RawCanChannel createSocket() {
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);
try {
channel.write(packet);
} catch (IOException e) {
throw new IllegalStateException(e);
}
channel.write(packet);
}

public static CanSender create() {
RawCanChannel canChannel = createSocket();
return new CanSender() {
@Override
public boolean send(int id, byte[] payload) {
SocketCANHelper.send(id, payload, canChannel);
return true;
try {
SocketCANHelper.send(id, payload, canChannel);
return true;
} catch (IOException e) {
return false;
}
}
};
}
Expand Down

0 comments on commit 40fa6e8

Please sign in to comment.