F#14341: Show only fronthaul ssid in WiFi

This commit is contained in:
Suvendhu Hansa 2024-05-14 15:15:15 +00:00 committed by Amin Ben Romdhane
parent 90f58787c5
commit 8c5337f1d3
4 changed files with 40 additions and 71 deletions

View file

@ -335,6 +335,24 @@ static struct uci_section *find_mapcontroller_section(struct uci_section *wirele
return NULL;
}
static bool multi_ap_type_backhaul(struct uci_section *config_section)
{
bool ret = false;
char *multi_ap = NULL;
/* multi_ap type
* 1 Backhaul
* 2 Fronthaul
* 3 Combined
* Others None
*/
dmuci_get_value_by_section_string(config_section, "multi_ap", &multi_ap);
if (DM_STRCMP(multi_ap, "1") == 0)
ret = true;
return ret;
}
/*************************************************************
* ADD DEL OBJ
**************************************************************/
@ -512,26 +530,35 @@ static void dmmap_synchronizeWiFiSSID(struct dmctx *dmctx, DMNODE *parent_node,
uci_path_foreach_sections_safe(bbfdm, "dmmap_wireless", "ssid", stmp, s) {
dmuci_get_value_by_section_string(s, "ap_section_name", &ap_sec_name);
if (DM_STRLEN(ap_sec_name)) {
ss = get_origin_section_from_config("wireless", "wifi-iface", ap_sec_name);
}
// Remove if backhaul
if (ss && multi_ap_type_backhaul(ss)) {
dmuci_delete_by_section(s, NULL, NULL);
continue;
}
// section added by user ==> skip it
dmuci_get_value_by_section_string(s, "added_by_user", &user_s);
if (DM_LSTRCMP(user_s, "1") == 0)
continue;
// check config section ==> if it exists then skip it
dmuci_get_value_by_section_string(s, "ap_section_name", &ap_sec_name);
if (DM_STRLEN(ap_sec_name)) {
ss = get_origin_section_from_config("wireless", "wifi-iface", ap_sec_name);
if (ss)
continue;
// if not exist in uci then delete from dmmap
if (!ss) {
dmuci_delete_by_section(s, NULL, NULL);
}
// else ==> delete section
dmuci_delete_by_section(s, NULL, NULL);
}
uci_foreach_sections("wireless", "wifi-iface", s) {
char *disabled = NULL, *ssid = NULL, *device = NULL;
/* filter out backhaul types. */
if (multi_ap_type_backhaul(s))
continue;
dmuci_get_value_by_section_string(s, "disabled", &disabled);
dmuci_get_value_by_section_string(s, "ssid", &ssid);
dmuci_get_value_by_section_string(s, "device", &device);
@ -611,6 +638,10 @@ static int browseWifiAccessPointInst(struct dmctx *dmctx, DMNODE *parent_node, v
if (DM_LSTRCMP(mode, "ap") != 0)
continue;
/* filter out backhaul types. */
if (multi_ap_type_backhaul(curr_data->config_section))
continue;
dmuci_get_value_by_section_string(curr_data->config_section, "ifname", &ifname);
curr_data->additional_data = (void *)ifname;

View file

@ -9,15 +9,11 @@
*
*/
#include "device.h"
#include "deviceinfo.h"
#include "ip.h"
#include "wifi.h"
#include "extension.h"
DM_MAP_OBJ tDynamicObj[] = {
/* parentobj, nextobject, parameter */
{"Device.DeviceInfo.", NULL, tIOPSYS_DeviceInfoParams},
{"Device.WiFi.AccessPoint.{i}.", NULL, tIOPSYS_WiFiAccessPointParams},
{0}
};

View file

@ -1,39 +0,0 @@
/*
* Copyright (C) 2023 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*
*/
#include "wifi.h"
static int get_multi_ap_mode(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *multi_ap = NULL;
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "multi_ap", &multi_ap);
if (DM_STRCMP(multi_ap, "1") == 0)
*value = "Backhaul";
else if (DM_STRCMP(multi_ap, "2") == 0)
*value = "Fronthaul";
else if (DM_STRCMP(multi_ap, "3") == 0)
*value = "Combined";
else
*value = "None";
return 0;
}
/**********************************************************************************************************************************
* OBJ & PARAM DEFINITION
***********************************************************************************************************************************/
DMLEAF tIOPSYS_WiFiAccessPointParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{BBF_VENDOR_PREFIX"MultiAPMode", &DMREAD, DMT_STRING, get_multi_ap_mode, NULL, BBFDM_BOTH},
{0}
};

View file

@ -1,19 +0,0 @@
/*
* Copyright (C) 2023 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*
*/
#ifndef __IOPSYS_WIFI_H
#define __IOPSYS_WIFI_H
#include "libbbfdm-api/dmcommon.h"
extern DMLEAF tIOPSYS_WiFiAccessPointParams[];
#endif //__IOPSYS_WIFI_H