Coder Social home page Coder Social logo

opc-ua-samples's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opc-ua-samples's Issues

Workstation.RobotApp Exception in Windows.UI.Xaml.dll code 0xc000027b

Have compiled Workstation.RobotApp and it run berfekt on my developer PC.
Have copied and installed it on a Win 10 Surface PC - here it crashes with:

Faulting module name: Windows.UI.Xaml.dll, version: 10.0.15063.966, time stamp: 0xe9d547ca
Exception code: 0xc000027b

Tried to remote debug. First it failed with unable to load mon-urho.dll becuase project is missing refrence to c++ runtime as described here:
https://stackoverflow.com/questions/39894134/urhosharp-forms-on-uwp-unable-to-load-dll-mono-urho?noredirect=1&lq=1
Adding the refenrce I can remote debug the App on the Surface PC - and the App runs perfect.
Installing it again and lunching it I get same Windows.UI.Xaml.dll error again.

It run in remote debugger but not when installed side loaded.

Mobile Hmi sample on Hololens ?

What code changes would be necessary in view to adapt the MobileHmi Urho-based sample, to get it running also on a HoloLens device (UrhoSharp should actually support also HoloLens )?

.NET Standard - based sample

Are you planning also to add a sample with the usage of UaClient in a .NET Standard based project ?
For instance Xamarin.Forms can use .NET Standard 1.4 based libraries, as described here

Why does this throw "LocalPrivateKey is null"

Hi Andrew,

Why is this throwing an exception that localprivatekey is null? I am trying to connect without any security.

    public OpcUaClient()
    {
        _appDescription = new ApplicationDescription()
        {
            ApplicationName = "Test",
            ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Bla",
            ApplicationType = ApplicationType.Client,
        };
    }

    public async Task Connect()
    {
        const string discoveryUrl = "opc.tcp://localhost:4840"; 

        var appDescription = new ApplicationDescription()
        {
            ApplicationName = "Test",
            ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Test",
            ApplicationType = ApplicationType.Client,
        };

        _channel = new UaTcpSessionChannel(
            appDescription,
            null, 
            async args => await Task.FromResult(new AnonymousIdentity()),
            discoveryUrl,
            loggerFactory:null);

        try
        {
            await _channel.OpenAsync();
        }
        catch (Exception e)
        {
          // throws "local private key is null"

/*
at Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel.d__119.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel.d__44.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Workstation.ServiceModel.Ua.Channels.CommunicationObject.d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Workstation.ServiceModel.Ua.Channels.CommunicationObject.d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at WpfApp1.OpcUaClient.d__3.MoveNext() in C:\Users\baprins\source\repos\WpfApp1\WpfApp1\OpcUaClient.cs:line 43
*/
}

    }

Get the nodeid corresponding to Tag name and vice versa

Sir,
I am referring to the code in the below link :
https://github.com/convertersystems/opc-ua-samples/blob/master/ConsoleApp/Program.cs
I have Tagname 'Tag1' created in OPC server. (in real scenario someone will create)
For monitoring this tag for data change notification i need to specify nodeid in the format (i=2256)
Can you please post C# code to get the nodeid from tagname and vice versa
Also suggest what is the SamplingInterval & QueueSize settings
Thanks in advance for your help.
Regards

new MonitoredItemCreateRequest { ItemToMonitor = new ReadValueId { NodeId = NodeId.Parse("i=2256"), AttributeId = AttributeIds.Value }, MonitoringMode = MonitoringMode.Reporting, RequestedParameters = new MonitoringParameters { ClientHandle = 12345, SamplingInterval = -1, QueueSize = 0, DiscardOldest = true } }

documentations about the library

where I can find more documentations about using this library, your example are already good, but I need a proper documentations to review.
thanks

Workstation.NodeServer - install missing NPM packages.

The missing NPM packages are not installed automatically when building the Workstation.NodeServer project. To generate them the "Install missing NPM packages" context menu inside the NodeServer project has to be explicitly executed.

UWP app rebuild issue in Visual Studio 2015

Dear Sir,

