Follow the steps for setting up your Raspberry PI 3 B. (Keep in mind, B+ is still not supported by Google) https://developer.android.com/things/hardware/raspberrypi
Open Android Studio and clone the SDK (File>New>Project from Version Control>Git) https://github.com/BankingofThings/BoT-Android-Things-SDK.git
After clonning make the project by clicking, Make Project (Green Hammer).
Open ExampleActivity class (app/src/main/java/io/bankingofthings/iot) and go to ExampleActivity.initFinn() method. Fill in your Maker ID and other device related data, in the Finn constructor. See Finn class (app/src/main/java/io/bankingofthings/iot) for more details.
The last parameter, newInstall, should only be set to 'true' when the Maker ID changes or a new device should be generated (for adding multiple devices on app level). Keep in mind to set it to false afterwards, otherwise every compilation will create a new device.
- Go to ExampleActivity.startFinnObservablePattern() (the same function is also available in callback pattern) and fill in the action ID you want to trigger, after the device is paired. Instead of trigger an action, you can also add your custom code here. (start reading sensors, manipulate actuators, etc).
If you have multi pair on, add (replace null) the alternative ID (the same ID entered in the app) as the second paramter for triggering the action.
A. Finn supports observable and callback patterns.
- For the callback pattern there are 3 callbacks:
- Finn.StartCallback: notifies when device is paired.
- Finn.GetActionsCallback: returns a list of ActionModels.
- Finn.TriggerActionCallback: notifies when an action is triggered.
B. Finn generates a QR bitmap after initialization.
- The QR code has a json text with the following data:
- multipair true/false
- aid (alternative identifier id))