本文整理汇总了C#中ReturnCode.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ReturnCode.ToString方法的具体用法?C# ReturnCode.ToString怎么用?C# ReturnCode.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ReturnCode
的用法示例。
在下文中一共展示了ReturnCode.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadInitDataSynch
public void ReadInitDataSynch(int clientSubscriptionIndex)
{
//turn dynamic list into array used to subscribe to items
itemIdentifiers = _itemIdentifiers.ToArray();
//create return code for subscription result
Kepware.ClientAce.OpcDaClient.ReturnCode returnCode;
returnCode = new ReturnCode();
// Transaction Handle Is the PLC's Index 1 Based So Must Decrement By 1
int idx = clientSubscriptionIndex - 1;
int index = 0;
if (_itemIdentifiers.Count != 0)
{
try
{
//temporarily use Synchronous Read. Calls the normal Callback Handler
ItemValue[] itemValues;
returnCode = clientAce.DAServer.Read(0, ref itemIdentifiers, out itemValues);
//set initial value read to true for each plc and record
if (IDCService.IDCConfig.model.plcs[idx].initDataReceived != true)
{
IDCService.IDCConfig.model.plcs[idx].initDataReceived = true;
logger.Debug("Initial data received for PLC: {0}", IDCService.IDCConfig.model.plcs[idx].name);
}
if (returnCode.ToString() != "SUCCEEDED")
{
logger.Error("DAServer.Read error: ReturnCode: {0} for PLC: {1}", returnCode, IDCService.IDCConfig.model.plcs[idx].name);
}
if (itemValues != null)
{
foreach (ItemValue itemValue in itemValues)
{
//write values to items within plc.
//clientSubscriptionIndex - PLC index
//index - item index within PLC
if (itemValue.Value != null & itemValue.Quality != null & itemValue.TimeStamp != null)
{
IDCService.IDCConfig.model.plcs[idx].opcliitems[index].value = itemValue.Value;
IDCService.IDCConfig.model.plcs[idx].opcliitems[index].quality = itemValue.Quality.Quality;
IDCService.IDCConfig.model.plcs[idx].opcliitems[index].timestamp = itemValue.TimeStamp;
}
else
{
logger.Error("ItemVlaue Read returned null values for opccliitem: {0}", IDCService.IDCConfig.model.plcs[idx].opcliitems[index].name);
}
index++;
}
}
}
catch (Exception ex)
{
logger.Error("ReadInitDataSynch exception. Reason: {0}, PLC: {1}", ex.Message, IDCService.IDCConfig.model.plcs[idx].name);
}
}
else
{
logger.Info("There were no items to be initially read.");
}
}