When I am download latest sample opc-ua-samples on today and try to rebuild in my visual studio then give below error

Error The Microsoft.Net.Native.Compiler package, included in Microsoft.NETCore.UniversalWindowsPlatform 5.3 and later, is only supported in Visual Studio 2017 and later. You can downgrade the version of the Microsoft.NETCore.UniversalWindowsPlatorm NuGet package to 5.2.* or earlier for Visual Studio 2015. Workstation.Common.Uwp

I downgrade Microsoft.NETCore.UniversalWindowsPlatform to 5.1.0 , 5.2.2 , 5.2.3 but still getting same error...

also delete the all content from bin and obj folder and try to rebuild but getting same errors.
What should I do if i want to run code in Visual studio 2015?

Thanks,

Problem to Load UWP app to Raspberry Pi

Dear Sir,

When I am trying to load Workstation.RobotApp UWP app but not able to load raspberry pi and give below exception

An exception of type 'System.BadImageFormatException' occurred in Urho.dll but was not handled in user code
Additional information: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)

Exception occur on below line in "RobotControl.xaml.cs"
this.robotGame = this.UrhoSurface.Run(new ApplicationOptions("Assets") { Width = (int)this.UrhoSurface.ActualWidth, Height = (int)this.UrhoSurface.ActualHeight });

Tejas Lodha

MobileHmi.Uwp ?

Would be possible to get the MobileHmi sample working also on UWP ?
As I did not use UrhoSharp by now, could you please tell me what tools are you using to design the UrhoSharp 3D graphical objects ?

[RobotApp] XAML Designer crashing caused by AlarmConditionToStringConverter (VS2017)

Dear Andrew!
I know, you run project on VS2015, but maybe you will be interested how it runs on VS2017 as well.
This is about RobotApp.
I able to compile the project and run it, but facing with the XAML Designer crashing (Designer crash occurs only for MainPage with the following error:
Microsoft.MetadataReader.UnresolvedAssemblyException
Type universe cannot resolve assembly: Workstation.UaClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null.).
I noticed this when started to use RC version of UaClient, and until 1.5.12 there was no any issues.
I found, that excluding reference of AlarmConditionToStringConverter from <Page.Resources> solving the issue. Of cause, I had to comment <ItemsControl>…</ItemsControl> on page in order it to run.
It might be VS2017 setup environment though.

OPC UA Example of website

Dear Sir,

It is not issue but only suggestions...

I am Very Happy to use and learn about OPC UA on your repository ...

All type of example available in your repository except Website.
I think you also give some basic example that how we can see live data efficiently of OPC UA on Web...

Are you plan something like that?

Thanks,

RobotApp disconnects from a opc server after window being minimized

Dear Andrew, thanks for the great example of OPC UA application!
I am using UWP RobotApp part of your project with connection to Codesys RTE.
I have found that in couple of seconds after being minimized RobotApp client disconnects from a server. When running in full screen or window mode connection remains stable.
I suspect that this is drawback from v1.4.1 release.
Could you please confirm if this behavior is common or i should be checking my setup?

Node monitoring reliability

Dear Andrew!
On a server side I do command validation and immediately reverting variable state back to previous value if not validated. The command is being successfully sent from RobotApp, but client does not picking up reverted variable value back, so HMI would reflect incorrect figures (RobotHmi does the same).
I am using CODESYS Control Win as a PLC, which running with 20ms cycle. Increasing PLC scan time improves the reliability but still discrepancy occurs. As a workaround I see implementation of the same validation on client side and block command which will be rejected as better option than increasing the PLC cycle.
Cross checked with UAExpert and found that one will pick up reverted value correctly even with 20ms cycle PLC scan time.
Hope this remark will fall within your interest scope.

Certificate Error in Workstation.ConsoleApp and also in Workstation.DataLoggingConsole

Dear Sir,

I am getting error while run Workstation.ConsoleApp and Workstation.DataLoggingConsole Project as below in command prompt

