Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcarr823/pico-gpio-net-client
Kotlin library which provides a client for interacting with pico-gpio-net daemons
https://github.com/mcarr823/pico-gpio-net-client
kotlin-library ktor-client
Last synced: 13 days ago
JSON representation
Kotlin library which provides a client for interacting with pico-gpio-net daemons
- Host: GitHub
- URL: https://github.com/mcarr823/pico-gpio-net-client
- Owner: mcarr823
- License: gpl-3.0
- Created: 2024-12-20T07:03:51.000Z (21 days ago)
- Default Branch: main
- Last Pushed: 2024-12-20T07:10:26.000Z (21 days ago)
- Last Synced: 2024-12-20T08:20:47.982Z (21 days ago)
- Topics: kotlin-library, ktor-client
- Language: Kotlin
- Homepage:
- Size: 81.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pico-gpio-net-client
## What is it?
PGNC (pico-gpio-net-client) is a Kotlin library for interacting with a [pico-gpio-net (PGN) daemon](https://github.com/mcarr823/pico-gpio-net) running on a Raspberry Pi Pico.
It abstracts away the nitty-gritty of communicating with PGN, so you can utilize human-readable client commands instead of manipulating raw byte data.
## Example usage
```kotlin
val rpiPicoIpAddress = "192.168.1.150"
val client = PicoGpioNetClient(
ip = rpiPicoIpAddress,
port = 8080,
autoFlush = false
)
client.connect()
val deviceName = client.getName()
client.close()
```The above example connects to the PGN daemon running on a Raspberry Pi Pico device on IP address 192.168.1.150, port 8080.
It then asks the device to name itself, stores the value in the `deviceName` variable, then closes the socket connection.
Under-the-hood, the client library is doing the following:
- opens a socket connection
- sends a command (raw byte data) asking for the device's name
- waits to read the length header of the response from the socket
- waits to read that number of bytes from the socket
- converts the response into a String## How do I use it?
This library has not yet been published anywhere publicly-accessible.
As such, it currently requires you to open this project on your own PC and publish the library to your own maven server.
eg. To publish the repository onto your own PC, you would run:
`gradlew publishToMavenLocal`
After that, you can import the library into a different project by adding mavenLocal to your repositories list, and pgnc to your dependencies.
eg. In build.gradle.kts:
```Kotlin
repositories {
mavenLocal()
}
dependencies {
implementation("dev.mcarr:pgnc:0.0.1")
}
```