-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #372 from magnusja/develop
Release core v0.9.3 libusbcommunication v0.2.4
- Loading branch information
Showing
10 changed files
with
110 additions
and
38 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
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
12 changes: 12 additions & 0 deletions
12
libusbcommunication/src/main/java/me/jahnen/libaums/libusbcommunication/ErrNoIOException.kt
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package me.jahnen.libaums.libusbcommunication | ||
|
||
import me.jahnen.libaums.core.ErrNo | ||
import java.io.IOException | ||
|
||
/** | ||
* IOException that captures the errno and errstr of the current thread. | ||
*/ | ||
open class ErrNoIOException(message: String, cause: Throwable? = null) : IOException(message, cause) { | ||
val errno = ErrNo.errno | ||
val errstr = ErrNo.errstr | ||
} |
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
24 changes: 24 additions & 0 deletions
24
libusbcommunication/src/main/java/me/jahnen/libaums/libusbcommunication/LibusbError.kt
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package me.jahnen.libaums.libusbcommunication | ||
|
||
enum class LibusbError(val code: Int, val message: String) { | ||
SUCCESS(0, "Success (no error)"), | ||
IO(-1, "Input/output error"), | ||
INVALID_PARAM(-2, "Invalid parameter"), | ||
ACCESS(-3, "Access denied (insufficient permissions)"), | ||
NO_DEVICE(-4, "No such device (it may have been disconnected)"), | ||
NOT_FOUND(-5, "Entity not found"), | ||
BUSY(-6, "Resource busy"), | ||
TIMEOUT(-7, "Operation timed out"), | ||
OVERFLOW(-8, "Overflow"), | ||
PIPE(-9, "Pipe error"), | ||
INTERRUPTED(-10, "System call interrupted (perhaps due to signal)"), | ||
NO_MEM(-11, "Insufficient memory"), | ||
NOT_SUPPORTED(-12, "Operation not supported or unimplemented on this platform"), | ||
OTHER(-99, "Other error"); | ||
|
||
companion object { | ||
fun fromCode(code: Int): LibusbError { | ||
return values().firstOrNull { it.code == code } ?: OTHER | ||
} | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
libusbcommunication/src/main/java/me/jahnen/libaums/libusbcommunication/LibusbException.kt
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package me.jahnen.libaums.libusbcommunication | ||
|
||
open class LibusbException( | ||
message: String, | ||
val libusbError: LibusbError, | ||
cause: Throwable? = null | ||
) : | ||
ErrNoIOException("$message: ${libusbError.message} [${libusbError.code}]", cause) |