Table of Contents

Class Parameter

Namespace
Skyline.DataMiner.Scripting
Assembly
ProtocolName.ProtocolVersion.QAction.Helper.dll

Holds an overview of the protocol parameters.

public static class Parameter
Inheritance
Parameter

Remarks

  • The Parameter class is an auto-generated static class. It allows you to improve readability and maintainability of QAction code. This class can be found in the [Protocol Name].[Protocol Version].QAction.Helper.dll DLL located in the folder C:\Skyline DataMiner\ProtocolScripts.
  • For every standalone read parameter, the class defines two public constant fields, one using the name of the parameter (lower cased and removing special characters) and one with an additional suffix consisting of an underscore and the parameter ID (e.g. "_108").
  • For example, suppose a protocol defines a parameter of type "read" with ID 108 and name "Status Code", then the Parameter class will define the following two fields:
public static class Parameter
{
	public const int statusCode_108 = 108;
	public const int statusCode = 108;
}

For write parameters, a public inner Write class is defined in the Parameter class. This class then defines two fields for each parameter of type "write", just like for parameters of type read. Suppose there is a parameter of type "write" with ID 158 and name "Status Code", then the Write class will define the following two fields for the write parameter:

public static class Parameter
{
	...
	public class Write
	{
		public const int statusCode_158 = 158;
		public const int statusCode = 158;
		...
	}
}

Additionally, the Parameter class defines a class for every table defined in the protocol. The table class takes the name of the table parameter (parameter of type array) and defines three constant fields:

  • tablePid: The parameter ID of the table parameter.

  • indexColumn: The index of the column that holds the primary keys.

  • indexColumnPid: The ID of the column parameter that holds the primary keys.

The table class also defines two inner classes named “Pid” and “Idx” which hold the parameter IDs and indexes of the columns defined in the table respectively. The Pid class additionally defines an inner class “Write”, defining the IDs of the write parameters (if any).

For example, consider a parameter of type “array” with name “Master Table” and ID 2000. The table has two columns: a column named “Master Index” (ID 2001) and a column named “Master Description” (ID 2002). Then the Parameter class will define a class MasterTable as follows:

public static class Parameter
{
	public class MasterTable
	{
		public const int tablePid = 2000;
		public const int indexColumn = 0;
		public const int indexColumnPid = 2001;
	public class Pid
	{
		public const int masterIndex_2001 = 2001;
		public const int masterIndex = 2001;
		public const int masterDescription_2002 = 2002;
		public const int masterDescription = 2002;
		public class Write
		{
		}
	}

	public class Idx
	{
		public const int masterIndex_2001 = 0;
		public const int masterIndex = 0;
		public const int masterDescription_2002 = 1;
		public const int masterDescription = 1;
	}
}

}

The parameter class allows to produce more readable code. For example, parameter ID or index positions often need to be provided in a method call of the SLProtocol class as in the examples below:

protocol.SetParameter(Parameter.requestCounter, 1);
protocol.SetParameterIndexByKey(Parameter.MasterTable.tablePid, "1", Parameter.MasterTable.Idx.masterDescription + 1, "Main");

It is clear that the above lines of code result in code that is easer to interpret than the following lines:

protocol.SetParameter(120, 1);
protocol.SetParameterIndexByKey(4000, "1", 6, "Main");