Android App Development

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

Moderator: uasdkjava

Post Reply
Full Member
Full Member
Posts: 9
Joined: 07 Jun 2019, 08:35

Android App Development

Post by rakshan »

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));
KeyPair myClientApplicationInstanceCertificate = ExampleKeys.getCert(getApplicationContext(), applicationDescription);

// Create Client
Client myClient = Client.createClientApplication(myClientApplicationInstanceCertificate);
EndpointDescription[] endpoints = myClient.discoverEndpoints(“opc.tcp://”) //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);

Kindly guide me here.

Post Reply