jwoglom/pumpX2
GitHub: jwoglom/pumpX2
Stars: 59 | Forks: 13





### Maven Packages
**For an Android project,** load the following Maven packages [from JitPack](https://jitpack.io):
* `com.github.jwoglom.pumpX2:pumpx2-android`
* `com.github.jwoglom.pumpX2:pumpx2-messages`
* `com.github.jwoglom.pumpX2:pumpx2-shared`
For example, using Gradle, first add the JitPack repositories to your root project `settings.gradle`:
pluginManagement {
repositories {
maven {
url 'https://jitpack.io'
}
}
}
Add a reference to the PumpX2 version in your root project `build.gradle`:
buildscript {
ext {
pumpx2_version = "x.x.x"
}
}
And then reference these dependencies in your module's `build.gradle`:
dependencies {
[...]
implementation "com.github.jwoglom.pumpX2:pumpx2-android:v${project.pumpx2_version}"
implementation "com.github.jwoglom.pumpX2:pumpx2-messages:v${project.pumpx2_version}"
implementation "com.github.jwoglom.pumpX2:pumpx2-shared:v${project.pumpx2_version}"
}
Then, to use PumpX2, subclass [the `com.jwoglom.pumpx2.pump.bluetooth.TandemPump` class](https://github.com/jwoglom/pumpX2/blob/main/androidLib/src/main/java/com/jwoglom/pumpx2/pump/bluetooth/TandemPump.java),
and initialize the library with:
TandemPump tandemPump = new SubclassedTandemPump(getApplicationContext());
TandemBluetoothHandler bluetoothHandler = TandemBluetoothHandler.getInstance(getApplicationContext(), tandemPump);
**For a Java (non-Android) project,** load the following Maven packages:
* `com.github.jwoglom.pumpX2:pumpx2-messages`
* `com.github.jwoglom.pumpX2:pumpx2-shared`
Look at [the `cliparser` Gradle module](https://github.com/jwoglom/pumpX2/blob/main/cliparser/src/main/java/com/jwoglom/pumpx2/cliparser/Main.java)
for an example of how to use the library.
### Build Instructions
To build the project, generating AAR (Android library) and JAR (Java library/executable) files:
./gradlew build
./gradlew publishToMavenLocal
The generated files will be created in `~/.m2/repository/com/jwoglom/pumpx2/`.
You can alternatively download from Github Packages, or use the most recent versions from the "Android CI" Github Action.
To integrate the PumpX2 Android library into your project, import the following dependencies into your project:
* `pumpx2-android.aar`, the Android Bluetooth library
* `pumpx2-messages.jar`, the common message-parsing code.
* `pumpx2-shared.jar`, a common shared module.
If Android-specific Bluetooth code is not needed, then `messages` and `shared` can be used in a standard, non-Android Java project.
Other Gradle dependencies are currently required by PumpX2 but not included in the JAR/AAR.
For an Android project:
dependencies {
implementation files('pumpx2-android-1.1.0.arr');
implementation files('pumpx2-messages-1.1.0.jar');
implementation files('pumpx2-shared-1.1.0.jar');
implementation "commons-codec:commons-codec:1.15"
implementation "org.apache.commons:commons-lang3:3.12.0"
implementation "com.google.guava:guava:31.0.1-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
}
For a non-Android Java project:
dependencies {
implementation files('pumpx2-messages-1.1.0.jar');
implementation files('pumpx2-shared-1.1.0.jar');
implementation "commons-codec:commons-codec:1.15"
implementation "org.apache.commons:commons-lang3:3.12.0"
implementation "com.google.guava:guava:31.0.1-android"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.10"
}
A `pumpx2-messages-all.jar` is also available on Github Actions as a fat JAR which contains all dependencies.
This may or may not work with your project depending on if there are any conflicting dependencies.
To utilize the command-line message-parsing tool, execute the `pumpx2-cliparser-all.jar` file using `java -jar`.
标签:域名枚举