I use the following function for saving the group id
Code: Select all
uint8_t dest_addr[6] = {0x0};
MDF_LOGI("the groupid have length of %d", groupid_args.groupid->count);
if (groupid_args.groupid->count) {
ret = mac_str2hex(groupid_args.groupid->sval[0], dest_addr);
MDF_ERROR_CHECK(ret == false, ESP_ERR_INVALID_ARG,
"The format of the address is incorrect. Please enter the format as xx:xx:xx:xx:xx:xx");
}
//groupid_cmd_handler(dest_addr);
ret = esp_mesh_set_group_id((mesh_addr_t *)dest_addr, 1);
ret = mdf_info_save("group_id", (mesh_addr_t *)dest_addr, sizeof(mesh_addr_t));
Code: Select all
groupid_args.groupid = arg_str0("s", "send", "<addr (xx:xx:xx:xx:xx:xx)>", "delete the group id of the node");
groupid_args.end = arg_end(1);
const esp_console_cmd_t cmd = {
.command = "groupid_del",
.help = "delete the node group id",
.hint = NULL,
.func = &delete_groupid_func,
.argtable = &groupid_args
};
ESP_ERROR_CHECK(esp_console_cmd_register(&cmd));