-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Hi everyone,
In my project, I want read some sensor wired with Raspberry Pi using Echonet Lite protocol from another Raspberry Pi .So I set 2 Node, one is Node A with sensor device, another is Node B with controller.
Node B request data from sensors of Node, first time in Overrided method onNewDeivce (example: onNewIlluminanceSensor) , and next time in method I get value, it work fine.
I tried to get value of a sensor by send UDP package to raspberry pi every time i got value success.
But it was not stability, because I think if a package lost in network then not have any request will be send to raspberry pi to get value of sensor.
Here is my code (simple print out console value read), it just work fine in some minute:
@OverRide
public void onNewIlluminanceSensor(IlluminanceSensor device) {
........super.onNewIlluminanceSensor(device);
........device.setReceiver(new IlluminanceSensor.Receiver(){
................protected void onGetMeasuredIlluminanceValue1(EchoObject eoj, short tid, byte esv,EchoProperty property, boolean success) {
.........................System.out.println(""+property.edt);
..........................try {
.................................device.inform().reqInformMeasuredIlluminanceValue1().send();
..........................} catch (IOException e1) {e1.printStackTrace();}
................};
..........});
..........try {
................device.inform().reqInformMeasuredIlluminanceValue1().send();
...........} catch (IOException e1) {e1.printStackTrace();}
}
So what i can do to solve this issue. Can you give me some ideal?
Thank you very much!