Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.krishnact:cayenne-lpp:-SNAPSHOT'
}
dependencies {
implementation("com.github.krishnact:cayenne-lpp:-SNAPSHOT")
}
<dependency>
<groupId>com.github.krishnact</groupId>
<artifactId>cayenne-lpp</artifactId>
<version>-SNAPSHOT</version>
</dependency>
libraryDependencies += "com.github.krishnact" % "cayenne-lpp" % "-SNAPSHOT"
:dependencies [[com.github.krishnact/cayenne-lpp "-SNAPSHOT"]]
Java library for Cayenne Low Power Payload (https://mydevices.com/cayenne/docs/lora/#lora-how-lorawan-works)
Following Groovy code shows how to use the library:
@Grapes([
@GrabResolver(name='jitpack', root='https://jitpack.io'),
@Grab ('com.github.krishnact:cayenne-lpp:-SNAPSHOT'),
])
import org.himalay.msgs.runtime.Created;
import org.himalay.msgs.runtime.IntegerHolder;
import org.himalay.lpp.LPPDataFactory;
// Temperature
byte[] bytes = "03 67 01 10".replaceAll('\\s+',"").decodeHex()
DataInputStream dis = new DataInputStream(new ByteArrayInputStream(bytes));
org.himalay.lpp.LPPDataFactory.LPPData data = LPPDataFactory.createMsg(dis, new IntegerHolder());
data.dump();
println data.getValue()
// Acceleration
bytes = "06 71 04 D2 FB 2E 00 00".replaceAll('\\s+',"").decodeHex()
dis = new DataInputStream(new ByteArrayInputStream(bytes));
data = LPPDataFactory.createMsg(dis, new IntegerHolder());
data.dump();