Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents


Scope

Objective is to add a Test Parameter in OneWiFi.

Steps to be followed:                                                                  

  • Identify the component and object to add new parameter.
  • In component XML file, add parameter with this set, get functions.
  • Define the set, get operations of parameters in OneWifi component.


Add a New Parameter

Code Snippet



Get Parameter API

The handle is taken from from TR181-WiFi-USGv2.XML file and Get Parameter API will fetch the respective parameter value from OneWiFi DB.

Example:

Code Block
File: cosa_wifi_dml.c
API: WiFi_GetParamBoolValue
if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_TestParameter", TRUE))
    {
        *pBool = pcfg->test_parameter;
        return TRUE;
    }

In the above example, the value for the test parameter is fetched from wifi_global_param_t structure that is to a WiFiDB. Get the respective parameters value from WiFiDB.


Code Snippet



Flow of Get Operation

Set Parameter API

The handle for setting a parameter value is taken from TR181-WiFi-USGv2.XML file and SetParameter API will push the changes. This API either pushes the changes to a queue () or will store values till HAL layer (on driver level)

Example:

Code Block
File: cosa_wifi_dml.c
API: WiFi_SetParamBoolValue

if (AnscEqualString(ParamName, "X_RDKCENTRAL-COM_TestParameter", TRUE))
{
if(global_wifi_config->global_parameters.test_parameter == bValue)
{
return TRUE;
}
wifi_util_dbg_print(WIFI_DMCLI,"%s:%d:test_parameter=%d Value = %d  \n",__func__, __LINE__,global_wifi_config->global_parameters.test_parameter,bValue);
global_wifi_config->global_parameters.test_parameter = bValue;
push_global_config_dml_cache_to_one_wifidb();
push_test_parameter_ctrl_queue(bValue);
return TRUE;
}

Code Snippet



Whenever an update is made to the Test Parameter, it must be pushed to the global config dml cache to one WiFiDB, along with its value. From cosa_wifi_dml.c file the control then goes to dml_onewifi_apis.c file.



push_global_config_dml_cache_to_one_wifidb API is the generic API for all parameters, which pushes the value to queue.



Here push_test_parameter_ctrl_queue API is defined specifically for Test Parameter and the value could directly pushed to queue with the above API.



Queue push is happening within push_event_to_ctrl_queue API. This API is invoked each time a queue push is required by respective parameters.

Flow of Set Operation


Various scenarios to reset the value

Factory Reset for SSID


Figure: Sequence diagram for factory reset of SSID


Example:


Code Block
root@RaspberryPi-Gateway:~#dmcli eRT getv Device.WiFi.SSID.1.SSID
Parameter    1 name: Device.WiFi.SSID.1.SSID
               type:     string,    value: RPI_RDKB-AP0
root@RaspberryPi-Gateway:~# dmcli eRT setv Device.WiFi.SSID.1.SSID string RPI_RDKB-AP0_NEW
setv from/to component(eRT.com.cisco.spvtg.ccsp.wifi): Device.WiFi.SSID.1.SSID
Execution succeed.
root@RaspberryPi-Gateway:~#  dmcli eRT setv Device.WiFi.ApplyAccessPointSettings bool true
setv from/to component(eRT.com.cisco.spvtg.ccsp.wifi): Device.WiFi.ApplyAccessPointSettings
Execution succeed.
root@RaspberryPi-Gateway:~#  dmcli eRT getv Device.WiFi.SSID.1.SSID
getv from/to component(eRT.com.cisco.spvtg.ccsp.wifi): Device.WiFi.SSID.1.SSID
Execution succeed.
Parameter    1 name: Device.WiFi.SSID.1.SSID
               type:     string,    value: RPI_RDKB-AP0_NEW

Factory reset command 

Code Block
dmcli eRT setv Device.X_CISCO_COM_DeviceControl.FactoryReset string Router,Wifi,Firewall

Factory Reset by default value

Factory Reset by default value can be achieved my hard coding the default value.

Figure: Sequence diagram for factory reset of default value


Example :

File: cosa_wifi_apis.c
API: wifi_factory_reset


Factory reset command

Code Block
dmcli eRT setv Device.X_CISCO_COM_DeviceControl.FactoryReset string Router,Wifi,Firewall

Factory Reset for all radios params to default

Figure: Sequence diagram for radios param factory reset


Example :

Command :

File: cosa_wifi_apis.c
API: wifi_factory_reset



Factory reset command

Code Block
dmcli eRT setv Device.X_CISCO_COM_DeviceControl.FactoryReset string Router,Wifi,Firewall

 

UNIT TEST RESULTS

Set operation for TestParameter:



Get operation for TestParameter:

 

Factory reset result for Test Parameter

Before Factory Reset:



After Factory Reset: