-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from nqminds/feat/integrate-on-off-boarding-sc…
…ripts Feat/integrate on off boarding scripts
- Loading branch information
Showing
10 changed files
with
178 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 8 additions & 3 deletions
11
debian-brski/brski-demo-app-deb/opt/demo-server/bash-scripts/offboard.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,10 @@ | ||
#!/bin/bash | ||
# offboard.sh | ||
echo "Offboarding IoT device..." | ||
|
||
# TODO: Add offboard logic | ||
echo "Starting offboarding process." | ||
|
||
# Disconnect from brski-open if connected | ||
echo "Disconnecting from brski-open (if connected)..." | ||
nmcli device disconnect wlan0 | ||
echo "Disconnected from brski-open." | ||
|
||
echo "Offboarding process completed." |
38 changes: 35 additions & 3 deletions
38
debian-brski/brski-demo-app-deb/opt/demo-server/bash-scripts/onboard.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
#!/bin/bash | ||
# onboard.sh | ||
echo "Onboarding IoT device..." | ||
|
||
# TODO: add onboarding logic | ||
echo "Starting onboarding process." | ||
|
||
# Disconnect from brski-secure if connected | ||
echo "Disconnecting from brski-secure (if connected)..." | ||
sudo nmcli device disconnect wlan0 | ||
echo "Disconnected from brski-secure." | ||
|
||
# Connect to brski-open | ||
echo "Connecting to brski-open..." | ||
sudo nmcli device wifi connect 'brski-open' ifname wlan0 | ||
echo "Connected to brski-open." | ||
|
||
sleep 2 | ||
|
||
echo "Running brski preq command..." | ||
sudo brski -c /etc/brski/config.ini -qqqq preq | ||
|
||
echo "Waiting for the pledge voucher" | ||
sleep 2 | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "brski preq command successful." | ||
sudo nmcli device disconnect wlan0 | ||
echo "Disconnected from brski-open." | ||
|
||
sleep 2 | ||
|
||
echo "Connecting to brski-secure..." | ||
sudo nmcli device wifi connect 'brski-secure' password '1234554321' ifname wlan0 | ||
echo "Connected to brski-secure." | ||
else | ||
echo "Error: brski preq command failed." | ||
fi | ||
|
||
echo "Onboarding process completed." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef CONFIG_H | ||
#define CONFIG_H | ||
|
||
|
||
#define CONFIG_FILE_PATH "/opt/demo-server/html/server.conf" | ||
#define HTML_BASE_PATH "/opt/demo-server/html" | ||
#define ONBOARDING_LOG_FILE_PATH "/opt/demo-server/html/onboarding_log_file.txt" | ||
#define OFFBOARDING_LOG_FILE_PATH "/opt/demo-server/html/offboarding_log_file.txt" | ||
#define ONBOARDING_SCRIPT_PATH "/opt/demo-server/bash-scripts/onboard.sh" | ||
#define OFFBOARDING_SCRIPT_PATH "/opt/demo-server/bash-scripts/offboard.sh" | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters