OPC UA调用确认方法并在Java中获取Bad_EventIdUnkown

问题描述 投票:0回答:1

[目前,我正在使用Eclipse Milo开发OPCUA客户端。我能够从OPC UA cpp服务器读取数据,并且能够将设定值数​​据写入服务器。

我无法执行OPCUA警报和事件的确认。

我尝试使用节点红色opcua服务器并获得警报,现在我想确认相同的消息,所以我尝试了用于调用opcua的确认方法的代码。这是:

byte[] b=new byte[] {-66, -115, -121, -6, -39, 40, 89, 114, 60, -66, -126, -79, -72, -128, -21, 23, 0, 0, 4, -4};
        LocalizedText lt = new LocalizedText("bagiya");     
ByteString bs=new ByteString(b);
    Variant evntid1 = new Variant(bs);
        System.out.println("jangli id :=>"+vs[1]);

        Variant lt1 = new Variant(lt);
        Variant[] v = new Variant[] { evntid1,lt1 = new Variant(lt)};
        System.out.println(vs[1].getDataType());
        CallMethodRequest rec = new CallMethodRequest(NodeId.parse("ns=1;i=1003"), NodeId.parse("ns=1;i=1022"), v);

            System.out.println( rec.getTypeId()+"::=>"+client.call(rec).get());

此字节数组字符串由节点红色opcua服务器使用事件订阅示例的Eclipse milo代码给出。

    EventFilter eventFilter = new EventFilter(new SimpleAttributeOperand[] {

            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "EventId") }, AttributeId.Value.uid(), null),
            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "EventType") }, AttributeId.Value.uid(), null),
            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "Severity") }, AttributeId.Value.uid(), null),
            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "Time") }, AttributeId.Value.uid(), null),
            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "Time") }, AttributeId.Value.uid(), null),
            new SimpleAttributeOperand(Identifiers.BaseEventType,
                    new QualifiedName[] { new QualifiedName(0, "Message") }, AttributeId.Value.uid(), null) },
            new ContentFilter(null));

因此,我们正在获得以下指定状态:CallMethodResult {状态代码=状态代码{名称= Bad_EventIdUnknown,值= 0x809A0000,质量=差},输入参数结果= [状态代码{名称=好,值= 0x00000000,质量=好},状态代码{名称=好,值= 0x00000000 ,quality = good}],InputArgumentDiagnosticInfos = [],OutputArguments = []}

请给我一些解决此问题的建议。

java spring-boot opc-ua milo node-opcua
1个回答
0
投票

在这行代码中:

CallMethodRequest rec = new CallMethodRequest(NodeId.parse("ns=1;i=1003"), 
NodeId.parse("ns=1;i=1022"), v);

您解析两个节点ID。并且“ CallMethodResult”状态描述为:

ns = 1; i = 1003:

StatusCode {name = Bad_EventIdUnknown,值= 0x809A0000,质量=不良},InputArgumentResults = [StatusCode {name =好,值= 0x00000000,质量=良好}] >>

含义

Bad_EventIdUnknown,0x809A0000:无法识别指定的事件ID。 (参考here)。

ns = 1; i = 1022:

StatusCode {名称=好,值= 0x00000000,质量=好}],InputArgumentDiagnosticInfos = [],OutputArguments = []

因此,我想得出的结论是,解析可能存在一些问题ns = 1; i = 1003:

节点ID。
© www.soinside.com 2019 - 2024. All rights reserved.