I have list of PIds which belong to table of Titan decoder. Using these PIds i want to get the parameter name. For example in Decoder overview table,
PID - 1112
Parameter name - Decoding
What im trying to do is, from LCA Im getting protocol name, using that Im fetching service params and table pids by below code. Now i want user to choose necessary table columns as per need from LCA. So i want to get table columns. In this case i wont have dmaId, element id. Im just having protocol name.
This is how i get service params and table details from protocol:
GetProtocolMessage getProtocolRequest = new GetProtocolMessage(protocolName, protocolVersion);
var protocolInfo = _engine.SendSLNetSingleResponseMessage(getProtocolRequest) as GetProtocolInfoResponseMessage;
currently im trying to get table definitions using below code but getting object reference error:
GetTableDefinitionMessage table = new GetTableDefinitionMessage(columnName);
var tableInfo = _engine.SendSLNetSingleResponseMessage(table) as GetTableDefinitionResponse;
Any suggestions to achieve this would be very helpful.
Since you are already using the GetProtocolMessage, you should already be able to view all information for every parameter of that protocol (standalone, table, column, ..). All parameters are listed under the 'Parameters' property inside the response. Each parameter entry has all the parameter information, such as the ID and Description (visible name) of the parameter.
If the parameter is a table you can find all the columns inside the TableColumnDefinitions. Each column contains the parameter ID.
If you use these ID's to find the correct parameters, you should be able to find the Description for each parameter as well.
The GetParameterMessage is used to get the value of a parameter. It does not return information about the parameter itself.
You can find the names of the parameter in the same response where you found the column IDs.
Here’s a quick example to find the column name in the GetProtocolMessage response, using the ID of the column.
ParameterInfo columnParameter = response.Parameters.FirstOrDefault(param => param.ID == columnId);
if (columnParameter != null)
{
string paramDescription = columnParameter.Description;
}
here the description contains Table name. Couldnt get column name.
I have tried this alternative way:
var _protocolInfo = _protocolHelper.GetTableColumnDefinitions(protocolName);
var paramInfo = _protocolInfo.Parameters.ToList().Find(x => x.Description == tableName);
List paramsName = new List();
foreach (var columnDefinition in paramInfo.TableColumnDefinitions)
{
var paramName = _protocolInfo.GetParameterName(columnDefinition.ParameterID);
_engine.Log(“Parameter Name ” + paramName);
paramsName.Add(paramName);
}
return paramsName;
Even here i get ParamName as – Parameter 701 instead of column name
Yes, i could achieve till getting parameter ids of the table columns. Using that parameter Id, im using below code to get column description, but it requires dma id and element id:
GetParameterMessage(
int dmaId,
int elId,
int parameterId,
string key,
bool usePrimaryKey)