PROG=/usr/bin/rtl_ais
validate_rtl_ais_section() {
- uci_validate_section "rtl_ais" "rtl_ais" "$1" \
+ uci_load_validate "rtl_ais" "rtl_ais" "$1" "$2" \
'enabled:bool' \
'ppm:range(-100,100):0'
}
load_rtl_ais() {
local cfg="$1"
- local enabled ppm
- validate_rtl_ais_section "$cfg" || { echo "validation failed"; return 1; }
+ [ "$2" = 0 ] || { echo "validation failed"; return 1; }
[ "$enabled" = "1" ] || return 1
- procd_open_instance
- procd_set_param command "$PROG" -p "$ppm"
+ procd_open_instance
+ procd_set_param command "$PROG" -p "$ppm"
procd_set_param stdout 1
procd_set_param stderr 1
- procd_set_param respawn
- procd_close_instance
+ procd_set_param respawn
+ procd_close_instance
}
start_service() {
config_load "rtl_ais"
- config_foreach load_rtl_ais "rtl_ais"
+ config_foreach validate_rtl_ais_section "rtl_ais" load_rtl_ais
}
service_triggers() {