Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintain connetion between device in a Node with another #7

Open
bacdaibang opened this issue Mar 14, 2017 · 8 comments
Open

Maintain connetion between device in a Node with another #7

bacdaibang opened this issue Mar 14, 2017 · 8 comments

Comments

@bacdaibang
Copy link

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!

@sowd
Copy link
Member

sowd commented Mar 17, 2017

Thank you for posting!

Are you asking whether it is possible to send information with the corresponding packets lost?
I do not think it possible...

@bacdaibang
Copy link
Author

bacdaibang commented Mar 18, 2017 via email

@sowd
Copy link
Member

sowd commented Mar 19, 2017

So you have two raspis, right?

One (sender) works as a sensor node that multicasts (using inform() method) the sensor data through ECHONET Lite, while the other just receives the packet. And both are implemented as OpenECHO (Processing?)

If so, is the issue about the sender which does not send after certain amount time, or about the receiver which does not receive the data even if the packet is monitored by wireshark?

@bacdaibang
Copy link
Author

bacdaibang commented Mar 20, 2017 via email

@sowd
Copy link
Member

sowd commented Apr 7, 2017

Sorry for not responding for long time.
Actually this is the first report of the issue, so it is hard for me to figure out what is really happening..
Do you have any updates?

If you send me the complete source code of both side, I could check in my environment. (Sorry for inconvenience)

@bacdaibang
Copy link
Author

bacdaibang commented Apr 7, 2017 via email

@bacdaibang
Copy link
Author

I found that the best way to work well with request and then receive message between many device in home is : put request into seperate thread with receive. I have completely received and sent (request and respond) data as desired.
I've used this project that implemented Echonet Lite protocol for my graduation thesi.
I see this protocol stability and I think this protocol shound be broastcast and be support by many company (not just in Jappan).
Thank you sowd for heping me partially in my graduation thesi.

@sowd
Copy link
Member

sowd commented May 11, 2017

Sorry, I could not help you much. Actually, I could not figure out what is happening, but as you noticed, it may caused by the usage of threads.
Yes, if you let sleep the main thread, Java cannot do anything else, including receiving ECHONET Lite packets from other nodes. It is great that you found it out by yourself and your thesis went well.

Also, thank you again for using my library.

Shigeru

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants