Skip to content

Latest commit

 

History

History
52 lines (40 loc) · 1.48 KB

README.md

File metadata and controls

52 lines (40 loc) · 1.48 KB

RuuviTag Common

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. :)

How to use

  1. 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

  1. Add the dependency to your project:
<dependency>
    <groupId>fi.tkgwf.ruuvi</groupId>
    <artifactId>ruuvitag-common</artifactId>
    <version>1.0.2</version>
</dependency>
  1. 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());
    }
}