0
votes

Currently i am developing OPCUA client using Eclipse Milo. I am able to read data from OPC UA cpp server and able to write setpoint data to server.

I am not able to perform acknowledgement of OPCUA ALarm and events.

I tried with node-red opcua server and getting alarms,now i want to acknowledge the same , so i had tried code for calling acknowledgement method for opcua. Here it is:

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());

this byte array string is given by node-red opcua server using eclipse milo code of Event Subscription Example.

    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));

So we are getting this below given status: CallMethodResult{StatusCode=StatusCode{name=Bad_EventIdUnknown, value=0x809A0000, quality=bad}, InputArgumentResults=[StatusCode{name=Good, value=0x00000000, quality=good}, StatusCode{name=Good, value=0x00000000, quality=good}], InputArgumentDiagnosticInfos=[], OutputArguments=[]}

Kindly give me some suggestions to troubleshoot this problem.

1

1 Answers

0
votes

In this line of code :

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

You parse two node Id's. And the "CallMethodResult" Status depicts that:

ns=1;i=1003 :

StatusCode{name=Bad_EventIdUnknown, value=0x809A0000, quality=bad}, InputArgumentResults=[StatusCode{name=Good, value=0x00000000, quality=good}

Meaning

Bad_EventIdUnknown, 0x809A0000 : The specified event ID is not recognized. (with reference to here).

ns=1;i=1022 :

StatusCode{name=Good, value=0x00000000, quality=good}], InputArgumentDiagnosticInfos=[], OutputArguments=[]

Therefore, I would like to conclude that there might be some problems with parsing ns=1;i=1003 : node id.