Login  •  Register


Android App Development

Questions regarding the use of the Java SDK for Server or Client development or integration into customer products ...

Android App Development

Postby rakshan » 07 Jun 2019, 08:41

Hi,
I am a beginner in OPCUA and also Java.
I have a task of developing an android application which would automate certain functionalities.

I have researched and come across a code, which would read/write to a node by specifying the namespace and NodeID through the code.
Now, i want to display a list of nodes present on the server( Raspberry Pi, Coded in C), Read value or write value through the APP itself.

I am not able to figure out a method to use for the same.

I have established the connection to the server as below.

Code: Select all
ApplicationDescription applicationDescription = new ApplicationDescription();
applicationDescription.setApplicationName(new LocalizedText(“AndroidClient”, Locale.ENGLISH));
applicationDescription.setApplicationUri(“urn:localhost:AndroidClient”);
applicationDescription.setProductUri(“urn:localhost:AndroidClient”);
applicationDescription.setApplicationType(ApplicationType.Client);
KeyPair myClientApplicationInstanceCertificate = ExampleKeys.getCert(getApplicationContext(), applicationDescription);

// Create Client
Client myClient = Client.createClientApplication(myClientApplicationInstanceCertificate);
EndpointDescription[] endpoints = myClient.discoverEndpoints(“opc.tcp://192.168.4.1:4840”) //connect to my server

// Filter out all but opc.tcp protocol endpoints
endpoints = EndpointUtil.selectByProtocol(endpoints, “opc.tcp”);

// Filter out all but Signed & Encrypted endpoints
endpoints = EndpointUtil.selectByMessageSecurityMode(endpoints, MessageSecurityMode.None);

// Filter out all but Basic256Sha256 cryption endpoints
endpoints = EndpointUtil.selectBySecurityPolicy(endpoints, SecurityPolicy.NONE);

// Sort endpoints by security level. The lowest level at the beginning, the highest at the end of the array
endpoints = EndpointUtil.sortBySecurityLevel(endpoints);

// Choose one endpoint.
EndpointDescription endpoint = endpoints[endpoints.length – 1];

SessionChannel mySession = myClient.createSessionChannel(endpoint);
mySession.activate();




Kindly guide me here.
rakshan
Newbie
Newbie
 
Posts: 1
Joined: 07 Jun 2019, 08:35

Return to JAVA based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests