aboutsummaryrefslogtreecommitdiffstats
path: root/binding/radio_impl_null.c
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2020-10-05 17:03:30 -0400
committerScott Murray <scott.murray@konsulko.com>2020-10-07 14:26:18 +0000
commit082bd9694e23f891eddbb2516cee7e5fe0269400 (patch)
tree66616d46c8bfcccb9e60030275edca532f0a3b71 /binding/radio_impl_null.c
parentf5f03fa4508a680cf44da710744402f9cfe71c4f (diff)
Fix frequency verb invalid frequency behaviorjellyfish_10.0.1jellyfish/10.0.110.0.1
The frequency verb was not checking if a frequency corresponds to the frequency band step the binding provides to users, add logic to do so and return an error if the frequency is invalid. While this is a change in behavior, it is believe it should not impact users, as the binding is intended to reflect user facing radio application usage. Additional tweaks: - fix error invalid frequency error message in reply JSON. - add the same band limit checks to the null implementation's frequency setting function that the other implementations do. - fix a couple of issues in README.md; the "rds" verb was missing, and the value key name for the "frequency" event was incorrect. Bug-AGL: SPEC-3620 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I2adfc10448546264110f6d854f02d677087f1e47 (cherry picked from commit 8958a8a3e98085c60c9cd803395be157e78e3565)
Diffstat (limited to 'binding/radio_impl_null.c')
-rw-r--r--binding/radio_impl_null.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/binding/radio_impl_null.c b/binding/radio_impl_null.c
index 8c28bca..a90835b 100644
--- a/binding/radio_impl_null.c
+++ b/binding/radio_impl_null.c
@@ -120,6 +120,10 @@ static uint32_t null_get_frequency(void)
static void null_set_frequency(uint32_t frequency)
{
+ if(frequency < known_fm_band_plans[bandplan].min ||
+ frequency > known_fm_band_plans[bandplan].max)
+ return;
+
current_frequency = frequency;
if(freq_callback)