Skip to content

Commit

Permalink
[Major] Removed GpioLine.eventReadMultiple()
Browse files Browse the repository at this point in the history
  • Loading branch information
eitch committed Feb 21, 2024
1 parent 752a730 commit b5603db
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

import com.pi4j.library.gpiod.util.NativeLibraryLoader;

import java.util.Arrays;

/**
* <p>GpioD interface.</p>
*
Expand Down Expand Up @@ -310,28 +308,6 @@ static boolean lineEventRead(long linePtr, long lineEventPtr) {

private static native int c_gpiod_line_event_read(long linePtr, long eventPtr);

static GpioLineEvent[] lineEventReadMultiple(long linePtr, int maxRead) {
GpioLineEvent[] events = new GpioLineEvent[maxRead];
for (int i = 0; i < events.length; i++) {
events[i] = new GpioLineEvent(GpioD.lineEventNew());
}

int numRead = c_gpiod_line_event_read_multiple(linePtr,
Arrays.stream(events).mapToLong(GpioLineEvent::getCPointer).toArray(), events.length);
if (numRead < 0)
throw new GpioDException("c_gpiod_line_event_read_multiple failed: " + numRead);

GpioLineEvent[] result = new GpioLineEvent[numRead];
if (numRead == maxRead) {
result = events;
} else {
System.arraycopy(events, 0, result, 0, result.length);
}
return result;
}

private static native int c_gpiod_line_event_read_multiple(long linePtr, long[] eventPtr, int num_events);

static long lineGet(String device, int offset) {
Long ptr = c_gpiod_line_get(device, offset);
if (ptr == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,4 @@ public GpioLineEvent eventRead(GpioLineEvent lineEvent) {
GpioD.lineEventRead(getCPointer(), lineEvent.getCPointer());
return lineEvent;
}

public GpioLineEvent[] eventReadMultiple(int maxRead) {
return GpioD.lineEventReadMultiple(getCPointer(), maxRead);
}
}

0 comments on commit b5603db

Please sign in to comment.