Bluetooth: samples: Update iso parameter check in iso_broadcast_benchmark
Update the iso parameter value checks from using literals to the defined #defines. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
This commit is contained in:
parent
90eb48b111
commit
ed46180ab8
1 changed files with 9 additions and 13 deletions
|
@ -114,8 +114,7 @@ static int parse_rtn_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
rtn = strtoul(buffer, NULL, 0);
|
rtn = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (rtn > BT_ISO_BROADCAST_RTN_MAX) {
|
||||||
if (rtn > 16) {
|
|
||||||
printk("Invalid RTN %llu", rtn);
|
printk("Invalid RTN %llu", rtn);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -138,8 +137,7 @@ static int parse_interval_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
interval = strtoul(buffer, NULL, 0);
|
interval = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (interval < BT_ISO_INTERVAL_MIN || interval > BT_ISO_INTERVAL_MAX) {
|
||||||
if (interval < 0x100 || interval > 0xFFFFF) {
|
|
||||||
printk("Invalid interval %llu", interval);
|
printk("Invalid interval %llu", interval);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -162,8 +160,7 @@ static int parse_latency_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
latency = strtoul(buffer, NULL, 0);
|
latency = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (latency < BT_ISO_LATENCY_MIN || latency > BT_ISO_LATENCY_MAX) {
|
||||||
if (latency > 0xFA0) {
|
|
||||||
printk("Invalid latency %llu", latency);
|
printk("Invalid latency %llu", latency);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -212,8 +209,7 @@ static int parse_sdu_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
sdu = strtoul(buffer, NULL, 0);
|
sdu = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (sdu > MIN(BT_ISO_MAX_SDU, sizeof(iso_data))) {
|
||||||
if (sdu > 0xFFF) {
|
|
||||||
printk("Invalid SDU %llu", sdu);
|
printk("Invalid SDU %llu", sdu);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -236,8 +232,8 @@ static int parse_packing_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
packing = strtoul(buffer, NULL, 0);
|
packing = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (packing != BT_ISO_PACKING_SEQUENTIAL &&
|
||||||
if (packing > 1) {
|
packing != BT_ISO_PACKING_INTERLEAVED) {
|
||||||
printk("Invalid packing %llu", packing);
|
printk("Invalid packing %llu", packing);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -260,8 +256,8 @@ static int parse_framing_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
framing = strtoul(buffer, NULL, 0);
|
framing = strtoul(buffer, NULL, 0);
|
||||||
/* TODO: Replace literal int with a #define once it has been created */
|
if (framing != BT_ISO_FRAMING_UNFRAMED &&
|
||||||
if (framing > 1) {
|
framing != BT_ISO_FRAMING_FRAMED) {
|
||||||
printk("Invalid framing %llu", framing);
|
printk("Invalid framing %llu", framing);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +280,7 @@ static int parse_bis_count_arg(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
bis_count = strtoul(buffer, NULL, 0);
|
bis_count = strtoul(buffer, NULL, 0);
|
||||||
if (bis_count > CONFIG_BT_ISO_MAX_CHAN) {
|
if (bis_count > MAX(BT_ISO_MAX_GROUP_ISO_COUNT, CONFIG_BT_ISO_MAX_CHAN)) {
|
||||||
printk("Invalid BIS count %llu", bis_count);
|
printk("Invalid BIS count %llu", bis_count);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue