ruuvitag-common is a library of utilities to work with RuuviTags, main purpose is providing parsers for parsing raw data from RuuviTags
Do note that this library is still being developed so comments, suggestions and other contributions are more than welcome. :)
- Add the repository to your pom:
<repositories>
<repository>
<id>ruuvitag-common-java-mvn-repo</id>
<url>https://raw.github.com/Scrin/ruuvitag-common-java/mvn-repo/</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</repository>
</repositories>
Alternative option: You can also clone this repository, then build and install the library locally with: mvn clean install
- Add the dependency to your project:
<dependency>
<groupId>fi.tkgwf.ruuvi</groupId>
<artifactId>ruuvitag-common</artifactId>
<version>1.0.2</version>
</dependency>
- Use the library in your code:
import fi.tkgwf.ruuvi.common.bean.RuuviMeasurement;
import fi.tkgwf.ruuvi.common.parser.DataFormatParser;
import fi.tkgwf.ruuvi.common.parser.impl.AnyDataFormatParser;
public class Example {
public void showTemperature() {
DataFormatParser parser = new AnyDataFormatParser();
byte[] rawData = getRawDataFromSomewhere();
RuuviMeasurement measurement = parser.parse(rawData);
System.out.println("Temperature is " + measurement.getTemperature());
}
}