11 Commits

Author SHA1 Message Date
Samuele Locatelli 31d0d1dec0 Completato test SHelly con Status e Switch DTO completi 2025-02-12 07:26:26 +01:00
Samuele Locatelli 48176e79b4 Aggiunta vari DTO x completare Shelly PM1 + update json insomnia 2025-02-11 19:24:00 +01:00
Samuele Locatelli 63db9dc28f Ok lettura shelly 2025-02-06 19:58:07 +01:00
Samuele Locatelli f7ed15b18d Aggiunto progetto test SHelly x iniziare debug 2025-02-06 19:41:47 +01:00
Samuele Locatelli 6d9778a685 Aggiunta demo ThirdParty proj x OPC-UA 2024-12-23 15:46:54 +01:00
Samuele Locatelli e63e78c30e Merge tag 'AddCliTest01' into develop
Merge progetti test CLI col resto dei proj di test
2024-12-23 15:45:34 +01:00
Samuele Locatelli 0451fc2df9 Merge branch 'release/AddCliTest01' 2024-12-23 15:45:03 +01:00
Samuele Locatelli 25b741a4dc Update readme 2024-12-23 15:44:39 +01:00
Samuele Locatelli 99e9238ce8 Aggiunta cli test applications x remote debug 2024-12-23 15:41:12 +01:00
Samuele Locatelli 10dad6681a modifica x load conf forzata 2022-05-04 10:56:24 +02:00
Samuele Locatelli c02e0bbde5 Aggiunto metodi x settare user/pwd/security 2022-05-04 10:56:16 +02:00
78 changed files with 4569 additions and 1100 deletions
@@ -37,6 +37,7 @@ using System.Windows.Forms;
using Opc.Ua;
using Opc.Ua.Client;
using System.IO;
using System.Text.RegularExpressions;
namespace Opc.Ua.Client.Controls
{
@@ -108,11 +109,24 @@ namespace Opc.Ua.Client.Controls
public void ReadAttributes(NodeId nodeId, bool showProperties)
{
AttributesLV.Items.Clear();
// effettua check preliminarei folder out...
string outPath = Path.Combine(Directory.GetCurrentDirectory(), "trace");
string expFile = Path.Combine(outPath, $"{nodeId}.txt".Replace("=", "_").Replace(";", "_"));
string nodePath = $"{nodeId}.txt".Replace("=", "_")
.Replace(";", "_")
.Replace("|", "_")
.Replace("/", "_")
.Replace("\\", "_")
.Replace("(", "_")
.Replace(")", "_");
// 2023.11.25 fix caratteri invalidi
string regexSearch = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars());
Regex r = new Regex(string.Format("[{0}]", Regex.Escape(regexSearch)));
nodePath = r.Replace(nodePath, "");
string expFile = Path.Combine(outPath, nodePath);
Directory.CreateDirectory(outPath);
StringBuilder sb = new StringBuilder();
@@ -210,7 +224,12 @@ namespace Opc.Ua.Client.Controls
// export finale su file proprietà...
string nodeData = sb.ToString();
File.WriteAllText(expFile, nodeData);
try
{
File.WriteAllText(expFile, nodeData);
}
catch
{ }
}
#endregion
@@ -38,6 +38,7 @@ using System.Text;
using System.Windows.Forms;
using Opc.Ua;
using Opc.Ua.Client;
using System.Threading;
namespace Opc.Ua.Client.Controls
{
@@ -332,6 +333,9 @@ namespace Opc.Ua.Client.Controls
/// </summary>
private void BrowseTV_AfterSelect(object sender, TreeViewEventArgs e)
{
// metto una pausa casuale 50-150 ms...
Random rnd = new Random();
Thread.Sleep(rnd.Next(50, 150));
try
{
m_selectedNodeId = null;
@@ -80,8 +80,6 @@ namespace Opc.Ua.Client.Controls
// UseSecurityCK
//
this.UseSecurityCK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.UseSecurityCK.Checked = true;
this.UseSecurityCK.CheckState = System.Windows.Forms.CheckState.Checked;
this.UseSecurityCK.Location = new System.Drawing.Point(346, 3);
this.UseSecurityCK.Name = "UseSecurityCK";
this.UseSecurityCK.Size = new System.Drawing.Size(91, 17);
@@ -91,27 +89,28 @@ namespace Opc.Ua.Client.Controls
//
// UrlCB
//
this.UrlCB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.UrlCB.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.UrlCB.FormattingEnabled = true;
this.UrlCB.Location = new System.Drawing.Point(0, 1);
this.UrlCB.Name = "UrlCB";
this.UrlCB.Size = new System.Drawing.Size(168, 21);
this.UrlCB.Size = new System.Drawing.Size(122, 21);
this.UrlCB.TabIndex = 0;
//
// userName
//
this.userName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.userName.Location = new System.Drawing.Point(187, 2);
this.userName.Location = new System.Drawing.Point(139, 2);
this.userName.MinimumSize = new System.Drawing.Size(80, 0);
this.userName.Name = "userName";
this.userName.Size = new System.Drawing.Size(71, 20);
this.userName.Size = new System.Drawing.Size(90, 20);
this.userName.TabIndex = 3;
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(171, 5);
this.label1.Location = new System.Drawing.Point(123, 5);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(15, 13);
this.label1.TabIndex = 4;
@@ -121,7 +120,7 @@ namespace Opc.Ua.Client.Controls
//
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(262, 5);
this.label2.Location = new System.Drawing.Point(236, 5);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(14, 13);
this.label2.TabIndex = 6;
@@ -130,9 +129,10 @@ namespace Opc.Ua.Client.Controls
// passwd
//
this.passwd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.passwd.Location = new System.Drawing.Point(278, 2);
this.passwd.Location = new System.Drawing.Point(250, 2);
this.passwd.MinimumSize = new System.Drawing.Size(80, 0);
this.passwd.Name = "passwd";
this.passwd.Size = new System.Drawing.Size(62, 20);
this.passwd.Size = new System.Drawing.Size(90, 20);
this.passwd.TabIndex = 5;
//
// ConnectServerCtrl
@@ -163,6 +163,16 @@ namespace Opc.Ua.Client.Controls
get => UseSecurityCK.Checked;
set => UseSecurityCK.Checked = value;
}
public string ConnUserName
{
get => userName.Text;
set => userName.Text = value;
}
public string ConnPwd
{
get => passwd.Text;
set => passwd.Text = value;
}
/// <summary>
/// The locales to use when creating the session.
@@ -112,9 +112,9 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -1,23 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(AppTargetFrameWorks)</TargetFrameworks>
<AssemblyName>ConsoleReferenceSubscriber</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>ConsoleReferenceSubscriber</PackageId>
<Company>OPC Foundation</Company>
<Description>.NET Console Reference Subscriber</Description>
<Copyright>Copyright © 2004-2020 OPC Foundation, Inc</Copyright>
<RootNamespace>Quickstarts.ConsoleReferenceSubscriber</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mono.Options" Version="6.12.0.148" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Stack\Opc.Ua.Core\Opc.Ua.Core.csproj" />
<ProjectReference Include="..\..\Libraries\Opc.Ua.PubSub\Opc.Ua.PubSub.csproj" />
</ItemGroup>
</Project>
@@ -1,952 +0,0 @@
/* ========================================================================
* Copyright (c) 2005-2020 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/
using System;
using System.Collections.Generic;
using System.Threading;
using Mono.Options;
using Opc.Ua;
using Opc.Ua.PubSub;
using Opc.Ua.PubSub.Configuration;
using Opc.Ua.PubSub.Encoding;
using Opc.Ua.PubSub.PublishedData;
using Opc.Ua.PubSub.Transport;
namespace Quickstarts.ConsoleReferenceSubscriber
{
public static class Program
{
public const ushort NamespaceIndexSimple = 2;
public const ushort NamespaceIndexAllTypes = 3;
// constant DateTime that represents the initial time when the metadata for the configuration was created
private static DateTime kTimeOfConfiguration = new DateTime(2021, 5, 1, 0, 0, 0, DateTimeKind.Utc);
private const string kDisplaySeparator = "------------------------------------------------";
private static object m_lock = new object();
public static void Main(string[] args)
{
Console.WriteLine("OPC UA Console Reference Subscriber");
// command line options
bool showHelp = false;
bool useMqttJson = true;
bool useMqttUadp = false;
bool useUdpUadp = false;
string subscriberUrl = null;
Mono.Options.OptionSet options = new Mono.Options.OptionSet {
{ "h|help", "Show usage information", v => showHelp = v != null },
{ "m|mqtt_json", "Use MQTT with Json encoding Profile. This is the default option.", v => useMqttJson = v != null },
{ "p|mqtt_uadp", "Use MQTT with UADP encoding Profile.", v => useMqttUadp = v != null },
{ "u|udp_uadp", "Use UDP with UADP encoding Profile", v => useUdpUadp = v != null },
{ "url|subscriber_url=", "Subscriber Url Address", v => subscriberUrl = v},
};
IList<string> extraArgs = null;
try
{
extraArgs = options.Parse(args);
if (extraArgs.Count > 0)
{
foreach (string extraArg in extraArgs)
{
Console.WriteLine("Error: Unknown option: {0}", extraArg);
showHelp = true;
}
}
}
catch (OptionException e)
{
Console.WriteLine(e.Message);
showHelp = true;
}
if (showHelp)
{
Console.WriteLine("Usage: dotnet ConsoleReferenceSubscriber.dll [OPTIONS]");
Console.WriteLine();
Console.WriteLine("Options:");
options.WriteOptionDescriptions(Console.Out);
return;
}
try
{
InitializeLog();
PubSubConfigurationDataType pubSubConfiguration = null;
if (useUdpUadp)
{
// set default UDP Subscriber Url to local multicast if not sent in args.
if (string.IsNullOrEmpty(subscriberUrl))
{
subscriberUrl = "opc.udp://239.0.0.1:4840";
}
// Create configuration using UDP protocol and UADP Encoding
pubSubConfiguration = CreateSubscriberConfiguration_UdpUadp(subscriberUrl);
Console.WriteLine("The Pubsub Connection was initialized using UDP & UADP Profile.");
}
else
{
// set default MQTT Broker Url to localhost if not sent in args.
if (string.IsNullOrEmpty(subscriberUrl))
{
subscriberUrl = "mqtt://localhost:1883";
}
if (useMqttUadp)
{
// Create configuration using MQTT protocol and UADP Encoding
pubSubConfiguration = CreateSubscriberConfiguration_MqttUadp(subscriberUrl);
Console.WriteLine("The PubSub Connection was initialized using MQTT & UADP Profile.");
}
else
{
// Create configuration using MQTT protocol and JSON Encoding
pubSubConfiguration = CreateSubscriberConfiguration_MqttJson(subscriberUrl);
Console.WriteLine("The PubSub Connection was initialized using MQTT & JSON Profile.");
}
}
// Create the UA Publisher application
using (UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(pubSubConfiguration))
{
// Subscribte to RawDataReceived event
uaPubSubApplication.RawDataReceived += UaPubSubApplication_RawDataReceived;
// Subscribte to DataReceived event
uaPubSubApplication.DataReceived += UaPubSubApplication_DataReceived;
// Subscribte to MetaDataReceived event
uaPubSubApplication.MetaDataReceived += UaPubSubApplication_MetaDataDataReceived;
uaPubSubApplication.ConfigurationUpdating += UaPubSubApplication_ConfigurationUpdating;
// Start the publisher
uaPubSubApplication.Start();
Console.WriteLine("Subscriber Started. Press Ctrl-C to exit...");
ManualResetEvent quitEvent = new ManualResetEvent(false);
try
{
Console.CancelKeyPress += (sender, eArgs) => {
quitEvent.Set();
eArgs.Cancel = true;
};
}
catch
{
}
// wait for timeout or Ctrl-C
quitEvent.WaitOne();
}
Console.WriteLine("Program ended.");
Console.WriteLine("Press any key to finish...");
Console.ReadKey();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
#region Private Methods
/// <summary>
/// Handler for <see cref="UaPubSubApplication.RawDataReceived" /> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void UaPubSubApplication_RawDataReceived(object sender, RawDataReceivedEventArgs e)
{
lock (m_lock)
{
Console.WriteLine("RawDataReceived bytes:{0}, Source:{1}, TransportProtocol:{2}, MessageMapping:{3}",
e.Message.Length, e.Source, e.TransportProtocol, e.MessageMapping);
Console.WriteLine(kDisplaySeparator);
}
}
/// <summary>
/// Handler for <see cref="UaPubSubApplication.DataReceived" /> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void UaPubSubApplication_DataReceived(object sender, SubscribedDataEventArgs e)
{
lock (m_lock)
{
Console.WriteLine("DataReceived event:");
if (e.NetworkMessage is UadpNetworkMessage)
{
Console.WriteLine("UADP Network DataSetMessage ({0} DataSets): Source={1}, SequenceNumber={2}",
e.NetworkMessage.DataSetMessages.Count, e.Source, ((UadpNetworkMessage)e.NetworkMessage).SequenceNumber);
}
else if (e.NetworkMessage is JsonNetworkMessage)
{
Console.WriteLine("JSON Network DataSetMessage ({0} DataSets): Source={1}, MessageId={2}",
e.NetworkMessage.DataSetMessages.Count, e.Source, ((JsonNetworkMessage)e.NetworkMessage).MessageId);
}
foreach (UaDataSetMessage dataSetMessage in e.NetworkMessage.DataSetMessages)
{
DataSet dataSet = dataSetMessage.DataSet;
Console.WriteLine("\tDataSet.Name={0}, DataSetWriterId={1}, SequenceNumber={2}", dataSet.Name, dataSet.DataSetWriterId, dataSetMessage.SequenceNumber);
for (int i = 0; i < dataSet.Fields.Length; i++)
{
Console.WriteLine("\t\tTargetNodeId:{0}, Attribute:{1}, Value:{2}",
dataSet.Fields[i].TargetNodeId, dataSet.Fields[i].TargetAttribute, dataSetMessage.DataSet.Fields[i].Value);
}
}
Console.WriteLine(kDisplaySeparator);
}
}
/// <summary>
/// Handler for <see cref="UaPubSubApplication.MetaDataDataReceived" /> event.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void UaPubSubApplication_MetaDataDataReceived(object sender, SubscribedDataEventArgs e)
{
lock (m_lock)
{
Console.WriteLine("MetaDataDataReceived event:");
if (e.NetworkMessage is JsonNetworkMessage)
{
Console.WriteLine("JSON Network MetaData Message: Source={0}, PublisherId={1}, DataSetWriterId={2} Fields count={3}\n",
e.Source,
((JsonNetworkMessage)e.NetworkMessage).PublisherId,
((JsonNetworkMessage)e.NetworkMessage).DataSetWriterId,
e.NetworkMessage.DataSetMetaData.Fields.Count);
}
if (e.NetworkMessage is UadpNetworkMessage)
{
Console.WriteLine("UADP Network MetaData Message: Source={0}, PublisherId={1}, DataSetWriterId={2} Fields count={3}\n",
e.Source,
((UadpNetworkMessage)e.NetworkMessage).PublisherId,
((UadpNetworkMessage)e.NetworkMessage).DataSetWriterId,
e.NetworkMessage.DataSetMetaData.Fields.Count);
}
Console.WriteLine("\tMetaData.Name={0}, MajorVersion={1} MinorVersion={2}",
e.NetworkMessage.DataSetMetaData.Name,
e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MajorVersion,
e.NetworkMessage.DataSetMetaData.ConfigurationVersion.MinorVersion);
foreach (FieldMetaData metaDataField in e.NetworkMessage.DataSetMetaData.Fields)
{
Console.WriteLine("\t\t{0, -20} DataType:{1, 10}, ValueRank:{2, 5}", metaDataField.Name, metaDataField.DataType, metaDataField.ValueRank);
}
Console.WriteLine(kDisplaySeparator);
}
}
/// <summary>
/// Handler for <see cref="UaPubSubApplication.ConfigurationUpdating"/>
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private static void UaPubSubApplication_ConfigurationUpdating(object sender, ConfigurationUpdatingEventArgs e)
{
Console.WriteLine("The UaPubSubApplication.ConfigurationUpdating event was triggered for part: {0} for {1}, With new value: {2}",
e.ChangedProperty, e.Parent.GetType().Name, e.NewValue.GetType().Name);
Console.WriteLine(kDisplaySeparator);
}
/// <summary>
/// Creates a Subscriber PubSubConfiguration object for UDP & UADP programmatically.
/// </summary>
/// <returns></returns>
private static PubSubConfigurationDataType CreateSubscriberConfiguration_UdpUadp(string urlAddress)
{
// Define a PubSub connection with PublisherId 1
PubSubConnectionDataType pubSubConnection1 = new PubSubConnectionDataType();
pubSubConnection1.Name = "Subscriber Connection UDP UADP";
pubSubConnection1.Enabled = true;
pubSubConnection1.PublisherId = (UInt16)1;
pubSubConnection1.TransportProfileUri = Profiles.PubSubUdpUadpTransport;
NetworkAddressUrlDataType address = new NetworkAddressUrlDataType();
// Specify the local Network interface name to be used
// e.g. address.NetworkInterface = "Ethernet";
// Leave empty to subscribe on all available local interfaces.
address.NetworkInterface = String.Empty;
address.Url = urlAddress;
pubSubConnection1.Address = new ExtensionObject(address);
// configure custoom DicoveryAddress for Dicovery messages
pubSubConnection1.TransportSettings = new ExtensionObject() {
Body = new DatagramConnectionTransportDataType() {
DiscoveryAddress = new ExtensionObject() {
Body = new NetworkAddressUrlDataType() {
Url = "opc.udp://224.0.2.15:4840"
}
}
}
};
#region Define ReaderGroup1
ReaderGroupDataType readerGroup1 = new ReaderGroupDataType();
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());
#region Define DataSetReader 'Simple' for PublisherId = (UInt16)1, DataSetWriterId = 1
DataSetReaderDataType dataSetReaderSimple = new DataSetReaderDataType();
dataSetReaderSimple.Name = "Reader 1 UDP UADP";
dataSetReaderSimple.PublisherId = (UInt16)1;
dataSetReaderSimple.WriterGroupId = 0;
dataSetReaderSimple.DataSetWriterId = 1;
dataSetReaderSimple.Enabled = true;
dataSetReaderSimple.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderSimple.KeyFrameCount = 1;
dataSetReaderSimple.TransportSettings = new ExtensionObject(new DataSetReaderTransportDataType());
UadpDataSetReaderMessageDataType uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
NetworkMessageNumber = 0,
NetworkMessageContentMask = (uint)(uint)(UadpNetworkMessageContentMask.PublisherId
| UadpNetworkMessageContentMask.GroupHeader
| UadpNetworkMessageContentMask.WriterGroupId
| UadpNetworkMessageContentMask.GroupVersion
| UadpNetworkMessageContentMask.NetworkMessageNumber
| UadpNetworkMessageContentMask.SequenceNumber),
DataSetMessageContentMask = (uint)(UadpDataSetMessageContentMask.Status | UadpDataSetMessageContentMask.SequenceNumber),
};
dataSetReaderSimple.MessageSettings = new ExtensionObject(uadpDataSetReaderMessage);
// Create and set DataSetMetaData for DataSet Simple
DataSetMetaDataType simpleMetaData = CreateDataSetMetaDataSimple();
dataSetReaderSimple.DataSetMetaData = simpleMetaData;
// Create and set SubscribedDataSet
TargetVariablesDataType subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in simpleMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexSimple),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderSimple.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderSimple);
#region Define DataSetReader 'AllTypes' for PublisherId = (UInt16)1, DataSetWriterId = 2
DataSetReaderDataType dataSetReaderAllTypes = new DataSetReaderDataType();
dataSetReaderAllTypes.Name = "Reader 2 UDP UADP";
dataSetReaderAllTypes.PublisherId = (UInt16)1;
dataSetReaderAllTypes.WriterGroupId = 0;
dataSetReaderAllTypes.DataSetWriterId = 2;
dataSetReaderAllTypes.Enabled = true;
dataSetReaderAllTypes.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderAllTypes.KeyFrameCount = 1;
dataSetReaderAllTypes.TransportSettings = new ExtensionObject(new DataSetReaderTransportDataType());
uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
NetworkMessageNumber = 0,
NetworkMessageContentMask = (uint)(uint)(UadpNetworkMessageContentMask.PublisherId
| UadpNetworkMessageContentMask.GroupHeader
| UadpNetworkMessageContentMask.WriterGroupId
| UadpNetworkMessageContentMask.GroupVersion
| UadpNetworkMessageContentMask.NetworkMessageNumber
| UadpNetworkMessageContentMask.SequenceNumber),
DataSetMessageContentMask = (uint)(UadpDataSetMessageContentMask.Status | UadpDataSetMessageContentMask.SequenceNumber),
};
dataSetReaderAllTypes.MessageSettings = new ExtensionObject(uadpDataSetReaderMessage);
// Create and set DataSetMetaData for DataSet AllTypes
DataSetMetaDataType allTypesMetaData = CreateDataSetMetaDataAllTypes();
dataSetReaderAllTypes.DataSetMetaData = allTypesMetaData;
// Create and set SubscribedDataSet
subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in allTypesMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexAllTypes),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderAllTypes.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderAllTypes);
#endregion
pubSubConnection1.ReaderGroups.Add(readerGroup1);
//create pub sub configuration root object
PubSubConfigurationDataType pubSubConfiguration = new PubSubConfigurationDataType();
pubSubConfiguration.Connections = new PubSubConnectionDataTypeCollection()
{
pubSubConnection1
};
return pubSubConfiguration;
}
/// <summary>
/// Creates a Subscriber PubSubConfiguration object for MQTT & Json programmatically.
/// </summary>
/// <returns></returns>
private static PubSubConfigurationDataType CreateSubscriberConfiguration_MqttJson(string urlAddress)
{
// Define a PubSub connection with PublisherId 2
PubSubConnectionDataType pubSubConnection1 = new PubSubConnectionDataType();
pubSubConnection1.Name = "Subscriber Connection MQTT Json";
pubSubConnection1.Enabled = true;
pubSubConnection1.PublisherId = (UInt16)2;
pubSubConnection1.TransportProfileUri = Profiles.PubSubMqttJsonTransport;
NetworkAddressUrlDataType address = new NetworkAddressUrlDataType();
// Specify the local Network interface name to be used
// e.g. address.NetworkInterface = "Ethernet";
// Leave empty to subscribe on all available local interfaces.
address.NetworkInterface = String.Empty;
address.Url = urlAddress;
pubSubConnection1.Address = new ExtensionObject(address);
// Configure the mqtt specific configuration with the MQTTbroker
ITransportProtocolConfiguration mqttConfiguration = new MqttClientProtocolConfiguration(version: EnumMqttProtocolVersion.V500);
pubSubConnection1.ConnectionProperties = mqttConfiguration.ConnectionProperties;
string brokerQueueName = "Json_WriterGroup_1";
string brokerMetaData = "$Metadata";
#region Define ReaderGroup1
ReaderGroupDataType readerGroup1 = new ReaderGroupDataType();
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());
#region Define DataSetReader1 'Simple' for PublisherId = (UInt16)2, DataSetWriterId = 1
DataSetReaderDataType dataSetReaderSimple = new DataSetReaderDataType();
dataSetReaderSimple.Name = "Reader 1 MQTT JSON Variant Encoding";
dataSetReaderSimple.PublisherId = (UInt16)2;
dataSetReaderSimple.WriterGroupId = 1;
dataSetReaderSimple.DataSetWriterId = 1;
dataSetReaderSimple.Enabled = true;
dataSetReaderSimple.DataSetFieldContentMask = (uint)DataSetFieldContentMask.None;// Variant encoding;
dataSetReaderSimple.KeyFrameCount = 3;
JsonDataSetReaderMessageDataType jsonDataSetReaderMessage = new JsonDataSetReaderMessageDataType() {
NetworkMessageContentMask = (uint)(uint)(JsonNetworkMessageContentMask.NetworkMessageHeader
| JsonNetworkMessageContentMask.DataSetMessageHeader
| JsonNetworkMessageContentMask.PublisherId
| JsonNetworkMessageContentMask.DataSetClassId
| JsonNetworkMessageContentMask.ReplyTo),
DataSetMessageContentMask = (uint)(JsonDataSetMessageContentMask.DataSetWriterId
| JsonDataSetMessageContentMask.MetaDataVersion
| JsonDataSetMessageContentMask.SequenceNumber
| JsonDataSetMessageContentMask.Status
| JsonDataSetMessageContentMask.Timestamp),
};
dataSetReaderSimple.MessageSettings = new ExtensionObject(jsonDataSetReaderMessage);
BrokerDataSetReaderTransportDataType brokerTransportSettings = new BrokerDataSetReaderTransportDataType() {
QueueName = brokerQueueName,
RequestedDeliveryGuarantee = BrokerTransportQualityOfService.BestEffort,
MetaDataQueueName = $"{brokerQueueName}/{brokerMetaData}",
};
dataSetReaderSimple.TransportSettings = new ExtensionObject(brokerTransportSettings);
// Create and set DataSetMetaData for DataSet Simple
DataSetMetaDataType simpleMetaData = CreateDataSetMetaDataSimple();
dataSetReaderSimple.DataSetMetaData = simpleMetaData;
// Create and set SubscribedDataSet
TargetVariablesDataType subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in simpleMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexSimple),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderSimple.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderSimple);
#region Define DataSetReader2 'AllTypes' for PublisherId = (UInt16)2, DataSetWriterId = 2
DataSetReaderDataType dataSetReaderAllTypes = new DataSetReaderDataType();
dataSetReaderAllTypes.Name = "Reader 2 MQTT JSON RawData Encoding";
dataSetReaderAllTypes.PublisherId = (UInt16)2;
dataSetReaderAllTypes.WriterGroupId = 1;
dataSetReaderAllTypes.DataSetWriterId = 2;
dataSetReaderAllTypes.Enabled = true;
dataSetReaderAllTypes.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;// RawData encoding;
dataSetReaderAllTypes.KeyFrameCount = 1;
jsonDataSetReaderMessage = new JsonDataSetReaderMessageDataType() {
NetworkMessageContentMask = (uint)(JsonNetworkMessageContentMask.NetworkMessageHeader
| JsonNetworkMessageContentMask.DataSetMessageHeader
| JsonNetworkMessageContentMask.PublisherId
| JsonNetworkMessageContentMask.DataSetClassId
| JsonNetworkMessageContentMask.ReplyTo),
DataSetMessageContentMask = (uint)(JsonDataSetMessageContentMask.DataSetWriterId
| JsonDataSetMessageContentMask.MetaDataVersion
| JsonDataSetMessageContentMask.SequenceNumber
| JsonDataSetMessageContentMask.Status
| JsonDataSetMessageContentMask.Timestamp),
};
dataSetReaderAllTypes.MessageSettings = new ExtensionObject(jsonDataSetReaderMessage);
brokerTransportSettings = new BrokerDataSetReaderTransportDataType() {
QueueName = brokerQueueName,
RequestedDeliveryGuarantee = BrokerTransportQualityOfService.BestEffort,
MetaDataQueueName = $"{brokerQueueName}/{brokerMetaData}",
};
dataSetReaderAllTypes.TransportSettings = new ExtensionObject(brokerTransportSettings);
// Create and set DataSetMetaData for DataSet AllTypes
DataSetMetaDataType allTypesMetaData = CreateDataSetMetaDataAllTypes();
dataSetReaderAllTypes.DataSetMetaData = allTypesMetaData;
// Create and set SubscribedDataSet
subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in allTypesMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexAllTypes),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderAllTypes.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderAllTypes);
#endregion
pubSubConnection1.ReaderGroups.Add(readerGroup1);
//create pub sub configuration root object
PubSubConfigurationDataType pubSubConfiguration = new PubSubConfigurationDataType();
pubSubConfiguration.Connections = new PubSubConnectionDataTypeCollection()
{
pubSubConnection1
};
return pubSubConfiguration;
}
/// <summary>
/// Creates a Subscriber PubSubConfiguration object for UDP & UADP programmatically.
/// </summary>
/// <returns></returns>
private static PubSubConfigurationDataType CreateSubscriberConfiguration_MqttUadp(string urlAddress)
{
// Define a PubSub connection with PublisherId 3
PubSubConnectionDataType pubSubConnection1 = new PubSubConnectionDataType();
pubSubConnection1.Name = "Subscriber Connection MQTT UADP";
pubSubConnection1.Enabled = true;
pubSubConnection1.PublisherId = (UInt16)3;
pubSubConnection1.TransportProfileUri = Profiles.PubSubMqttUadpTransport;
NetworkAddressUrlDataType address = new NetworkAddressUrlDataType();
// Specify the local Network interface name to be used
// e.g. address.NetworkInterface = "Ethernet";
// Leave empty to subscribe on all available local interfaces.
address.NetworkInterface = String.Empty;
address.Url = urlAddress;
pubSubConnection1.Address = new ExtensionObject(address);
// Configure the mqtt specific configuration with the MQTTbroker
ITransportProtocolConfiguration mqttConfiguration = new MqttClientProtocolConfiguration(version: EnumMqttProtocolVersion.V500);
pubSubConnection1.ConnectionProperties = mqttConfiguration.ConnectionProperties;
string brokerQueueName = "Uadp_WriterGroup_1";
string brokerMetaData = "$Metadata";
#region Define ReaderGroup1
ReaderGroupDataType readerGroup1 = new ReaderGroupDataType();
readerGroup1.Name = "ReaderGroup 1";
readerGroup1.Enabled = true;
readerGroup1.MaxNetworkMessageSize = 1500;
readerGroup1.MessageSettings = new ExtensionObject(new ReaderGroupMessageDataType());
readerGroup1.TransportSettings = new ExtensionObject(new ReaderGroupTransportDataType());
#region Define DataSetReader 'Simple' for PublisherId = (UInt16)1, DataSetWriterId = 1
DataSetReaderDataType dataSetReaderSimple = new DataSetReaderDataType();
dataSetReaderSimple.Name = "Reader 1 MQTT UADP";
dataSetReaderSimple.PublisherId = (UInt16)3;
dataSetReaderSimple.WriterGroupId = 0;
dataSetReaderSimple.DataSetWriterId = 1;
dataSetReaderSimple.Enabled = true;
dataSetReaderSimple.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderSimple.KeyFrameCount = 1;
BrokerDataSetReaderTransportDataType brokerTransportSettings = new BrokerDataSetReaderTransportDataType() {
QueueName = brokerQueueName,
MetaDataQueueName = $"{brokerQueueName}/{brokerMetaData}",
};
dataSetReaderSimple.TransportSettings = new ExtensionObject(brokerTransportSettings);
UadpDataSetReaderMessageDataType uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
NetworkMessageNumber = 0,
NetworkMessageContentMask = (uint)(uint)(UadpNetworkMessageContentMask.PublisherId
| UadpNetworkMessageContentMask.GroupHeader
| UadpNetworkMessageContentMask.WriterGroupId
| UadpNetworkMessageContentMask.PayloadHeader
| UadpNetworkMessageContentMask.GroupVersion
| UadpNetworkMessageContentMask.NetworkMessageNumber
| UadpNetworkMessageContentMask.SequenceNumber),
DataSetMessageContentMask = (uint)(UadpDataSetMessageContentMask.Status | UadpDataSetMessageContentMask.SequenceNumber),
};
dataSetReaderSimple.MessageSettings = new ExtensionObject(uadpDataSetReaderMessage);
// Create and set DataSetMetaData for DataSet Simple
DataSetMetaDataType simpleMetaData = CreateDataSetMetaDataSimple();
dataSetReaderSimple.DataSetMetaData = simpleMetaData;
// Create and set SubscribedDataSet
TargetVariablesDataType subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in simpleMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexSimple),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderSimple.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderSimple);
#region Define DataSetReader 'AllTypes' for PublisherId = (UInt16)1, DataSetWriterId = 2
DataSetReaderDataType dataSetReaderAllTypes = new DataSetReaderDataType();
dataSetReaderAllTypes.Name = "Reader 2 MQTT UADP";
dataSetReaderAllTypes.PublisherId = (UInt16)3;
dataSetReaderAllTypes.WriterGroupId = 0;
dataSetReaderAllTypes.DataSetWriterId = 2;
dataSetReaderAllTypes.Enabled = true;
dataSetReaderAllTypes.DataSetFieldContentMask = (uint)DataSetFieldContentMask.RawData;
dataSetReaderAllTypes.KeyFrameCount = 1;
dataSetReaderAllTypes.TransportSettings = new ExtensionObject(brokerTransportSettings);
uadpDataSetReaderMessage = new UadpDataSetReaderMessageDataType() {
GroupVersion = 0,
NetworkMessageNumber = 0,
NetworkMessageContentMask = (uint)(uint)(UadpNetworkMessageContentMask.PublisherId
| UadpNetworkMessageContentMask.GroupHeader
| UadpNetworkMessageContentMask.WriterGroupId
| UadpNetworkMessageContentMask.PayloadHeader
| UadpNetworkMessageContentMask.GroupVersion
| UadpNetworkMessageContentMask.NetworkMessageNumber
| UadpNetworkMessageContentMask.SequenceNumber),
DataSetMessageContentMask = (uint)(UadpDataSetMessageContentMask.Status | UadpDataSetMessageContentMask.SequenceNumber),
};
dataSetReaderAllTypes.MessageSettings = new ExtensionObject(uadpDataSetReaderMessage);
// Create and set DataSetMetaData for DataSet AllTypes
DataSetMetaDataType allTypesMetaData = CreateDataSetMetaDataAllTypes();
dataSetReaderAllTypes.DataSetMetaData = allTypesMetaData;
// Create and set SubscribedDataSet
subscribedDataSet = new TargetVariablesDataType();
subscribedDataSet.TargetVariables = new FieldTargetDataTypeCollection();
foreach (var fieldMetaData in allTypesMetaData.Fields)
{
subscribedDataSet.TargetVariables.Add(new FieldTargetDataType() {
DataSetFieldId = fieldMetaData.DataSetFieldId,
TargetNodeId = new NodeId(fieldMetaData.Name, NamespaceIndexAllTypes),
AttributeId = Attributes.Value,
OverrideValueHandling = OverrideValueHandling.OverrideValue,
OverrideValue = new Variant(TypeInfo.GetDefaultValue(fieldMetaData.DataType, (int)ValueRanks.Scalar))
});
}
dataSetReaderAllTypes.SubscribedDataSet = new ExtensionObject(subscribedDataSet);
#endregion
readerGroup1.DataSetReaders.Add(dataSetReaderAllTypes);
#endregion
pubSubConnection1.ReaderGroups.Add(readerGroup1);
//create pub sub configuration root object
PubSubConfigurationDataType pubSubConfiguration = new PubSubConfigurationDataType();
pubSubConfiguration.Connections = new PubSubConnectionDataTypeCollection()
{
pubSubConnection1
};
return pubSubConfiguration;
}
/// <summary>
/// Creates the "Simple" DataSetMetaData
/// </summary>
/// <returns></returns>
private static DataSetMetaDataType CreateDataSetMetaDataSimple()
{
DataSetMetaDataType simpleMetaData = new DataSetMetaDataType();
simpleMetaData.DataSetClassId = new Uuid(Guid.Empty);
simpleMetaData.Name = "Simple";
simpleMetaData.Fields = new FieldMetaDataCollection()
{
new FieldMetaData()
{
Name = "BoolToggle",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte) DataTypes.Boolean,
DataType = DataTypeIds.Boolean,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Int32",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte) DataTypes.Int32,
DataType = DataTypeIds.Int32,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Int32Fast",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte) DataTypes.Int32,
DataType = DataTypeIds.Int32,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "DateTime",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte) DataTypes.DateTime,
DataType = DataTypeIds.DateTime,
ValueRank = ValueRanks.Scalar
},
};
// set the ConfigurationVersion relative to kTimeOfConfiguration constant
simpleMetaData.ConfigurationVersion = new ConfigurationVersionDataType() {
MinorVersion = ConfigurationVersionUtils.CalculateVersionTime(kTimeOfConfiguration),
MajorVersion = ConfigurationVersionUtils.CalculateVersionTime(kTimeOfConfiguration)
};
return simpleMetaData;
}
/// <summary>
/// Creates the "AllTypes" DataSetMetaData
/// </summary>
/// <returns></returns>
private static DataSetMetaDataType CreateDataSetMetaDataAllTypes()
{
DataSetMetaDataType allTypesMetaData = new DataSetMetaDataType();
allTypesMetaData.DataSetClassId = new Uuid(Guid.Empty);
allTypesMetaData.Name = "AllTypes";
allTypesMetaData.Fields = new FieldMetaDataCollection()
{
new FieldMetaData()
{
Name = "BoolToggle",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Boolean,
DataType = DataTypeIds.Boolean,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Byte",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Byte,
DataType = DataTypeIds.Byte,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Int16",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Int16,
DataType = DataTypeIds.Int16,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Int32",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Int32,
DataType = DataTypeIds.Int32,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "SByte",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.SByte,
DataType = DataTypeIds.SByte,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "UInt16",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.UInt16,
DataType = DataTypeIds.UInt16,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "UInt32",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.UInt32,
DataType = DataTypeIds.UInt32,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "UInt64",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.UInt64,
DataType = DataTypeIds.UInt64,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Float",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Float,
DataType = DataTypeIds.Float,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Double",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Double,
DataType = DataTypeIds.Double,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "String",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.String,
DataType = DataTypeIds.String,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "ByteString",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.ByteString,
DataType = DataTypeIds.ByteString,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "Guid",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.Guid,
DataType = DataTypeIds.Guid,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "DateTime",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.DateTime,
DataType = DataTypeIds.DateTime,
ValueRank = ValueRanks.Scalar
},
new FieldMetaData()
{
Name = "UInt32Array",
DataSetFieldId = new Uuid(Guid.NewGuid()),
BuiltInType = (byte)DataTypes.UInt32,
DataType = DataTypeIds.UInt32,
ValueRank = ValueRanks.OneDimension
},
};
// set the ConfigurationVersion relative to kTimeOfConfiguration constant
allTypesMetaData.ConfigurationVersion = new ConfigurationVersionDataType() {
MinorVersion = ConfigurationVersionUtils.CalculateVersionTime(kTimeOfConfiguration),
MajorVersion = ConfigurationVersionUtils.CalculateVersionTime(kTimeOfConfiguration)
};
return allTypesMetaData;
}
/// <summary>
/// Initialize logging
/// </summary>
private static void InitializeLog()
{
// Initialize logger
Utils.SetTraceLog("%CommonApplicationData%\\OPC Foundation\\Logs\\Quickstarts.ConsoleReferenceSubscriber.log.txt", true);
Utils.SetTraceMask(Utils.TraceMasks.Error);
Utils.SetTraceOutput(Utils.TraceOutput.DebugAndFile);
}
#endregion
}
}
@@ -1,92 +0,0 @@
# OPC Foundation UA .NET Standard Library - Console Reference Subscriber
## Introduction
This OPC application was created to provide the sample code for creating Subscriber applications using the OPC Foundation UA .NET Standard PubSub Library. There is a .NET Core 3.1 (2.1) console version of the Subscriber which runs on any OS supporting [.NET Standard](https://docs.microsoft.com/en-us/dotnet/articles/standard).
The Reference Subscriber is configured to run in parallel with the [Console Reference Publisher](../ConsoleReferencePublisher/README.md)
## How to build and run the Windows OPC UA Reference Server from Visual Studio
1. Open the solution **UA Reference.sln** with Visual Studio 2019.
2. Choose the project `ConsoleReferenceSubscriber` in the Solution Explorer and set it with a right click as `Startup Project`.
3. Hit `F5` to build and execute the sample.
## How to build and run the console OPC UA Reference Subscriber on Windows, Linux and iOS
This section describes how to run the **ConsoleReferenceSubscriber**.
Please follow instructions in this [article](https://aka.ms/dotnetcoregs) to setup the dotnet command line environment for your platform.
## Start the Subscriber
1. Open a command prompt.
2. Navigate to the folder **Applications/ConsoleReferenceSubscriber**.
3. To run the Subscriber sample type
`dotnet run --project ConsoleReferenceSubscriber.csproj --framework netcoreapp3.1.`
The Subscriber will start and listen for network messages sent by the Reference Publisher.
## Command Line Arguments for *ConsoleReferenceSubscriber*
**ConsoleReferenceSubscriber** can be executed using the following command line arguments:
- -h|help - Shows usage information
- -m|mqtt_json - Creates a connection using there MQTT with Json encoding Profile. This is the default option.
- -u|udp_uadp - Creates a connection using there UDP with UADP encoding Profile.
To run the Subscriber sample using a connection with MQTT with Json encoding execute:
dotnet run --project ConsoleReferenceSubscriber.csproj --framework netcoreapp3.1
or
dotnet run --project ConsoleReferenceSubscriber.csproj --framework netcoreapp3.1 -m
To run the Subscriber sample using a connection with the UDP with UADP encoding execute:
dotnet run --project ConsoleReferenceSubscriber.csproj --framework netcoreapp3.1 -u
# Programmer's Guide
To create a new OPC UA Subscriber application:
- Open Microsoft Visual Studio 2019 environment,
- Create a new project and give it a name,
- Add a reference to the [OPCFoundation.NetStandard.Opc.Ua.PubSub NuGet package](https://www.nuget.org/packages/OPCFoundation.NetStandard.Opc.Ua.PubSub/),
- Initialize Subscriber application (see [Subscriber Initialization](#subscriber-initialization)).
## Subscriber Initialization
The following four steps are required to implement a functional Subscriber:
1. Create [Subscriber Configuration](#subscriber-configuration).
// Create configuration using UDP protocol and UADP Encoding
PubSubConfigurationDataType pubSubConfiguration = CreateSubscriberConfiguration_UdpUadp();
Or use the alternative configuration object for MQTT with JSON encoding
// Create configuration using MQTT protocol and JSON Encoding
PubSubConfigurationDataType pubSubConfiguration = CreateSubscriberConfiguration_MqttJson();
The CreateSubscriberConfiguration methods can be found in [ConsoleReferenceSubscriber/Program.cs](./Program.cs) file.
2. Create an instance of the [UaPubSubApplication Class](../../Docs/PubSub.md#uapubsubapplication-class) using the configuration data from step 1.
// Subscribe to data events
UaPubSubApplication uaPubSubApplication = UaPubSubApplication.Create(pubSubConfiguration);
3. Provide the event handler for the *DataReceived* event. This event will be raised when data sets matching the subscriber configuration arrive over the network. See the DataReceived Event section for more details.
// Create an instance of UaPubSubApplication
uaPubSubApplication.DataReceived += PubSubApplication_DataReceived;
4. Start PubSub application
// Start the publisher
uaPubSubApplication.Start();
After this step the *Subscriber* will listen for *NetworkMessages* as configured.
## Subscriber Configuration
The Subscriber configuration is a subset of the [PubSub Configuration](../../Docs/PubSub.md#pubsub-configuration). A functional *Subscriber* application needs to have a configuration (*PubSubConfgurationDataType* instance) that contains at least one connection (*PubSubConnectionDataType* instance) with at least one reader group configuration (*ReaderGroupDataType* instance). The reader group contains at least one data set reader (*DataSetReaderDataType* instance) that describes a published data set that can be processed and retrieved by the *Subscriber* application.
The diagram shows the subset of classes involved in an *OPC UA Publisher* configuration.
![SubscriberConfigClasses](../../Docs/Images/SubscriberConfigClasses.png)
+21 -11
View File
@@ -63,6 +63,7 @@ namespace Egalware.ReferenceClient
this.MenuBar = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.scanDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ServerMI = new System.Windows.Forms.ToolStripMenuItem();
this.Server_DiscoverMI = new System.Windows.Forms.ToolStripMenuItem();
this.Server_ConnectMI = new System.Windows.Forms.ToolStripMenuItem();
@@ -76,7 +77,7 @@ namespace Egalware.ReferenceClient
this.BrowseCTRL = new Opc.Ua.Client.Controls.BrowseNodeCtrl();
this.clientHeaderBranding1 = new Opc.Ua.Client.Controls.HeaderBranding();
this.timerUI = new System.Windows.Forms.Timer(this.components);
this.scanDataToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.loadConfToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MenuBar.SuspendLayout();
this.StatusBar.SuspendLayout();
this.SuspendLayout();
@@ -96,8 +97,9 @@ namespace Egalware.ReferenceClient
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.exitToolStripMenuItem,
this.scanDataToolStripMenuItem});
this.loadConfToolStripMenuItem,
this.scanDataToolStripMenuItem,
this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "&File";
@@ -109,6 +111,13 @@ namespace Egalware.ReferenceClient
this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.ExitToolStripMenuItem_Click);
//
// scanDataToolStripMenuItem
//
this.scanDataToolStripMenuItem.Name = "scanDataToolStripMenuItem";
this.scanDataToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.scanDataToolStripMenuItem.Text = "&Scan Data";
this.scanDataToolStripMenuItem.Click += new System.EventHandler(this.scanDataToolStripMenuItem_Click);
//
// ServerMI
//
this.ServerMI.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -122,21 +131,21 @@ namespace Egalware.ReferenceClient
// Server_DiscoverMI
//
this.Server_DiscoverMI.Name = "Server_DiscoverMI";
this.Server_DiscoverMI.Size = new System.Drawing.Size(180, 22);
this.Server_DiscoverMI.Size = new System.Drawing.Size(133, 22);
this.Server_DiscoverMI.Text = "Discover...";
this.Server_DiscoverMI.Click += new System.EventHandler(this.Server_DiscoverMI_Click);
//
// Server_ConnectMI
//
this.Server_ConnectMI.Name = "Server_ConnectMI";
this.Server_ConnectMI.Size = new System.Drawing.Size(180, 22);
this.Server_ConnectMI.Size = new System.Drawing.Size(133, 22);
this.Server_ConnectMI.Text = "Connect";
this.Server_ConnectMI.Click += new System.EventHandler(this.Server_ConnectMI_Click);
//
// Server_DisconnectMI
//
this.Server_DisconnectMI.Name = "Server_DisconnectMI";
this.Server_DisconnectMI.Size = new System.Drawing.Size(180, 22);
this.Server_DisconnectMI.Size = new System.Drawing.Size(133, 22);
this.Server_DisconnectMI.Text = "Disconnect";
this.Server_DisconnectMI.Click += new System.EventHandler(this.Server_DisconnectMI_Click);
//
@@ -224,12 +233,12 @@ namespace Egalware.ReferenceClient
this.clientHeaderBranding1.Size = new System.Drawing.Size(884, 75);
this.clientHeaderBranding1.TabIndex = 7;
//
// scanDataToolStripMenuItem
// loadConfToolStripMenuItem
//
this.scanDataToolStripMenuItem.Name = "scanDataToolStripMenuItem";
this.scanDataToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.scanDataToolStripMenuItem.Text = "&Scan Data";
this.scanDataToolStripMenuItem.Click += new System.EventHandler(this.scanDataToolStripMenuItem_Click);
this.loadConfToolStripMenuItem.Name = "loadConfToolStripMenuItem";
this.loadConfToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.loadConfToolStripMenuItem.Text = "&Load conf";
this.loadConfToolStripMenuItem.Click += new System.EventHandler(this.loadConfToolStripMenuItem_Click);
//
// MainForm
//
@@ -273,5 +282,6 @@ namespace Egalware.ReferenceClient
private System.Windows.Forms.ToolStripStatusLabel tsslAppVers;
private System.Windows.Forms.Timer timerUI;
private System.Windows.Forms.ToolStripMenuItem scanDataToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem loadConfToolStripMenuItem;
}
}
@@ -119,6 +119,8 @@ namespace Egalware.ReferenceClient
System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
System.Diagnostics.FileVersionInfo fvi = System.Diagnostics.FileVersionInfo.GetVersionInfo(assembly.Location);
tsslAppVers.Text = $"v.{fvi.FileVersion}";
// se trovo file di conf leggo
}
/// <summary>
@@ -228,5 +230,14 @@ namespace Egalware.ReferenceClient
// effettua selezione di ogni nodo dell'albero x esportare...
BrowseCTRL.expandAll();
}
private void loadConfToolStripMenuItem_Click(object sender, EventArgs e)
{
// apro file di conf.. x ora forzo conf a mano...
ConnectServerCTRL.ServerUrl = "opc.tcp://192.168.250.1:4840";
ConnectServerCTRL.ConnUserName = "egalware";
ConnectServerCTRL.ConnPwd = "egalware2022";
ConnectServerCTRL.UseSecurity = false;
}
}
}
@@ -27,11 +27,11 @@
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.1.25" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.1.3" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.1.22" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Core" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" Version="2.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="System.Io.Pipelines" Version="6.0.2" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
</ItemGroup>
File diff suppressed because one or more lines are too long
+106
View File
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.5" newVersion="8.0.0.5" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Primitives" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Binder" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.CommandLine" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.EnvironmentVariables" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.FileExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.FileProviders.Physical" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.DependencyInjection" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Debug" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Options.ConfigurationExtensions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Logging.Configuration" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Configuration.Json" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Extensions.Hosting.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.1" newVersion="8.0.0.1" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
+231
View File
@@ -0,0 +1,231 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{C33D677A-DDAB-41EF-831F-DC9401BC573E}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MTConnect</RootNamespace>
<AssemblyName>MTConnect</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.8.0.0\lib\net462\Microsoft.Extensions.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.Configuration.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Binder, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Binder.8.0.2\lib\net462\Microsoft.Extensions.Configuration.Binder.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.CommandLine, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.CommandLine.8.0.0\lib\net462\Microsoft.Extensions.Configuration.CommandLine.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.EnvironmentVariables, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.EnvironmentVariables.8.0.0\lib\net462\Microsoft.Extensions.Configuration.EnvironmentVariables.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.FileExtensions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.FileExtensions.8.0.1\lib\net462\Microsoft.Extensions.Configuration.FileExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.Json, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.Json.8.0.1\lib\net462\Microsoft.Extensions.Configuration.Json.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Configuration.UserSecrets, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Configuration.UserSecrets.8.0.1\lib\net462\Microsoft.Extensions.Configuration.UserSecrets.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.8.0.1\lib\net462\Microsoft.Extensions.DependencyInjection.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.DependencyInjection.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.DependencyInjection.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Diagnostics, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Diagnostics.8.0.1\lib\net462\Microsoft.Extensions.Diagnostics.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Diagnostics.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Diagnostics.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Diagnostics.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Abstractions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Abstractions.8.0.0\lib\net462\Microsoft.Extensions.FileProviders.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileProviders.Physical, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileProviders.Physical.8.0.0\lib\net462\Microsoft.Extensions.FileProviders.Physical.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.FileSystemGlobbing, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.FileSystemGlobbing.8.0.0\lib\net462\Microsoft.Extensions.FileSystemGlobbing.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Hosting, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Hosting.8.0.1\lib\net462\Microsoft.Extensions.Hosting.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Hosting.Abstractions, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Hosting.Abstractions.8.0.1\lib\net462\Microsoft.Extensions.Hosting.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.8.0.1\lib\net462\Microsoft.Extensions.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.8.0.2\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Configuration, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Configuration.8.0.1\lib\net462\Microsoft.Extensions.Logging.Configuration.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Console, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Console.8.0.1\lib\net462\Microsoft.Extensions.Logging.Console.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.Debug, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.Debug.8.0.1\lib\net462\Microsoft.Extensions.Logging.Debug.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.EventLog, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.EventLog.8.0.1\lib\net462\Microsoft.Extensions.Logging.EventLog.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Logging.EventSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Logging.EventSource.8.0.1\lib\net462\Microsoft.Extensions.Logging.EventSource.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options, Version=8.0.0.2, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.8.0.2\lib\net462\Microsoft.Extensions.Options.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Options.ConfigurationExtensions, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Options.ConfigurationExtensions.8.0.0\lib\net462\Microsoft.Extensions.Options.ConfigurationExtensions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Extensions.Primitives, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Extensions.Primitives.8.0.0\lib\net462\Microsoft.Extensions.Primitives.dll</HintPath>
</Reference>
<Reference Include="MQTTnet, Version=4.3.3.952, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.4.3.3.952\lib\net461\MQTTnet.dll</HintPath>
</Reference>
<Reference Include="MQTTnet.Extensions.ManagedClient, Version=4.3.3.952, Culture=neutral, PublicKeyToken=fdb7629f2e364a63, processorArchitecture=MSIL">
<HintPath>..\packages\MQTTnet.Extensions.ManagedClient.4.3.3.952\lib\net461\MQTTnet.Extensions.ManagedClient.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET.6.5.1\lib\net462\MTConnect.NET.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-Common, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-Common.6.5.1\lib\net462\MTConnect.NET-Common.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-HTTP, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-HTTP.6.5.1\lib\net462\MTConnect.NET-HTTP.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-JSON, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-JSON.6.5.1\lib\net462\MTConnect.NET-JSON.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-JSON-cppagent, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-JSON-cppagent.6.5.1\lib\net462\MTConnect.NET-JSON-cppagent.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-MQTT, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-MQTT.6.5.1\lib\net462\MTConnect.NET-MQTT.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-SHDR, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-SHDR.6.5.1\lib\net462\MTConnect.NET-SHDR.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-TLS, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-TLS.6.5.1\lib\net462\MTConnect.NET-TLS.dll</HintPath>
</Reference>
<Reference Include="MTConnect.NET-XML, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MTConnect.NET-XML.6.5.1\lib\net462\MTConnect.NET-XML.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net461\System.Security.Cryptography.Algorithms.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.5, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.5\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="YamlDotNet, Version=13.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
<HintPath>..\packages\YamlDotNet.13.7.1\lib\net45\YamlDotNet.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="file.log">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
<None Include="postBuildTgt.bat" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)postBuildTgt.bat" "$(ConfigurationName)" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
</Project>
+311
View File
@@ -0,0 +1,311 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.Remoting;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
using MTConnect.Clients;
using MTConnect.Observations;
using MTConnect.Streams;
using YamlDotNet.Serialization.ObjectGraphVisitors;
namespace MTConnect
{
internal class Program
{
#region Private Fields
private static MTConnectHttpClient client;
// Get the current directory
private static string currentDirectory = Directory.GetCurrentDirectory();
private static string filePath = Path.Combine(currentDirectory, "file.log");
private static string sep = "------------------------";
private static Stopwatch sw = new Stopwatch();
#endregion Private Fields
#region Private Methods
private static void Client_AssetsReceived(object sender, Assets.IAssetsResponseDocument document)
{
doLog(sep);
doLog("ASSET");
doLog(sep);
foreach (var asset in document.Assets)
{
// Print AssetId to the Console
doLog($"Asset: {asset.AssetId}");
}
doLog(sep);
doLog();
}
private static void Client_ClientStarted(object sender, EventArgs e)
{
doLog(sep);
doLog($"Client Started! | {e}");
doLog(sep);
doLog("Press ESC to exit");
}
private static void Client_ClientStopped(object sender, EventArgs e)
{
doLog(sep);
doLog($"Client Stopped! | {e}");
doLog(sep);
doLog("Press ESC to exit");
}
private static void Client_ConnectionError(object sender, Exception exc)
{
doLog(sep);
doLog($"CONNECTION ERROR returned!");
doLog($"{exc}");
doLog(sep);
doLog("Press ESC to exit");
}
private static void Client_CurrentReceived(object sender, Streams.IStreamsResponseDocument document)
{
doLog(sep);
doLog("CURRENT");
doLog(sep);
foreach (var deviceStream in document.Streams)
{
// DeviceStream
doLog($"Stream: {deviceStream.Name}");
// Component Streams
foreach (var componentStream in deviceStream.ComponentStreams)
{
processData(componentStream);
}
}
doLog(sep);
doLog();
}
private static void Client_ObservationReceived(object sender, IObservation observ)
{
doLog(sep);
doLog("OBSERVATION");
doLog(sep);
processObservation(observ);
}
private static void Client_ProbeReceived(object sender, Devices.IDevicesResponseDocument document)
{
doLog(sep);
doLog("PROBE returned");
doLog(sep);
foreach (var device in document.Devices)
{
// Device
doLog($"DEV: {device.Id}");
// All DataItems (traverse the entire Device model)
if (device.DataItems.Count() > 0)
{
foreach (var dataItem in device.GetDataItems())
{
doLog($" DItm | {dataItem.IdPath}");
}
}
// All Components (traverse the entire Device model)
if (device.Components.Count() > 0)
{
foreach (var component in device.GetComponents())
{
doLog($" Comp | {component.IdPath}");
}
}
// All Compositions (traverse the entire Device model)
if (device.Compositions.Count() > 0)
{
foreach (var composition in device.GetCompositions())
{
doLog($" Cpst | {composition.IdPath}");
}
}
}
doLog(sep);
doLog();
}
private static void Client_SampleReceived(object sender, Streams.IStreamsResponseDocument document)
{
doLog(sep);
doLog("SAMPLE");
doLog(sep);
foreach (var deviceStream in document.Streams)
{
// DeviceStream
doLog($"Stream: {deviceStream.Name}");
// Component Streams
foreach (var componentStream in deviceStream.ComponentStreams)
{
processData(componentStream);
}
}
doLog(sep);
doLog();
}
private static void doLog(string msg = "")
{
string dtMessage = $"{DateTime.Now:HH:mm:ss.fff} | {msg}";
File.AppendAllText(filePath, $"{dtMessage}{Environment.NewLine}");
Console.WriteLine(dtMessage);
}
private static void doPreliminaryProbe(string baseUrl)
{
doLog();
doLog("Call Probe");
var prbClient = new MTConnectHttpProbeClient(baseUrl);
prbClient.Timeout = 20000;
var prbDoc = prbClient.Get();
if (prbDoc == null)
{
doLog("Preliminari Probe | No answer, continue...");
}
else
{
doLog(sep);
doLog("Preliminary PROBE");
doLog(sep);
foreach (var device in prbDoc.Devices)
{
// Device
doLog($"DEV: {device.Id}");
// All DataItems (traverse the entire Device model)
if (device.DataItems.Count() > 0)
{
foreach (var dataItem in device.GetDataItems())
{
doLog($" DItm | {dataItem.IdPath}");
}
}
// All Components (traverse the entire Device model)
if (device.Components.Count() > 0)
{
foreach (var component in device.GetComponents())
{
doLog($" Comp | {component.IdPath}");
}
}
// All Compositions (traverse the entire Device model)
if (device.Compositions.Count() > 0)
{
foreach (var composition in device.GetCompositions())
{
doLog($" Cpst | {composition.IdPath}");
}
}
}
doLog(sep);
doLog();
}
}
private static void Main(string[] args)
{
// setup oggetti
//var baseUrl = "127.0.0.1:5000";
var baseUrl = "192.168.1.27:5000";
// inizio ciclo
doLog(sep);
doLog("Rest Client test application");
doLog(sep);
doPreliminaryProbe(baseUrl);
doLog("Call connection");
client = new MTConnectHttpClient(baseUrl);
// sample interval
client.Interval = 500;
// timeout x richieste
client.Timeout = 4000;
// timeout riconnessione
client.ReconnectionInterval = 5000;
// aggancio eventi
client.ClientStarted += Client_ClientStarted;
client.ClientStopped += Client_ClientStopped;
client.ConnectionError += Client_ConnectionError;
client.ProbeReceived += Client_ProbeReceived;
client.AssetsReceived += Client_AssetsReceived;
client.CurrentReceived += Client_CurrentReceived;
client.SampleReceived += Client_SampleReceived;
// conviene usare sample x avere la stessa cosa ma con altre info...
//client.ObservationReceived += Client_ObservationReceived;
// vero avvio
client.Start();
Task.Delay(5000);
doLog();
ConsoleKeyInfo answ;
doLog("Press ESC to exit");
answ = Console.ReadKey();
while (answ == null || answ.Key != ConsoleKey.Escape)
{
doLog("Press ESC to exit");
Task.Delay(1000);
answ = Console.ReadKey();
}
doLog("...closing Now!");
}
private static void processData(IComponentStream dataStream)
{
doLog($"Component {dataStream.Name} -->");
// DataItems (Samples, Events, and Conditions)
foreach (var observation in dataStream.Observations)
{
processObservation(observation);
}
}
private static void processObservation(IObservation observation)
{
string sMsg = $" - {observation.DataItemId} | {observation.Category}";
switch (observation.Category)
{
case Devices.DataItemCategory.CONDITION:
break;
case Devices.DataItemCategory.EVENT:
break;
case Devices.DataItemCategory.SAMPLE:
break;
default:
break;
}
if (observation.Values != null && observation.Values.Count() > 0)
{
foreach (var item in observation.Values)
{
sMsg += $" | {item.Key}: {item.Value}";
}
}
doLog(sMsg);
}
#endregion Private Methods
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MTConnect")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MTConnect")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("c33d677a-ddab-41ef-831f-dc9401bc573e")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+55
View File
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.Abstractions" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.Binder" version="8.0.2" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.CommandLine" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.EnvironmentVariables" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.FileExtensions" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.Json" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Configuration.UserSecrets" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="8.0.2" targetFramework="net462" />
<package id="Microsoft.Extensions.Diagnostics" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Diagnostics.Abstractions" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.FileProviders.Abstractions" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.FileProviders.Physical" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.FileSystemGlobbing" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Hosting" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Hosting.Abstractions" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.Abstractions" version="8.0.2" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.Configuration" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.Console" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.Debug" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.EventLog" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Logging.EventSource" version="8.0.1" targetFramework="net462" />
<package id="Microsoft.Extensions.Options" version="8.0.2" targetFramework="net462" />
<package id="Microsoft.Extensions.Options.ConfigurationExtensions" version="8.0.0" targetFramework="net462" />
<package id="Microsoft.Extensions.Primitives" version="8.0.0" targetFramework="net462" />
<package id="MQTTnet" version="4.3.3.952" targetFramework="net462" />
<package id="MQTTnet.Extensions.ManagedClient" version="4.3.3.952" targetFramework="net462" />
<package id="MTConnect.NET" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-Common" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-HTTP" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-JSON" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-JSON-cppagent" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-MQTT" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-SHDR" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-TLS" version="6.5.1" targetFramework="net462" />
<package id="MTConnect.NET-XML" version="6.5.1" targetFramework="net462" />
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
<package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net462" />
<package id="System.Memory" version="4.5.5" targetFramework="net462" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net462" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net462" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net462" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net462" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net462" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net462" />
<package id="System.Text.Json" version="8.0.5" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net462" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" />
<package id="YamlDotNet" version="13.7.1" targetFramework="net462" />
</packages>
+70
View File
@@ -0,0 +1,70 @@
@echo off
echo Effettua pulizia post build: configurazione %1. directory %2
RD /S /Q %2"\lib\da"
RD /S /Q %2"\lib\de"
RD /S /Q %2"\lib\es"
RD /S /Q %2"\lib\fr"
RD /S /Q %2"\lib\it"
RD /S /Q %2"\lib\ja-JP"
RD /S /Q %2"\lib\ko"
RD /S /Q %2"\lib\nl"
RD /S /Q %2"\lib\pl"
RD /S /Q %2"\lib\pt"
RD /S /Q %2"\lib\ru"
RD /S /Q %2"\lib\sv"
RD /S /Q %2"\lib\tr"
RD /S /Q %2"\lib\zh"
MOVE /Y %2"da" %2"lib\"
MOVE /Y %2"de" %2"lib\"
MOVE /Y %2"es" %2"lib\"
MOVE /Y %2"fr" %2"lib\"
MOVE /Y %2"it" %2"lib\"
MOVE /Y %2"ja-JP" %2"lib\"
MOVE /Y %2"ko" %2"lib\"
MOVE /Y %2"nl" %2"lib\"
MOVE /Y %2"pl" %2"lib\"
MOVE /Y %2"pt" %2"lib\"
MOVE /Y %2"ru" %2"lib\"
MOVE /Y %2"sv" %2"lib\"
MOVE /Y %2"tr" %2"lib\"
MOVE /Y %2"zh" %2"lib\"
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
REM INIZIO eliminando i files pdb
del /S %2"*.pdb""
del /S %2"*.xml""
del /S %2"lib/*.pdb""
echo Release: eliminato pdb + xml!!!
goto END
:Debug
echo Debug: nulla da eliminare
REM copia script verso server remoto
REM ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
:RemoteDebug
REM copia script verso server remoto
REM echo Debug remoto: effettuo robocopy sync (verificare remote per cliente)
REM IOB-WIN-SIM
REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR
REM IOBVPN4MACHINE
REM ROBOCOPY . \\10.51.90.5\Steamware\TestCli /MIR
ROBOCOPY . \\10.51.90.9\Steamware\TestCli\CLI /MIR
goto END
:END
echo Fatto!
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2" />
</startup>
</configuration>
+82
View File
@@ -0,0 +1,82 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1A4D0968-9C4B-4509-98AF-20A62DF59558}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>Mitsubishi</RootNamespace>
<AssemblyName>Mitsubishi</AssemblyName>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="postBuildTgt.bat" />
</ItemGroup>
<ItemGroup>
<COMReference Include="EZNCAUTLib">
<Guid>{1B93D6AF-FD32-4281-83FE-533F666FAE6C}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)postBuildTgt.bat" "$(ConfigurationName)" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
</Project>
+336
View File
@@ -0,0 +1,336 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime;
using System.Security.Policy;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Mitsubishi
{
internal class Program
{
static void Main(string[] args)
{
// preparo area x file test x debug successivo
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
var fPath = Directory.GetParent(appPath).FullName;
string basePath = Path.Combine(fPath, "Test");
if (!Directory.Exists(basePath))
{
Directory.CreateDirectory(basePath);
}
outPath = Path.Combine(basePath, "test.log");
File.WriteAllText(outPath, "");
bool testWrite = false;
DoLog(sep);
DoLog("Mitsubishi Client test application");
DoLog(sep);
DoLog("");
Console.WriteLine("Vuoi simulare scritture? S/N");
ConsoleKeyInfo answ = Console.ReadKey();
testWrite = answ.KeyChar == 's' || answ.KeyChar == 'S';
// obj connessione
EZNCAUTLib.DispEZNcCommunication oEZNcAutCom = null;
oEZNcAutCom = new EZNCAUTLib.DispEZNcCommunication();
// [Local variable declaration]
object BlockValue = "";
int iRet = 0;
//Open communication
iRet = oEZNcAutCom.SetTCPIPProtocol("192.168.213.199", 683);
//Console.WriteLine($"R: {iRet}");
iRet = oEZNcAutCom.Open3(5, 1, 10, "EZNC_LOCALHOST");
DoLog(sep);
DoLog("Retrieve Serial/Vers");
DoLog(sep);
int partSys = -1;
oEZNcAutCom.System_GetSystemInformation(0, out partSys);
DoLog($"PartSys: {partSys}");
int numAx = -1; ;
oEZNcAutCom.System_GetSystemInformation(1, out numAx);
DoLog($"Num Ax: {numAx}");
string serNo = "";
oEZNcAutCom.System_GetSerialNo(out serNo);
DoLog($"SerNo: {serNo}");
string pVers = "";
oEZNcAutCom.System_GetVersion(0, 0, out pVers);
DoLog($"Vers 0: {pVers}");
oEZNcAutCom.System_GetVersion(0, 1, out pVers);
DoLog($"Vers 1: {pVers}");
oEZNcAutCom.System_GetVersion(0, 2, out pVers);
DoLog($"Vers 2: {pVers}");
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test DateTime");
DoLog(sep);
// preparo memorie
int pDate = 0;
int pTime = 0;
try
{
oEZNcAutCom.Time_GetClockData(out pDate, out pTime);
DoLog($"Date-Time | D: {pDate} | T: {pTime}");
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test Program");
DoLog(sep);
// preparo memorie
string prgText = "";
int prgState = 0;
// solo nome...
iRet = oEZNcAutCom.Program_GetProgramNumber2((Int32)PROGRAMTYPE.EZNC_MAINPRG, out String strProgramNo);
DoLog($"ProgramName: {strProgramNo}");
DoLog("");
// leggo contenuto
try
{
oEZNcAutCom.Program_CurrentBlockRead(10, out prgText, out prgState);
DoLog($"Program {prgState} | {prgText}");
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test CycleTyme");
DoLog(sep);
// preparo memorie
int plTime = 0;
try
{
oEZNcAutCom.Status_GetCycleTime(out plTime);
DoLog($"GetCycleTime | Time: {plTime}");
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test Lettura posizioni");
DoLog(sep);
double pdPosit = 0;
for (int i = 1; i < 4; i++)
{
iRet = oEZNcAutCom.Position_GetCurrentPosition(i, out pdPosit);
DoLog($"Pos: {i} | {pdPosit}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test scrittura Var500");
DoLog(sep);
// NB: max 7 char!!!
if (testWrite)
{
oEZNcAutCom.CommonVariable_SetName(500, "ODL");
oEZNcAutCom.CommonVariable_SetName(501, "CodArt");
oEZNcAutCom.CommonVariable_SetName(502, "NumPz");
oEZNcAutCom.CommonVariable_SetName(503, "");
oEZNcAutCom.CommonVariable_Write2(500, 105, 1);
oEZNcAutCom.CommonVariable_Write2(501, 205, 1);
oEZNcAutCom.CommonVariable_Write2(502, 305, 1);
oEZNcAutCom.CommonVariable_Write2(503, 0, 1);
}
DoLog("CommonVariable 500..503 Write Done!");
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test lettura Var500");
DoLog(sep);
string varName = "";
double pData = 0;
int pType = 0;
for (int i = 500; i < 505; i++)
{
oEZNcAutCom.CommonVariable_GetName(i, out varName);
oEZNcAutCom.CommonVariable_Read2(i, out pData, out pType);
DoLog($"Var: {i} | {varName} | val: {pData} | type: {pType}");
}
DoLog(sep);
DoLog("");
// lettura lampade
DoLog(sep);
DoLog("Test lettura lampade Y60..Y63");
DoLog(sep);
object pvRead = "bbb";
int sec = 53;
Dictionary<string, string> DictLamp = new Dictionary<string, string>();
//Y60 --> 10000+96
int subSec = 10096;
for (int j = 0; j < 5; j++)
{
for (int i = 0; i < 4; i++)
{
oEZNcAutCom.Generic_ReadData(0, sec, subSec + i, ref pvRead);
DictLamp.Add($"{subSec + i}", $"{pvRead}");
}
StringBuilder sb = new StringBuilder();
foreach (var item in DictLamp)
{
sb.Append($"{item.Key}:{item.Value} | ");
}
DoLog($"Lamp: Generic ReadData | sec: {sec} | {sb.ToString()}");
Thread.Sleep(100);
DictLamp = new Dictionary<string, string>();
}
DoLog(sep);
DoLog("");
// lettura parametri (pzcount)
DoLog(sep);
DoLog("Test Parametri");
DoLog(sep);
int lAxis = 0;
int startPar = 8001;
if (testWrite)
{
// scrivo pz req a 100...
String[] sValue = new String[1];
sValue[0] = "101";
oEZNcAutCom.Parameter_SetData3(0, 8003, lAxis, (object)sValue);
}
object parValue = "www";
try
{
oEZNcAutCom.Parameter_GetData3(0, startPar, 3, lAxis, out parValue);
string[] rawData = (string[])parValue;
DoLog($"Found {rawData.Count()} values");
int i = 0;
foreach (var item in rawData)
{
DoLog($"Params | #: {startPar + i} | {item}");
i++;
}
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test Allarmi");
DoLog(sep);
// preparo memorie
Array plSystem = new long[1];
Array pbWarning = new bool[1];
Array plAlarmType = new long[1];
string pbstrBuffer = "";
try
{
for (int i = 0; i < 5; i++)
{
oEZNcAutCom.System_GetAlarm2(1, i, out pbstrBuffer);
DoLog($"Alarm {i}: {pbstrBuffer}");
}
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test Feed");
DoLog(sep);
// preparo memorie
double feed = 0;
try
{
for (int i = 0; i <= 5; i++)
{
oEZNcAutCom.Position_GetFeedSpeed(i, out feed);
DoLog($"FeedSpeed {i}: {feed}");
oEZNcAutCom.Command_GetFeedCommand(i, out feed);
DoLog($"FeedCommand {i}: {feed}");
}
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
DoLog(sep);
DoLog("Test RunStatus");
DoLog(sep);
// preparo memorie
int plStatus = 0;
try
{
for (int i = 0; i < 4; i++)
{
oEZNcAutCom.Status_GetRunStatus(i, out plStatus);
DoLog($"GetRunStatus | Idx: {i} | Status: {plStatus}");
}
}
catch (Exception exc)
{
DoLog($"{exc}");
}
DoLog(sep);
DoLog("");
// Close.
iRet = oEZNcAutCom.Close();
//Release object
oEZNcAutCom = null;
DoLog("Press enter to close");
Console.ReadLine();
}
protected static void DoLog(string logMessage)
{
File.AppendAllText(outPath, $"{logMessage}{Environment.NewLine}");
Console.WriteLine(logMessage);
}
public enum PROGRAMTYPE
{
EZNC_MAINPRG = 0, //メインプログラム
EZNC_SUBPRG = 1, //サブプログラム
}
protected static string outPath = "";
private static string sep = "------------------------";
private static Stopwatch sw = new Stopwatch();
}
}
+33
View File
@@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Mitsubishi")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mitsubishi")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1a4d0968-9c4b-4509-98af-20a62df59558")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+70
View File
@@ -0,0 +1,70 @@
@echo off
echo Effettua pulizia post build: configurazione %1. directory %2
RD /S /Q %2"\lib\da"
RD /S /Q %2"\lib\de"
RD /S /Q %2"\lib\es"
RD /S /Q %2"\lib\fr"
RD /S /Q %2"\lib\it"
RD /S /Q %2"\lib\ja-JP"
RD /S /Q %2"\lib\ko"
RD /S /Q %2"\lib\nl"
RD /S /Q %2"\lib\pl"
RD /S /Q %2"\lib\pt"
RD /S /Q %2"\lib\ru"
RD /S /Q %2"\lib\sv"
RD /S /Q %2"\lib\tr"
RD /S /Q %2"\lib\zh"
MOVE /Y %2"da" %2"lib\"
MOVE /Y %2"de" %2"lib\"
MOVE /Y %2"es" %2"lib\"
MOVE /Y %2"fr" %2"lib\"
MOVE /Y %2"it" %2"lib\"
MOVE /Y %2"ja-JP" %2"lib\"
MOVE /Y %2"ko" %2"lib\"
MOVE /Y %2"nl" %2"lib\"
MOVE /Y %2"pl" %2"lib\"
MOVE /Y %2"pt" %2"lib\"
MOVE /Y %2"ru" %2"lib\"
MOVE /Y %2"sv" %2"lib\"
MOVE /Y %2"tr" %2"lib\"
MOVE /Y %2"zh" %2"lib\"
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
REM INIZIO eliminando i files pdb
del /S %2"*.pdb""
del /S %2"*.xml""
del /S %2"lib/*.pdb""
echo Release: eliminato pdb + xml!!!
goto END
:Debug
echo Debug: nulla da eliminare
REM copia script verso server remoto
REM ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
:RemoteDebug
REM copia script verso server remoto
REM echo Debug remoto: effettuo robocopy sync (verificare remote per cliente)
REM IOB-WIN-SIM
REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR
REM IOBVPN4MACHINE
REM ROBOCOPY . \\10.51.90.5\Steamware\TestCli /MIR
ROBOCOPY . \\10.51.90.6\Steamware\TestCli /MIR
goto END
:END
echo Fatto!
+16 -1
View File
@@ -1,3 +1,18 @@
# Mapo-IOB-Test
Progetti testing x area IOB (es test siemens, test Beckhoff...)
Progetti testing x area IOB (es test siemens, test Beckhoff...).
## Standard Tecnici
Il progetto impiega i seguenti standard tecnici:
- C# (W-IOB)
- nuget packages
Alcuni progetti di base sono netFramework, i più recenti (CLI based) sono netCore 6.0 / 8.0
## Versions
| rel | Date | Note |
|--|--|--|
| 3.6.* | 2020+ | inizio progetto dentro IOB-WIN-NEXT e TEST |
| 3.7.24* | 2024.12.23 | Spostamento progetti client test (CLI, net 6.0/8.0) repository separato da IOB-WIN-NEXT |
BIN
View File
Binary file not shown.
+52
View File
@@ -0,0 +1,52 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mitsubishi", "Mitsubishi\Mitsubishi.csproj", "{1A4D0968-9C4B-4509-98AF-20A62DF59558}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestAppCitizen", "RestAppCitizen\RestAppCitizen.csproj", "{F206B5DB-E062-417E-BF29-197FB8111DCD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MTConnect", "MTConnect\MTConnect.csproj", "{C33D677A-DDAB-41EF-831F-DC9401BC573E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shelly", "Shelly\Shelly.csproj", "{C67A4DD0-C11D-428A-951E-C83BA143DBB4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Remote_DEBUG|Any CPU = Remote_DEBUG|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Release|Any CPU.Build.0 = Release|Any CPU
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{1A4D0968-9C4B-4509-98AF-20A62DF59558}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Release|Any CPU.Build.0 = Release|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Remote_DEBUG|Any CPU.ActiveCfg = Release|Any CPU
{F206B5DB-E062-417E-BF29-197FB8111DCD}.Remote_DEBUG|Any CPU.Build.0 = Release|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Release|Any CPU.Build.0 = Release|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{C33D677A-DDAB-41EF-831F-DC9401BC573E}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Release|Any CPU.Build.0 = Release|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Remote_DEBUG|Any CPU.ActiveCfg = Release|Any CPU
{C67A4DD0-C11D-428A-951E-C83BA143DBB4}.Remote_DEBUG|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DC9CC892-232E-4D99-8C91-07F023E0F4FE}
EndGlobalSection
EndGlobal
+99
View File
@@ -0,0 +1,99 @@
// See https://aka.ms/new-console-template for more information
using System.Diagnostics;
using System.Dynamic;
using Newtonsoft.Json;
internal class Program
{
private static void Main(string[] args)
{
Console.WriteLine(sep);
Console.WriteLine("Rest Client test application");
Console.WriteLine(sep);
Console.WriteLine();
Console.WriteLine("Call connection");
// setup oggetti
int tOut = 60;
string apiUrl = "http://192.168.80.61:8733/DRIVER_MES/rest/";
rCall = new RestCaller(apiUrl, tOut);
// chiamate!
CallAndLog("checkconnection");
string token = CallAndLog("gettoken/mecmaticames/mecmatica@mes").Replace("\"", "");
string gLamp = CallAndLog($"getsingleladderio/{token}/Y/8E");
string yLamp = CallAndLog($"getsingleladderio/{token}/Y/21");
string rLamp = CallAndLog($"getsingleladderio/{token}/Y/22");
string qtyTot = CallAndLog($"gettotalquantity/{token}");
string qtyReq = CallAndLog($"getneededquantity/{token}");
string qtyWrk = CallAndLog($"getworkedquantity/{token}");
string cTime = CallAndLog($"getcycletime/{token}");
string pName = CallAndLog($"getmainprogram/{token}");
string cAlarm = CallAndLog($"getalarm/{token}");
var sAlarm = JsonConvert.DeserializeObject<WarnInfo>(cAlarm);
cAlarm = JsonConvert.SerializeObject(sAlarm, Formatting.Indented);
string allAlarm = CallAndLog($"getallalarmlog/{token}");
var alarmList = JsonConvert.DeserializeObject<List<AlarmInfo>>(allAlarm);
allAlarm = JsonConvert.SerializeObject(alarmList, Formatting.Indented);
string err = CallAndLog($"getsingleladderio/ABC/Y/22");
// ora scrivo i files dei test x debug successivo
var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
var fPath = Directory.GetParent(appPath).FullName;
string basePath = Path.Combine(fPath, "Test");
if (!Directory.Exists(basePath))
{
Directory.CreateDirectory(basePath);
}
File.WriteAllText(Path.Combine(basePath, "token.txt"), token);
File.WriteAllText(Path.Combine(basePath, "gLamp.txt"), gLamp);
File.WriteAllText(Path.Combine(basePath, "yLamp.txt"), yLamp);
File.WriteAllText(Path.Combine(basePath, "rLamp.txt"), rLamp);
File.WriteAllText(Path.Combine(basePath, "qtyTot.txt"), qtyTot);
File.WriteAllText(Path.Combine(basePath, "qtyReq.txt"), qtyReq);
File.WriteAllText(Path.Combine(basePath, "qtyWrk.txt"), qtyWrk);
File.WriteAllText(Path.Combine(basePath, "cTime.txt"), cTime);
File.WriteAllText(Path.Combine(basePath, "pName.txt"), pName);
File.WriteAllText(Path.Combine(basePath, "cAlarm.txt"), cAlarm);
File.WriteAllText(Path.Combine(basePath, "allAlarm.txt"), allAlarm);
}
private static RestCaller rCall { get; set; } = new RestCaller("http://localhost", 60);
private static string sep = "------------------------";
private static Stopwatch sw = new Stopwatch();
private static string CallAndLog(string fullUri)
{
sw.Restart();
Console.WriteLine(sep);
Console.WriteLine($"Calling: {fullUri}");
// chiamo
string answ = rCall.ExecuteCallGet(fullUri);
sw.Stop();
// loggo
Console.WriteLine(answ);
Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds}");
Console.WriteLine(sep);
Console.WriteLine();
return answ;
}
}
internal class AlarmInfo
{
public int id { get; set; } = 0;
public string? ErrorMessage { get; set; } = null;
public DateTime date { get; set; } = DateTime.Today.AddYears(-10);
public string message { get; set; } = "";
public string type { get; set; } = "";
}
internal class WarnInfo
{
public bool IsAlarm { get; set; } = false;
public bool IsCaution { get; set; } = false;
public string? ErrorMessage { get; set; } = null;
public string message { get; set; } = "";
}
+15
View File
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>
</Project>
+62
View File
@@ -0,0 +1,62 @@
using RestSharp;
public class RestCaller
{
/// <summary>
/// Classe gestione chiamate REST
/// </summary>
/// <param name="ApiUrl"></param>
/// <param name="TimeOutSec"></param>
public RestCaller(string ApiUrl, int TimeOutSec)
{
tOut = TimeOutSec;
apiUrl = ApiUrl;
restOptStd = new RestClientOptions
{
Timeout = TimeSpan.FromSeconds(tOut),
BaseUrl = new Uri(apiUrl)
};
}
/// <summary>
/// Esecuzione chiamata Rest tipo GET
/// </summary>
/// <param name="resource"></param>
/// <returns></returns>
public string ExecuteCallGet(string resource)
{
string answ = "";
if (!string.IsNullOrEmpty(resource))
{
// client chiamate rest
using (var client = new RestClient(restOptStd))
{
var currReq = new RestRequest(resource, Method.Get);
// currReq.AddHeader("Content-type", "application/xml");
currReq.AddHeader("Content-type", "application/json");
// effettuo vera chiamata
var currResp = client.Get(currReq);
if (currResp.StatusCode == System.Net.HttpStatusCode.OK && currResp.Content != null)
{
answ = $"{currResp.Content}";
}
}
}
return answ;
}
protected string apiUrl = "";
protected int tOut = 60;
/// <summary>
/// Conf client RestSharp standard:
/// - timeout 1 min
/// </summary>
private RestClientOptions restOptStd = new RestClientOptions { Timeout = TimeSpan.FromSeconds(60) };
}
File diff suppressed because one or more lines are too long
+1
View File
@@ -0,0 +1 @@
{"ErrorMessage":null,"IsAlarm":false,"IsCaution":true,"message":"CAUTION ON MACHINE"}
+1
View File
@@ -0,0 +1 @@
56
+1
View File
@@ -0,0 +1 @@
{"Address":"8E","Description":"","ErrorMessage":null,"IOType":"Y","VarValue":"0"}
View File
+1
View File
@@ -0,0 +1 @@
500
+1
View File
@@ -0,0 +1 @@
500
+1
View File
@@ -0,0 +1 @@
0
+1
View File
@@ -0,0 +1 @@
{"Address":"22","Description":"","ErrorMessage":null,"IOType":"Y","VarValue":"0"}
+1
View File
@@ -0,0 +1 @@
6d65636d61746963616d6573c2a76d65636d6174696361406d6573c2a731
+1
View File
@@ -0,0 +1 @@
{"Address":"21","Description":"","ErrorMessage":null,"IOType":"Y","VarValue":"0"}
+14
View File
@@ -0,0 +1,14 @@
using Shelly.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Clients
{
public interface IShelly1
{
Task<ShellyResult<ShellyGen2StatusDto>> GetStatus(CancellationToken cancellationToken, TimeSpan? timeout = null);
}
}
+14
View File
@@ -0,0 +1,14 @@
using Shelly.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Clients
{
public interface IShelly1Pm
{
Task<ShellyResult<Shelly1PmStatusDto>> GetStatus(CancellationToken cancellationToken, TimeSpan? timeout = null);
}
}
+25
View File
@@ -0,0 +1,25 @@
using Flurl;
using Shelly.DTO;
using Shelly.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Clients
{
public class Shelly1Client : ShellyClientBase, IShelly1
{
public Shelly1Client(HttpClient httpClient, Shelly1Options shelly1Options) : base(httpClient, shelly1Options)
{
}
public async Task<ShellyResult<ShellyGen2StatusDto>> GetStatus(CancellationToken cancellationToken, TimeSpan? timeout = null)
{
var endpoint = ServerUri.AppendPathSegment("status");
var requestMessage = new HttpRequestMessage(HttpMethod.Get, endpoint);
return await ExecuteRequestAsync<ShellyGen2StatusDto>(requestMessage, cancellationToken, timeout);
}
}
}
+33
View File
@@ -0,0 +1,33 @@
using Flurl;
using Shelly.DTO;
using Shelly.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace Shelly.Clients
{
public class Shelly1PmClient : ShellyClientBase, IShelly1Pm
{
public Shelly1PmClient(HttpClient httpClient, Shelly1PmOptions shellyOptions) : base(httpClient, shellyOptions)
{
}
public async Task<ShellyResult<Shelly1PmStatusDto>> GetStatus(CancellationToken cancellationToken, TimeSpan? timeout = null)
{
var endpoint = ServerUri.AppendPathSegment("Shelly.GetStatus");
var requestMessage = new HttpRequestMessage(HttpMethod.Get, endpoint);
return await ExecuteRequestAsync<Shelly1PmStatusDto>(requestMessage, cancellationToken, timeout);
}
public async Task<ShellyResult<DTO.Shelly1PM.SwitchDto>> GetSwitchStatus(CancellationToken cancellationToken, int id, TimeSpan? timeout = null)
{
var endpoint = ServerUri.AppendPathSegment("Switch.GetStatus").AppendQueryParam("id",id);
var requestMessage = new HttpRequestMessage(HttpMethod.Get, endpoint);
return await ExecuteRequestAsync<DTO.Shelly1PM.SwitchDto>(requestMessage, cancellationToken, timeout);
}
}
}
+84
View File
@@ -0,0 +1,84 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Shelly.Options;
using Newtonsoft.Json;
namespace Shelly.Clients
{
public abstract class ShellyClientBase
{
protected readonly HttpClient ShellyHttpClient;
private readonly IShellyCommonOptions _shellyCommonOptions;
protected readonly Uri ServerUri;
protected TimeSpan DefaultTimeout = TimeSpan.FromSeconds(5);
public ShellyClientBase(HttpClient httpClient, IShellyCommonOptions shellyCommonOptions)
{
if (httpClient == null) throw new ArgumentNullException(nameof(httpClient));
if (shellyCommonOptions == null) throw new ArgumentNullException(nameof(shellyCommonOptions));
ShellyHttpClient = httpClient;
_shellyCommonOptions = shellyCommonOptions;
ServerUri = shellyCommonOptions.ServerUri;
if (shellyCommonOptions.DefaultTimeout.HasValue)
{
DefaultTimeout = shellyCommonOptions.DefaultTimeout.Value;
}
}
protected async Task<ShellyResult<T>> ExecuteRequestAsync<T>(HttpRequestMessage httpRequestMessage,
CancellationToken cancellationToken, TimeSpan? timeout = null)
{
timeout = timeout ?? DefaultTimeout;
using (var timeoutTokenSource = new CancellationTokenSource(timeout.Value))
{
var authenticationString = $"{_shellyCommonOptions.UserName}:{_shellyCommonOptions.Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(Encoding.ASCII.GetBytes(authenticationString));
httpRequestMessage.Headers.Authorization = new AuthenticationHeaderValue("Basic", base64EncodedAuthenticationString);
var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutTokenSource.Token, cancellationToken);
var response = await ShellyHttpClient.SendAsync(httpRequestMessage, linkedTokenSource.Token);
if (response.StatusCode == 0)
{
// Status code of 0 means timeout reached
return ShellyResult<T>.TransientFailure("Device did not respond within timeout period");
}
if (response.StatusCode == HttpStatusCode.ServiceUnavailable)
{
return ShellyResult<T>.TransientFailure("Device responded with ServiceUnavailable");
}
if (response.StatusCode == HttpStatusCode.NotFound)
{
return ShellyResult<T>.Success(default, "Device responded with NotFound");
}
if (response.StatusCode != HttpStatusCode.OK)
{
return ShellyResult<T>.Failure($"Device responded with http status code {response.StatusCode}");
}
return await HandleOkResponse<T>(response);
}
}
protected virtual async Task<ShellyResult<T>> HandleOkResponse<T>(HttpResponseMessage response)
{
var readAsStringAsync = await response.Content.ReadAsStringAsync();
var shelly1Status = JsonConvert.DeserializeObject<T>(readAsStringAsync);
return ShellyResult<T>.Success(shelly1Status);
}
}
}
+18
View File
@@ -0,0 +1,18 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO.Shelly1PM
{
public class BaseServiceDto
{
/// <summary>
/// Connection State
/// </summary>
[JsonProperty("connected")]
public bool Connected { get; set; }
}
}
+19
View File
@@ -0,0 +1,19 @@
using Newtonsoft.Json;
using Shelly.DTO.Shelly1PM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
public class CloudDto :BaseServiceDto
{
/// <summary>
/// Define if service is enabled
/// </summary>
[JsonProperty("enabled")]
public bool Enabled { get; set; } = true;
}
}
+33
View File
@@ -0,0 +1,33 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO.Shelly1PM
{
/// <summary>
/// Energy Info
/// </summary>
public class EnergyDto
{
/// <summary>
/// Total returned energy consumed in Watt-hours
/// </summary>
[JsonProperty("total")]
public double Total { get; set; }
/// <summary>
/// Returned energy in Milliwatt-hours for the last three complete minutes. The 0-th element indicates the counts accumulated during the minute preceding minute_ts. Present only if the device clock is synced.
/// </summary>
[JsonProperty("by_minute")]
public double[] LastByMinute { get; set; }
/// <summary>
/// Unix timestamp marking the start of the current minute (in UTC).
/// </summary>
[JsonProperty("minute_ts")]
public long TimeStamp { get; set; }
}
}
+27
View File
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO.Shelly1PM
{
/// <summary>
/// Input info
/// </summary>
public class InputDto
{
/// <summary>
/// Id of the Input component instance
/// </summary>
[JsonProperty("id")]
public int Id { get; set; }
/// <summary>
/// Current State(only for type switch, button) State of the input (null if the input instance is stateless, i.e. for type button)
/// </summary>
[JsonProperty("state")]
public bool State { get; set; }
}
}
+72
View File
@@ -0,0 +1,72 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO.Shelly1PM
{
public class SwitchDto
{
/// <summary>
/// Id of the Switch component instance
/// </summary>
[JsonProperty("id")]
public int Id { get; set; } = 0;
/// <summary>
/// Source of the last command, for example: init, WS_in, http, ...
/// </summary>
[JsonProperty("source")]
public string Source { get; set; } = "";
/// <summary>
/// Output status: rue if the output channel is currently on, false otherwise
/// </summary>
[JsonProperty("output")]
public bool Output { get; set; }
/// <summary>
/// Last measured instantaneous active power(in Watts) delivered to the attached load(shown if applicable)
/// </summary>
[JsonProperty("apower")]
public double Power { get; set; }
/// <summary>
/// Last measured voltage in Volts (shown if applicable)
/// </summary>
[JsonProperty("voltage")]
public double Voltage { get; set; }
/// <summary>
/// Last measured current in Amperes (shown if applicable)
/// </summary>
[JsonProperty("current")]
public double Current { get; set; }
/// <summary>
/// Information about the active energy counter (shown if applicable)
/// </summary>
[JsonProperty("aenergy")]
public EnergyDto? ActEnergy { get; set; }
/// <summary>
/// Information about the returned active energy counter * (shown if applicable)
/// </summary>
[JsonProperty("ret_aenergy")]
public EnergyDto? RetEnergy { get; set; }
/// <summary>
/// Information about the temperature (shown if applicable)
/// </summary>
[JsonProperty("temperature")]
public TemperatureDto? Temperature { get; set; }
/// <summary>
/// Error conditions occurred. May contain overtemp, overpower, overvoltage, undervoltage, (shown if at least one error is present)
/// </summary>
[JsonProperty("errors")]
public string[]? Errors { get; set; }
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Shelly.DTO.Shelly1PM;
namespace Shelly.DTO
{
/// <summary>
/// Extended information for the Shelly1PM
/// https://shelly-api-docs.shelly.cloud/gen2/Devices/Gen3/Shelly1PMG3
/// </summary>
public class Shelly1PmStatusDto : ShellyGen2StatusDto
{
/// <summary>
/// Input channel
/// </summary>
[JsonProperty("input:0")]
public InputDto? Input { get; set; }
/// <summary>
/// Switch 0 data
/// </summary>
[JsonProperty("switch:0")]
public SwitchDto? Switch { get; set; }
}
}
+49
View File
@@ -0,0 +1,49 @@
using Newtonsoft.Json;
using Shelly.DTO.Shelly1PM;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
/// <summary>
/// Shelly Gen2 device status data
/// https://shelly-api-docs.shelly.cloud/gen2/#status
/// </summary>
public class ShellyGen2StatusDto
{
/// <summary>
/// WiFi data
/// </summary>
[JsonProperty("wifi")]
public WifiDto? WiFiStatus { get; set; }
/// <summary>
/// Shelly Cloud state
/// </summary>
[JsonProperty("cloud")]
public CloudDto? ShellyCloud { get; set; }
/// <summary>
/// MQTT queue state
/// </summary>
[JsonProperty("mqtt")]
public BaseServiceDto? MQTT { get; set; }
/// <summary>
/// Sys Info data
/// </summary>
[JsonProperty("sys")]
public SysDto? SysInfo { get; set; }
/// <summary>
/// WS state
/// </summary>
[JsonProperty("ws")]
public BaseServiceDto? WebSocket { get; set; }
}
}
+106
View File
@@ -0,0 +1,106 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
/// <summary>
/// System Info
/// </summary>
public class SysDto
{
/// <summary>
/// Mac address of the device
/// </summary>
[JsonProperty("mac")]
public string Mac { get; set; } = "";
/// <summary>
/// True if restart is required, false otherwise
/// </summary>
[JsonProperty("restart_required")]
public bool RestartRequired { get; set; } = false;
/// <summary>
/// Current time in the format HH:MM (24-hour time format in the current timezone with leading zero). null when time is not synced from NTP server.
/// </summary>
[JsonProperty("time")]
public string Time { get; set; } = "";
/// <summary>
/// Unix timestamp (in UTC), null when time is not synced from NTP server.
/// </summary>
[JsonProperty("unixtime")]
public int UnixTime { get; set; } = 0;
/// <summary>
/// Time in seconds since last reboot
/// </summary>
[JsonProperty("uptime")]
public int Uptime { get; set; } = 0;
/// <summary>
/// Total size of the RAM in the system in Bytes
/// </summary>
[JsonProperty("ram_size")]
public int RamSize { get; set; } = 0;
/// <summary>
/// Size of the free RAM in the system in Bytes
/// </summary>
[JsonProperty("ram_free")]
public int RamFree { get; set; } = 0;
/// <summary>
/// Total size of the file system in Bytes
/// </summary>
[JsonProperty("fs_size")]
public int FSSize { get; set; } = 0;
/// <summary>
/// Size of the free file system in Bytes
/// </summary>
[JsonProperty("fs_free")]
public int FSFree { get; set; } = 0;
/// <summary>
/// Configuration revision number
/// </summary>
[JsonProperty("cfg_rev")]
public int CfgRev { get; set; } = 0;
/// <summary>
/// KVS (Key-Value Store) revision number
/// </summary>
[JsonProperty("kvs_rev")]
public int KvsRev { get; set; } = 0;
/// <summary>
/// Schedules revision number, present if schedules are enabled
/// </summary>
[JsonProperty("schedule_rev")]
public int ScheduleRev { get; set; } = 0;
/// <summary>
/// Webhooks revision number, present if webhooks are enabled
/// </summary>
[JsonProperty("webhook_rev")]
public int WebhookRev { get; set; } = 0;
/// <summary>
/// Webhooks revision number, present if webhooks are enabled
/// </summary>
[JsonProperty("available_updates")]
public UpdateDto AvailUpdates { get; set; }
/// <summary>
/// Information about reset type and cause
/// </summary>
[JsonProperty("reset_reason")]
public int ResetReason { get; set; } = 0;
}
}
+24
View File
@@ -0,0 +1,24 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
public class TemperatureDto
{
/// <summary>
/// Temperature in Celsius (null if the temperature is out of the measurement range)
/// </summary>
[JsonProperty("tC")]
public double? Celsius { get; set; }
/// <summary>
/// Temperature in Fahrenheit (null if the temperature is out of the measurement range)
/// </summary>
[JsonProperty("tF")]
public double? Fahrenheit { get; set; }
}
}
+27
View File
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
/// <summary>
/// Info about sw update
/// </summary>
public class UpdateDto
{
/// <summary>
/// Shown only if beta update is available
/// </summary>
[JsonProperty("beta")]
public VersDto Beta { get; set; }
/// <summary>
/// Shown only if beta update is available
/// </summary>
[JsonProperty("stable")]
public VersDto Stable { get; set; }
}
}
+18
View File
@@ -0,0 +1,18 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
public class VersDto
{
/// <summary>
/// Version of the new firmware
/// </summary>
[JsonProperty("version")]
public string Version { get; set; } = "";
}
}
+45
View File
@@ -0,0 +1,45 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.DTO
{
/// <summary>
/// WiFi status info
/// </summary>
public class WifiDto
{
/// <summary>
/// Ip of the device in the network (null if disconnected)
/// </summary>
[JsonProperty("sta_ip")]
public string StaIp { get; set; } = "";
/// <summary>
/// Status of the connection. Range of values: disconnected, connecting, connected, got ip
/// </summary>
[JsonProperty("status")]
public string Status { get; set; } = "";
/// <summary>
/// SSID of the network (null in case of hidden network)
/// </summary>
[JsonProperty("ssid")]
public string SSID { get; set; } = "";
/// <summary>
/// Strength of the signal in dBms
/// </summary>
[JsonProperty("rssi")]
public int RSSI { get; set; } = 0;
/// <summary>
/// Number of clients connected to the access point. Present only when AP is enabled and range extender functionality is present and enabled.
/// </summary>
[JsonProperty("ap_client_count")]
public int NumClients { get; set; } = 0;
}
}
+17
View File
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Options
{
/// <summary>
/// Common authentication options across all shelly devices
/// </summary>
public interface IShellyAuthOptions
{
string UserName { get; }
string Password { get; }
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Options
{
/// <summary>
/// Common options across all shelly devices
/// </summary>
public interface IShellyCommonOptions : IShellyAuthOptions
{
/// <summary>
/// URI for the Shelly device
/// </summary>
Uri ServerUri { get; }
/// <summary>
/// Default timeout for HTTP requests if a specific timeout is not supplied
/// </summary>
TimeSpan? DefaultTimeout { get; }
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Options
{
public class Shelly1Options : IShellyCommonOptions
{
public Uri ServerUri { get; set; }
public TimeSpan? DefaultTimeout { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Shelly1Options()
{
DefaultTimeout = null;
}
}
}
+21
View File
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly.Options
{
public class Shelly1PmOptions : IShellyCommonOptions
{
public Uri ServerUri { get; set; }
public TimeSpan? DefaultTimeout { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public Shelly1PmOptions()
{
DefaultTimeout = null;
}
}
}
+59
View File
@@ -0,0 +1,59 @@
// See https://aka.ms/new-console-template for more information
using Newtonsoft.Json;
using Shelly;
using Shelly.Clients;
using Shelly.Options;
using System.Diagnostics;
Console.WriteLine("Start shelly test!");
//// caffè
//var shellyAddr = "10.74.81.72";
//APC
var shellyAddr = "10.74.81.71";
Shelly1PmOptions options = new Shelly1PmOptions()
{
DefaultTimeout = TimeSpan.FromSeconds(5),
ServerUri = new Uri($"http://{shellyAddr}/rpc")
};
var shelly = new Shelly1PmClient(new HttpClient(), options);
Stopwatch sw = new Stopwatch();
while (true)
{
sw.Restart();
var response = await shelly.GetStatus(CancellationToken.None);
sw.Stop();
try
{
Console.WriteLine($"Success: {response.IsSuccess}");
if (response.Value != null)
{
//Console.WriteLine($"Switch | Power: {response.Value.Switch.Power} | Current: {response.Value.Switch.Current} | Voltage: {response.Value.Switch.Voltage}");
//Console.WriteLine($"ActEnergy.Total: {response.Value.Switch.ActEnergy.Total}");
//Console.WriteLine($"Input: {response.Value.Input.Id} | state {response.Value.Input.State}");
//Console.WriteLine($"Cloud: {response.Value.ShellyCloud.Connected}");
//Console.WriteLine();
Console.WriteLine(JsonConvert.SerializeObject(response.Value, Formatting.Indented));
Console.WriteLine($"Elapsed: {sw.Elapsed.TotalMilliseconds:N3}ms");
Console.WriteLine();
}
else
{
Console.WriteLine("Empty value!");
}
}
catch { }
Thread.Sleep(TimeSpan.FromSeconds(1));
sw.Restart();
var respSwitch = await shelly.GetSwitchStatus(CancellationToken.None, 0);
sw.Stop();
Console.WriteLine($"Success: {respSwitch.IsSuccess}");
Console.WriteLine(JsonConvert.SerializeObject(respSwitch.Value, Formatting.Indented));
Console.WriteLine($"Elapsed: {sw.Elapsed.TotalMilliseconds:N3}ms");
Console.WriteLine();
Thread.Sleep(TimeSpan.FromSeconds(3));
}
+16
View File
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Flurl" Version="4.0.0" />
<PackageReference Include="Flurl.Http" Version="4.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
+78
View File
@@ -0,0 +1,78 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Shelly
{
public class ShellyResult<T>
{
public T Value
{
get
{
if (!_successChecked)
{
throw new InvalidOperationException("Cannot access value of result without checking success first");
}
return _value;
}
}
/// <summary>
/// Indicates the client request has completed successfully
/// </summary>
public bool IsSuccess
{
get
{
_successChecked = true;
return _success;
}
}
/// <summary>
/// Indicates the client request has failed
/// </summary>
public bool IsFailure => !IsSuccess;
/// <summary>
/// Indicates if the reason for failure is transient
/// </summary>
public bool IsTransient { get; private set; }
/// <summary>
/// Any message that accompanies this result
/// </summary>
public string Message { get; }
private T _value;
private bool _successChecked = false;
private bool _success = false;
private ShellyResult(T value, bool success, bool isTransient, string message = null)
{
_value = value;
_success = success;
IsTransient = isTransient;
Message = message;
}
public static ShellyResult<T> Success(T value, string message = null)
{
return new ShellyResult<T>(value, true, false, message);
}
public static ShellyResult<T> Failure(string message = null)
{
return new ShellyResult<T>(default, success: false, isTransient: false, message);
}
public static ShellyResult<T> TransientFailure(string message = null)
{
return new ShellyResult<T>(default, success: false, isTransient: true, message);
}
}
}
+28
View File
@@ -0,0 +1,28 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.11.35431.28
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleAppCS", "SampleAppCS\SampleAppCS.csproj", "{3D20D5E3-7DB0-495C-89E0-DF6968879D29}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Remote_DEBUG|Any CPU = Remote_DEBUG|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Release|Any CPU.Build.0 = Release|Any CPU
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Remote_DEBUG|Any CPU.ActiveCfg = Remote_DEBUG|Any CPU
{3D20D5E3-7DB0-495C-89E0-DF6968879D29}.Remote_DEBUG|Any CPU.Build.0 = Remote_DEBUG|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {CFD136ED-9DE7-4EFE-A308-6A558B222552}
EndGlobalSection
EndGlobal
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/>
</startup>
</configuration>
+98
View File
@@ -0,0 +1,98 @@
// ClassDefine.cs : 定義用ヘッダファイル
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 MITSUBISHI Electric Corporation All Rights Reserved
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SampleAppCS
{
static class ClassDefine
{
public const String APPLICATION_NAME = "FCSB1224W000 "; //アプリ名
public enum SYSTEMTYPE
{
EZNC_SYS_MELDAS700L = 5, //M700L
EZNC_SYS_MELDAS700M = 6, //M700M
EZNC_SYS_MELDASC70 = 7, //C70
EZNC_SYS_MELDAS800L = 8, //M800L
EZNC_SYS_MELDAS800M = 9, //M800M
EZNC_SYS_CNCC80 = 10, //C80
}
public const Int32 EZNC_SYS_MULTI = 0x00010000; //マルチスレッド指定
public const Int32 EZNC_PLCAXIS = 255; //PLC軸指定
public enum PROGRAMTYPE
{
EZNC_MAINPRG = 0, //メインプログラム
EZNC_SUBPRG = 1, //サブプログラム
}
public enum MSTBTYPE
{
EZNC_M = 0, //M指令
EZNC_S = 1, //S指令
EZNC_T = 2, //T指令
EZNC_B = 3, //B指令
}
public enum PRGNUMTYPE
{
EZNC_PRG_MAXNUM = 0, //登録可能な最大本数
EZNC_PRG_CURNUM = 1, //現在登録されている本数
EZNC_PRG_RESTNUM = 2, //登録可能な残本数
EZNC_PRG_CHARNUM = 3, //登録されている文字数
EZNC_PRG_RESTCHARNUM = 4, //登録可能な残文字数
}
public enum DISKREADTYPE
{
EZNC_DISK_DIRTYPE = 0x10000, //ディレクトリ情報読み出し
EZNC_DISK_COMMENT = 0x04, //コメント情報読み出し
EZNC_DISK_DATE = 0x02, //日付情報読み出し
EZNC_DISK_SIZE = 0x01, //サイズ情報読み出し
}
public enum ALARMTYPE
{
M_ALM_ALL_ALARM = 0x000, //アラーム種類の区別なし
M_ALM_NC_ALARM = 0x100, //NCアラーム
M_ALM_STOP_CODE = 0x200, //ストップコード
M_ALM_PLC_ALARM = 0x300, //PLCアラームメッセージ
M_ALM_OPE_MSG = 0x400, //オペレータメッセージ
M_ALM_WARNING = 0x500, //ワーニング
}
public enum DEVICEDATATYPE
{
EZNC_PLC_BIT = 0x11, //ビット型
EZNC_PLC_BYTE = 0x12, //バイト型
EZNC_PLC_WORD = 0x14, //ワード型
EZNC_PLC_DWORD = 0x18, //ダブルワード型
}
public enum RESETTYPE
{
EZNC_RESET_NONE = 0, //NCシステムのリセットなし
EZNC_RESET_SIMPLE = 1, //オープン中のNCシステムのリセット
EZNC_RESET_ALL = 2, //全てのNCシステムのリセット
}
public enum OPENFILETYPE
{
EZNC_FILE_READ = 1, //読み出しモード
EZNC_FILE_WRITE = 2, //書き出しモード
EZNC_FILE_OVERWRITE = 3, //強制上書きモード
EZNC_FILE_OPEN = 1, //書き込みオープンモード
EZNC_FILE_CREATE = 2, //書き込み新規作成モード
}
}
}
+742
View File
@@ -0,0 +1,742 @@
namespace SampleAppCS
{
partial class FormSampleApp
{
/// <summary>
/// 必要なデザイナー変数です。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
/// <param name="disposing">マネージド リソースを破棄する場合は true を指定し、その他の場合は false を指定します。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// デザイナー サポートに必要なメソッドです。このメソッドの内容を
/// コード エディターで変更しないでください。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBoxOpenStatus = new System.Windows.Forms.TextBox();
this.textBoxConnectStatus = new System.Windows.Forms.TextBox();
this.buttonExcute = new System.Windows.Forms.Button();
this.buttonConnect = new System.Windows.Forms.Button();
this.comboBoxSystemType = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.textBoxTimeOut = new System.Windows.Forms.TextBox();
this.textBoxMachineNo = new System.Windows.Forms.TextBox();
this.textBoxIPAddress = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBoxSystemVersion = new System.Windows.Forms.TextBox();
this.radioButtonEnd = new System.Windows.Forms.RadioButton();
this.radioButtonStart = new System.Windows.Forms.RadioButton();
this.label2 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.textBoxSequenceNo = new System.Windows.Forms.TextBox();
this.textBoxPrgNo = new System.Windows.Forms.TextBox();
this.label17 = new System.Windows.Forms.Label();
this.label16 = new System.Windows.Forms.Label();
this.groupBox4 = new System.Windows.Forms.GroupBox();
this.listBoxCurrentProgram = new System.Windows.Forms.ListBox();
this.groupBox5 = new System.Windows.Forms.GroupBox();
this.groupBox8 = new System.Windows.Forms.GroupBox();
this.textBoxMachinePositionZ = new System.Windows.Forms.TextBox();
this.textBoxMachinePositionY = new System.Windows.Forms.TextBox();
this.textBoxMachinePositionX = new System.Windows.Forms.TextBox();
this.label11 = new System.Windows.Forms.Label();
this.label12 = new System.Windows.Forms.Label();
this.label13 = new System.Windows.Forms.Label();
this.textBoxWorkPositionZ = new System.Windows.Forms.TextBox();
this.groupBox7 = new System.Windows.Forms.GroupBox();
this.textBoxWorkPositionY = new System.Windows.Forms.TextBox();
this.textBoxWorkPositionX = new System.Windows.Forms.TextBox();
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.groupBox6 = new System.Windows.Forms.GroupBox();
this.textBoxCurrentPositionZ = new System.Windows.Forms.TextBox();
this.textBoxCurrentPositionY = new System.Windows.Forms.TextBox();
this.textBoxCurrentPositionX = new System.Windows.Forms.TextBox();
this.label15 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.groupBox9 = new System.Windows.Forms.GroupBox();
this.textBoxAlarmMessage = new System.Windows.Forms.TextBox();
this.groupBoxErrorCode = new System.Windows.Forms.GroupBox();
this.textBoxErrorCode = new System.Windows.Forms.TextBox();
this.timerHighCycle = new System.Windows.Forms.Timer(this.components);
this.timerLowCycle = new System.Windows.Forms.Timer(this.components);
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.groupBox4.SuspendLayout();
this.groupBox5.SuspendLayout();
this.groupBox8.SuspendLayout();
this.groupBox7.SuspendLayout();
this.groupBox6.SuspendLayout();
this.groupBox9.SuspendLayout();
this.groupBoxErrorCode.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.buttonExcute);
this.groupBox1.Controls.Add(this.buttonConnect);
this.groupBox1.Controls.Add(this.comboBoxSystemType);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.textBoxTimeOut);
this.groupBox1.Controls.Add(this.textBoxMachineNo);
this.groupBox1.Controls.Add(this.textBoxIPAddress);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.textBoxSystemVersion);
this.groupBox1.Controls.Add(this.radioButtonEnd);
this.groupBox1.Controls.Add(this.radioButtonStart);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(16, 11);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(442, 178);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "NCカード通信開始/終了";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBoxOpenStatus);
this.groupBox2.Controls.Add(this.textBoxConnectStatus);
this.groupBox2.Location = new System.Drawing.Point(329, 24);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(98, 85);
this.groupBox2.TabIndex = 15;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "通信状態";
//
// textBoxOpenStatus
//
this.textBoxOpenStatus.BackColor = System.Drawing.Color.Yellow;
this.textBoxOpenStatus.Location = new System.Drawing.Point(8, 50);
this.textBoxOpenStatus.Name = "textBoxOpenStatus";
this.textBoxOpenStatus.ReadOnly = true;
this.textBoxOpenStatus.Size = new System.Drawing.Size(86, 19);
this.textBoxOpenStatus.TabIndex = 1;
this.textBoxOpenStatus.Text = "通信終了";
this.textBoxOpenStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// textBoxConnectStatus
//
this.textBoxConnectStatus.BackColor = System.Drawing.Color.Red;
this.textBoxConnectStatus.Location = new System.Drawing.Point(8, 21);
this.textBoxConnectStatus.Name = "textBoxConnectStatus";
this.textBoxConnectStatus.ReadOnly = true;
this.textBoxConnectStatus.Size = new System.Drawing.Size(86, 19);
this.textBoxConnectStatus.TabIndex = 0;
this.textBoxConnectStatus.Text = "切断";
this.textBoxConnectStatus.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// buttonOpenClose
//
this.buttonExcute.Enabled = false;
this.buttonExcute.Location = new System.Drawing.Point(352, 115);
this.buttonExcute.Name = "buttonOpenClose";
this.buttonExcute.Size = new System.Drawing.Size(57, 22);
this.buttonExcute.TabIndex = 14;
this.buttonExcute.Text = "実行";
this.buttonExcute.UseVisualStyleBackColor = true;
this.buttonExcute.Click += new System.EventHandler(this.ButtonExcute_Click);
//
// buttonConnect
//
this.buttonConnect.Location = new System.Drawing.Point(258, 25);
this.buttonConnect.Name = "buttonConnect";
this.buttonConnect.Size = new System.Drawing.Size(57, 23);
this.buttonConnect.TabIndex = 13;
this.buttonConnect.Text = "接続";
this.buttonConnect.UseVisualStyleBackColor = true;
this.buttonConnect.Click += new System.EventHandler(this.ButtonConnect_Click);
//
// comboBoxSystemType
//
this.comboBoxSystemType.FormattingEnabled = true;
this.comboBoxSystemType.Location = new System.Drawing.Point(89, 58);
this.comboBoxSystemType.Name = "comboBoxSystemType";
this.comboBoxSystemType.Size = new System.Drawing.Size(152, 20);
this.comboBoxSystemType.TabIndex = 12;
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(270, 120);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(60, 12);
this.label6.TabIndex = 11;
this.label6.Text = "(×100ms)";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(101, 119);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(60, 12);
this.label5.TabIndex = 10;
this.label5.Text = "TimeOut値";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(101, 97);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(103, 12);
this.label4.TabIndex = 9;
this.label4.Text = "NC制御ユニット番号";
//
// textBoxTimeOut
//
this.textBoxTimeOut.Location = new System.Drawing.Point(210, 117);
this.textBoxTimeOut.Name = "textBoxTimeOut";
this.textBoxTimeOut.Size = new System.Drawing.Size(52, 19);
this.textBoxTimeOut.TabIndex = 8;
this.textBoxTimeOut.Text = "50";
this.textBoxTimeOut.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBoxMachineNo
//
this.textBoxMachineNo.Location = new System.Drawing.Point(210, 92);
this.textBoxMachineNo.Name = "textBoxMachineNo";
this.textBoxMachineNo.Size = new System.Drawing.Size(52, 19);
this.textBoxMachineNo.TabIndex = 7;
this.textBoxMachineNo.Text = "1";
this.textBoxMachineNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBoxIPAddress
//
this.textBoxIPAddress.Location = new System.Drawing.Point(89, 27);
this.textBoxIPAddress.Name = "textBoxIPAddress";
this.textBoxIPAddress.Size = new System.Drawing.Size(152, 19);
this.textBoxIPAddress.TabIndex = 6;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(16, 149);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(97, 12);
this.label3.TabIndex = 5;
this.label3.Text = "システム番号/名称";
//
// textBoxSystemVersion
//
this.textBoxSystemVersion.BackColor = System.Drawing.SystemColors.Info;
this.textBoxSystemVersion.Location = new System.Drawing.Point(135, 146);
this.textBoxSystemVersion.Name = "textBoxSystemVersion";
this.textBoxSystemVersion.ReadOnly = true;
this.textBoxSystemVersion.Size = new System.Drawing.Size(292, 19);
this.textBoxSystemVersion.TabIndex = 4;
//
// radioButtonEnd
//
this.radioButtonEnd.AutoSize = true;
this.radioButtonEnd.Location = new System.Drawing.Point(17, 117);
this.radioButtonEnd.Name = "radioButtonEnd";
this.radioButtonEnd.Size = new System.Drawing.Size(71, 16);
this.radioButtonEnd.TabIndex = 3;
this.radioButtonEnd.Text = "通信終了";
this.radioButtonEnd.UseVisualStyleBackColor = true;
//
// radioButtonStart
//
this.radioButtonStart.AutoSize = true;
this.radioButtonStart.Checked = true;
this.radioButtonStart.Location = new System.Drawing.Point(17, 95);
this.radioButtonStart.Name = "radioButtonStart";
this.radioButtonStart.Size = new System.Drawing.Size(71, 16);
this.radioButtonStart.TabIndex = 2;
this.radioButtonStart.TabStop = true;
this.radioButtonStart.Text = "通信開始";
this.radioButtonStart.UseVisualStyleBackColor = true;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(16, 61);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(47, 12);
this.label2.TabIndex = 1;
this.label2.Text = "NCタイプ";
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(15, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 12);
this.label1.TabIndex = 0;
this.label1.Text = "IPアドレス";
//
// groupBox3
//
this.groupBox3.Controls.Add(this.textBoxSequenceNo);
this.groupBox3.Controls.Add(this.textBoxPrgNo);
this.groupBox3.Controls.Add(this.label17);
this.groupBox3.Controls.Add(this.label16);
this.groupBox3.Controls.Add(this.groupBox4);
this.groupBox3.Location = new System.Drawing.Point(477, 17);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(316, 395);
this.groupBox3.TabIndex = 1;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "プログラム";
//
// textBoxSequenceNo
//
this.textBoxSequenceNo.BackColor = System.Drawing.SystemColors.Info;
this.textBoxSequenceNo.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxSequenceNo.Location = new System.Drawing.Point(115, 347);
this.textBoxSequenceNo.Name = "textBoxSequenceNo";
this.textBoxSequenceNo.ReadOnly = true;
this.textBoxSequenceNo.Size = new System.Drawing.Size(188, 34);
this.textBoxSequenceNo.TabIndex = 22;
this.textBoxSequenceNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// textBoxPrgNo
//
this.textBoxPrgNo.BackColor = System.Drawing.SystemColors.Info;
this.textBoxPrgNo.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxPrgNo.Location = new System.Drawing.Point(115, 303);
this.textBoxPrgNo.Name = "textBoxPrgNo";
this.textBoxPrgNo.ReadOnly = true;
this.textBoxPrgNo.Size = new System.Drawing.Size(188, 34);
this.textBoxPrgNo.TabIndex = 21;
this.textBoxPrgNo.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// label17
//
this.label17.AutoSize = true;
this.label17.Font = new System.Drawing.Font("MS UI Gothic", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.label17.Location = new System.Drawing.Point(16, 357);
this.label17.Name = "label17";
this.label17.Size = new System.Drawing.Size(95, 15);
this.label17.TabIndex = 2;
this.label17.Text = "シーケンス番号";
//
// label16
//
this.label16.AutoSize = true;
this.label16.Font = new System.Drawing.Font("MS UI Gothic", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.label16.Location = new System.Drawing.Point(16, 314);
this.label16.Name = "label16";
this.label16.Size = new System.Drawing.Size(93, 15);
this.label16.TabIndex = 1;
this.label16.Text = "プログラム番号";
//
// groupBox4
//
this.groupBox4.Controls.Add(this.listBoxCurrentProgram);
this.groupBox4.Location = new System.Drawing.Point(6, 21);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(304, 269);
this.groupBox4.TabIndex = 0;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "実行プログラム表示";
//
// listBoxCurrentProgram
//
this.listBoxCurrentProgram.BackColor = System.Drawing.SystemColors.Info;
this.listBoxCurrentProgram.FormattingEnabled = true;
this.listBoxCurrentProgram.ItemHeight = 12;
this.listBoxCurrentProgram.Location = new System.Drawing.Point(8, 18);
this.listBoxCurrentProgram.Name = "listBoxCurrentProgram";
this.listBoxCurrentProgram.Size = new System.Drawing.Size(289, 244);
this.listBoxCurrentProgram.TabIndex = 17;
//
// groupBox5
//
this.groupBox5.Controls.Add(this.groupBox8);
this.groupBox5.Controls.Add(this.textBoxWorkPositionZ);
this.groupBox5.Controls.Add(this.groupBox7);
this.groupBox5.Controls.Add(this.groupBox6);
this.groupBox5.Location = new System.Drawing.Point(16, 195);
this.groupBox5.Name = "groupBox5";
this.groupBox5.Size = new System.Drawing.Size(442, 217);
this.groupBox5.TabIndex = 2;
this.groupBox5.TabStop = false;
this.groupBox5.Text = "位置表示";
//
// groupBox8
//
this.groupBox8.Controls.Add(this.textBoxMachinePositionZ);
this.groupBox8.Controls.Add(this.textBoxMachinePositionY);
this.groupBox8.Controls.Add(this.textBoxMachinePositionX);
this.groupBox8.Controls.Add(this.label11);
this.groupBox8.Controls.Add(this.label12);
this.groupBox8.Controls.Add(this.label13);
this.groupBox8.Location = new System.Drawing.Point(268, 118);
this.groupBox8.Name = "groupBox8";
this.groupBox8.Size = new System.Drawing.Size(168, 94);
this.groupBox8.TabIndex = 19;
this.groupBox8.TabStop = false;
this.groupBox8.Text = "機械位置";
//
// textBoxMachinePositionZ
//
this.textBoxMachinePositionZ.BackColor = System.Drawing.SystemColors.Info;
this.textBoxMachinePositionZ.Location = new System.Drawing.Point(27, 66);
this.textBoxMachinePositionZ.Name = "textBoxMachinePositionZ";
this.textBoxMachinePositionZ.ReadOnly = true;
this.textBoxMachinePositionZ.Size = new System.Drawing.Size(130, 19);
this.textBoxMachinePositionZ.TabIndex = 20;
//
// textBoxMachinePositionY
//
this.textBoxMachinePositionY.BackColor = System.Drawing.SystemColors.Info;
this.textBoxMachinePositionY.Location = new System.Drawing.Point(27, 41);
this.textBoxMachinePositionY.Name = "textBoxMachinePositionY";
this.textBoxMachinePositionY.ReadOnly = true;
this.textBoxMachinePositionY.Size = new System.Drawing.Size(130, 19);
this.textBoxMachinePositionY.TabIndex = 17;
//
// textBoxMachinePositionX
//
this.textBoxMachinePositionX.BackColor = System.Drawing.SystemColors.Info;
this.textBoxMachinePositionX.Location = new System.Drawing.Point(27, 17);
this.textBoxMachinePositionX.Name = "textBoxMachinePositionX";
this.textBoxMachinePositionX.ReadOnly = true;
this.textBoxMachinePositionX.Size = new System.Drawing.Size(130, 19);
this.textBoxMachinePositionX.TabIndex = 16;
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(9, 69);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(12, 12);
this.label11.TabIndex = 3;
this.label11.Text = "Z";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(9, 44);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(12, 12);
this.label12.TabIndex = 2;
this.label12.Text = "Y";
//
// label13
//
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(9, 20);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(12, 12);
this.label13.TabIndex = 1;
this.label13.Text = "X";
//
// textBoxWorkPositionZ
//
this.textBoxWorkPositionZ.BackColor = System.Drawing.SystemColors.Info;
this.textBoxWorkPositionZ.Location = new System.Drawing.Point(295, 83);
this.textBoxWorkPositionZ.Name = "textBoxWorkPositionZ";
this.textBoxWorkPositionZ.ReadOnly = true;
this.textBoxWorkPositionZ.Size = new System.Drawing.Size(130, 19);
this.textBoxWorkPositionZ.TabIndex = 18;
//
// groupBox7
//
this.groupBox7.Controls.Add(this.textBoxWorkPositionY);
this.groupBox7.Controls.Add(this.textBoxWorkPositionX);
this.groupBox7.Controls.Add(this.label10);
this.groupBox7.Controls.Add(this.label9);
this.groupBox7.Controls.Add(this.label8);
this.groupBox7.Location = new System.Drawing.Point(268, 18);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(168, 94);
this.groupBox7.TabIndex = 1;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "ワーク座標位置";
//
// textBoxWorkPositionY
//
this.textBoxWorkPositionY.BackColor = System.Drawing.SystemColors.Info;
this.textBoxWorkPositionY.Location = new System.Drawing.Point(27, 41);
this.textBoxWorkPositionY.Name = "textBoxWorkPositionY";
this.textBoxWorkPositionY.ReadOnly = true;
this.textBoxWorkPositionY.Size = new System.Drawing.Size(130, 19);
this.textBoxWorkPositionY.TabIndex = 17;
//
// textBoxWorkPositionX
//
this.textBoxWorkPositionX.BackColor = System.Drawing.SystemColors.Info;
this.textBoxWorkPositionX.Location = new System.Drawing.Point(27, 17);
this.textBoxWorkPositionX.Name = "textBoxWorkPositionX";
this.textBoxWorkPositionX.ReadOnly = true;
this.textBoxWorkPositionX.Size = new System.Drawing.Size(130, 19);
this.textBoxWorkPositionX.TabIndex = 16;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(9, 69);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(12, 12);
this.label10.TabIndex = 3;
this.label10.Text = "Z";
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(9, 44);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(12, 12);
this.label9.TabIndex = 2;
this.label9.Text = "Y";
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(9, 20);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(12, 12);
this.label8.TabIndex = 1;
this.label8.Text = "X";
//
// groupBox6
//
this.groupBox6.Controls.Add(this.textBoxCurrentPositionZ);
this.groupBox6.Controls.Add(this.textBoxCurrentPositionY);
this.groupBox6.Controls.Add(this.textBoxCurrentPositionX);
this.groupBox6.Controls.Add(this.label15);
this.groupBox6.Controls.Add(this.label14);
this.groupBox6.Controls.Add(this.label7);
this.groupBox6.Location = new System.Drawing.Point(6, 18);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(254, 193);
this.groupBox6.TabIndex = 0;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "現在座標位置";
//
// textBoxCurrentPositionZ
//
this.textBoxCurrentPositionZ.BackColor = System.Drawing.SystemColors.Info;
this.textBoxCurrentPositionZ.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxCurrentPositionZ.Location = new System.Drawing.Point(58, 137);
this.textBoxCurrentPositionZ.Name = "textBoxCurrentPositionZ";
this.textBoxCurrentPositionZ.ReadOnly = true;
this.textBoxCurrentPositionZ.Size = new System.Drawing.Size(177, 34);
this.textBoxCurrentPositionZ.TabIndex = 20;
//
// textBoxCurrentPositionY
//
this.textBoxCurrentPositionY.BackColor = System.Drawing.SystemColors.Info;
this.textBoxCurrentPositionY.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxCurrentPositionY.Location = new System.Drawing.Point(58, 82);
this.textBoxCurrentPositionY.Name = "textBoxCurrentPositionY";
this.textBoxCurrentPositionY.ReadOnly = true;
this.textBoxCurrentPositionY.Size = new System.Drawing.Size(177, 34);
this.textBoxCurrentPositionY.TabIndex = 19;
//
// textBoxCurrentPositionX
//
this.textBoxCurrentPositionX.BackColor = System.Drawing.SystemColors.Info;
this.textBoxCurrentPositionX.Font = new System.Drawing.Font("MS UI Gothic", 20.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxCurrentPositionX.Location = new System.Drawing.Point(58, 30);
this.textBoxCurrentPositionX.Name = "textBoxCurrentPositionX";
this.textBoxCurrentPositionX.ReadOnly = true;
this.textBoxCurrentPositionX.Size = new System.Drawing.Size(177, 34);
this.textBoxCurrentPositionX.TabIndex = 18;
//
// label15
//
this.label15.AutoSize = true;
this.label15.Font = new System.Drawing.Font("MS UI Gothic", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.label15.Location = new System.Drawing.Point(16, 133);
this.label15.Name = "label15";
this.label15.Size = new System.Drawing.Size(35, 35);
this.label15.TabIndex = 2;
this.label15.Text = "Z";
//
// label14
//
this.label14.AutoSize = true;
this.label14.Font = new System.Drawing.Font("MS UI Gothic", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.label14.Location = new System.Drawing.Point(16, 82);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(36, 35);
this.label14.TabIndex = 1;
this.label14.Text = "Y";
//
// label7
//
this.label7.AutoSize = true;
this.label7.Font = new System.Drawing.Font("MS UI Gothic", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.label7.Location = new System.Drawing.Point(16, 29);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(36, 35);
this.label7.TabIndex = 0;
this.label7.Text = "X";
//
// groupBox9
//
this.groupBox9.Controls.Add(this.textBoxAlarmMessage);
this.groupBox9.Location = new System.Drawing.Point(19, 422);
this.groupBox9.Name = "groupBox9";
this.groupBox9.Size = new System.Drawing.Size(384, 83);
this.groupBox9.TabIndex = 3;
this.groupBox9.TabStop = false;
this.groupBox9.Text = "アラーム表示";
//
// textBoxAlarmMessage
//
this.textBoxAlarmMessage.BackColor = System.Drawing.SystemColors.Info;
this.textBoxAlarmMessage.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxAlarmMessage.Location = new System.Drawing.Point(6, 18);
this.textBoxAlarmMessage.Multiline = true;
this.textBoxAlarmMessage.Name = "textBoxAlarmMessage";
this.textBoxAlarmMessage.ReadOnly = true;
this.textBoxAlarmMessage.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBoxAlarmMessage.Size = new System.Drawing.Size(372, 55);
this.textBoxAlarmMessage.TabIndex = 21;
//
// groupBoxErrorCode
//
this.groupBoxErrorCode.Controls.Add(this.textBoxErrorCode);
this.groupBoxErrorCode.Location = new System.Drawing.Point(409, 422);
this.groupBoxErrorCode.Name = "groupBoxErrorCode";
this.groupBoxErrorCode.Size = new System.Drawing.Size(384, 83);
this.groupBoxErrorCode.TabIndex = 22;
this.groupBoxErrorCode.TabStop = false;
this.groupBoxErrorCode.Text = "Error Code";
//
// textBoxErrorCode
//
this.textBoxErrorCode.BackColor = System.Drawing.SystemColors.Info;
this.textBoxErrorCode.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128)));
this.textBoxErrorCode.Location = new System.Drawing.Point(6, 18);
this.textBoxErrorCode.Multiline = true;
this.textBoxErrorCode.Name = "textBoxErrorCode";
this.textBoxErrorCode.ReadOnly = true;
this.textBoxErrorCode.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBoxErrorCode.Size = new System.Drawing.Size(372, 55);
this.textBoxErrorCode.TabIndex = 22;
//
// timerHighCycle
//
this.timerHighCycle.Tick += new System.EventHandler(this.TimerHighCycle_Tick);
//
// timerLowCycle
//
this.timerLowCycle.Interval = 1000;
this.timerLowCycle.Tick += new System.EventHandler(this.TimerLowCycle_Tick);
//
// FormSampleApp
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(805, 520);
this.Controls.Add(this.groupBoxErrorCode);
this.Controls.Add(this.groupBox9);
this.Controls.Add(this.groupBox5);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox1);
this.Name = "FormSampleApp";
this.Text = "Sample Application";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox5.PerformLayout();
this.groupBox8.ResumeLayout(false);
this.groupBox8.PerformLayout();
this.groupBox7.ResumeLayout(false);
this.groupBox7.PerformLayout();
this.groupBox6.ResumeLayout(false);
this.groupBox6.PerformLayout();
this.groupBox9.ResumeLayout(false);
this.groupBox9.PerformLayout();
this.groupBoxErrorCode.ResumeLayout(false);
this.groupBoxErrorCode.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBoxTimeOut;
private System.Windows.Forms.TextBox textBoxMachineNo;
private System.Windows.Forms.TextBox textBoxIPAddress;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBoxSystemVersion;
private System.Windows.Forms.RadioButton radioButtonEnd;
private System.Windows.Forms.RadioButton radioButtonStart;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textBoxOpenStatus;
private System.Windows.Forms.TextBox textBoxConnectStatus;
private System.Windows.Forms.Button buttonExcute;
private System.Windows.Forms.Button buttonConnect;
private System.Windows.Forms.ComboBox comboBoxSystemType;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.GroupBox groupBox4;
private System.Windows.Forms.GroupBox groupBox5;
private System.Windows.Forms.GroupBox groupBox7;
private System.Windows.Forms.Label label10;
private System.Windows.Forms.Label label9;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.GroupBox groupBox6;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.GroupBox groupBox8;
private System.Windows.Forms.TextBox textBoxMachinePositionY;
private System.Windows.Forms.TextBox textBoxMachinePositionX;
private System.Windows.Forms.Label label11;
private System.Windows.Forms.Label label12;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox textBoxWorkPositionZ;
private System.Windows.Forms.TextBox textBoxWorkPositionY;
private System.Windows.Forms.TextBox textBoxWorkPositionX;
private System.Windows.Forms.TextBox textBoxSequenceNo;
private System.Windows.Forms.TextBox textBoxPrgNo;
private System.Windows.Forms.Label label17;
private System.Windows.Forms.Label label16;
private System.Windows.Forms.TextBox textBoxMachinePositionZ;
private System.Windows.Forms.TextBox textBoxCurrentPositionZ;
private System.Windows.Forms.TextBox textBoxCurrentPositionY;
private System.Windows.Forms.TextBox textBoxCurrentPositionX;
private System.Windows.Forms.Label label15;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.GroupBox groupBox9;
private System.Windows.Forms.TextBox textBoxAlarmMessage;
private System.Windows.Forms.GroupBox groupBoxErrorCode;
private System.Windows.Forms.TextBox textBoxErrorCode;
private System.Windows.Forms.Timer timerHighCycle;
private System.Windows.Forms.Timer timerLowCycle;
private System.Windows.Forms.ListBox listBoxCurrentProgram;
}
}
+564
View File
@@ -0,0 +1,564 @@
// FormSampleApp.cs : アプリケーション用クラスの機能定義ファイル
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 MITSUBISHI Electric Corporation All Rights Reserved
//
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static SampleAppCS.ClassDefine;
namespace SampleAppCS
{
public partial class FormSampleApp : Form
{
private EZNCAUTLib.DispEZNcCommunication oEZNcAutCom = null;
private Boolean bConnectStatus = false;
private Boolean bCommunicateStatus = false;
//Open3の第4引数は"EZNC_LOCALHOST"固定
private String strHostName = "EZNC_LOCALHOST";
//コンストラクタ
public FormSampleApp()
{
InitializeComponent();
//アプリ名の登録
this.Text = APPLICATION_NAME + this.Text;
groupBoxErrorCode.Text = APPLICATION_NAME + groupBoxErrorCode.Text;
//NCタイプの登録(C70/C80除く)
foreach (String stType in Enum.GetNames(typeof(SYSTEMTYPE)))
{
if ((stType != "EZNC_SYS_MELDASC70") && (stType != "EZNC_SYS_CNCC80"))
{
comboBoxSystemType.Items.Add(stType);
}
}
}
//ErrorCodeの出力
private void CheckError(String strMethod, Int32 lResult)
{
if (lResult != 0)
{
Int32 lBase = 16;
textBoxErrorCode.Text = strMethod + " failed. " + "0x" +
Convert.ToString(lResult, lBase) + Environment.NewLine + textBoxErrorCode.Text;
}
}
//「接続/切断」ボタン押下時の処理
private void ButtonConnect_Click(object sender, EventArgs e)
{
//M700/M800シリーズではポート番号に683という固定値を指定
Int32 lPort = 683;
Int32 lNCType;
Int32 lResult;
Boolean bResult;
String strIPAddress;
//IPアドレスの取得
if (textBoxIPAddress.Text == "")
{
MessageBox.Show("IPアドレスが不正です。");
return;
}
else
{
strIPAddress = textBoxIPAddress.Text;
}
//NCタイプの取得
bResult = Enum.TryParse<SYSTEMTYPE>(comboBoxSystemType.Text, out SYSTEMTYPE sysNCType);
if (bResult == false)
{
MessageBox.Show("NCタイプが不正です。");
return;
}
if (oEZNcAutCom == null)
{
//オブジェクトの作成
oEZNcAutCom = new EZNCAUTLib.DispEZNcCommunication();
//通信回線のオープン
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80)
{
//下記の設定は一例のため、接続環境に合わせた設定が必要
lResult = oEZNcAutCom.SetMelsecProtocol(0x00, 0xFF, 0x00, 0x00, 0x3E1, 0x1018,
0x1002, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, strIPAddress, 0x04,
Int32.Parse(textBoxTimeOut.Text), 0x00, 0x00, 0x00, 5006, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01);
CheckError("SetMelsecProtocol", lResult);
}
else if (sysNCType == SYSTEMTYPE.EZNC_SYS_MELDASC70)
{
//下記の設定は一例のため、接続環境に合わせた設定が必要
lResult = oEZNcAutCom.SetMelsecProtocol(0x01, 0x01, 0x00, 0x00, 0x3E1, 0x0901,
0x1A, 0x01, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, strIPAddress, 0x04,
Int32.Parse(textBoxTimeOut.Text), 0x00, 0x01, 0x04, 5001, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01);
CheckError("SetMelsecProtocol", lResult);
}
else
{
//TCPIP通信設定
lResult = oEZNcAutCom.SetTCPIPProtocol(strIPAddress, lPort);
CheckError("SetTCPIPProtocol", lResult);
}
if (oEZNcAutCom != null)
{
//マルチスレッドの有効化
lNCType = (Int32)sysNCType | EZNC_SYS_MULTI;
//通信回線のオープン
lResult = oEZNcAutCom.Open3(lNCType, Int32.Parse(textBoxMachineNo.Text),
Int32.Parse(textBoxTimeOut.Text), strHostName);
CheckError("Open", lResult);
if (lResult == 0)
{
//接続の設定
bConnectStatus = true;
//通信回線のクローズ
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80 ||
sysNCType == SYSTEMTYPE.EZNC_SYS_MELDASC70)
{
lResult = oEZNcAutCom.Close();
}
else
{
lResult = oEZNcAutCom.Close2((Int32)RESETTYPE.EZNC_RESET_SIMPLE);
}
CheckError("Close", lResult);
}
else
{
//オブジェクトの解放
oEZNcAutCom = null;
MessageBox.Show("ホスト名(IPアドレス)またはNCタイプが不正です。");
}
}
}
else
{
if (bCommunicateStatus == true)
{
//通信回線のクローズ
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80 ||
sysNCType == SYSTEMTYPE.EZNC_SYS_MELDASC70)
{
lResult = oEZNcAutCom.Close();
}
else
{
lResult = oEZNcAutCom.Close2((Int32)RESETTYPE.EZNC_RESET_SIMPLE);
}
CheckError("Close", lResult);
//通信終了の設定
bCommunicateStatus = false;
//周期処理の終了
timerHighCycle.Enabled = false;
timerLowCycle.Enabled = false;
}
//切断の設定
bConnectStatus = false;
//オブジェクトの解放
oEZNcAutCom = null;
//GUI状態の初期化
ResetGUIStatus();
}
//GUI状態の更新
UpdateGUIStatus();
}
//「実行」ボタン押下時の処理
private void ButtonExcute_Click(object sender, EventArgs e)
{
Int32 lNCType;
Int32 lAxisNo = 0;
Int32 lIndex = 0;
Int32 lResult;
String strIPAddress;
//IPアドレスの取得
if (textBoxIPAddress.Text == "")
{
MessageBox.Show("IPアドレスが不正です。");
return;
}
else
{
strIPAddress = textBoxIPAddress.Text;
}
//NCタイプの取得
Enum.TryParse<SYSTEMTYPE>(comboBoxSystemType.Text, out SYSTEMTYPE sysNCType);
if (radioButtonStart.Checked == true)
{
//マルチスレッドの有効化
lNCType = (Int32)sysNCType | EZNC_SYS_MULTI;
//通信回線のオープン
lResult = oEZNcAutCom.Open3(lNCType, Int32.Parse(textBoxMachineNo.Text),
Int32.Parse(textBoxTimeOut.Text), strHostName);
CheckError("Open", lResult);
if (lResult == 0)
{
//通信開始の設定
bCommunicateStatus = true;
//周期処理の開始
timerHighCycle.Enabled = true;
timerLowCycle.Enabled = true;
//NCシステム番号の取得
lResult = oEZNcAutCom.System_GetVersion(lAxisNo, lIndex, out String strNCVersion);
CheckError("GetVersion", lResult);
textBoxSystemVersion.Text = strNCVersion;
}
}
else
{
//通信回線のクローズ
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80 ||
sysNCType == SYSTEMTYPE.EZNC_SYS_MELDASC70)
{
lResult = oEZNcAutCom.Close();
}
else
{
lResult = oEZNcAutCom.Close2((Int32)RESETTYPE.EZNC_RESET_SIMPLE);
}
CheckError("Close", lResult);
if (lResult == 0)
{
//通信終了の設定
bCommunicateStatus = false;
//周期処理の終了
timerHighCycle.Enabled = false;
timerLowCycle.Enabled = false;
}
}
//GUI状態の更新
UpdateGUIStatus();
}
//周期処理(0.1秒周期)
private void TimerHighCycle_Tick(object sender, EventArgs e)
{
//位置情報の取得
GetPosition();
}
//周期処理(1秒周期)
private void TimerLowCycle_Tick(object sender, EventArgs e)
{
//アラーム情報の取得
GetAlarm();
//プログラム情報の取得
GetProgramData();
}
//位置情報の取得
private void GetPosition()
{
Int32 lResult;
Double dPosition;
//NCタイプの取得
Enum.TryParse<SYSTEMTYPE>(comboBoxSystemType.Text, out SYSTEMTYPE sysNCType);
//現在座標位置の取得
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80)
{
textBoxCurrentPositionX.Text = "Not supported";
textBoxCurrentPositionY.Text = "Not supported";
textBoxCurrentPositionZ.Text = "Not supported";
}
else
{
lResult = oEZNcAutCom.Position_GetCurrentPosition(1, out dPosition);
CheckError("GetCurrentPosition", lResult);
if (lResult == 0)
{
textBoxCurrentPositionX.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetCurrentPosition(2, out dPosition);
CheckError("GetCurrentPosition", lResult);
if (lResult == 0)
{
textBoxCurrentPositionY.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetCurrentPosition(3, out dPosition);
CheckError("GetCurrentPosition", lResult);
if (lResult == 0)
{
textBoxCurrentPositionZ.Text = dPosition.ToString("F3");
}
}
//ワーク座標位置の取得
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80)
{
textBoxWorkPositionX.Text = "Not supported";
textBoxWorkPositionY.Text = "Not supported";
textBoxWorkPositionZ.Text = "Not supported";
}
else
{
lResult = oEZNcAutCom.Position_GetWorkPosition(1, out dPosition, 0);
CheckError("GetWorkPosition", lResult);
if (lResult == 0)
{
textBoxWorkPositionX.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetWorkPosition(2, out dPosition, 0);
CheckError("GetWorkPosition", lResult);
if (lResult == 0)
{
textBoxWorkPositionY.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetWorkPosition(3, out dPosition, 0);
CheckError("GetWorkPosition", lResult);
if (lResult == 0)
{
textBoxWorkPositionZ.Text = dPosition.ToString("F3");
}
}
//機械座標位置の取得
lResult = oEZNcAutCom.Position_GetMachinePosition(1, out dPosition, 0);
CheckError("GetMachinePosition", lResult);
if (lResult == 0)
{
textBoxMachinePositionX.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetMachinePosition(2, out dPosition, 0);
CheckError("GetMachinePosition", lResult);
if (lResult == 0)
{
textBoxMachinePositionY.Text = dPosition.ToString("F3");
}
lResult = oEZNcAutCom.Position_GetMachinePosition(3, out dPosition, 0);
CheckError("GetMachinePosition", lResult);
if (lResult == 0)
{
textBoxMachinePositionZ.Text = dPosition.ToString("F3");
}
}
//アラーム情報の取得
private void GetAlarm()
{
Int32 lMessageNumber = 3;
Int32 lResult;
String strAlarmMsg;
Array lSystem = Array.CreateInstance(typeof(Int32), lMessageNumber);
Array lWarning = Array.CreateInstance(typeof(Int32), lMessageNumber);
Array lAlarmType = Array.CreateInstance(typeof(Int32), lMessageNumber);
//アラーム表示のテキスト消去
textBoxAlarmMessage.ResetText();
//NCタイプの取得
Enum.TryParse<SYSTEMTYPE>(comboBoxSystemType.Text, out SYSTEMTYPE sysNCType);
//アラーム情報の取得
if (sysNCType == SYSTEMTYPE.EZNC_SYS_MELDASC70)
{
lResult = oEZNcAutCom.System_GetAlarm2(lMessageNumber,
(Int32)ALARMTYPE.M_ALM_ALL_ALARM, out strAlarmMsg);
}
else
{
lResult = oEZNcAutCom.System_GetAlarm3(lMessageNumber, (Int32)ALARMTYPE.M_ALM_ALL_ALARM,
ref lSystem, ref lWarning, ref lAlarmType, out strAlarmMsg);
}
CheckError("GetAlarm", lResult);
//アラーム情報の出力
if ((lResult == 0) && (strAlarmMsg != ""))
{
//改行コードを区切りとして文字列を分割
String[] strAlarmMsgArray = strAlarmMsg.Split(new[] { "\r\n" }, StringSplitOptions.None);
for (Int32 i = 0; i < strAlarmMsgArray.Length; i++)
{
//アラームメッセージの出力(NC警告メッセージの場合はWaringという文字列を付与)
if (Int32.Parse(lWarning.GetValue(i).ToString()) != 0)
{
textBoxAlarmMessage.Text = textBoxAlarmMessage.Text + "(Warning)"
+ strAlarmMsgArray[i] + Environment.NewLine;
}
else
{
textBoxAlarmMessage.Text = textBoxAlarmMessage.Text
+ strAlarmMsgArray[i] + Environment.NewLine;
}
}
}
}
//プログラム情報の取得
private void GetProgramData()
{
Int32 lBlockNumber = 10;
Int32 lCountSize;
Int32 lCountStart = 0;
Int32 lResult;
String strProgramDataSubstring;
//NCタイプの取得
Enum.TryParse<SYSTEMTYPE>(comboBoxSystemType.Text, out SYSTEMTYPE sysNCType);
//実行プログラム表示のテキスト消去
listBoxCurrentProgram.Items.Clear();
//サポート対象外の場合の処理
if (sysNCType == SYSTEMTYPE.EZNC_SYS_CNCC80)
{
listBoxCurrentProgram.Items.Add("Not supported");
textBoxPrgNo.Text = "Not supported";
textBoxSequenceNo.Text = "Not supported";
return;
}
//プログラムブロック読み出し
lResult = oEZNcAutCom.Program_CurrentBlockRead(lBlockNumber,
out String strProgramData, out Int32 lCurrentBlockNumber);
CheckError("CurrentBlockRead", lResult);
//プログラム情報の出力
if (lResult == 0)
{
//改行コードを区切りとして文字列をリストに追加
lCountSize = strProgramData.IndexOf("\n");
while (lCountSize > 0)
{
strProgramDataSubstring = strProgramData.Substring(lCountStart,
lCountSize - lCountStart - 1);
listBoxCurrentProgram.Items.Add(strProgramDataSubstring);
lCountStart = lCountSize + 1;
lCountSize = strProgramData.IndexOf("\n", lCountStart);
}
//強調行の指定
if (lCurrentBlockNumber == 1)
{
//1ブロック目を強調
listBoxCurrentProgram.SelectedIndex = 0;
}
else if (lCurrentBlockNumber == 2)
{
//2ブロック目を強調
listBoxCurrentProgram.SelectedIndex = 1;
}
}
//プログラム番号の取得
lResult = oEZNcAutCom.Program_GetProgramNumber2((Int32)PROGRAMTYPE.EZNC_MAINPRG, out String strProgramNo);
CheckError("GetProgramNumber", lResult);
if(lResult == 0)
{
textBoxPrgNo.Text = strProgramNo;
}
//シーケンス番号の取得
lResult = oEZNcAutCom.Program_GetSequenceNumber((Int32)PROGRAMTYPE.EZNC_MAINPRG, out Int32 lSequenceNo);
CheckError("GetSequenceNumber", lResult);
if (lResult == 0)
{
textBoxSequenceNo.Text = lSequenceNo.ToString();
}
}
//GUI状態の更新
private void UpdateGUIStatus()
{
//接続中の場合
if(bConnectStatus == true)
{
textBoxConnectStatus.Text = "接続";
textBoxConnectStatus.BackColor = Color.LightBlue;
buttonConnect.Text = "切断";
textBoxIPAddress.Enabled = false;
comboBoxSystemType.Enabled = false;
buttonExcute.Enabled = true;
//通信開始中の場合
if(bCommunicateStatus == true)
{
textBoxOpenStatus.Text = "通信開始";
textBoxOpenStatus.BackColor = Color.LightBlue;
}
//通信終了中の場合
else
{
textBoxOpenStatus.Text = "通信終了";
textBoxOpenStatus.BackColor = Color.Yellow;
}
}
//切断中の場合
else
{
textBoxConnectStatus.Text = "切断";
textBoxConnectStatus.BackColor = Color.Red;
buttonConnect.Text = "接続";
textBoxOpenStatus.Text = "通信終了";
textBoxOpenStatus.BackColor = Color.Yellow;
textBoxIPAddress.Enabled = true;
comboBoxSystemType.Enabled = true;
buttonExcute.Enabled = false;
}
}
//GUI状態の初期化
private void ResetGUIStatus()
{
textBoxSystemVersion.ResetText();
textBoxCurrentPositionX.ResetText();
textBoxCurrentPositionY.ResetText();
textBoxCurrentPositionZ.ResetText();
textBoxWorkPositionX.ResetText();
textBoxWorkPositionY.ResetText();
textBoxWorkPositionZ.ResetText();
textBoxMachinePositionX.ResetText();
textBoxMachinePositionY.ResetText();
textBoxMachinePositionZ.ResetText();
listBoxCurrentProgram.Items.Clear();
textBoxPrgNo.ResetText();
textBoxSequenceNo.ResetText();
textBoxAlarmMessage.ResetText();
textBoxErrorCode.ResetText();
}
}
}
+126
View File
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="timerHighCycle.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="timerLowCycle.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>152, 17</value>
</metadata>
</root>
+28
View File
@@ -0,0 +1,28 @@
// Program.cs : アプリケーションのメインエントリポイント
//
/////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2023 MITSUBISHI Electric Corporation All Rights Reserved
//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace SampleAppCS
{
static class Program
{
/// <summary>
/// アプリケーションのメイン エントリ ポイントです。
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new FormSampleApp());
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[assembly: AssemblyTitle("SampleAppCS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SampleAppCS")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[assembly: ComVisible(false)]
// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
[assembly: Guid("3d20d5e3-7db0-495c-89e0-df6968879d29")]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+63
View File
@@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------
namespace SampleAppCS.Properties {
using System;
/// <summary>
/// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
/// </summary>
// このクラスは StronglyTypedResourceBuilder クラスが ResGen
// または Visual Studio のようなツールを使用して自動生成されました。
// メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
// ResGen を実行し直すか、または VS プロジェクトをビルドし直します。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SampleAppCS.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
/// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+26
View File
@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします。
// </auto-generated>
//------------------------------------------------------------------------------
namespace SampleAppCS.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+112
View File
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{3D20D5E3-7DB0-495C-89E0-DF6968879D29}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>SampleAppCS</RootNamespace>
<AssemblyName>SampleAppCS</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote_DEBUG|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Remote_DEBUG\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ClassDefine.cs" />
<Compile Include="FormSampleApp.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="FormSampleApp.Designer.cs">
<DependentUpon>FormSampleApp.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="FormSampleApp.resx">
<DependentUpon>FormSampleApp.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="postBuildTgt.bat" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<COMReference Include="EZNCAUTLib">
<Guid>{1B93D6AF-FD32-4281-83FE-533F666FAE6C}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>"$(ProjectDir)postBuildTgt.bat" "$(ConfigurationName)" "$(TargetDir)"</PostBuildEvent>
</PropertyGroup>
</Project>
+69
View File
@@ -0,0 +1,69 @@
@echo off
echo Effettua pulizia post build: configurazione %1. directory %2
RD /S /Q %2"\lib\da"
RD /S /Q %2"\lib\de"
RD /S /Q %2"\lib\es"
RD /S /Q %2"\lib\fr"
RD /S /Q %2"\lib\it"
RD /S /Q %2"\lib\ja-JP"
RD /S /Q %2"\lib\ko"
RD /S /Q %2"\lib\nl"
RD /S /Q %2"\lib\pl"
RD /S /Q %2"\lib\pt"
RD /S /Q %2"\lib\ru"
RD /S /Q %2"\lib\sv"
RD /S /Q %2"\lib\tr"
RD /S /Q %2"\lib\zh"
MOVE /Y %2"da" %2"lib\"
MOVE /Y %2"de" %2"lib\"
MOVE /Y %2"es" %2"lib\"
MOVE /Y %2"fr" %2"lib\"
MOVE /Y %2"it" %2"lib\"
MOVE /Y %2"ja-JP" %2"lib\"
MOVE /Y %2"ko" %2"lib\"
MOVE /Y %2"nl" %2"lib\"
MOVE /Y %2"pl" %2"lib\"
MOVE /Y %2"pt" %2"lib\"
MOVE /Y %2"ru" %2"lib\"
MOVE /Y %2"sv" %2"lib\"
MOVE /Y %2"tr" %2"lib\"
MOVE /Y %2"zh" %2"lib\"
if %1 == "Release" goto Release
if %1 == "Debug" goto Debug
if %1 == "Remote_DEBUG" goto RemoteDebug
:Release
REM INIZIO eliminando i files pdb
del /S %2"*.pdb""
del /S %2"*.xml""
del /S %2"lib/*.pdb""
echo Release: eliminato pdb + xml!!!
goto END
:Debug
echo Debug: nulla da eliminare
REM copia script verso server remoto
REM ROBOCOPY . \\10.150.0.1\Steamware\IOB-WIN-NEXT-DEB /MIR
goto END
:RemoteDebug
REM copia script verso server remoto
REM echo Debug remoto: effettuo robocopy sync (verificare remote per cliente)
REM IOB-WIN-SIM
REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR
REM IOBVPN4MACHINE
ROBOCOPY . \\10.51.90.6\Steamware\SampleAppCS /MIR
goto END
:END
echo Fatto!