-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing basic poller, SysFsPin path issue and renaming modules
- Loading branch information
1 parent
26e1544
commit 08c7cd2
Showing
11 changed files
with
126 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,6 @@ public BasicPollResult(byte... data) { | |
|
||
@Override | ||
public byte[] getData() { | ||
return new byte[0]; | ||
return data; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
simplegpio-core/src/main/java/com/doordeck/simplegpio/gpio/io/AbstractInputPoller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
simplegpio-core/src/main/java/com/doordeck/simplegpio/gpio/io/BasicInputPoller.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
simplegpio-core/src/main/java/com/doordeck/simplegpio/gpio/io/BasicInputPollerFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
simplegpio-core/src/test/java/com/doordeck/simplegpio/SignalTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,52 @@ | ||
package com.doordeck.simplegpio; | ||
|
||
/* | ||
* (C) Copyright 2016 Doordeck Limited and others. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
import org.junit.Test; | ||
import static org.junit.Assert.assertEquals; | ||
|
||
public class SignalTest { | ||
|
||
@Test | ||
public void testSignal() { | ||
assertEquals(Signal.Low, Signal.fromBooleanValue(false)); | ||
assertEquals(Signal.High, Signal.fromBooleanValue(true)); | ||
|
||
assertEquals(Signal.Low, Signal.fromNumericValue(0)); | ||
assertEquals(Signal.High, Signal.fromNumericValue(-1)); | ||
assertEquals(Signal.High, Signal.fromNumericValue(1)); | ||
|
||
assertEquals(Signal.Low, Signal.fromString("0")); | ||
assertEquals(Signal.High, Signal.fromString("1")); | ||
assertEquals(Signal.Low, Signal.fromString("-0")); | ||
|
||
assertEquals(Signal.Low, Signal.fromString("LOW")); | ||
assertEquals(Signal.High, Signal.fromString("HIGH")); | ||
assertEquals(Signal.Low, Signal.fromString("low")); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void testSignalFromNullStringThrowsException() { | ||
Signal.fromString(null); | ||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void testSignalFromNonsenseStringThrowsException() { | ||
Signal.fromString("highlow"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters