Error BadWaitingforInitialData

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

Moderator: uasdkjava

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

Error BadWaitingforInitialData

Post by ighoddan »

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

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Error BadWaitingforInitialData

Post by Support Team »

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

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

Re: Error BadWaitingforInitialData

Post by ighoddan »

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

User avatar
Support Team
Hero Member
Hero Member
Posts: 3064
Joined: 18 Mar 2011, 15:09

Re: Error BadWaitingforInitialData

Post by Support Team »

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

Post Reply