It's the first time I use Java for a project and I need to do this:
- send a CoAP POST request to turn on an actuator
- wait 10 seconds
- send a CoAP POST request to turn off the actuator.
I'm using this code inside the method I wrote that has to automatically turn on/off the actuator:
new java.util.Timer().schedule(
new java.util.TimerTask() {
@Override
public void run (){
Request postRequest2 = new Request(CoAP.Code.POST);
postRequest2.setURI(String.format("%s%s", COAP_ENDPOINT1, targetStatusActuatorUri));
postRequest2.setConfirmable(true);
}
},
10000
);
But it throws an error Unreachable statement and I don't understand why.