"Step 1 - Describe this app.
Step 2 - Discover endpoints of 'opc.tcp://localhost:26543'.
Step 3 - Choose the endpoint with highest security level.
http://opcfoundation.org/UA/SecurityPolicy#Basic256
Step 4 - Create a session with your server.
The Certificate has expired or is not yet valid.
Press any key to close the program..."

in same project I am able to successfully run Workstation.RobotApp(UWP) but I am not able to run Workstation.RobotHmi and Error is Timeout

I think issue is Certificate location Define in code.....
Need your help

Tejas Lodha

Timing at application startup

The following problem occurs at startup if a opc-ua item has a constant value. The view model (containing the MonitoredItem attribute) is initialized and the monitored opc-ua item fetched, before the Urho object is created. The "Renderer" property is set only after the view model already received the opc-ua item value ( I tested with the debugger). This leads to the problem that the bindable property changes before the urho object was showed, and practically the urho code "misses" the property change.

protected async override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); if (propertyName == "Renderer") { this.robotGame = await this.UrhoSurface.Show<RobotGame>(new ApplicationOptions(assetsFolder: "Data") { Orientation = ApplicationOptions.OrientationType.LandscapeAndPortrait }); } }

How could the startup order be changed, to avoid the problems that occur if a opc-ua item has a constant value ? (sorry, I cannot get the code formatted properly...)

How to make these parameter can modify

Dear sir,
How to make these parameter can modify in View, seemingly cannot use class variables.

[Subscription(endpointUrl: "opc.tcp://192.168.11.18:4840", publishingInterval: 500, keepAliveCount: 20)]

Publish several subscriptions

Could you please post a sample about how to publish several subscriptions ?
In the ConsoleApp sample the PublishRequest class is used as follows

var publishRequest = new PublishRequest
{
SubscriptionAcknowledgements = new SubscriptionAcknowledgement[0]
};
...
var publishResponse = await session.PublishAsync(publishRequest).ConfigureAwait(false);

How does the PublishRequest relate to the previously created Subscription/MonitoringItemRequest ? What if there are several subcriptions ?

Workstation.MobileHmi.Droid project compilation errors

I am trying to compile the new version but am getting lots of errors like:

...
Please install package: 'Xamarin.Android.Support.v7.CardView' available in SDK installer. Android resource directory C:\Users*\AppData\Local\Xamarin\Xamarin.Android.Support.v7.CardView\23.3.0.0\content./ doesn't exist.
...
Please install package: 'Xamarin.Android.Support.Vector.Drawable' available in SDK installer. Java library file C:\Users*
\AppData\Local\Xamarin\Xamarin.Android.Support.Vector.Drawable\23.3.0.0\content\classes.jar doesn't exist.
...
Please install package: 'Xamarin.Android.Support.v4' available in SDK installer. Android resource directory C:\Users***\AppData\Local\Xamarin\Xamarin.Android.Support.v4\23.3.0.0\content./ doesn't exist.

... and so on.

I installed these packages manually from the nuget server, but the error messages are still generated ...
Why are these packages reported as missing, respectively why are they searched into the c:\users... folder ?

Server certificate rejected

I recently heard about this project and I donwloaded it this morning. I compiled and run Workstation.RobotServer and I'm trying to connect to it using Workstation.ConsoleApp.
Unfortunatelly I get:

Step 1 - Describe this app.
Step 2 - Create a certificate store.
Step 3 - Create a session with your server.
Error connecting to endpoint. Did the server reject our certificate?
Could not verify security on OpenSecureChannel request.
Press any key to close the program...

The trace from visual studio output is:

Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Information: Discovering endpoints of 'opc.tcp://portatilesys8:26543/Workstation.RobotServer'.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Channel opening.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Sending OpenSecureChannelRequest, Handle: 1
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Received OpenSecureChannelResponse, Handle: 1 Result: 0x00000000
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Channel opened.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Sending GetEndpointsRequest, Handle: 2
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Installed new security token 1.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Received GetEndpointsResponse, Handle: 2 Result: 0x00000000
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Channel closing.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Sending CloseSecureChannelRequest, Handle: 3
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Channel closed.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Trace: Success discovering endpoints of 'opc.tcp://portatilesys8:26543/Workstation.RobotServer'.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Trace: Channel opening.
'Workstation.ConsoleApp.exe' (CLR v4.0.30319: Workstation.ConsoleApp.exe): caricamento di 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.resources\v4.0_4.0.0.0_it_b77a5c561934e089\System.resources.dll' completato. Modulo compilato senza simboli.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Found certificate with subject alt name 'urn:PORTATILESYS8:MyHomework'.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Information: Opening session channel with endpoint 'opc.tcp://portatilesys8:26543/Workstation.RobotServer'.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Information: SecurityPolicy: 'http://opcfoundation.org/UA/SecurityPolicy#Basic256Sha256'.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Information: SecurityMode: 'SignAndEncrypt'.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Information: UserIdentity: 'Workstation.ServiceModel.Ua.AnonymousIdentity'.
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Trace: Sending OpenSecureChannelRequest, Handle: 1
Workstation.ServiceModel.Ua.Channels.UaTcpSecureChannel: Error: Error receiving response. Could not verify security on OpenSecureChannel request.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Trace: Channel faulted.
Il thread 0x3e94 è terminato con il codice 0 (0x0).
Il thread 0x32bc è terminato con il codice 0 (0x0).
Eccezione generata: 'Workstation.ServiceModel.Ua.ServiceResultException' in mscorlib.dll
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Trace: Channel closing.
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel: Trace: Channel closed.
Eccezione generata: 'Workstation.ServiceModel.Ua.ServiceResultException' in mscorlib.dll
Eccezione generata: 'Workstation.ServiceModel.Ua.ServiceResultException' in mscorlib.dll

If I connect to Workstation.RobotServer with UaExpert client and it works properly and I'm able to see the robot axis.

Am I missing some configuration?

node-opcua OPC Server certificate file location

I tried to start the Workstation.NodeServer, but following error is displayed:

AssertionError: fs.existsSync(this.certificateFile), "Certificate file must exist :" + this.certificateFile

In what folder does the OPC Server search the "server_selfsigned_cert_2048.pem" and "server_key_2048.pem" certificate files ?

Connecting to RobotServer

The MobileHmi.Droid and RobotHmi client samples do not connect to the new RobotServer.
Both samples work fine with the "old" node-based server form opc-ua-samples.
Are some client/server new certificates to be created ? If yes, how ?

What is the licensing model for the OPC UA .Net Standard Library SDK used in the RobotServer ?

Workstation.RobotServer with MonitoringMode.Sampling

Hello,
in a test client I'm trying to subscribe to a ValueMonitoredItem for "Axis1" in the Workstation.RobotServer with SamplingInterval = 100 and MonitoringMode = MonitoringMode.Sampling. With this configuration, the Workstation.RobotServer does not return any NotificationMessage.NotificationData. NotificationData is only returned if SamplingInterval = -1. Is MonitoringMode.Sampling just not implemented in Workstation.RobotServer?

Cannot compile sample

I am trying to build a simple OPCUA Browser, and am considering this OPCUA Client, but I cannot get the sample code to run. I am using a VS2015 UPD 3 with a new Console App.

I imported the NuGet package COnverterSystems.OpcUA v 5.0.0

//declaration:
using System;
using System.Linq;
using System.Threading.Tasks;
using Opc.Ua;

Issue: these aren't recognized and I don't know the proper way to include them in a new console app:
using Workstation.ServiceModel.Ua;
using Workstation.ServiceModel.Ua.Channels;

errors:

Error CS0103 The name 'TransportProfileUris' does not exist in the current context ConsoleOPCUA C:\Users\user\Documents\Visual Studio 2015\Projects\ConsoleOPCUA\ConsoleOPCUA\Program.cs 44 Active
Error CS0103 The name 'UaTcpDiscoveryClient' does not exist in the current context ConsoleOPCUA C:\Users\user\Documents\Visual Studio 2015\Projects\ConsoleOPCUA\ConsoleOPCUA\Program.cs 46 Active
Error CS0246 The type or namespace name 'UaTcpSessionChannel' could not be found (are you missing a using directive or an assembly reference?) ConsoleOPCUA C:\Users\user\Documents\Visual Studio 2015\Projects\ConsoleOPCUA\ConsoleOPCUA\Program.cs 57 Active
Error CS1061 'ApplicationDescription' does not contain a definition for 'GetCertificate' and no extension method 'GetCertificate' accepting a first argument of type 'ApplicationDescription' could be found (are you missing a using directive or an assembly reference?) ConsoleOPCUA C:\Users\user\Documents\Visual Studio 2015\Projects\ConsoleOPCUA\ConsoleOPCUA\Program.cs 57 Active

Using UaTcpSessionClient constructor with EndpointDescription - MobileHmi.Droid sample does not work

I tried to change the MobileHmi.Droid sample and use the UaTcpSessionClient constructor with EndpointDescription as parameter instead of the discovery URL. In this case the MobileHmi.Droid ends immediately after start. Here is what I changed in OnStart()

    protected override async void OnStart()
    {
        // Setup a logger.
        this.loggerFactory = new LoggerFactory();
        this.loggerFactory.AddDebug(LogLevel.Trace);
        this.logger = this.loggerFactory.CreateLogger<App>();

        bool useEndpoint = true;

        if (useEndpoint)
        {
            // discover available endpoints of server.
            var getEndpointsRequest = new GetEndpointsRequest
            {
                EndpointUrl = this.discoveryUrl,
                ProfileUris = new[] {TransportProfileUris.UaTcpTransport}
            };
            Console.WriteLine($"Discovering endpoints of '{getEndpointsRequest.EndpointUrl}'.");
            var getEndpointsResponse = await UaTcpDiscoveryClient.GetEndpointsAsync(getEndpointsRequest);
            var selectedEndpoint = getEndpointsResponse.Endpoints.OrderByDescending(e => e.SecurityLevel).First();

            // Create the session client for the app.
            this.session = new UaTcpSessionClient(
            new ApplicationDescription()
            {
                ApplicationName = "Workstation.MobileHmi",
                ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Workstation.MobileHmi",
                ApplicationType = ApplicationType.Client
            },
            new DirectoryStore(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "pki"), loggerFactory: this.loggerFactory),
            this.ProvideUserIdentity,
            selectedEndpoint,
            this.loggerFactory);
        }
        else
        {
            // Create the session client for the app.
            this.session = new UaTcpSessionClient(
            new ApplicationDescription()
            {
                ApplicationName = "Workstation.MobileHmi",
                ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Workstation.MobileHmi",
                ApplicationType = ApplicationType.Client
            },
            new DirectoryStore(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "pki"), loggerFactory: this.loggerFactory),
            this.ProvideUserIdentity,
            this.discoveryUrl,
            this.loggerFactory);
        }


        // Show the MainPage
        var viewModel = new MainPageViewModel(this.session);
        var view = new MainPage { BindingContext = viewModel };

        this.MainPage = new NavigationPage(view);
    }

Detailed Documentation to understand that communication of OPC UA with .Net?

Dear Sir,

Can you give Documentation of your this code or Can you give video or any web site which explain opc ua and .net in detail?
Means Explain Why this code need in this class. in short How begging programming with OPC UA and .Net..
It is good for understanding basic of code so beginner will start.

Thanks

The message encoding/decoding limits imposed by the stack have been exceeded.

Hello ,awcullen

I use your UaAndroid to connect PROSYS Simulation Server,the following error occurred,
I found this link talk about my error,you can look at what's the problem.

Thank for you contribution,
Best regards.

Workstation.ServiceModel.Ua.UaTcpSessionClient: Information: Discovering endpoints of 'opc.tcp://ip:53530'.
[0:] Workstation.ServiceModel.Ua.UaTcpSessionClient: Error: Error discovering endpoints of 'opc.tcp://ip:53530'. The message encoding/decoding limits imposed by the stack have been exceeded.
[0:] Workstation.ServiceModel.Ua.UaTcpSessionClient: Information: Closing channel with endpoint 'opc.tcp://ip:53530'.
[0:] Workstation.ServiceModel.Ua.UaTcpSessionClient: Error: Error closing channel. Object reference not set to an instance of an object.
[0:] Workstation.ServiceModel.Ua.UaTcpSessionClient: Trace: Connecting in 20000 ms.

How does the initial reconnect work?

As if the client start before the server doesn't start.
This code works well this condition.
What is the machinism?

        this.application = new UaApplicationBuilder()
            .SetApplicationUri($"urn:{Dns.GetHostName()}:Workstation.RobotHmi")
            .SetDirectoryStore(Path.Combine(
                Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                "Workstation.RobotHmi",
                "pki"))
            .SetIdentity(this.ShowSignInDialog)
            .SetLoggerFactory(this.loggerFactory)
            .AddMappedEndpoints(config)
            .Build();

two way communications possible in this example?

Hi,

Can we do two way communication between Mobile app(Mobil Hmi) to OPC server?
Can you demonstrate in exiting example?
Example: i want give parameters to axis by mobile app n axis changed on given parameters.
Or
I want to stop machine by mobile app,
Or
I want to start again machine by mobile app?

Can possible that many instants of OPC UA server fetch and display in mobile app ?

Dear Sir,

I am looking for that multiple opc ua server fetch and display on same page of mobile application

Example:
I have 10 OPC UA server and fetch some 5 variables from each server and display 5 variable of each opc ua server on same page of android application. can you demonstrate this in Workstation.MobileHmi ?

Thanks,

Unable to connect to RobotServer using ConsoleApp due to Certificate issue

Hi,

I just forked the samples repo and simply tried to run the RobotServer and the ConsoleApp. In step 3 of the ConsoleApp, the app gets stuck. After about 15 seconds I get this in the console:

Step 1 - Describe this app.
Step 2 - Create a certificate store.
Step 3 - Create a session with your server.
Error connecting to endpoint. Did the server reject our certificate?
Could not verify security on OpenSecureChannel request.
Press any key to close the program...

Do I have to configure anything related to the certificates? Maybe in the '\opc-ua-samples\RobotServer\Workstation.RobotServer.Config.xml' config file?

I checked that the ConsoleApp created the following files:
\AppData\Local\Workstation.ConsoleApp\pki\own\certs\********.crt
\AppData\Local\Workstation.ConsoleApp\pki\own\private\********.key

Thanks!

Mssing certificate or what?

Trying to use sample console in other environment and I got these messages:
Step 4 - Create a session with your server.

(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 45)

[2016/12/11 08:33:45][10][Informational][X509CertificateExtensions.cs:110][GetCertificate] Found certificate 'CN=MyHomework, DC=TREL16087112.VSTAGE.CO'.
[2016/12/11 08:33:45][10][Informational][X509CertificateExtensions.cs:110][GetCertificate] Found certificate 'CN=MyHomework, DC=TREL16087112.VSTAGE.CO'.
[2016/12/11 08:33:45][10][Informational][X509CertificateExtensions.cs:110][GetCertificate] Found certificate 'CN=MyHomework, DC=TREL16087112.VSTAGE.CO'.
The thread 0xa54 has exited with code 0 (0x0).
Workstation.ServiceModel.Ua.Channels.UaTcpSessionChannel

(Filename: C:\buildslave\unity\build\artifacts/generated/Metro/runtime/UnityEngineDebugBindings.gen.cpp Line: 45)

The thread 0xda0 has exited with code 0 (0x0).
The thread 0x818 has exited with code 0 (0x0).
The thread 0x102c has exited with code 0 (0x0).
The thread 0x444 has exited with code 0 (0x0).
[2016/12/11 08:33:57][10][Verbose][CommunicationObject.cs:422][OnOpeningAsync] Channel opening.
[2016/12/11 08:33:57][10][Verbose][CommunicationObject.cs:422][OnOpeningAsync] Channel opening.
[2016/12/11 08:33:57][10][Verbose][CommunicationObject.cs:422][OnOpeningAsync] Channel opening.
[2016/12/11 08:33:57][19][Error][CommunicationObject.cs:359][OnFaulted] Channel faulted.
[2016/12/11 08:33:58][19][Error][CommunicationObject.cs:359][OnFaulted] Channel faulted.
[2016/12/11 08:33:58][19][Error][CommunicationObject.cs:359][OnFaulted] Channel faulted.
Exception thrown: 'System.Net.Sockets.SocketException' in mscorlib.ni.dll
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:329][OnClosingAsync] Channel closing.
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:329][OnClosingAsync] Channel closing.
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:329][OnClosingAsync] Channel closing.
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:298][OnClosedAsync] Channel closed.
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:298][OnClosedAsync] Channel closed.
[2016/12/11 08:33:58][20][Verbose][CommunicationObject.cs:298][OnClosedAsync] Channel closed.
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
Exception thrown: 'System.AggregateException' in mscorlib.ni.dll
One or more errors occurred. (Channel faulted.)

Fetch data to mobile from Cloud

Dear Sir,

Its not issue but want suggestion.
I want to use mobile application MobileHmi from any where through internet.

because MobileHmi.Droid only run in intranet(in the same network) but how we can use this application in internet?

Any OPC UA web service required?

Thanks.

Get node id, node name (tag name) in data change notification

Sir,
I am referring to the code in the below link :
https://github.com/convertersystems/opc-ua-samples/blob/master/ConsoleApp/Program.cs
When monitoring for multiple nodes (Tags), how to get the node name, node id etc in data changed notification.
Going to pass the node name (Tag name), its value and the timestamp to a rest API.
I have to get it in below lines of code :
foreach (var dcn in dcns)
{
foreach (var min in dcn.MonitoredItems)
{
Console.WriteLine($"clientHandle: {min.ClientHandle}; value: {min.Value}");
}
}

Fetch Live data from method

Dear Sir,

I can able to fetch live data via viewmodel.
But how can I fetch live data through method which call to Viewmodel from diffrent class

Example

I have one main view model MainPageViewModel


using System;
using System.Runtime.CompilerServices;
using Workstation.ServiceModel.Ua;



namespace IoT_Mobile
{

    [Subscription(endpointUrl: "opc.tcp://192.168.137.1:26543", publishingInterval: 501, keepAliveCount: 30)]

    public class **MainPageViewModel** : SubscriptionBase
    {

        [MonitoredItem(nodeId: "ns=2;s=Robot1_Axis4")]
        public float Robot1Axis4
        {
            get { return this.robot1Axis4; }
            set { this.SetPropertyWithDeadband(ref this.robot1Axis4, value, 1.0f); }
        }

        private float robot1Axis4;

        /// <summary>
        /// Added to help with Xamarin Forms implementation of Slider.
        /// </summary>
        protected virtual bool SetPropertyWithDeadband(ref float storage, float value, float deadband, [CallerMemberName] string propertyName = null)
        {
            if (Math.Abs(storage - value) < deadband)
            {
                return false;
            }

            storage = value;
            this.NotifyPropertyChanged(propertyName);
            return true;
        }
    }
}

Now I want Live data through method GetData() as below from different class

 public static double GetValue()
        {
            MainPageViewModel obj1 = new MainPageViewModel();
            double axiesdata = obj1.Robot1Axis1;

            return axiesdata;
        }

But every time I got value 0 from above method.
Any mistake i Did in above?

need your help.

thanks,

Wpf on .NET 5

Hi team,
I just started playing with your library, and so I created a Console on .NET 5 using your sample code: everything worked fine. However, I couldn't get it to work on Wpf on .NET 5. I set it up exactly as in your sample Wpf .NET 4.6 app, but it wouldn't log anything in the Output window and the window would only show "connecting". I don't know much about async machinery, but I noticed it hanged on await this.whenSubscribed.Task in SubscriptionBase.

On the other hand, when I recreated your wpf sample using .NET 4.8, everything worked fine.

Is this something you ever tried?

System.TypeLoadException: Could not load type 'Workstation.ServiceModel.Ua.Subscription[]' from assembly 'Workstation.UaClient, Version=1.5.0.30692

Where you able to make it work? I tried doing a sample application but in this line of code.

` private string discoveryUrl = @"opc.tcp://10.164.232.82:62547"; // Use ip address ( or '10.0.2.2' for accessing local host computer from emulator. hostname, localhost or 127.0.0.1 will not work on Android emu!)

    private ILoggerFactory loggerFactory;
    private ILogger logger;
    private UaTcpSessionClient session;
    protected override void OnCreate (Bundle bundle)
	{
		base.OnCreate (bundle);

		global::Xamarin.Forms.Forms.Init (this, bundle);
        // Setup a logger.
        this.loggerFactory = new LoggerFactory();

        this.logger = this.loggerFactory.CreateLogger<MainActivity>();

        try
        {
            // Create the session client for the app.
            this.session = new UaTcpSessionClient(
                new ApplicationDescription()
                {
                    ApplicationName = "Workstation.MobileHmi",
                    ApplicationUri = $"urn:{System.Net.Dns.GetHostName()}:Workstation.MobileHmi",
                    ApplicationType = ApplicationType.Client
                },
                new DirectoryStore(
                    Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "pki"),
                    loggerFactory: loggerFactory),
                this.ProvideUserIdentity,
                this.discoveryUrl,
                this.loggerFactory);

            this.LoadApplication(new App(this.session));
        }
        catch (Exception ex)
        {
            this.logger.LogError("Error creating UaTcpSessionClient. {0}", ex.Message);
        }
    }

`

ex:

{System.TypeInitializationException: The type initializer for 'System.Collections.Generic.List1' threw an exception. ---> System.TypeLoadException: Could not load type 'Workstation.ServiceModel.Ua.Subscription[]' from assembly 'Workstation.UaClient, Version=1.5.0.30692, Culture=neutral, PublicKeyToken=null'. at System.Collections.Generic.List1[T]..cctor () [0x00000] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/collections/generic/list.cs:47
--- End of inner exception stack trace ---
at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr)
at System.Collections.ObjectModel.Collection1[T]..ctor () [0x00006] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/collections/objectmodel/collection.cs:28 at System.Collections.ObjectModel.ObservableCollection1[T]..ctor () [0x0000b] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:50
at Workstation.ServiceModel.Ua.UaTcpSessionClient..ctor (Workstation.ServiceModel.Ua.ApplicationDescription localDescription, ICertificateStore certificateStore, System.Func`2 userIdentityProvider, System.String endpointUrl, ILoggerFactory loggerFactory, Double sessionTimeout, UInt32 timeoutHint, UInt32 diagnosticsHint, UInt32 localReceiveBufferSize, UInt32 localSendBufferSize, UInt32 localMaxMessageSize, UInt32 localMaxChunkCount) [0x0002b] in :0
at App1.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0002e] in D:\Files\Personal\Development\OpcUa\App1\App1\App1.Droid\MainActivity.cs:37 }

stacktrace:

at (wrapper managed-to-native) System.Object:__icall_wrapper_mono_generic_class_init (intptr) at System.Collections.ObjectModel.Collection1[T]..ctor () [0x00006] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/mscorlib/system/collections/objectmodel/collection.cs:28 at System.Collections.ObjectModel.ObservableCollection1[T]..ctor () [0x0000b] in /Users/builder/data/lanes/3415/7db2aac3/source/mono/external/referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs:50 at Workstation.ServiceModel.Ua.UaTcpSessionClient..ctor (Workstation.ServiceModel.Ua.ApplicationDescription localDescription, ICertificateStore certificateStore, System.Func`2 userIdentityProvider, System.String endpointUrl, ILoggerFactory loggerFactory, Double sessionTimeout, UInt32 timeoutHint, UInt32 diagnosticsHint, UInt32 localReceiveBufferSize, UInt32 localSendBufferSize, UInt32 localMaxMessageSize, UInt32 localMaxChunkCount) [0x0002b] in :0 at App1.Droid.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0002e] in D:\Files\Personal\Development\OpcUa\App1\App1\App1.Droid\MainActivity.cs:37

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.