Added endpoint stats

This commit is contained in:
Vivek Kumar Dutta 2022-11-29 10:20:29 +00:00
parent e62604bfb8
commit 0ab15cf808
2 changed files with 61 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2020 iopsys Software Solutions AB
* Copyright (C) 2020-22 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
@ -2528,6 +2528,54 @@ static int get_WiFiEndPoint_SSIDReference(char *refparam, struct dmctx *ctx, voi
return 0;
}
static int get_WiFiEndPointStats_LastDataDownlinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL;
char object[32];
snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname);
dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res);
DM_ASSERT(res, *value = "0");
*value = dmjson_get_value(res, 3, "stats", "rx_rate_latest", "rate");
return 0;
}
static int get_WiFiEndPointStats_LastDataUplinkRate(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL;
char object[32];
snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname);
dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res);
DM_ASSERT(res, *value = "0");
*value = dmjson_get_value(res, 3, "stats", "tx_rate_latest", "rate");
return 0;
}
static int get_WiFiEndPointStats_SignalStrength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL;
char object[32];
snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname);
dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res);
DM_ASSERT(res, *value = "0");
*value = dmjson_get_value(res, 1, "rssi");
return 0;
}
static int get_WiFiEndPointStats_Retransmissions(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL;
char object[32];
snprintf(object, sizeof(object), "wifi.backhaul.%s", ((struct wifi_enp_args *)data)->ifname);
dmubus_call(object, "status", UBUS_ARGS{0}, 0, &res);
DM_ASSERT(res, *value = "0");
*value = dmjson_get_value(res, 2, "stats", "tx_pkts_retries");
return 0;
}
static int get_WiFiEndPointSecurity_ModesSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return get_supported_modes("wifi.backhaul", ((struct wifi_enp_args *)data)->ifname, value);
@ -6573,6 +6621,7 @@ DMLEAF tWiFiAccessPointAccountingParams[] = {
/* *** Device.WiFi.EndPoint.{i}. *** */
DMOBJ tWiFiEndPointObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
{"Stats", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointStatsParams, NULL, BBFDM_BOTH, NULL, "2.0"},
{"Security", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointSecurityParams, NULL, BBFDM_BOTH, NULL, "2.0"},
{"Profile", &DMREAD, NULL, NULL, NULL, browseWiFiEndPointProfileInst, NULL, NULL, tWiFiEndPointProfileObj, tWiFiEndPointProfileParams, NULL, BBFDM_BOTH, LIST_KEY{"Alias", "SSID", "Location", "Priority", NULL}, "2.0"},
{"WPS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiEndPointWPSParams, NULL, BBFDM_BOTH, NULL, "2.0"},
@ -6590,6 +6639,16 @@ DMLEAF tWiFiEndPointParams[] = {
{0}
};
/* *** Device.WiFi.EndPoint.{i}.Stats. *** */
DMLEAF tWiFiEndPointStatsParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
{"LastDataDownlinkRate", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_LastDataDownlinkRate, NULL, BBFDM_BOTH, "2.0"},
{"LastDataUplinkRate", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_LastDataUplinkRate, NULL, BBFDM_BOTH, "2.0"},
{"SignalStrength", &DMREAD, DMT_INT, get_WiFiEndPointStats_SignalStrength, NULL, BBFDM_BOTH, "2.0"},
{"Retransmissions", &DMREAD, DMT_UNINT, get_WiFiEndPointStats_Retransmissions, NULL, BBFDM_BOTH, "2.0"},
{0}
};
/* *** Device.WiFi.EndPoint.{i}.Security. *** */
DMLEAF tWiFiEndPointSecurityParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/

View file

@ -120,5 +120,6 @@ extern DMLEAF tWiFiDataElementsDisassociationEventDisassociationEventDataParams[
extern DMOBJ tWiFiDataElementsFailedConnectionEventObj[];
extern DMLEAF tWiFiDataElementsFailedConnectionEventParams[];
extern DMLEAF tWiFiDataElementsFailedConnectionEventFailedConnectionEventDataParams[];
extern DMLEAF tWiFiEndPointStatsParams[];
#endif