The sources in this folder showcase OpenDDS P2P features using ICE/Stun and the RTPS Relay with a demo SmartLock application.
Currently there is an Android tablet app which communicates and controls two Raspberry Pis (mock smart-locks). The Raspberry Pis use a Pi Traffic Light to simulate the locked/unlocked states simply by lighting up red for unlocked and green for locked.
Some notes on the directory structure:
- android: Android Studio project files and Idl for SmartLock app.
- deploy: Deployment scripts for RTPS Relay on GCP.
- dockerfiles: Build environments for Android and Raspberry Pi.
- src: Source files for SmartLock application on Raspberry Pi and the core IDL files used by Android as well.
On the Raspberry Pi, the smart lock app uses the below (highlighted in yellow) traffic light pin assignments. Simply plug in the light so that the first pin is the 19th pin and the lights are facing outside of the case (away from the circuit board). The yellow box below shows which ones. Additionally, on the traffic light board it shows which lights are expected in GPIO pin 10, 9, 11, GND (actual pins 19, 21, 23, 25) in the order to match them up if needed.
The smart-lock
script contains a number of commands for building and deploying.
-
Create a
smart-lock-conf.sh
file.smart-lock-conf.sh.template
may be used as a template. This file defines the name, IP address, and lock id for the Raspberry Pis. If you want to work with the Android, you must download the Android SDK, accept the licenses (tools/bin/sdkmanager --licenses
), and setANDROID_HOME
variable. -
Enable tab completion.
source smart-lock.inc
-
./smart-lock [TAB][TAB]
to show the various commands../smart-lock help
to show the usage.
-
Build the cross-compiler and dependencies
smart-lock pi build-toolchain
Or use the existing image from GitHub
smart-lock pi get-github-image
-
Install the dependencies
smart-lock pi install-dependencies pi_1
-
Compile the SmartLock Demo application
smart-lock pi compile
-
Install the SmartLock Demo application
smart-lock pi install pi_1 <dpm_password>
-
Restart the SmartLock Demo application
smart-lock pi restart pi_1 (or on pi: sudo systemctl restart smartlock)
-
Check the status of the SmartLock Demo application
smart-lock pi status pi_1
-
Build the cross-compiler and dependencies for the target architecture. For example, for arm64:
smart-lock android build-toolchain-arm64 [git tag or branch] // optional parameter - defaults to master branch
Or use an existing image from GitHub
smart-lock android get-github-image-arm64
-
Compile the SmartLock Demo application
smart-lock android compile
-
Install the SmartLock Demo application
smart-lock android install
-
Start the SmartLock Demo application
smart-lock android start
-
Check the logs for the SmartLock Demo application
smart-lock android logs
-
Stop the SmartLock Demo application
smart-lock android stop