blob: d9f4bb0f097b4b407d3d14422971f148ff605d6f [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2019 Ericsson Telecom AB //
// //
// All rights reserved. This program and the accompanying materials //
// are made available under the terms of the Eclipse Public License v2.0 //
// which accompanies this distribution, and is available at //
// https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////
// Module: EPTF_CLL_UIHandler_DS_Functions
//
// Purpose:
// This module contains the implementation of EPTF_CLL_UIHandler_DS_Functions functions.
//
// Module depends on:
// <EPTF_CLL_DataSource_Definitions>
// <EPTF_CLL_DataSource_Functions>
// <EPTF_CLL_Variable_Definitions>
// <EPTF_CLL_Variable_Functions>
// <EPTF_CLL_Logging_Functions>
// <EPTF_CLL_UIHandler_Definitions>
// <EPTF_CLL_UIHandler_DS_Definitions>
//
// Module Parameters:
//
// Current Owner:
// Mihaly Miko (emihmik)
//
// Last Review Date:
// 2012-05-16
//
// Detailed Comments:
//
// Public functions:
// -
//
// All other functions in this module are private!
//
///////////////////////////////////////////////////////////////
module EPTF_CLL_UIHandler_DS_Functions {
//=========================================================================
// Import Part
//=========================================================================
import from EPTF_CLL_DataSource_Definitions all;
import from EPTF_CLL_DataSource_Functions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_Variable_Functions all;
import from EPTF_CLL_Logging_Functions all;
import from EPTF_CLL_UIHandler_Definitions all;
import from EPTF_CLL_UIHandler_DS_Definitions all;
//=========================================================================
// Functions
//========================================================================
friend module EPTF_CLL_UIHandler_WidgetFunctions;
group DataSourceClient {
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIhandler_DSProcessData
//
// Purpose:
// Processes the incoming Data requests - iterators and external data elements - and gives back a variable name.
// It should be registered in the UIHandler_init_CT. Type function fcb_EPTF_DataSourceClient_dataHandler
//
// Parameters:
// *out charstring pl_dataVarName* - this variable contains the value of the data or the iterator result
// *in charstring pl_source* - the name of the data source 'feature'
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC)
// *in charstring pl_element* - the name of the data element
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful: e.g. invalid parameters given in pl_params)
//
// Detailed Comments:
// When this function is called in the first time it creates the variable that contains the
// names of the variables that store the values of the elements of the data or the iterator. This variable name
// is returned in pl_dataVarName.
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIhandler_DSProcessData(out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params)
runs on EPTF_UIHandler_Private_CT return integer{
// DATAELEMENTS:
pl_dataVarName := "";
select(pl_element){
case (c_UIHandler_dataElement_simulation_saveDBToFile){
if(sizeof(pl_params) == 0){
pl_dataVarName := c_EPTF_UIHandler_simulation_saveDBToFile;
} else {
f_EPTF_Logging_warning(true, %definitionId& ": Datasource Parameter not needed." );
}
}
case (c_UIHandler_dataElement_progressBar){
if(sizeof(pl_params) == 0){
pl_dataVarName := c_UIHandler_DS_var_prefix&c_UIHandler_dataElement_progressBar;
} else {
f_EPTF_Logging_warning(true, %definitionId& ": Datasource Parameter not needed." );
}
}
case (c_UIHandler_dataElement_progressBarHistory){
if(sizeof(pl_params) == 0){
pl_dataVarName := c_UIHandler_DS_var_prefix&c_UIHandler_dataElement_progressBarHistory;
} else {
f_EPTF_Logging_warning(true, %definitionId& ": Datasource Parameter not needed." );
}
}
case else { //error, no rule for that
pl_dataVarName := "";
f_EPTF_Logging_warning(true, %definitionId& ": unhandled element: "& pl_element);
return -1;
}
}
var integer vl_iteratorVarIdx := f_EPTF_Var_getId(pl_dataVarName);
if(vl_iteratorVarIdx == -1){
f_EPTF_Logging_warning(true, %definitionId&": Invalid DataSource parameter: Invalid iterator or externalData or parameter: "&
"\nSource: "&pl_source&
"\nPTC : "&pl_ptcName &
"\nElement Name : " &pl_element&
"\nParams: " & log2str(pl_params));
return -2;
}
return 0;
}
}
///////////////////////////////////////////////////////////
// Function: f_EPTF_UIHandler_DSProcessDataValue
//
// Purpose:
// Processes the incoming DataValue requests - iterators and external data elements - and gives back the value.
// It should be registered in the UIHandler_init_CT. Type function fcb_EPTF_DataSourceClient_dataValueHandler
//
// Parameters:
// *out *<EPTF_Var_DirectContent>* pl_dataValue* - the value of the data or the iterator result
// *in charstring pl_source* - the name of the data source 'feature'
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC)
// *in charstring pl_element* - the name of the data element
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful: e.g. invalid parameters given in pl_params)
//
// Detailed Comments:
// -
//
///////////////////////////////////////////////////////////
friend function f_EPTF_UIHandler_DSProcessDataValue(out EPTF_Var_DirectContent pl_dataValue,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params)
runs on EPTF_UIHandler_Private_CT return integer{
var integer vl_errorCode := -1;
pl_dataValue := {unknownVal := {omit}}; // set it to invalid
select( pl_element )
{
case(c_EPTF_DataSource_dataElement_Help) {
vl_errorCode := f_EPTF_DataSource_handleHelp(pl_dataValue,pl_source,pl_params,c_EPTF_UIHandler_help);
}
case else
{
}
}
return vl_errorCode;
}
} // module