_DEVICE=/dev/ttyUSB2
_DEFAULT_LTE_BANDS="1 2 3 4 5 7 8 12 13 14 18 19 20 25 26 28 29 30 32 38 39 40 41 42 46 48 66"

getinfo() {
	echo "Quectel EM160R-GL"
}

getsupportedbands() {
	echo "$_DEFAULT_LTE_BANDS"
}

getbands() {
# +QNWPREFCFG: "lte_band",1:3:7:8:20:28:38

	O=$(sms_tool -d $_DEVICE at "at+qnwprefcfg=\"lte_band\"?")
	echo "$O" | awk -F, '/^\+QNWPREFCFG:/{gsub(":"," ");print $2}'
}

setbands() {
	BANDS="$1"
	[ "$BANDS" = "default" ] && BANDS="$_DEFAULT_LTE_BANDS"

	T=""
	for BAND in $BANDS; do
		case $BAND in
			''|*[!0-9]*) continue ;;
		esac
		[ -n "$T" ] && T="${T}:"
		T="${T}${BAND}"
	done

	[ -n "$T" ] && sms_tool -d $_DEVICE at "at+qnwprefcfg=\"lte_band\",$T"
}
