btshell: Set connectable/scannable to 1 when legacy is used
For the case when legacy adv is used in most of cases connectable and
scannable shall be set, therefore make it default.
Those values can be overwritten
@@ -117,7 +117,7 @@ static bool adv_instances[BLE_ADV_INSTANCES];
static int
cmd_advertise_configure(int argc, char **argv)
{
- struct ble_gap_ext_adv_params params;
+ struct ble_gap_ext_adv_params params = {0};
int8_t selected_tx_power;
uint8_t instance;
int rc;
@@ -140,13 +140,24 @@ cmd_advertise_configure(int argc, char **argv)
memset(&params, 0, sizeof(params));
- params.connectable = parse_arg_bool_dflt("connectable", 0, &rc);
+ params.legacy_pdu = parse_arg_bool_dflt("legacy", 0, &rc);
+ if (rc != 0) {
+ console_printf("invalid 'legacy' parameter\n");
+ return rc;
+ }
+
+ if (params.legacy_pdu) {
+ params.connectable = 1;
+ params.scannable = 1;
+ }
+
+ params.connectable = parse_arg_bool_dflt("connectable", params.connectable, &rc);
if (rc != 0) {
console_printf("invalid 'connectable' parameter\n");
return rc;
}
- params.scannable = parse_arg_bool_dflt("scannable", 0, &rc);
+ params.scannable = parse_arg_bool_dflt("scannable", params.scannable, &rc);
if (rc != 0) {
console_printf("invalid 'scannable' parameter\n");
return rc;
@@ -164,12 +175,6 @@ cmd_advertise_configure(int argc, char **argv)
return rc;
}
- params.legacy_pdu = parse_arg_bool_dflt("legacy", 0, &rc);
- if (rc != 0) {
- console_printf("invalid 'legacy' parameter\n");
- return rc;
- }
-
params.include_tx_power = parse_arg_bool_dflt("include_tx_power", 0, &rc);
if (rc != 0) {
console_printf("invalid 'include_tx_power' parameter\n");
