RDK Documentation (Open Sourced RDK Components)
AampConfig Class Reference

AAMP Config Class defn. More...

#include <AampConfig.h>

Collaboration diagram for AampConfig:
Collaboration graph

Public Member Functions

 AampConfig ()
 AampConfig Constructor function . Default values defined. More...
 
 ~AampConfig ()
 AampConfig Distructor function. More...
 
 AampConfig (const AampConfig &)=delete
 Copy constructor disabled. More...
 
AampConfigoperator= (const AampConfig &)
 AampConfig Copy Constructor function.
 
void Initialize ()
 
void ReadDeviceCapability ()
 
void ShowOperatorSetConfiguration ()
 ShowOperatorSetConfiguration - List all operator configured settings. More...
 
void ShowAppSetConfiguration ()
 ShowAppSetConfiguration - List all Application configured settings. More...
 
void ShowStreamSetConfiguration ()
 ShowStreamSetConfiguration - List all stream configured settings. More...
 
void ShowDefaultAampConfiguration ()
 ShowDefaultAampConfiguration - List all AAMP Default settings. More...
 
void ShowDevCfgConfiguration ()
 ShowDevCfgConfiguration - List all developer configured settings. More...
 
void ShowAAMPConfiguration ()
 ShowAAMPConfiguration - Show all settings for every owner. More...
 
bool ReadAampCfgTxtFile ()
 ReadAampCfgTxtFile - Function to parse and process configuration file in text format. More...
 
bool ReadAampCfgJsonFile ()
 ReadAampCfgJsonFile - Function to parse and process configuration file in json format. More...
 
void ReadOperatorConfiguration ()
 ReadOperatorConfiguration - Reads Operator configuration from RFC and env variables. More...
 
void ReadBase64TR181Param ()
 
void ReadAllTR181Params ()
 
void ParseAampCfgTxtString (std::string &cfg)
 ParseAampCfgTxtString - It parses the aamp configuration. More...
 
void ParseAampCfgJsonString (std::string &cfg)
 ParseAampCfgJsonString - It parses the aamp configuration from json format. More...
 
void ToggleConfigValue (ConfigPriority owner, AAMPConfigSettings cfg)
 ToggleConfigValue - Toggle Boolean configuration. More...
 
template<typename T >
void SetConfigValue (ConfigPriority owner, AAMPConfigSettings cfg, const T &value)
 SetConfigValue - Set function to set bool/int/long data type configuration. More...
 
bool IsConfigSet (AAMPConfigSettings cfg)
 Gets the boolean configuration value. More...
 
bool GetConfigValue (AAMPConfigSettings cfg, std::string &value)
 GetConfigValue - Gets configuration for string data type. More...
 
bool GetConfigValue (AAMPConfigSettings cfg, long &value)
 GetConfigValue - Gets configuration for long data type. More...
 
bool GetConfigValue (AAMPConfigSettings cfg, double &value)
 GetConfigValue - Gets configuration for double data type. More...
 
bool GetConfigValue (AAMPConfigSettings cfg, int &value)
 GetConfigValue - Gets configuration for integer data type. More...
 
ConfigPriority GetConfigOwner (AAMPConfigSettings cfg)
 GetConfigOwner - Gets configuration Owner. More...
 
const char * GetChannelOverride (const std::string chName)
 GetChannelOverride - Gets channel override url for channel Name. More...
 
const char * GetChannelLicenseOverride (const std::string chName)
 GetChannelLicenseOverride - Gets channel License override url for channel Url. More...
 
bool ProcessConfigJson (const char *cfg, ConfigPriority owner)
 ProcessConfigJson - Function to parse and process json configuration string. More...
 
bool ProcessConfigJson (const cJSON *cfgdata, ConfigPriority owner)
 ProcessConfigJson - Function to parse and process json configuration string. More...
 
bool ProcessConfigText (std::string &cfg, ConfigPriority owner)
 ProcessConfigText - Function to parse and process configuration text. More...
 
void RestoreConfiguration (ConfigPriority owner, AampLogManager *mLogObj)
 RestoreConfiguration - Function is restore last configuration value from current ownership. More...
 
void ConfigureLogSettings ()
 ConfigureLogSettings - This function configures log settings for LogManager instance. More...
 
