#!/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. # main 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 # exit gracefully sleep 0.1 echo "" exit 0