blob: c06bcc362344fa84a4ad3a82d4bf4d1c727c2772 [file] [log] [blame]
///////////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2000-2018 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_DataSource_Definitions
//
// Purpose:
// This module contains type definitions for EPTF_DataSource implementation.
//
// Module depends on:
// <EPTF_CLL_Base_Definitions>
// <EPTF_CLL_Semaphore_Definitions>
// <EPTF_CLL_Variable_Definitions>
// <EPTF_CLL_HashMap_Definitions>
// <EPTF_CLL_CLI_Definitions>
//
// Module Parameters:
// tsp_EPTF_DataSource_subscriptionMode - <EPTF_Var_SubscriptionMode> - The default subscription mode
// in the <f_EPTF_DataSource_getData> function. Default value is sampled
// tsp_EPTF_DataSource_refreshRate - integer - the default value of the refresh rate in the function
// <f_EPTF_DataSource_getData>. The default value is -1
// tsp_EPTF_Config_Scenario2EntityGroupList - <EPTF_Config_ScenarioInstanceTypeList> - Scenario-EntityGroup assignment
//
// Public functions:
// <f_EPTF_DataSourceClient_downcast>
//
// Current Owner:
// Jozsef Gyurusi (ethjgi)
//
// Last Review Date:
// 2011-02-03
//
// Detailed Comments:
// This module contains type definitions for EPTF_CLL_DataSource implementation.
//
///////////////////////////////////////////////////////////////
module EPTF_CLL_DataSource_Definitions {
import from EPTF_CLL_Logging_Definitions all;
import from EPTF_CLL_Base_Definitions all;
import from EPTF_CLL_Common_Definitions all;
import from EPTF_CLL_Semaphore_Definitions all;
import from EPTF_CLL_Variable_Definitions all;
import from EPTF_CLL_HashMap_Definitions all;
import from EPTF_CLL_CLI_Definitions all;
modulepar EPTF_Var_SubscriptionMode tsp_EPTF_DataSource_subscriptionMode := sampled;
modulepar integer tsp_EPTF_DataSource_refreshRate := -1;
modulepar float tsp_EPTF_DataSource_maxWaitTime := 10.0;
modulepar float tsp_EPTF_DataSourceClient_maxWaitTime := 10.0;
modulepar integer tsp_EPTF_DataSource_Msg_GetData_maxBurstSize := 7; // increase this parameter to boost performance, decrease if you get "would block warnings"
modulepar integer tsp_EPTF_DataSource_maxNofPendingGetData := 7; // increase this parameter to boost performance, decrease if you get "would block warnings"
///////////////////////////////////////////////////////////////////////
// DataSource "server"
///////////////////////////////////////////////////////////////////////
// group EPTF_DataSource_CT
group EPTF_DataSource_CT {
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_sourceId
//
// Purpose:
// This is the source ID of the dataElements of the DataSource feature.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_sourceId := "DataSource";
///////////////////////////
// Conditions
///////////////////////////
group Conditions {
//these constants are the charstring versions of boolean values
const charstring c_EPTF_DataSource_condition_value_true := "true";
const charstring c_EPTF_DataSource_condition_value_false := "false";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_equal
//
// Purpose:
// This condition tests if the value of the first argument is the same
// as of the second
//
// Parameters:
// Two parameters (not sorted by their names!) with any type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_equal := "==";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_equal := {
name := c_EPTF_DataSource_condition_equal,
valueType := boolType,
description := "This condition tests if the value of the first argument is the same as of the second",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := charstringType
},
description := "the first param to compare",
exampleValue := "some string"
},
{
name := "Par2",
typeDescriptor := {
valueType := charstringType
},
description := "the second param to compare",
exampleValue := "some other string"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_notEqual
//
// Purpose:
// This condition tests if the value of the first argument is differs
// from the second
//
// Parameters:
// Two parameters (not sorted by their names!) with any type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_notEqual := "!=";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_notEqual := {
name := c_EPTF_DataSource_condition_notEqual,
valueType := boolType,
description := "This condition tests if the value of the first argument differs from the second",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := charstringType
},
description := "the first param to compare",
exampleValue := "some string"
},
{
name := "Par2",
typeDescriptor := {
valueType := charstringType
},
description := "the second param to compare",
exampleValue := "some other string"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_more
//
// Purpose:
// This condition tests if the value of the first argument is more than the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_more := ">";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_more := {
name := c_EPTF_DataSource_condition_more,
valueType := boolType,
description := "This condition tests if the value of the first argument is more than the second. The value of the parameters should be a float number.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := floatType
},
description := "the first param to compare",
exampleValue := "1.0"
},
{
name := "Par2",
typeDescriptor := {
valueType := floatType
},
description := "the second param to compare",
exampleValue := "2.0e-2"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_notLess
//
// Purpose:
// This condition tests if the value of the first argument is more or equal
// than the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_notLess := ">=";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_notLess := {
name := c_EPTF_DataSource_condition_notLess,
valueType := boolType,
description := "This condition tests if the value of the first argument is more or equal than the second. The value of the parameters should be a float number.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := floatType
},
description := "the first param to compare",
exampleValue := "1.0"
},
{
name := "Par2",
typeDescriptor := {
valueType := floatType
},
description := "the second param to compare",
exampleValue := "2.0e-2"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_less
//
// Purpose:
// This condition tests if the value of the first argument is less
// than the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_less := "<";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_less := {
name := c_EPTF_DataSource_condition_less,
valueType := boolType,
description := "This condition tests if the value of the first argument is less than the second. The value of the parameters should be a float number.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := floatType
},
description := "the first param to compare",
exampleValue := "1.0"
},
{
name := "Par2",
typeDescriptor := {
valueType := floatType
},
description := "the second param to compare",
exampleValue := "2.0e-2"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_notMore
//
// Purpose:
// This condition tests if the value of the first argument is less or equal
// than the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_notMore := "<=";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_notMore := {
name := c_EPTF_DataSource_condition_notMore,
valueType := boolType,
description := "This condition tests if the value of the first argument is less or equal than the second. The value of the parameters should be a float number.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := floatType
},
description := "the first param to compare",
exampleValue := "1.0"
},
{
name := "Par2",
typeDescriptor := {
valueType := floatType
},
description := "the second param to compare",
exampleValue := "2.0e-2"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_match
//
// Purpose:
// This condition tests if the value of the first argument matches
// the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
// The ttcn match function is called for the given arguments in order.
// The second parameter used as a pattern string for matching.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_match := "match";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_match := {
name := c_EPTF_DataSource_condition_match,
valueType := boolType,
description := "This condition tests if the value of the first argument matches the second."
&" The ttcn match function is called for the given arguments in order. The second parameter used as a pattern string for matching.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := charstringType
},
description := "the first param to compare",
exampleValue := "some string"
},
{
name := "Par2",
typeDescriptor := {
valueType := charstringType
},
description := "the second param to compare. This parameter is used as a pattern string for matching",
exampleValue := "*str*"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_notMatch
//
// Purpose:
// This condition tests if the value of the first argument does not match
// the second
//
// Parameters:
// Two parameters (not sorted by their names!) with float type
// The ttcn 'not match' function is called for the given arguments in order.
// The second parameter used as a pattern string for matching.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_notMatch := "not match";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_notMatch := {
name := c_EPTF_DataSource_condition_notMatch,
valueType := boolType,
description := "This condition tests if the value of the first argument does not match the second."
&" The ttcn match function is called for the given arguments in order. The second parameter used as a pattern string for matching.",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := charstringType
},
description := "the first param to compare",
exampleValue := "some string"
},
{
name := "Par2",
typeDescriptor := {
valueType := charstringType
},
description := "the second param to compare. This parameter is used as a pattern string for matching",
exampleValue := "*str*"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_and
//
// Purpose:
// This condition returns the logical 'and' of the arguments
//
// Parameters:
// Two parameters (not sorted by their names!) with boolean type
// The ttcn 'and' operator is called for the given arguments in order.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_and := "and";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_and := {
name := c_EPTF_DataSource_condition_and,
valueType := boolType,
description := "This condition returns the logical 'and' of the arguments",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := boolType
},
description := "the first param. Type: booltype",
exampleValue := "true"
},
{
name := "Par2",
typeDescriptor := {
valueType := boolType
},
description := "the second param. Type: booltype",
exampleValue := "false"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_or
//
// Purpose:
// This condition returns the logical 'or' of the arguments
//
// Parameters:
// Two parameters (not sorted by their names!) with boolean type
// The ttcn 'or' operator is called for the given arguments in order.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_or := "or";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_or := {
name := c_EPTF_DataSource_condition_or,
valueType := boolType,
description := "This condition returns the logical 'or' of the arguments",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := boolType
},
description := "the first param. Type: booltype",
exampleValue := "true"
},
{
name := "Par2",
typeDescriptor := {
valueType := boolType
},
description := "the second param. Type: booltype",
exampleValue := "false"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_not
//
// Purpose:
// This condition returns the logical 'not' of the argument
//
// Parameters:
// One parameter (not sorted by their names!) with boolean type
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_not := "not";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_not := {
name := c_EPTF_DataSource_condition_not,
valueType := boolType,
description := "This condition returns the logical 'not' of the argument",
parameters := {
{
name := "Par1",
typeDescriptor := {
valueType := boolType
},
description := "the first param. Type: booltype",
exampleValue := "false"
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_condition_dataElementPresent
//
// Purpose:
// This condition returns the true if the specified dataElement is present
//
// Parameters:
// - <c_EPTF_DataSource_paramNameSource> - the data source
// - <c_EPTF_DataSource_paramNamePTCName> - the PTC name (optional)
// - <c_EPTF_DataSource_paramNameElement> - the Element
// Followed by an optional list of the pairs:
// - <c_EPTF_DataSource_paramNameParamName> - the ParamName
// - <c_EPTF_DataSource_paramNameParamValue> - the ParamValue
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_condition_dataElementPresent := "dataElementPresent";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_condition_dataElementPresent := {
name := c_EPTF_DataSource_condition_dataElementPresent,
valueType := boolType,
description := "This condition returns true if the specified dataElement is present",
parameters := {
{
name := c_EPTF_DataSource_paramNameSource,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_Sources.typeDescriptor.typeName
}
},
description := "the data source",
exampleValue := c_EPTF_DataSource_sourceId
},
{
name := c_EPTF_DataSource_paramNamePTCName,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_PTCs.typeDescriptor.typeName
}
},
description := "the PTC name (optional)",
exampleValue := ""
},
{
name := c_EPTF_DataSource_paramNameElement,
typeDescriptor := {
valueType := charstringType
},
description := "the Element. This parameter is followed by an optional list of the parameterName-Value pairs",
exampleValue := c_EPTF_DataSource_dataElement_PTCs
},
{
name := c_EPTF_DataSource_paramNameParamName,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamName",
exampleValue := c_EPTF_DataSource_paramNameSource
},
{
name := c_EPTF_DataSource_paramNameParamValue,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamValue",
exampleValue := c_EPTF_DataSource_sourceId
}
}
}
} // group Conditions
///////////////////////////////////////////////////////////////////////////////
// Constants for Data Elements
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_externalDataVar_prefix
//
// Purpose:
// This is the prefix for DataSource externalData variables
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_externalDataVar_prefix := c_EPTF_DataSource_sourceId&"_var_";
///////////////////////////
// Iterators
// These are dataElements with value type: charstringlist
///////////////////////////
group Iterators {
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_Sources
//
// Purpose:
// This iterator enlists the data sources that have been registered into the DataSource
// ValueType: charstringlist
//
// Parameters:
// -
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_dataElement_Sources := "Sources"
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_Sources := {
name := c_EPTF_DataSource_dataElement_Sources,
valueType := charstringlistType,
typeDescriptor := {
isListOf := true,
typeName := "Source"
},
description := "This iterator enlists the data sources that have been registered into the DataSource"
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_PTCs
//
// Purpose:
// This data element returns the list of PTCs for a given data source
// ValueType: charstringlist
//
// Parameters:
// - <c_EPTF_DataSource_paramNameSource> - the data source
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_dataElement_PTCs := "PTCs";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_PTCs := {
name := c_EPTF_DataSource_dataElement_PTCs,
valueType := charstringlistType,
typeDescriptor := {
isListOf := true,
typeName := "PTC"
},
description := "This data element returns the list of PTCs for a given data source",
parameters := {
{
name := c_EPTF_DataSource_paramNameSource,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_Sources.typeDescriptor.typeName
}
},
description := "the data source. Should be one item in the list returned by '"&c_EPTF_DataSource_dataElement_Sources&"'",
exampleValue := c_EPTF_DataSource_sourceId
}
}
}
} // group Iterators
///////////////////////////
// DataElements
///////////////////////////
group DataElements {
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_Help
//
// Purpose:
// This data element returns the help information about
// all dataElements supported in DataSource.
// ValueType: charstring
//
// Parameters:
// - <c_EPTF_DataSource_paramNameHelpFormat> - the format of the output (Valid values: "TEXT" or "JSON"), default "JSON"
// - <c_EPTF_DataSource_paramNameSource> - the source to select the help for. If not specified (or empty string "" is given) it means 'all available sources'
// - <c_EPTF_DataSource_paramNameElement> - the element to select the help for. If not specified (or empty string "" is given) it means 'all available elements'
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_dataElement_Help := "help"
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_Help := {
name := c_EPTF_DataSource_dataElement_Help,
valueType := charstringType,
description := "This data element returns the help information about all dataElements supported",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
valueType := charstringType
},
description := "The format of the output. Valid values: \""
&c_EPTF_DataSource_helpFormatJSON&"\", \""&c_EPTF_DataSource_helpFormatTEXT
&"\". Default: \""&c_EPTF_DataSource_helpFormatJSON&"\"",
exampleValue := c_EPTF_DataSource_helpFormatTEXT
},
{
name := c_EPTF_DataSource_paramNameSource,
typeDescriptor := {
valueType := charstringType
},
description := "The source to select the help for. If not specified (or empty string \"\" is given) it means 'all available sources'",
exampleValue := c_EPTF_DataSource_sourceId
},
{
name := c_EPTF_DataSource_paramNameElement,
typeDescriptor := {
valueType := charstringType
},
description := "The element to select the help for. If not specified (or empty string \"\" is given) it means 'all available elements'",
exampleValue := ""
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_genericHelp
//
// Purpose:
// This data element returns the help information about
// all dataElements supported in DataSource.
// This constant can be used as a help information in all data sources
// that support the <c_EPTF_DataSource_dataElement_Help> help data element
// and uses the handler <f_EPTF_DataSource_handleHelp>.
// ValueType: charstring
//
// Parameters:
// - <c_EPTF_DataSource_paramNameHelpFormat> - the format of the output
//
///////////////////////////////////////////////////////////////////////////////
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_genericHelp := {
name := c_EPTF_DataSource_dataElement_Help,
valueType := charstringType,
description := "This data element returns the help information about all dataElements supported",
parameters := {
{
name := c_EPTF_DataSource_paramNameHelpFormat,
typeDescriptor := {
valueType := charstringType
},
description := "The format of the output. Valid values: "
&c_EPTF_DataSource_helpFormatJSON&", "&c_EPTF_DataSource_helpFormatTEXT
&". Default: "&c_EPTF_DataSource_helpFormatJSON,
exampleValue := c_EPTF_DataSource_helpFormatTEXT
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_sizeOf
//
// Purpose:
// This dataelement returns the size of the iterator list or 1 for single elements
// ValueType: integer
//
// Parameters:
// - <c_EPTF_DataSource_paramNameSource> - the data source
// - <c_EPTF_DataSource_paramNamePTCName> - the PTC name (optional)
// - <c_EPTF_DataSource_paramNameElement> - the Element
// Followed by an optional list of the pairs:
// - <c_EPTF_DataSource_paramNameParamName> - the ParamName
// - <c_EPTF_DataSource_paramNameParamValue> - the ParamValue
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_dataElement_sizeOf := "sizeOf";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_sizeOf := {
name := c_EPTF_DataSource_dataElement_sizeOf,
valueType := intType,
description := "This dataelement returns the size of the iterator list or 1 for single elements",
parameters := {
{
name := c_EPTF_DataSource_paramNameSource,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_Sources.typeDescriptor.typeName
}
},
description := "the data source",
exampleValue := c_EPTF_DataSource_sourceId
},
{
name := c_EPTF_DataSource_paramNamePTCName,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_PTCs.typeDescriptor.typeName
}
},
description := "the PTC name (optional)",
exampleValue := ""
},
{
name := c_EPTF_DataSource_paramNameElement,
typeDescriptor := {
valueType := charstringType
},
description := "the Element. This parameter is followed by an optional list of the parameterName-Value pairs",
exampleValue := c_EPTF_DataSource_dataElement_PTCs
},
{
name := c_EPTF_DataSource_paramNameParamName,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamName",
exampleValue := c_EPTF_DataSource_paramNameSource
},
{
name := c_EPTF_DataSource_paramNameParamValue,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamValue",
exampleValue := c_EPTF_DataSource_sourceId
}
}
}
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_dataElement_isWritable
//
// Purpose:
// This dataelement returns whether the given element is writable
// ValueType: integer
//
// Parameters:
// - <c_EPTF_DataSource_paramNameSource> - the data source
// - <c_EPTF_DataSource_paramNamePTCName> - the PTC name (optional)
// - <c_EPTF_DataSource_paramNameElement> - the Element
// Followed by an optional list of the pairs:
// - <c_EPTF_DataSource_paramNameParamName> - the ParamName
// - <c_EPTF_DataSource_paramNameParamValue> - the ParamValue
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_dataElement_isWritable := "isWritable";
const EPTF_DataSource_Help_DataElement c_EPTF_DataSource_Help_dataElement_isWritable := {
name := c_EPTF_DataSource_dataElement_isWritable,
valueType := boolType,
description := "This dataelement returns whether the given element is writable",
parameters := {
{
name := c_EPTF_DataSource_paramNameSource,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_Sources.typeDescriptor.typeName
}
},
description := "the data source",
exampleValue := c_EPTF_DataSource_sourceId
},
{
name := c_EPTF_DataSource_paramNamePTCName,
typeDescriptor := {
reference := {
typeName := c_EPTF_DataSource_Help_dataElement_PTCs.typeDescriptor.typeName
}
},
description := "the PTC name (optional)",
exampleValue := ""
},
{
name := c_EPTF_DataSource_paramNameElement,
typeDescriptor := {
valueType := charstringType
},
description := "the Element. This parameter is followed by an optional list of the parameterName-Value pairs",
exampleValue := c_EPTF_DataSource_dataElement_PTCs
},
{
name := c_EPTF_DataSource_paramNameParamName,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamName",
exampleValue := c_EPTF_DataSource_paramNameSource
},
{
name := c_EPTF_DataSource_paramNameParamValue,
typeDescriptor := {
valueType := charstringType
},
description := "the ParamValue",
exampleValue := c_EPTF_DataSource_sourceId
}
}
}
} // group DataElements
///////////////////////////
// ParamNames
///////////////////////////
group ParamNames {
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNameSource
//
// Purpose:
// Specifies a data source
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNameSource := "Source";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNamePTCName
//
// Purpose:
// Specifies a PTCName parameter name
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNamePTCName := "PTCName";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNameElement
//
// Purpose:
// Specifies an Element parameter
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNameElement := "Element";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNameParamName
//
// Purpose:
// Specifies a ParamName
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNameParamName := "ParamName";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNameParamValue
//
// Purpose:
// Specifies a ParamValue
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNameParamValue := "ParamValue";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_paramNameHelpFormat
//
// Purpose:
// Specifies a format of the help.
// Valid values: <c_EPTF_DataSource_helpFormatJSON>,
// <c_EPTF_DataSource_helpFormatTEXT>. Default: <c_EPTF_DataSource_helpFormatJSON>
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_paramNameHelpFormat := "Format";
} // group ParamNames
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_helpFormatJSON
//
// Purpose:
// Specifies the JSON format of the help.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_helpFormatJSON := "JSON";
///////////////////////////////////////////////////////////////////////////////
// Constant: c_EPTF_DataSource_helpFormatTEXT
//
// Purpose:
// Specifies the TEXT format of the help.
//
///////////////////////////////////////////////////////////////////////////////
const charstring c_EPTF_DataSource_helpFormatTEXT := "TEXT";
type record EPTF_DataSource_Msg_RegisterData {
charstring dataSource,
charstring ptcName
}
type record EPTF_DataSource_Param {
charstring paramName,
charstring paramValue
}
type record of EPTF_DataSource_Param EPTF_DataSource_Params;
type record EPTF_DataSource_Msg_GetData {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring dataElement,
EPTF_DataSource_Params params
}
type record EPTF_DataSource_Msg_GetDataValue {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring dataElement,
EPTF_DataSource_Params params,
EPTF_DataSource_Filter filter optional
}
type record EPTF_DataSource_Filter {
EPTF_DataSource_RangeFilter rangeFilter optional
}
const EPTF_DataSource_Filter c_EPTF_DataSource_Filter_empty := {
rangeFilter := omit
}
type record EPTF_DataSource_RangeFilter {
integer offset optional,
integer count optional
}
type record EPTF_DataSource_Msg_SetDataValue {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring dataElement,
EPTF_DataSource_Params params,
EPTF_Var_DirectContent dataValue,
EPTF_IntegerList indexList
}
type record EPTF_DataSource_Msg_DataValue {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring dataElement,
EPTF_DataSource_Params params,
charstring dataVarName optional, // the name of the EPTF_Var that stores the data on the data owner component (remote), in response to getDataValue this field is omit. If errorCode is non zero this field may contain the error message
EPTF_Var_DirectContent dataValue, // the current value of the requested data (=value of the remote variable)
integer errorCode,
EPTF_Var_CT/*EPTF_DataSourceClient_CT*/ ownerCompRef // used only between Server -> Client direction for forwarding subscription to the source component directly
}
type record EPTF_DataSource_Msg_DataValueResponse {
integer transactionId,
EPTF_Var_DirectContent dataValue, // the current value of the requested data (=value of the remote variable)
integer errorCode
}
type record EPTF_DataSource_Msg_ReadyEvent {
charstring dataSource,
charstring ptcName
}
type record EPTF_DataSource_Msg_GetCondition {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring method,
EPTF_DataSource_Params params
}
type record EPTF_DataSource_Msg_ConditionValue {
integer transactionId,
charstring dataSource,
charstring ptcName,
charstring method,
EPTF_DataSource_Params params,
boolean conditionValue,
integer errorCode
}
type record of EPTF_DataSource_Msg_GetData EPTF_DataSource_Msg_GetDataList;
type record of EPTF_DataSource_Msg_DataValue EPTF_DataSource_Msg_DataValueList;
type union EPTF_DataSource_Msg {
EPTF_DataSource_Msg_RegisterData registerData, // Client -> Server
EPTF_DataSource_Msg_GetData getData, // Client <- Server, Server <- Client
EPTF_DataSource_Msg_GetDataValue getDataValue, // Client <- Server, Server <- Client
EPTF_DataSource_Msg_SetDataValue setDataValue, // Client <- Server, Server <- Client
EPTF_DataSource_Msg_DataValue dataValue, // Client -> Server, Server -> Client
EPTF_DataSource_Msg_DataValueResponse dataValueResponse, // Client -> Server, Server -> Client
EPTF_DataSource_Msg_GetCondition getCondition, // Client <- Server, Server <- Client
EPTF_DataSource_Msg_ConditionValue conditionValue, // Client -> Server, Server -> Client
EPTF_DataSource_Msg_ReadyEvent clientReady, // Client -> Server
EPTF_DataSource_Msg_List getList, // Client <- Server, Server <- Client // list of getData or getCondition
EPTF_DataSource_Msg_List valueList // Client -> Server, Server -> Client // list of dataValue or conditionValue
}
type port EPTF_DataSource_PT message {
inout EPTF_DataSource_Msg;
} with {extension "internal"}
type record EPTF_DataSource_DataHandler {
charstring dataSource,
charstring ptcName,
EPTF_DataSourceClient_CT ownerCompRef
}
const EPTF_DataSource_DataHandler c_EPTF_DataSource_DataHandler_invalid := {"","",null};
type function EPTF_DataSource_Ready_FT(
in charstring pl_source,
in charstring pl_ptcName) runs on self;
type record of EPTF_DataSource_Ready_FT EPTF_DataSource_Ready_FT_List;
type record EPTF_DataSource_DataValue {
charstring remoteDataVarName,
EPTF_Var_CT ownerCompRef, // EPTF_Var_CT needed instead of EPTF_DataSourceClient_CT because EPTF_DataSource_CT can be a source as well
integer localDataVarId
}
type record of EPTF_DataSource_DataHandler EPTF_DataSource_DataHandler_List;
type record of EPTF_DataSource_Msg EPTF_DataSource_Msg_List;
type record of EPTF_DataSource_DataValue EPTF_DataSource_DataValue_List;
const charstring c_EPTF_DataSource_dataHandlerHashName_NoPTCName := "c_EPTF_DataSource_dataHandlerHashName_NoPTCName";
const charstring c_EPTF_DataSource_dataHandlerHashName := "c_EPTF_DataSource_dataHandlerHashName";
const charstring c_EPTF_DataSource_dataValueHashName := "c_EPTF_DataSource_dataValueHashName";
const charstring c_EPTF_DataSource_pendingGetDataHashName := "c_EPTF_DataSource_pendingGetDataHashName";
type function f_EPTF_DataSource_DScheckParams_FT(
in EPTF_DataSource_Params pl_params
) runs on self return integer;
// Commandline interface commands:
group CLI {
const charstring c_EPTF_DataSource_CLI_commandName := "ds";
const charstring c_EPTF_DataSource_CLI_commandHelp := "executes DataSource commands"
} //group CLI
group Help {
//type EPTF_Var_RefType EPTF_DataSource_ValueType
// with {
// variant(intType) "JSON: name as integer";
// variant(floatType) "JSON: name as float";
// variant(boolType) "JSON: name as boolean";
// variant(charstringType) "JSON: name as charstring";
// variant(octetstringType) "JSON: name as octetstring";
// variant(hexstringType) "JSON: name as hexstring";
// variant(bitstringType) "JSON: name as bitstring";
// variant(integerlistType) "JSON: name as integerlist";
// variant(floatlistType) "JSON: name as floatlist";
// variant(charstringlistType) "JSON: name as charstringlist";
// variant(statusLEDType) "JSON: name as statusLED";
// };
// we have to copy the EPTF_Var_RefType because the JSON encoder cannot encode the type in a different module (Var)
type enumerated EPTF_DataSource_ValueType {
intType,
floatType,
boolType,
charstringType,
octetstringType,
hexstringType,
bitstringType,
integerlistType,
floatlistType,
charstringlistType,
statusLEDType
}
type record EPTF_DataSource_Help_DataElementTypeDescriptor {
boolean isListOf optional, // omit == false
charstring typeName
}
type record EPTF_DataSource_Help_DataElementTypeDescriptorReference {
boolean isIndexInListOf optional, // omit == false
charstring typeName
}
type union EPTF_DataSource_Help_ParameterTypeDescriptor {
EPTF_DataSource_ValueType valueType,
EPTF_DataSource_Help_DataElementTypeDescriptorReference reference
} with {
variant(valueType) "JSON: name as valueType";
variant(reference) "JSON: name as reference";
}
type record EPTF_DataSource_Help_Parameter {
charstring name,
EPTF_DataSource_Help_ParameterTypeDescriptor typeDescriptor,
charstring description,
charstring exampleValue
}
type record of EPTF_DataSource_Help_Parameter EPTF_DataSource_Help_Parameters;
type record EPTF_DataSource_Help_DataElement {
charstring name,
EPTF_DataSource_ValueType valueType,
EPTF_DataSource_Help_DataElementTypeDescriptor typeDescriptor optional,
charstring description,
EPTF_DataSource_Help_Parameters parameters optional
}
type record EPTF_DataSource_Help_DataElementTree {
EPTF_DataSource_Help_DataElement dataElement,
EPTF_DataSource_Help_DataElementChildren children optional
} with {
variant(dataElement) "JSON: name as dataElement";
variant(children) "JSON: name as children";
}
type record of EPTF_DataSource_Help_DataElementTree EPTF_DataSource_Help_DataElementChildren;
type record EPTF_DataSource_Help_DataElements {
charstring source,
EPTF_DataSource_Help_DataElementChildren dataElements
}
type record of EPTF_DataSource_Help_DataElements EPTF_DataSource_Help_Sources;
type record EPTF_DataSource_Help {
EPTF_DataSource_Help_Sources sources
} with {
variant(sources) "JSON: name as sources";
}
// the datasource help database for DataSource
const EPTF_DataSource_Help_DataElementChildren c_EPTF_DataSource_help := {
{
dataElement := c_EPTF_DataSource_Help_dataElement_Sources
},
{
dataElement := c_EPTF_DataSource_Help_dataElement_PTCs
},
{
dataElement := c_EPTF_DataSource_Help_dataElement_sizeOf
},
{
dataElement := c_EPTF_DataSource_Help_dataElement_isWritable
},
{
dataElement := c_EPTF_DataSource_Help_dataElement_Help
},
// conditions:
{
dataElement := c_EPTF_DataSource_Help_condition_equal
},
{
dataElement := c_EPTF_DataSource_Help_condition_notEqual
},
{
dataElement := c_EPTF_DataSource_Help_condition_more
},
{
dataElement := c_EPTF_DataSource_Help_condition_notLess
},
{
dataElement := c_EPTF_DataSource_Help_condition_less
},
{
dataElement := c_EPTF_DataSource_Help_condition_notMore
},
{
dataElement := c_EPTF_DataSource_Help_condition_match
},
{
dataElement := c_EPTF_DataSource_Help_condition_notMatch
},
{
dataElement := c_EPTF_DataSource_Help_condition_and
},
{
dataElement := c_EPTF_DataSource_Help_condition_or
},
{
dataElement := c_EPTF_DataSource_Help_condition_not
},
{
dataElement := c_EPTF_DataSource_Help_condition_dataElementPresent
}
}
} //group Help
group NonBlockingGetData {
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSource_getDataHandler
//
// Purpose:
// This function is called when the response for the getData request is received
//
// Parameters:
// *in charstring pl_source* - the name of the dataSource 'feature'
// *in charstring pl_ptcName* - the name of the PTC
// (dataSource+ptcName should be a unigue id of the data). Default: "" (i.e. PTC name is ignored)
// *in charstring pl_element* - the type of data
// *in* <EPTF_DataSource_Params> *pl_params* - additional parameters (default: {})
// The parameters are sorted lexicographically according to the paramNames
// *in integer pl_errorCode* - error code in the response
// *in charstring pl_remoteDataVarName* - var name on the remote component. In case errorCode!=0: it contains the error message
// *in* <EPTF_Var_CT> *pl_ownerCompRef* - reference to the remote component
// *in integer pl_localDataVarId* - var Id on the local component (contains the current value, not subscribed to remote!)
// *in* <EPTF_Var_DirectContent> *pl_dataValue* - the value of the data
// *in* <EPTF_IntegerList> *pl_userData* - user specific data given at the request
//
// Return Value:
// -
//
// Detailed Comments:
// This function can be specified in pl_getDataHandler in the non-blocking getData and getCondition functions:
// <f_EPTF_DataSource_getData_nonBlocking>, <f_EPTF_DataSourceClient_getData_nonBlocking>,
// <f_EPTF_DataSource_getCondition_nonBlocking>. The function is called when the response is received.
// All information regarding the request and the respose is passed in the function,
// together with the user specific data in pl_userData.
// It is recommended that this function should not block execution.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSource_getDataHandler(
//request parameters:
in charstring pl_source,
in charstring pl_ptcName, // response may fill this if it was ""
in charstring pl_element,
in EPTF_DataSource_Params pl_params,
// reponse parameters:
in integer pl_errorCode, // error code in the response
in charstring pl_remoteDataVarName, // var name on the remote component. In case errorCode!=0: it contains the error message
in EPTF_Var_CT/*EPTF_DataSourceClient_CT*/ pl_ownerCompRef,// reference to the remote component
in integer pl_localDataVarId, // var Id on the local component (contains the current value, not subscribed to remote!)
in EPTF_Var_DirectContent pl_dataValue, // the value of the data
// user data
in EPTF_IntegerList pl_userData // user specific data given at the request
) runs on self;
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSource_getDataValueHandler
//
// Purpose:
// This function is called when the response for the getDataValue request is received
//
// Parameters:
// *in integer pl_errorCode* - error code in the response
// *in* <EPTF_Var_DirectContent> *pl_dataValue* - the value of the data
// *in* <EPTF_IntegerList> *pl_userData* - user specific data given at the request
//
// Return Value:
// -
//
// Detailed Comments:
// This function can be specified in pl_getDataValueHandler in the non-blocking getDataValue and setDataValue functions:
// <f_EPTF_DataSource_getDataValue_nonBlocking>, <f_EPTF_DataSourceClient_setDataValue_nonBlocking>.
// The function is called when the response is received.
// All information regarding the respose is passed in the function,
// together with the user specific data in pl_userData.
// It is recommended that this function should not block execution.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSource_getDataValueHandler(
// reponse parameters:
in integer pl_errorCode, // error code in the response
in EPTF_Var_DirectContent pl_dataValue, // the value of the data
// user data
in EPTF_IntegerList pl_userData // user specific data given at the request
) runs on self;
type record EPTF_DataSource_GetDataHandler {
fcb_EPTF_DataSource_getDataHandler getDataHandler,
EPTF_IntegerList userData
}
type record EPTF_DataSource_GetDataValueHandler {
fcb_EPTF_DataSource_getDataValueHandler getDataValueHandler,
EPTF_IntegerList userData
}
const EPTF_DataSource_GetDataHandler cg_EPTF_DataSource_GetDataHandler_null := {null,{}}
const EPTF_DataSource_GetDataValueHandler cg_EPTF_DataSource_GetDataValueHandler_null := {null,{}}
type record of EPTF_DataSource_GetDataHandler EPTF_DataSource_GetDataHandler_List;
type record of EPTF_DataSource_GetDataValueHandler EPTF_DataSource_GetDataValueHandler_DB;
type record of EPTF_DataSource_GetDataHandler_List EPTF_DataSource_GetDataHandler_DB;
type record EPTF_DataSource_Msg_GetData_BufferItem {
EPTF_DataSource_Msg_GetData getDataMsg,
EPTF_DataSourceClient_CT destinationCompRef
}
type record of EPTF_DataSource_Msg_GetData_BufferItem EPTF_DataSource_Msg_GetData_Buffer;
type record of EPTF_DataSource_Msg_List EPTF_DataSource_GetDataMsgClusters;
} //group NonBlockingGetData
group NonBlockingGetCondition {
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSource_getConditionHandler
//
// Purpose:
// This function is called when the response for the getCondition request is received
//
// Parameters:
// *in charstring pl_source* - the name of the dataSource 'feature'
// *in charstring pl_ptcName* - the name of the PTC
// (dataSource+ptcName should be a unigue id of the data). Default: "" (i.e. PTC name is ignored)
// *in charstring pl_element* - the type of method, corresponds to the pl_method (in getCondition)
// *in* <EPTF_DataSource_Params> *pl_params* - additional parameters (default: {})
// The parameters are sorted lexicographically according to the paramNames
// *in integer pl_errorCode* - error code in the response
// *in charstring pl_remoteDataVarName* - not used!
// *in* <EPTF_Var_CT> *pl_ownerCompRef* - not used!
// *in integer pl_localDataVarId* - not used!
// *in* <EPTF_Var_DirectContent> *pl_dataValue* - the value of the condition. (It is a boolVal)
// *in* <EPTF_IntegerList> *pl_userData* - user specific data given at the request
//
// Return Value:
// -
//
// Detailed Comments:
// It has the same type as the function type <fcb_EPTF_DataSource_getDataHandler>.
///////////////////////////////////////////////////////////
type fcb_EPTF_DataSource_getDataHandler fcb_EPTF_DataSource_getConditionHandler;
type EPTF_DataSource_GetDataHandler EPTF_DataSource_GetConditionHandler;
const EPTF_DataSource_GetConditionHandler cg_EPTF_DataSource_GetConditionHandler_null := cg_EPTF_DataSource_GetDataHandler_null;
// uses the same handler database as for getData
// type EPTF_DataSource_GetDataHandler_DB EPTF_DataSource_GetConditionHandler_DB;
// // This function is called when the response for the getCondition request is received
// // returns the error code
// type function fcb_EPTF_DataSource_getConditionHandler(
// //request parameters:
// in charstring pl_source,
// in charstring pl_ptcName, // response may fill this if it was ""
// in charstring pl_method,
// in EPTF_DataSource_Params pl_params,
// // reponse parameters:
// in integer pl_errorCode, // error code in the response
// in boolean pl_conditionValue, // the value of the condition
// // user data
// in EPTF_IntegerList pl_userData // user specific data given at the request
// ) runs on self;
//
// type record EPTF_DataSource_GetConditionHandler {
// fcb_EPTF_DataSource_getConditionHandler getConditionHandler,
// EPTF_IntegerList userData
// }
//
// const EPTF_DataSource_GetConditionHandler cg_EPTF_DataSource_GetConditionHandler_null := {null,{}}
//
// type record of EPTF_DataSource_GetConditionHandler EPTF_DataSource_GetConditionHandler_DB;
type record EPTF_DataSource_Msg_GetCondition_BufferItem {
EPTF_DataSource_Msg_GetCondition getConditionMsg,
EPTF_DataSourceClient_CT destinationCompRef
}
type record of EPTF_DataSource_Msg_GetCondition_BufferItem EPTF_DataSource_Msg_GetCondition_Buffer;
} //group NonBlockingGetCondition
///////////////////////////////////////////////////////////
// Type: EPTF_DataSource_CT
//
// Purpose:
// The component type of the DataSource
//
// Detailed Comments:
// Value for data sources and condition can be requested
// from this component
///////////////////////////////////////////////////////////
type component EPTF_DataSource_CT extends EPTF_Base_CT, EPTF_Semaphore_CT, EPTF_Var_CT, EPTF_HashMap_CT {
private var boolean v_EPTF_DataSource_initialized := false;
private port EPTF_DataSource_PT EPTF_DataSourceIf;
private var default v_DataSource_handler := null;
private var integer v_EPTF_DataSource_DataHandlerHash_NoPTCName := -1; // hashmap that belongs to v_EPTF_DataSource_DataHandler_List, PTCName is ignored
private var integer v_EPTF_DataSource_DataHandlerHash := -1; // hashmap that belongs to v_EPTF_DataSource_DataHandler_List
private var EPTF_DataSource_DataHandler_List v_EPTF_DataSource_DataHandler_List := {}; // database for the data handlers
private var integer v_EPTF_DataSource_dataValueHash := -1; // hashmap that belongs to v_EPTF_DataSource_dataValue_List
private var EPTF_DataSource_DataValue_List v_EPTF_DataSource_dataValue_List := {}; // stores the values of the data that was successfully requested before
private var EPTF_DataSource_Msg_List v_EPTF_DataSource_Msg_List := {}; // message buffer
private var EPTF_DataSource_Ready_FT_List v_EPTF_DataSource_ready_functions := {}; //list of registered functions that need to be notified
private var integer v_EPTF_DataSource_pendingGetDataHash := -1; // hashmap that stores the getDataId for pending getData requests, points into v_EPTF_DataSource_GetDataHandler_DB
private var EPTF_DataSource_GetDataHandler_DB v_EPTF_DataSource_GetDataHandler_DB := {}; // database for getDataHandlers
private var EPTF_DataSource_GetDataValueHandler_DB v_EPTF_DataSource_GetDataValueHandler_DB := {}; // database for getDataValueHandlers
private var EPTF_DataSource_Msg_GetData_Buffer v_EPTF_DataSource_Msg_GetData_Buffer := {}; // message buffer for getData messages
private timer t_EPTF_DataSource_Msg_GetData_Buffer_timer := 0.0; // timer for getData message buffer handling
private var integer v_EPTF_DataSource_Msg_GetData_BufferBurstSize := tsp_EPTF_DataSource_Msg_GetData_maxBurstSize;
private var integer v_EPTF_DataSource_nofPendingGetData := 0; // pending getData request sent to other components
private var integer v_EPTF_DataSource_maxNofPendingGetData := tsp_EPTF_DataSource_maxNofPendingGetData; // if nof pending getData reaches this threshold, no more getData sent
private var integer v_EPTF_DataSource_Msg_GetData_BufferStartIdx := 0; // pointer to the start of the buffer
private var EPTF_DataSource_GetDataMsgClusters v_EPTF_DataSource_getDataMsgClusters := {} // stores the list of pointers to v_EPTF_DataSource_Msg_GetData_Buffer that have the same destinationCompRef
private var EPTF_IntegerList v_EPTF_DataSource_getDataMsgClusters_BufferStartIdx := {} // stores the list of pointers to v_EPTF_DataSource_Msg_GetData_Buffer that have the same destinationCompRef
private var boolean v_EPTF_DataSource_getDataMsgClusters_BufferEmpty := true;
}
} // group EPTF_DataSource_CT
///////////////////////////////////////////////////////////////////////
// DataSource CLI
///////////////////////////////////////////////////////////////////////
group EPTF_DataSource_CLI_CT {
///////////////////////////////////////////////////////////
// Type: EPTF_DataSource_CLI_CT
//
// Purpose:
// The component type of the DataSource extended with Command Line Interface support
//
// Detailed Comments:
// Value for data sources and condition can be requested
// from this component also from the command line interface
///////////////////////////////////////////////////////////
type component EPTF_DataSource_CLI_CT extends EPTF_DataSource_CT, EPTF_CLI_Client_CT {
}
} //group EPTF_DataSource_CLI_CT
///////////////////////////////////////////////////////////////////////
// DataSource CLIENT
///////////////////////////////////////////////////////////////////////
group EPTF_DataSourceClient_CT {
type record of fcb_EPTF_DataSourceClient_dataHandler fcb_EPTF_DataSourceClient_dataHandler_List;
type record of fcb_EPTF_DataSourceClient_dataValueHandler fcb_EPTF_DataSourceClient_dataValueHandler_List
type record of fcb_EPTF_DataSourceClient_setDataValueHandler fcb_EPTF_DataSourceClient_setDataValueHandler_List
type record of fcb_EPTF_DataSourceClient_conditionHandler fcb_EPTF_DataSourceClient_conditionHandler_List;
const charstring c_EPTF_DataSourceClient_dataHandlerHashName := "c_EPTF_DataSourceClient_dataHandlerHashName";
const charstring c_EPTF_DataSourceClient_dataValueHashName := "c_EPTF_DataSourceClient_dataValueHashName";
const charstring c_EPTF_DataSourceClient_pendingGetDataHashName := "c_EPTF_DataSourceClient_pendingGetDataHashName";
///////////////////////////////////////////////////////////
// Type: EPTF_DataSourceClient_CT
//
// Purpose:
// The component type of the DataSource Client
//
// Detailed Comments:
// The DataSource Client component can register data sources
// and conditions.
///////////////////////////////////////////////////////////
type component EPTF_DataSourceClient_CT extends EPTF_Base_CT, EPTF_Var_CT, EPTF_Logging_CT, EPTF_HashMap_CT, EPTF_Semaphore_CT {
private var boolean v_EPTF_DataSourceClient_initialized := false;
private port EPTF_DataSource_PT EPTF_DataSourceClientIf;
private var default v_DataSourceClient_handler := null;
private var integer v_EPTF_DataSourceClient_dataHandlerHash := -1; // hashmap that belongs to v_fcb_EPTF_DataSourceClient_dataHandler_List
private var fcb_EPTF_DataSourceClient_dataHandler_List v_fcb_EPTF_DataSourceClient_dataHandler_List := {}; // database for the data handlers
private var fcb_EPTF_DataSourceClient_dataValueHandler_List v_fcb_EPTF_DataSourceClient_dataValueHandler_List := {}; // database for the data value handlers
private var fcb_EPTF_DataSourceClient_setDataValueHandler_List v_fcb_EPTF_DataSourceClient_setDataValueHandler_List := {}; // database for the set data value handlers
private var fcb_EPTF_DataSourceClient_conditionHandler_List v_fcb_EPTF_DataSourceClient_conditionHandler_List := {}; // database for the condition handlers
private var integer v_EPTF_DataSourceClient_dataValueHash := -1; // hashmap that belongs to v_EPTF_DataSourceClient_dataValue_List
private var EPTF_DataSource_DataValue_List v_EPTF_DataSourceClient_dataValue_List := {}; // stores the values of the data that was successfully requested before
private var EPTF_DataSource_Msg_List v_EPTF_DataSourceClient_Msg_List := {}; // message buffer
private var boolean v_EPTF_DataSourceClient_connected := false; // true if connection to dataSource exists
private var integer v_EPTF_DataSourceClient_pendingGetDataHash := -1; // hashmap that stores the getDataId for pending getData requests, points into v_EPTF_DataSourceClient_GetDataHandler_DB
private var EPTF_DataSource_GetDataHandler_DB v_EPTF_DataSourceClient_GetDataHandler_DB := {}; // database for getDataHandlers
private var EPTF_DataSource_GetDataValueHandler_DB v_EPTF_DataSourceClient_GetDataValueHandler_DB := {}; // database for getDataHandlers
}
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSourceClient_dataHandler
//
// Purpose:
// Callback function type to handle registered data
//
// Parameters:
// *out charstring pl_dataVarName* - this variable
// contains the value of the data (e.g 2.5)
// *in charstring pl_source* - the name of the data source 'feature' (e.g. "LGenBase")
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC) (e.g. "LGen1")
// *in charstring pl_element* - the name of the data element (e.g. "TC_CPS")
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement (e.g. "EG1.SC2.TC3" <= TC ID)
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful:
// e.g. invalid parameters given in pl_params
// If error code is not zero pl_dataVarName can be used to provide textual error message)
//
// Detailed Comments:
// This function is called when <f_EPTF_DataSource_getData> is requested
// for the specified pl_source and pl_ptcName.
// Its return value (error code) and pl_dataVarName is forwarded
// to <f_EPTF_DataSource_getData>.
// When this function is called for the first time
// it may create the variable that contains the
// names of the variables that store the values
// of the elements of the data. This variable name
// is returned in pl_dataVarName.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSourceClient_dataHandler(
out charstring pl_dataVarName,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_element,
in EPTF_DataSource_Params pl_params
) runs on self return integer;
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSourceClient_dataValueHandler
//
// Purpose:
// Callback function type to handle registered data value requests
//
// Parameters:
// *out* <EPTF_Var_DirectContent> *pl_dataValue* - the value of the data (e.g floatVal := 2.5)
// *in charstring pl_source* - the name of the data source 'feature' (e.g. "LGenBase")
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC) (e.g. "LGen1")
// *in charstring pl_element* - the name of the data element (e.g. "TC_CPS")
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement (e.g. "EG1.SC2.TC3" <= TC ID)
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful:
// e.g. invalid parameters given in pl_params.
// If error code is not zero pl_dataValue can be used to provide textual error message)
//
// Detailed Comments:
// This function is called when <f_EPTF_DataSource_getDataValue> is requested
// for the specified pl_source and pl_ptcName.
// Its return value (error code) and pl_dataValue is forwarded
// to <f_EPTF_DataSource_getDataValue>.
// DataValue is useful when only the value of data is important
// or data is not stored in EPTF Variable.
// This functionality provides support for 'pull model' type data access.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSourceClient_dataValueHandler(
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 self return integer;
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSourceClient_setDataValueHandler
//
// Purpose:
// Callback function type to handle set data value requests
//
// Parameters:
// *inout* <EPTF_Var_DirectContent> *pl_dataValue* - the value of the data (e.g floatVal := 2.5)
// *in charstring pl_source* - the name of the data source 'feature' (e.g. "LGenBase")
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC) (e.g. "LGen1")
// *in charstring pl_element* - the name of the data element (e.g. "TC_CPS")
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement (e.g. "EG1.SC2.TC3" <= TC ID)
// *in* <EPTF_IntegerList> *pl_indexList* - in case of list-type values the elements of this parameter
// are the indexes in the list-type data for which the values should be set
// For elementary type values this argument is not used
//
// Return Value:
// integer - error code (0 if OK, non zero if unsuccessful:
// e.g. invalid parameters given in pl_params, or data is read-only.
// For negative error codes the getDataHandlers registered by <f_EPTF_DataSourceClient_registerData>
// are also called to get the EPTF Variable name to process the request, since the value of any data source
// that have getDataHandler might also be set (if the corresponding variable can be adjusted with the value to be set)
// For positive error codes, the getDataHandlers are not called for the same request.
// If error code is positive pl_dataValue can be used to provide textual error message)
//
// Detailed Comments:
// This function is called when <f_EPTF_DataSource_setDataValue> is requested
// for the specified pl_source and pl_ptcName.
// Its return value (error code) and pl_dataValue is forwarded
// to <f_EPTF_DataSource_setDataValue>.
// DataValue is useful when only the value of data is important
// or data is not stored in EPTF Variable.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSourceClient_setDataValueHandler(
inout EPTF_Var_DirectContent pl_dataValue,
in charstring pl_source,
in charstring pl_ptcName := "",
in charstring pl_element,
in EPTF_DataSource_Params pl_params := {},
in EPTF_IntegerList pl_indexList := {}
) runs on self return integer
///////////////////////////////////////////////////////////
// Function: fcb_EPTF_DataSourceClient_conditionHandler
//
// Purpose:
// Callback function type to handle registered data
//
// Parameters:
// *out boolean pl_conditionValue* - this argument
// contains the value of the condition
// *in charstring pl_source* - the name of the data source 'feature' (e.g. "LGenBase")
// *in charstring pl_ptcName* - the name of the ptc (ID of the PTC) (e.g. "LGen1")
// *in charstring pl_method* - the name of the method (e.g. "isWeightedScenario")
// *in* <EPTF_DataSource_Params> *pl_params* - the parameters
// of the data for the dataElement (e.g. "EG1.SC2.TC3" <= TC ID)
//
// Return Value:
// integer - error code (0 of OK, non zero if unsuccessful:
// e.g. invalid parameters given in pl_params)
//
// Detailed Comments:
// This function is called when <f_EPTF_DataSource_getCondition> is requested
// for the specified pl_source,pl_ptcName and pl_method.
// Its return value (error code) and pl_conditionValue is forwarded
// to <f_EPTF_DataSource_getCondition>.
///////////////////////////////////////////////////////////
type function fcb_EPTF_DataSourceClient_conditionHandler(
out boolean pl_conditionValue,
in charstring pl_source,
in charstring pl_ptcName,
in charstring pl_method,
in EPTF_DataSource_Params pl_params
) runs on self return integer;
///////////////////////////////////////////////////////////
// Function: f_EPTF_DataSourceClient_downcast
//
// Purpose:
// Cast the component type from integer to EPTF_DataSourceClient_CT
//
// Parameters:
// pl_dataSourceClientCompRef - *integer* - the component to cast
//
// Return Value:
// EPTF_DataSourceClient_CT - the casted component reference
//
///////////////////////////////////////////////////////////
public external function f_EPTF_DataSourceClient_downcast(in integer pl_dataSourceClientCompRef) return EPTF_DataSourceClient_CT;
} // group EPTF_DataSourceClient_CT
} // module EPTF_CLL_DataSource_Definitions