bool GetAampConfigJSONStr (std::string &str)
 GetAampConfigJSONStr - Function to Complete Config as JSON str. More...
 
bool GetDeveloperConfigData (std::string &key, std::string &value)
 GetDeveloperConfigData - Function to parse and process configuration text. More...
 
void DoCustomSetting (ConfigPriority owner)
 DoCustomSetting - Function to do override , to avoid complexity with multiple configs. More...
 
void CustomArrayRead (cJSON *customArray, ConfigPriority owner)
 CustomArrayRead - Function to Read Custom JSON Array. More...
 
bool CustomSearch (std::string url, int playerId, std::string appname)
 CustomSearch - Function to apply custom search. More...
 
AampLogManagerGetLoggerInstance ()
 
std::string GetUserAgentString ()
 
template<>
void SetConfigValue (ConfigPriority owner, AAMPConfigSettings cfg, const std::string &value)
 SetConfigValue - Set function to set string data type configuration. More...
 

Data Fields

AampLogManager logging
 
AampLogManagermLogObj
 

Private Types

typedef std::map< std::string, AampConfigLookupEntryLookUp
 
typedef std::map< std::string, AampConfigLookupEntry >::iterator LookUpIter
 
typedef std::map< std::string, std::string > DevCmds
 
typedef std::map< std::string, std::string >::iterator DevCmdsIter
 
typedef std::list< ConfigChannelInfoChannelMap
 
typedef std::list< ConfigChannelInfo >::iterator ChannelMapIter
 

Private Member Functions

template<class J , class K >
void SetValue (J &setting, ConfigPriority newowner, const K &value, std::string cfgName)
 SetValue - Function to store the configuration and ownership based on priority set. More...
 
void trim (std::string &src)
 
char * GetTR181AAMPConfig (const char *paramName, size_t &iConfigLen)
 
template<typename T >
bool ReadNumericHelper (std::string valStr, T &value)
 ReadNumericHelper - Parse helper function. More...
 
void ShowConfiguration (ConfigPriority owner)
 ShowConfiguration - Function to list configration values based on the owner. More...
 
std::string GetConfigName (AAMPConfigSettings cfg)
 GetConfigName - Function to get configuration name for enum from lookup table. More...
 
template<typename T >
bool ValidateRange (std::string key, T &value)
 

Private Attributes

LookUp mAampLookupTable
 
DevCmds mAampDevCmdTable
 
std::vector< struct customJsonvCustom
 
std::vector< struct customJson >::iterator vCustomIt
 
bool customFound
 
ConfigBool bAampCfgValue [eAAMPConfig_BoolMaxValue]
 
ConfigInt iAampCfgValue [eAAMPConfig_IntMaxValue-eAAMPConfig_IntStartValue]
 
ConfigLong lAampCfgValue [eAAMPConfig_LongMaxValue-eAAMPConfig_LongStartValue]
 
ConfigDouble dAampCfgValue [eAAMPConfig_DoubleMaxValue-eAAMPConfig_DoubleStartValue]
 
ConfigString sAampCfgValue [eAAMPConfig_StringMaxValue-eAAMPConfig_StringStartValue]
 
ChannelMap mChannelOverrideMap
 

yes

AAMP Config Class defn.

Definition at line 457 of file AampConfig.h.

Constructor & Destructor Documentation

◆ AampConfig() [1/2]

AampConfig::AampConfig ( )

AampConfig Constructor function . Default values defined.

Returns
None

Definition at line 305 of file AampConfig.cpp.

◆ ~AampConfig()

AampConfig::~AampConfig ( )
inline

AampConfig Distructor function.

Returns
None

Definition at line 476 of file AampConfig.h.

◆ AampConfig() [2/2]

AampConfig::AampConfig ( const AampConfig )
delete

Copy constructor disabled.

Member Function Documentation

◆ ReadDeviceCapability()

void AampConfig::ReadDeviceCapability ( )
Returns
Void

Definition at line 609 of file AampConfig.cpp.

◆ ShowOperatorSetConfiguration()

void AampConfig::ShowOperatorSetConfiguration ( )

ShowOperatorSetConfiguration - List all operator configured settings.

Returns
Void

Definition at line 1909 of file AampConfig.cpp.

◆ ShowAppSetConfiguration()

