Giter VIP home page Giter VIP logo

Comments (2)

kevinherron avatar kevinherron commented on May 20, 2024

The constructor you're using for DataValue takes a value and uses
StatusCode.GOOD by default. If I remember correctly, the Beckhoff servers
are very picky about allowing writes that include a StatusCode. Try
building your DataValue using the full 4-argument constructor but supplying
null values for everything but the value argument.

On Sunday, October 2, 2016, tosuns [email protected] wrote:

After a while I started again with the evaluation of this library. My
previous issue seems to be resolved.
But now when I try to change a value on the Beckhoff-OPCUA-Server it fails
with the message Bad_WriteNotSupported, even if the variable is set to
readable and writable. I tried the Beckhoff OPCUA-Client and the write
operation worked fine and I'm able to read the value of the variable with
the milo opcua client (read-operation works fine, but not the write
operation).

The Test-case in the milo project works fine too. So I'm not sure what
could actually be the cause for this issue.

My Test-case looks as follows:

`Test
public void lowlevelTest() throws InterruptedException,
ExecutionException {

final OpcUaClient opcUaclient = UaTcpStackClient.getEndpoints("opc.tcp://localhost:4840")
        .thenApply(endPoints -> {
            EndpointDescription endpoint = Arrays.stream(endPoints)
                    .filter(e -> e.getSecurityPolicyUri().equals(SecurityPolicy.None.getSecurityPolicyUri()))
                    .findFirst()
                    .orElseThrow(() -> new RuntimeException("no desired endpoints return from the opcua server!"));
            OpcUaClientConfig clientConfig = OpcUaClientConfig.builder()
                    .setApplicationName(LocalizedText.english("test opcua client"))
                    .setApplicationUri("urn:test:opcua:client")
                    .setEndpoint(endpoint)
                    .setRequestTimeout(uint(60000))
                    .setExecutor(Executors.newCachedThreadPool())
                    .build();
            return new OpcUaClient(clientConfig);
        })
        .get();
final NodeId nodeId = new NodeId(7, "GlobalData.AirConditioning.Config.T_on");
final DataValue before = opcUaclient.readValue(0, TimestampsToReturn.Both, nodeId)
        .get();
System.out.println(MessageFormat.format("before write value: {0}", before));

final StatusCode statusCode = opcUaclient.writeValue(nodeId, new DataValue(new Variant(32f))).get();

Assert.assertTrue(statusCode.toString(), statusCode.isGood());

final DataValue after = opcUaclient.readValue(0, TimestampsToReturn.Both, nodeId)
        .get();

System.out.println(MessageFormat.format("after write value: {0}", after));

Assert.assertThat(after.getValue().getValue(), not(is(before.getValue().getValue())));

}`

The assertion regarding the StatusCode fails.

java.lang.AssertionError: StatusCode{name=Bad_WriteNotSupported,
value=0x80730000, quality=bad}
at org.junit.Assert.fail(Assert.java:93)
at org.junit.Assert.assertTrue(Assert.java:43)
at com.milo.opcua.MiloOpcUaClientNGTest.lowlevelTest(
MiloOpcUaClientNGTest.java:151)

I'm testing the most recent master branch.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#57, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUxMRHDZSZQHAonYjmy2N_ol7HRThKpks5qv6_ZgaJpZM4KMAnI
.

from milo.

tosuns avatar tosuns commented on May 20, 2024

Thanks, that worked 👍

from milo.

Related Issues (20)

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.