Skip to content

Commit

Permalink
~ formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinherron committed Dec 31, 2024
1 parent 4c6fb49 commit 8a479c3
Showing 1 changed file with 35 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/*
* Copyright (c) 2024 the Eclipse Milo Authors
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/

package org.eclipse.milo.examples.client;

import java.util.concurrent.CompletableFuture;

import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.eclipse.milo.opcua.stack.core.security.SecurityPolicy;
import org.eclipse.milo.opcua.stack.core.types.builtin.DataValue;
Expand All @@ -15,40 +24,40 @@

public class IJTReadCustomDataTypeExample implements ClientExample {

public static void main(String[] args) throws Exception {
var example = new IJTReadCustomDataTypeExample();

new ClientExampleRunner(example, false).run();
}
public static void main(String[] args) throws Exception {
var example = new IJTReadCustomDataTypeExample();

private final Logger logger = LoggerFactory.getLogger(getClass());
new ClientExampleRunner(example, false).run();
}

@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
client.setDataTypeManagerInitializer(new OpcUaClient.DefaultDataTypeManagerInitializer(JsonCodecFactory::create));
private final Logger logger = LoggerFactory.getLogger(getClass());

client.connect();
@Override
public void run(OpcUaClient client, CompletableFuture<OpcUaClient> future) throws Exception {
client.setDataTypeManagerInitializer(
new OpcUaClient.DefaultDataTypeManagerInitializer(JsonCodecFactory::create));

NodeId nodeId = NodeId.parse("ns=1;s=TighteningSystem/ResultManagement/Results/Result");
DataValue value = client.readValue(0, TimestampsToReturn.Both, nodeId);
client.connect();

if (value.getValue().getValue() instanceof ExtensionObject xo) {
JsonStruct struct = (JsonStruct) xo.decode(client.getDynamicEncodingContext());
NodeId nodeId = NodeId.parse("ns=1;s=TighteningSystem/ResultManagement/Results/Result");
DataValue value = client.readValue(0, TimestampsToReturn.Both, nodeId);

System.out.println(struct);
}
if (value.getValue().getValue() instanceof ExtensionObject xo) {
JsonStruct struct = (JsonStruct) xo.decode(client.getDynamicEncodingContext());

future.complete(client);
System.out.println(struct);
}

@Override
public String getEndpointUrl() {
return "opc.tcp://10.211.55.3:40451";
}
future.complete(client);
}

@Override
public SecurityPolicy getSecurityPolicy() {
return SecurityPolicy.None;
}
@Override
public String getEndpointUrl() {
return "opc.tcp://10.211.55.3:40451";
}

@Override
public SecurityPolicy getSecurityPolicy() {
return SecurityPolicy.None;
}
}

0 comments on commit 8a479c3

Please sign in to comment.