AampConfig::ShowAppSetConfiguration ( )

ShowAppSetConfiguration - List all Application configured settings.

Returns
void

Definition at line 1918 of file AampConfig.cpp.

◆ ShowStreamSetConfiguration()

AampConfig::ShowStreamSetConfiguration ( )

ShowStreamSetConfiguration - List all stream configured settings.

Returns
Void

Definition at line 1927 of file AampConfig.cpp.

◆ ShowDefaultAampConfiguration()

AampConfig::ShowDefaultAampConfiguration ( )

ShowDefaultAampConfiguration - List all AAMP Default settings.

Returns
Void

Definition at line 1938 of file AampConfig.cpp.

◆ ShowDevCfgConfiguration()

void AampConfig::ShowDevCfgConfiguration ( )

ShowDevCfgConfiguration - List all developer configured settings.

Returns
Void

Definition at line 1947 of file AampConfig.cpp.

◆ ShowAAMPConfiguration()

AampConfig::ShowAAMPConfiguration ( )

ShowAAMPConfiguration - Show all settings for every owner.

Returns
Void

Definition at line 1957 of file AampConfig.cpp.

◆ ReadAampCfgTxtFile()

bool AampConfig::ReadAampCfgTxtFile ( )

ReadAampCfgTxtFile - Function to parse and process configuration file in text format.

Returns
Void

Definition at line 1574 of file AampConfig.cpp.

◆ ReadAampCfgJsonFile()

bool AampConfig::ReadAampCfgJsonFile ( )

ReadAampCfgJsonFile - Function to parse and process configuration file in json format.

Returns
true if read successfully

Definition at line 1523 of file AampConfig.cpp.

◆ ReadOperatorConfiguration()

void AampConfig::ReadOperatorConfiguration ( )

ReadOperatorConfiguration - Reads Operator configuration from RFC and env variables.

Returns
void

Definition at line 1789 of file AampConfig.cpp.

◆ ParseAampCfgTxtString()

void AampConfig::ParseAampCfgTxtString ( std::string &  cfg)

ParseAampCfgTxtString - It parses the aamp configuration.

Returns
Void

◆ ParseAampCfgJsonString()

void AampConfig::ParseAampCfgJsonString ( std::string &  cfg)

ParseAampCfgJsonString - It parses the aamp configuration from json format.

Returns
Void

◆ ToggleConfigValue()

AampConfig::ToggleConfigValue ( ConfigPriority  owner,
AAMPConfigSettings  cfg 
)

ToggleConfigValue - Toggle Boolean configuration.

Returns
void
Parameters
[in]owner- ownership of new set call
[in]cfg- Configuration enum to set

Definition at line 809 of file AampConfig.cpp.

◆ SetConfigValue() [1/2]

template<typename T >
void AampConfig::SetConfigValue ( ConfigPriority  owner,
AAMPConfigSettings  cfg,
const T &  value 
)

SetConfigValue - Set function to set bool/int/long data type configuration.

CAUTION !!!! STOP !!! Read this before you proceed !!!!!!! /////////////

  1. This Class handles Configuration Parameters of AAMP Player , only Config related functionality to be added
  2. Simple Steps to add a new configuration a) Identify new configuration takes what value ( bool / int / long / string ) b) Add the new configuration string in README.txt with appropriate comment c) Add a enum value for new config in AAMPConfigSettings. It should be inserted at right place based on data type d) Add the config string added in README and its equivalent enum value at the end of ConfigLookUpTable e) Go to AampConfig constructor and assign default value . Again the array to store is based on the datatype of config f) Thats it !! You added a new configuration . Use Set and Get function to store and read value using enum config g) IF any conversion required only (from config to usage, ex: sec to millisec ), add specific Get function for each config Not recommened . Better to have the conversion ( enum to string , sec to millisec etc ) where its consumed .
Returns
void

Definition at line 830 of file AampConfig.cpp.

◆ IsConfigSet()

bool AampConfig::IsConfigSet ( AAMPConfigSettings  cfg)

Gets the boolean configuration value.

Parameters
[in]cfg- Configuration enum
Returns
true / false

Definition at line 649 of file AampConfig.cpp.

◆ GetConfigValue() [1/4]

bool AampConfig::GetConfigValue ( AAMPConfigSettings  cfg,
std::string &  value 
)

GetConfigValue - Gets configuration for string data type.

Returns
true - if valid return

Definition at line 748 of file AampConfig.cpp.

◆ GetConfigValue() [2/4]

bool AampConfig::GetConfigValue ( AAMPConfigSettings  cfg,
long &  value 
)

GetConfigValue - Gets configuration for long data type.

Returns
true - if valid return

Definition at line 716 of file AampConfig.cpp.

◆ GetConfigValue() [3/4]

bool AampConfig::GetConfigValue ( AAMPConfigSettings  cfg,
double &  value 
)

GetConfigValue - Gets configuration for double data type.

Returns
true - if valid return

Definition at line 732 of file AampConfig.cpp.

◆ GetConfigValue() [4/4]

bool AampConfig::GetConfigValue ( AAMPConfigSettings  cfg,
int &  value 
)

GetConfigValue - Gets configuration for integer data type.

Returns
true - if valid return

Definition at line 664 of file AampConfig.cpp.

◆ GetConfigOwner()

ConfigPriority AampConfig::GetConfigOwner ( AAMPConfigSettings  cfg)

GetConfigOwner - Gets configuration Owner.

Returns
ConfigPriority - owner of the config
Parameters
[in]cfg- configuration enum

Definition at line 680 of file AampConfig.cpp.

◆ GetChannelOverride()

const char * AampConfig::GetChannelOverride ( const std::string  manifestUrl)

GetChannelOverride - Gets channel override url for channel Name.

Returns
true - if valid return
Parameters
[in]chName- channel name to search

Definition at line 764 of file AampConfig.cpp.

◆ GetChannelLicenseOverride()

const char * AampConfig::GetChannelLicenseOverride ( const std::string  manifestUrl)

GetChannelLicenseOverride - Gets channel License override url for channel Url.

Returns
true - if valid return
Parameters
[in]chName- channel Name to override

Definition at line 785 of file AampConfig.cpp.

◆ ProcessConfigJson() [1/2]

bool AampConfig::ProcessConfigJson ( const char *  jsonbuffer,
ConfigPriority  owner 
)

ProcessConfigJson - Function to parse and process json configuration string.

Returns
bool - true on success

Definition at line 889 of file AampConfig.cpp.

◆ ProcessConfigJson() [2/2]

bool AampConfig::ProcessConfigJson ( const cJSON *  cfgdata,
ConfigPriority  owner 
)

ProcessConfigJson - Function to parse and process json configuration string.

Returns
bool - true on success

Definition at line 906 of file AampConfig.cpp.

◆ ProcessConfigText()

AampConfig::ProcessConfigText ( std::string &  cfg,
ConfigPriority  owner 
)

ProcessConfigText - Function to parse and process configuration text.

Returns
true if config process success
Parameters
[in]cfg- config text ( new line separated)
[in]owner- Owner who is setting the value

Definition at line 1347 of file AampConfig.cpp.

◆ RestoreConfiguration()

void AampConfig::RestoreConfiguration ( ConfigPriority  owner,
AampLogManager mLogObj 
)

RestoreConfiguration - Function is restore last configuration value from current ownership.

Parameters
[in]owner- Owner value for reverting
Returns
None

Definition at line 2147 of file AampConfig.cpp.

◆ ConfigureLogSettings()

AampConfig::ConfigureLogSettings ( )

ConfigureLogSettings - This function configures log settings for LogManager instance.

Returns
None

Definition at line 1859 of file AampConfig.cpp.

◆ GetAampConfigJSONStr()

bool AampConfig::GetAampConfigJSONStr ( std::string &  str)

GetAampConfigJSONStr - Function to Complete Config as JSON str.

Returns
true
Parameters
[in]str- input string where config json will be stored

Definition at line 1287 of file AampConfig.cpp.

◆ GetDeveloperConfigData()

AampConfig::GetDeveloperConfigData ( std::string &  key,
std::string &  value 
)

GetDeveloperConfigData - Function to parse and process configuration text.

Returns
true if parse successfully
Parameters
[in]key- key string to parse
[in]value- value read from input string

Definition at line 1330 of file AampConfig.cpp.

◆ DoCustomSetting()

