Index: scripts/bluetooth_paired_clear.sh =================================================================== diff -u --- scripts/bluetooth_paired_clear.sh (revision 0) +++ scripts/bluetooth_paired_clear.sh (revision 15f9b824713355427ea8a1de5e0a7ecca5392c28) @@ -0,0 +1,39 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file bluetooth_paired_clear.sh +# +# @author (last) Behrouz NematiPour +# @date (last) 11-Nov-2021 +# @author (original) Behrouz NematiPour +# @date (original) 11-Nov-2021 +# +############################################################################ + +# @details +# This file is called by UI Software to removed all the currnelty paired or cached devices. +# This is done before each scan to clean up and start a fresh scan. + +DEVICES=$(echo "devices" | sudo bluetoothctl | grep ^Device | cut -b 8-25) +if [ ! -z "$DEVICES" ]; then + for device in $DEVICES; do + if [ ! -z "$device" ]; then + echo "remove $device" | sudo bluetoothctl + fi + done +fi + +PAIRED_DEVICES=$(echo "paired-devices" | sudo bluetoothctl | grep ^Device | cut -b 8-25) +if [ ! -z "$PAIRED_DEVICES" ]; then + for paired_device in $PAIRED_DEVICES; do + if [ ! -z "$paired_device" ]; then + echo "remove $paired_device" | sudo bluetoothctl + fi + done +fi + Index: scripts/factory_reset.sh =================================================================== diff -u -r7d194844bb325200b78da21ae7457bb7f7543ec7 -r15f9b824713355427ea8a1de5e0a7ecca5392c28 --- scripts/factory_reset.sh (.../factory_reset.sh) (revision 7d194844bb325200b78da21ae7457bb7f7543ec7) +++ scripts/factory_reset.sh (.../factory_reset.sh) (revision 15f9b824713355427ea8a1de5e0a7ecca5392c28) @@ -34,21 +34,17 @@ ERR_CLEAN_LOGS=162 -LOC_WIFI_CONFIGURATION="/etc/wpa_supplicant/wpa_supplicant-wlan0.conf" -LOC_BLUETOOTH_DEVCACHE="/var/lib/bluetooth/" -LOC_SETTINGS_CONF="/var/configurations/Settings/System.conf" -LOC_SETTINGS_DFLT="/var/configurations/Settings/System.dflt" +LOC_SETTINGS_CONF="/opt/leahi/configurations/Settings/System.conf" +LOC_SETTINGS_DFLT="/opt/leahi/configurations/Settings/System.dflt" LOC_LOG_BASE_FOLDER="/media/sd-card/" LOC_TX_LOG_BASE_FOLDER="/var/configurations/treatment/" -LOC_SCRIPTS=$HOME/scripts -LOC_SCRIPTS_BRIGHTNESS=$LOC_SCRIPTS/brightness_set.sh +LOC_SCRIPTS=/opt/leahi/scripts +LOC_SCRIPTS_BRIGHTNESS=$LOC_SCRIPTS/brightness.sh -DEFAULT_BRIGHTNESS_LEVEL=10 +DEFAULT_BRIGHTNESS_LEVEL=5 TRUE=1 FALSE=0 -function false() { echo $FALSE; } -function true () { echo $TRUE ; } # check if the passed argument is a non-zero number function isNonZero () @@ -79,14 +75,11 @@ } function deleteWiFi() { - SCRIPTS=/home/$(whoami)/ - # $SCRIPTS/wifi_disconnect.sh - $SCRIPTS/wifi_disconnect_network.sh wlan0 + $LOC_SCRIPTS/wifi_disconnect_network.sh wlan0 } function deleteBluetooth() { - SCRIPTS=/home/$(whoami) - $SCRIPTS/bluetooth_paired_clear.sh + $LOC_SCRIPTS/bluetooth_paired_clear.sh } function defaultSettings() { Index: scripts/wifi_disconnect_network.sh =================================================================== diff -u --- scripts/wifi_disconnect_network.sh (revision 0) +++ scripts/wifi_disconnect_network.sh (revision 15f9b824713355427ea8a1de5e0a7ecca5392c28) @@ -0,0 +1,35 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file wifi_disconnect_network.sh +# +# @author (last) Vy +# @date (last) 26-Jan-2023 +# @author (original) Behrouz NematiPour +# @date (original) 11-May-2021 +# +############################################################################ + +if [ $# -eq 0 ]; then + currentFile=$(basename "$0") + echo "Usage: ./$currentFile " + exit 0 +fi + +iface=$1 + +# stop the wpa service +sudo systemctl stop wpa_supplicant@"$iface".service + +#remove the wpa configuration file +sudo rm -f /etc/wpa_supplicant/wpa_supplicant-"$iface".conf + +#Shutoff wifi interface +sudo ip link set $iface down + +