# #
###############################################################################
-function devicify() {
- local device=${1}
-
- assert isset device
-
- if device_exists ${device}; then
- echo "${device}"
- return ${EXIT_OK}
- fi
-
- local d
- for d in $(devices_get_all); do
- if [ "$(device_get_address ${d})" = "${device}" ]; then
- echo "${d}"
- return ${EXIT_OK}
- fi
- done
-
- return ${EXIT_ERROR}
-}
-
-function macify() {
- local device=${1}
-
- assert isset device
-
- if mac_is_valid ${device}; then
- echo "${device}"
- return ${EXIT_OK}
- fi
-
- if device_exists ${device}; then
- device_get_address ${device}
- return ${EXIT_OK}
- fi
-
- return ${EXIT_ERROR}
-}
-
function device_list() {
local devices
return ${EXIT_ERROR}
}
-function device_hash() {
- local device=${1}
-
- # Get mac address of device and remove all colons (:)
- # that will result in a hash.
- device=$(macify ${device})
-
- echo "${device//:/}"
-}
-
# Give the device a new name
function device_set_name() {
local source=$1