@@ -552,6 +552,38 @@ static esp_err_t cli_zdo_bind(esp_zb_cli_cmd_t *self, int argc, char **argv)
552552 return ret ;
553553}
554554
555+ static esp_err_t cli_power_desc (esp_zb_cli_cmd_t * self , int argc , char * * argv )
556+ {
557+ struct {
558+ arg_u16_t * power_desc ;
559+ arg_lit_t * help ;
560+ arg_end_t * end ;
561+ } argtable = {
562+ .power_desc = arg_u16n (NULL , NULL , "<u16:DESC>" , 0 , 1 , "Power descriptor of the device" ),
563+ .help = arg_lit0 (NULL , "help" , "Print this help message" ),
564+ .end = arg_end (2 ),
565+ };
566+
567+ esp_err_t ret = ESP_OK ;
568+
569+ /* Parse command line arguments */
570+ int nerrors = arg_parse (argc , argv , (void * * )& argtable );
571+ EXIT_ON_FALSE (argtable .help -> count == 0 , ESP_OK , arg_print_help ((void * * )& argtable , argv [0 ]));
572+ EXIT_ON_FALSE (nerrors == 0 , ESP_ERR_INVALID_ARG , arg_print_errors (stdout , argtable .end , argv [0 ]));
573+
574+
575+ if (argtable .power_desc -> count > 0 ) {
576+ esp_zb_af_node_power_desc_t power_desc ;
577+ memcpy (& power_desc , & argtable .power_desc -> val [0 ], sizeof (power_desc ));
578+ esp_zb_set_node_power_descriptor (power_desc );
579+ } else {
580+ EXIT_ON_ERROR (ESP_ERR_NOT_SUPPORTED , cli_output_line ("Get value is not supported." ));
581+ }
582+
583+ exit :
584+ return ret ;
585+ }
586+
555587DECLARE_ESP_ZB_CLI_CMD_WITH_SUB (zdo , "Zigbee Device Object management" ,
556588 ESP_ZB_CLI_SUBCMD (request , cli_zdo_request , "Request information from node" ),
557589 ESP_ZB_CLI_SUBCMD (annce , cli_zdo_annce , "Announce current node" ),
@@ -560,3 +592,7 @@ DECLARE_ESP_ZB_CLI_CMD_WITH_SUB(zdo, "Zigbee Device Object management",
560592 ESP_ZB_CLI_SUBCMD (nwk_open , cli_zdo_nwk_open , "Request the node to open the network" ),
561593 ESP_ZB_CLI_SUBCMD (nwk_leave , cli_zdo_nwk_leave , "Request the node to leave the network" ),
562594);
595+
596+ DECLARE_ESP_ZB_CLI_CMD_WITH_SUB (descriptors , "Configure Device descriptors" ,
597+ ESP_ZB_CLI_SUBCMD (power , cli_power_desc , "Get/Set node power descriptor" ),
598+ );
0 commit comments