void AampConfig::DoCustomSetting ( ConfigPriority  owner)

DoCustomSetting - Function to do override , to avoid complexity with multiple configs.

Parameters
[in]owner- ConfigPriority owner
Returns
None

Definition at line 1993 of file AampConfig.cpp.

◆ CustomArrayRead()

AampConfig::CustomArrayRead ( cJSON *  customArray,
ConfigPriority  owner 
)

CustomArrayRead - Function to Read Custom JSON Array.

Returns
void
Parameters
[in]customArray- input string where custom config json will be stored
[in]owner- ownership of configs will be stored

Definition at line 1070 of file AampConfig.cpp.

◆ CustomSearch()

bool AampConfig::CustomSearch ( std::string  url,
int  playerId,
std::string  appname 
)

CustomSearch - Function to apply custom search.

Parameters
[in]url- input string where url name will be stored
[in]playerId- input int variable where playerId will be stored
[in]appname- input string where appname will be stored

Definition at line 1142 of file AampConfig.cpp.

◆ SetValue()

template<class J , class K >
AampConfig::SetValue ( J &  setting,
ConfigPriority  newowner,
const K &  value,
std::string  cfgName 
)
private

SetValue - Function to store the configuration and ownership based on priority set.

Parameters
[in]setting- Config variable to set
[in]newowner- New owner value
[in]value- Value to set
Returns
void

Definition at line 2062 of file AampConfig.cpp.

◆ GetTR181AAMPConfig()

AampConfig::GetTR181AAMPConfig ( const char *  paramName,
size_t &  iConfigLen 
)
private
Parameters
[in]paramName- Parameter Name to parse
[in]iConfigLen- Length of the configuration

◆ ReadNumericHelper()

template<typename T >
AampConfig::ReadNumericHelper ( std::string  valStr,
T &  value 
)
private

ReadNumericHelper - Parse helper function.

Parameters
[in]valStr- string input to convert
[out]value- coverted output
Returns
true on success

Definition at line 2294 of file AampConfig.cpp.

◆ ShowConfiguration()

AampConfig::ShowConfiguration ( ConfigPriority  owner)
private

ShowConfiguration - Function to list configration values based on the owner.

Parameters
[in]owner- Owner value for listing
Returns
None

Definition at line 2225 of file AampConfig.cpp.

◆ GetConfigName()

AampConfig::GetConfigName ( AAMPConfigSettings  cfg)
private

GetConfigName - Function to get configuration name for enum from lookup table.

Parameters
[in]cfg- configuration enum
Returns
string - configuration name

Definition at line 2087 of file AampConfig.cpp.

◆ SetConfigValue() [2/2]

template<>
void AampConfig::SetConfigValue ( ConfigPriority  owner,
AAMPConfigSettings  cfg,
const std::string &  value 
)

SetConfigValue - Set function to set string data type configuration.

Returns
void

Definition at line 872 of file AampConfig.cpp.

Field Documentation

◆ logging

AampLogManager AampConfig::logging

Aamp log manager class

Definition at line 462 of file AampConfig.h.

◆ bAampCfgValue

ConfigBool AampConfig::bAampCfgValue[eAAMPConfig_BoolMaxValue]
private

Stores bool configuration

Definition at line 745 of file AampConfig.h.

◆ iAampCfgValue

ConfigInt AampConfig::iAampCfgValue[eAAMPConfig_IntMaxValue-eAAMPConfig_IntStartValue]
private

Stores int configuration

Definition at line 746 of file AampConfig.h.

◆ lAampCfgValue

ConfigLong AampConfig::lAampCfgValue[eAAMPConfig_LongMaxValue-eAAMPConfig_LongStartValue]
private

Stores long configuration

Definition at line 747 of file AampConfig.h.

◆ dAampCfgValue

ConfigDouble AampConfig::dAampCfgValue[eAAMPConfig_DoubleMaxValue-eAAMPConfig_DoubleStartValue]
private

Stores double configuration

Definition at line 748 of file AampConfig.h.

◆ sAampCfgValue

ConfigString AampConfig::sAampCfgValue[eAAMPConfig_StringMaxValue-eAAMPConfig_StringStartValue]
private

Stores string configuration

Definition at line 749 of file AampConfig.h.


The documentation for this class was generated from the following files: