Login  •  Register


Error BadWaitingforInitialData

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

Error BadWaitingforInitialData

Postby ighoddan » 12 Aug 2014, 15:25

Hello,
i'm doing some tests with the Java SDK on Raspberry Pi. I want to read the Temperature of a DHT22 Sensor over OPCUA. I'm using JNI to call a C Funktion, that returns the Value of the Sensor. Everything works fine (C-Code,JNI), except reading the Sensor via OPCUA. I'm using the UaExpert. When i try to read the Variable, that contains the Value of the Sensor i get the Error "BadWaitingForInitialData". Could it be, that the return from the read_dht Funktion ist to slow?
When i test the call via JNI, it takes about 1 sec to get the value.

Thanks
Greetings
ighoddan
Sr. Member
Sr. Member
 
Posts: 10
Joined: 20 Jun 2014, 17:24

Re: Error BadWaitingforInitialData

Postby Support Team » 12 Aug 2014, 18:38

Hi Ighoddan,

it seems that the value is not updated internally and by this never send, on first subscribing the (initial) value should be send in a Publish response. This obviously does not happen. From there on the server must monitor the value and send (PublishResponse) when the value has changed.

Can you explicitely "read" the value? By using the "Attribute-Window" of the UaExpert, pressing the refresh button at the top?

Best Regards
Support Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2420
Joined: 18 Mar 2011, 15:09

Re: Error BadWaitingforInitialData

Postby ighoddan » 13 Aug 2014, 09:36

Hello,
i tried to read the value in the Attribute-Window, but it is still the same Error.
I included my Code into your sample server code. I'm calling my native Funktion inside the simulate() Funktion in MyNodeManager.java. Could it be, that the response time from the native Funktion is too long ?
I also wrote a alternative funktion lokal inside MyNodeManager.java, which only returns a double value. When i call this funktion instead of the real native funktion everything works fine and the returned value shows in UaExpert.

Thanks

Ghoddan
ighoddan
Sr. Member
Sr. Member
 
Posts: 10
Joined: 20 Jun 2014, 17:24

Re: Error BadWaitingforInitialData

Postby Support Team » 18 Aug 2014, 11:57

Hi Ghoddan,

if the read does not work either, it is not a problem in the SDK but most likely a problem in your implementation where you get the real data value, probably in the JNI call.

The simulate() method is called from a separate simulation Thread, therefore the duration of the call should not matter. The method is scheduled to execute every second; in case it takes longer, it just starts the next execution late. If the JNI method call is placed in the try-catch part of the simulate() method, then in case of an exception the simulation is stopped.

You should get error level log message if this does happen. You should check the logs and/or printing the return value of the JNI call in the simulate() method to know it is still running.

Best Regards
Support Team
User avatar
Support Team
Hero Member
Hero Member
 
Posts: 2420
Joined: 18 Mar 2011, 15:09


Return to JAVA based OPC UA SDK

Who is online

Users browsing this forum: No registered users and 0 guests