@@ -1572,6 +1572,51 @@ static int cmd_wifi_twt_setup_quick(const struct shell *sh, size_t argc,
15721572 return 0 ;
15731573}
15741574
1575+ static int cmd_wifi_btwt_setup (const struct shell * sh , size_t argc , char * argv [])
1576+ {
1577+ struct net_if * iface = net_if_get_wifi_sap ();
1578+ struct wifi_twt_params params = {0 };
1579+ int idx = 1 ;
1580+ long value ;
1581+ int ret = 0 ;
1582+
1583+ context .sh = sh ;
1584+
1585+ params .btwt .sub_id = (uint16_t )shell_strtol (argv [idx ++ ], 10 , & ret );
1586+ params .btwt .nominal_wake = (uint8_t )shell_strtol (argv [idx ++ ], 10 , & ret );
1587+ params .btwt .max_sta_support = (uint8_t )shell_strtol (argv [idx ++ ], 10 , & ret );
1588+
1589+ if (!parse_number (sh , & value , argv [idx ++ ], NULL , 1 , 0xFFFF )) {
1590+ return - EINVAL ;
1591+ }
1592+ params .btwt .twt_mantissa = (uint16_t )value ;
1593+
1594+ params .btwt .twt_offset = (uint16_t )shell_strtol (argv [idx ++ ], 10 , & ret );
1595+
1596+ if (!parse_number (sh , & value , argv [idx ++ ], NULL , 0 , WIFI_MAX_TWT_EXPONENT )) {
1597+ return - EINVAL ;
1598+ }
1599+ params .btwt .twt_exponent = (uint8_t )value ;
1600+
1601+ params .btwt .sp_gap = (uint8_t )shell_strtol (argv [idx ++ ], 10 , & ret );
1602+
1603+ if (ret ) {
1604+ PR_ERROR ("Invalid argument (ret %d)\n" , ret );
1605+ return - EINVAL ;
1606+ }
1607+
1608+ if (net_mgmt (NET_REQUEST_WIFI_BTWT , iface , & params , sizeof (params ))) {
1609+ PR_WARNING ("Failed reason : %s\n" ,
1610+ wifi_twt_get_err_code_str (params .fail_reason ));
1611+
1612+ return - ENOEXEC ;
1613+ }
1614+
1615+ PR ("BTWT setup\n" );
1616+
1617+ return 0 ;
1618+ }
1619+
15751620static int twt_args_to_params (const struct shell * sh , size_t argc , char * argv [],
15761621 struct wifi_twt_params * params )
15771622{
@@ -3344,6 +3389,13 @@ SHELL_STATIC_SUBCMD_SET_CREATE(wifi_twt_ops,
33443389 "[-h, --help]: Print out command usage.\n" ,
33453390 cmd_wifi_twt_setup ,
33463391 23 , 1 ),
3392+ SHELL_CMD_ARG (
3393+ btwt_setup , NULL ,
3394+ " Start a BTWT flow:\n"
3395+ "<sub_id: Broadcast TWT AP config> <nominal_wake: 64-255> <max_sta_support>"
3396+ "<twt_mantissa:0-sizeof(UINT16)> <twt_offset> <twt_exponent: 0-31> <sp_gap>.\n" ,
3397+ cmd_wifi_btwt_setup ,
3398+ 8 , 0 ),
33473399 SHELL_CMD_ARG (teardown , NULL , " Teardown a TWT flow:\n"
33483400 "<negotiation_type, 0: Individual, 1: Broadcast, 2: Wake TBTT>\n"
33493401 "<setup_cmd: 0: Request, 1: Suggest, 2: Demand>\n"
0 commit comments