Get the jar
from the Release page and include it in your project.
Several basic examples are found in the /src/examples
folder.
Counter.java
send data from your application to AllThingsTalk (sensing)Actuation.java
toggle a boolean from AllThingsTalk (actuation)BinaryPayload.java
send data of multiple assets together in one binary payload. The corresponding .json file for decoding the payload in AllThingsTalk can be found in the same folder.
You can either set them globally, using the same credentials for all applications using the sdk. Or you can set them locally in a specific sketch, overriding the global settings.
Depending on how you initialize the device object in your application, the global or local credentials will be used.
device = new Device(this, "your_device_id", "your_device_token");
will use the provided local credentialsdevice = new Device(this);
will use the global credentials from the keys.json file
Java 1.8 installed on your Raspberry Pi.
Raspian Jessie with Pixel has the latest Java version by default.
Raspian Jessie lite does not come with Java preinstalled.
Please check the pi4j documentation. Add the following jars to your project
pi4j-core.jar
pi4j-gpio-extension.jar
You can download the pi4j library here.
You can build the project locally using supplied gradlew
wrapper:
gradlew jar
This will produce .jar
in the build/libs
directory.