mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Update Status parameter value
This commit is contained in:
parent
a9db18e315
commit
6df50f9956
4 changed files with 35 additions and 37 deletions
|
|
@ -1643,9 +1643,10 @@ static int set_BridgingBridge_Enable(char *refparam, struct dmctx *ctx, void *da
|
|||
/*#Device.Bridging.Bridge.{i}.Status!UCI:network/device,@i-1/enabled*/
|
||||
static int get_BridgingBridge_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
get_BridgingBridge_Enable(refparam, ctx, data, instance, value);
|
||||
*value = (DM_LSTRCMP(*value, "1") == 0) ? "Enabled" : "Disabled";
|
||||
return 0;
|
||||
char *name = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_args *)data)->bridge_sec, "name", &name);
|
||||
return get_net_device_status(name, value);
|
||||
}
|
||||
|
||||
/*#Device.Bridging.Bridge.{i}.Alias!UCI:dmmap_bridge/device,@i-1/bridge_alias*/
|
||||
|
|
@ -1737,9 +1738,10 @@ static int set_BridgingBridgeSTP_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
static int get_BridgingBridgeSTP_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
get_BridgingBridgeSTP_Enable(refparam, ctx, data, instance, value);
|
||||
*value = (DM_LSTRCMP(*value, "1") == 0) ? "Enabled" : "Disabled";
|
||||
return 0;
|
||||
char *name = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct bridge_args *)data)->bridge_sec, "name", &name);
|
||||
return get_net_device_status(name, value);
|
||||
}
|
||||
|
||||
static int get_BridgingBridgeSTP_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
|
|
@ -1916,9 +1918,11 @@ static int set_BridgingBridgePort_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
static int get_BridgingBridgePort_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
get_BridgingBridgePort_Enable(refparam, ctx, data, instance, value);
|
||||
*value = (DM_LSTRCMP(*value, "1") == 0) ? "Up" : "Down";
|
||||
return 0;
|
||||
struct bridge_port_args *args = (struct bridge_port_args *)data;
|
||||
char *port = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(args->bridge_port_dmmap_sec, "port", &port);
|
||||
return get_net_device_status(port, value);
|
||||
}
|
||||
|
||||
static int get_BridgingBridgePort_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
|
|
@ -2871,9 +2875,10 @@ static int set_BridgingBridgeProviderBridge_Enable(char *refparam, struct dmctx
|
|||
|
||||
static int get_BridgingBridgeProviderBridge_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_value_by_section_string(((struct provider_bridge_args *)data)->provider_bridge_sec, "enable", value);
|
||||
*value = (DM_LSTRCMP(*value, "1") == 0) ? "Enabled" : "Disabled";
|
||||
return 0;
|
||||
char *name = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string(((struct provider_bridge_args *)data)->provider_bridge_sec, "name", &name);
|
||||
return get_net_device_status(name, value);
|
||||
}
|
||||
|
||||
static int get_BridgingBridgeProviderBridge_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
|
|
|
|||
|
|
@ -1550,9 +1550,10 @@ static int set_EthernetRMONStats_Enable(char *refparam, struct dmctx *ctx, void
|
|||
|
||||
static int get_EthernetRMONStats_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
get_EthernetRMONStats_Enable(refparam, ctx, data, instance, value);
|
||||
*value = (DM_LSTRCMP(*value, "1") == 0) ? "Enabled" : "Disabled";
|
||||
return 0;
|
||||
char *ifname = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct eth_rmon_args *)data)->sections)->config_section, "ifname", &ifname);
|
||||
return get_net_device_status(ifname, value);
|
||||
}
|
||||
|
||||
/*#Device.Ethernet.RMONStats.{i}.Alias!UCI:dmmap_eth_rmon/ethport,@i-1/eth_rmon_alias*/
|
||||
|
|
|
|||
|
|
@ -1221,17 +1221,10 @@ static int set_IPInterface_ULAEnable(char *refparam, struct dmctx *ctx, void *da
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.IP.Interface.{i}.Status!UCI:network/interface,@i-1/disabled*/
|
||||
static int get_IPInterface_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
json_object *res = NULL;
|
||||
|
||||
char *if_name = section_name((struct uci_section *)data);
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", if_name, String}}, 1, &res);
|
||||
DM_ASSERT(res, *value = "Down");
|
||||
char *up = dmjson_get_value(res, 1, "up");
|
||||
*value = (DM_LSTRCMP(up, "true") == 0) ? "Up" : "Down";
|
||||
return 0;
|
||||
char *device = get_device(section_name((struct uci_section *)data));
|
||||
return get_net_device_status(device, value);
|
||||
}
|
||||
|
||||
/*#Device.IP.Interface.{i}.Alias!UCI:dmmap_network/interface,@i-1/ip_int_alias*/
|
||||
|
|
|
|||
|
|
@ -1203,12 +1203,12 @@ static int set_wifi_enable(char *refparam, struct dmctx *ctx, void *data, char *
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.WiFi.SSID.{i}.Status!UCI:wireless/wifi-iface,@i-1/disabled*/
|
||||
static int get_wifi_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
static int get_wifi_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_value_by_section_string((((struct wifi_ssid_args *)data)->sections)->config_section, "disabled", value);
|
||||
*value = ((*value)[0] == '1') ? "Down" : "Up";
|
||||
return 0;
|
||||
char *ifname = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_ssid_args *)data)->sections)->config_section, "ifname", &ifname);
|
||||
return get_net_device_status(ifname, value);
|
||||
}
|
||||
|
||||
/*#Device.WiFi.SSID.{i}.SSID!UCI:wireless/wifi-iface,@i-1/ssid*/
|
||||
|
|
@ -1285,11 +1285,10 @@ static int set_radio_enable(char *refparam, struct dmctx *ctx, void *data, char
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.WiFi.Radio.{i}.Status!UCI:wireless/wifi-device,@i-1/disabled*/
|
||||
static int get_radio_status (char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
static int get_radio_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_value_by_section_string((((struct wifi_radio_args *)data)->sections)->config_section, "disabled", value);
|
||||
*value = ((*value)[0] == '1') ? "Down" : "Up";
|
||||
char *isup = get_radio_option_nocache(section_name((((struct wifi_radio_args *)data)->sections)->config_section), "isup");
|
||||
*value = (DM_STRCMP(isup, "false") == 0) ? "Down" : "Up";
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -2595,12 +2594,12 @@ static int set_WiFiEndPoint_Enable(char *refparam, struct dmctx *ctx, void *data
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.WiFi.EndPoint.{i}.Status!UCI:wireless/wifi-iface,@i-1/disabled*/
|
||||
static int get_WiFiEndPoint_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
dmuci_get_value_by_section_string((((struct wifi_enp_args *)data)->sections)->config_section, "disabled", value);
|
||||
*value = ((*value)[0] == '1') ? "Disabled" : "Enabled";
|
||||
return 0;
|
||||
char *ifname = NULL;
|
||||
|
||||
dmuci_get_value_by_section_string((((struct wifi_enp_args *)data)->sections)->config_section, "ifname", &ifname);
|
||||
return get_net_device_status(ifname, value);
|
||||
}
|
||||
|
||||
/*#Device.WiFi.EndPoint.{i}.Alias!UCI:dmmap_wireless/wifi-iface,@i-1/endpointalias*/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue