-
Notifications
You must be signed in to change notification settings - Fork 15
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
Comments
Thank you for posting! Are you asking whether it is possible to send information with the corresponding packets lost? |
Sorry for reply late,
Yes, I found that:
1. Packets request data did not lost.
2. When (N-1)th time request, I received corresponding pakage from my
Raspberry Pi, but Nth time request, I did not receive any package.
I solve that by from my Rasp I inform data out periodicly. And then I have
data in EventListener at another Node.
But I still did not know why have request to sensor (implemented in my
Rasp) and not have respond.
Thank you for support me.
Best Regard!
Bac-san.
2017-03-17 12:19 GMT+07:00 Shigeru Owada <[email protected]>:
… 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...
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOcJEi1lk1jwXLu5LO_i-zLiyc7IAtvSks5rmhfygaJpZM4McE1i>
.
|
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? |
Maybe my way to explain can not explicit.
If I make sensor node multicast and other node listen, it work well. But if
I make a node to request after receive message from sensor node frequently
(like code above), it work not stably. It just receive N message respond
from sensor node and then it not receive any message multicast from sensor
node.
Vào 19-03-2017 20:06, "Shigeru Owada" <[email protected]> đã viết:
… 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?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOcJEuXyUXNFYJK3UgXEcll1I5AXuT2Mks5rnShCgaJpZM4McE1i>
.
|
Sorry for not responding for long time. If you send me the complete source code of both side, I could check in my environment. (Sorry for inconvenience) |
Thank you for respond, it is ok, I can wait longer time.
I tried some way to get value and I got some issue:
1.
PC side (receiver side):
I started my PC with a default node and node have a default controller.
I add listener in default node and register to receive data
(MeasuredValueOfRelativeHumidity) from any new humidity that join network.
Code for my receiver side below:
//Start Echonet Node
Echo.start(new DefaultNodeProfile(), new DeviceObject[]{new
DefaultController()});
//Add event for Node
Echo.addEventListener(new EventListener(){
@OverRide
public void onNewHumiditySensor(HumiditySensor device) {
// When have new Humidity Sensor
super.onNewHumiditySensor(device);
device.setReceiver(new HumiditySensor.Receiver(){
@OverRide
protected void onGetMeasuredValueOfRelativeHumidity(EchoObject eoj, short
tid, byte esv, EchoProperty property, boolean success) {
super.onGetMeasuredValueOfRelativeHumidity(eoj, tid, esv, property,
success);
Date date = new Date();
String now = date.toString();
System.out.println("Humidity value at "+now+"\t is "+property.edt[0]);
}
});
}
});
//send to Multicast Address for present
NodeProfile.getG().send();
Raspberry Pi (sender side):
I started my Raspberry Pi with a default node. in this node, I implemented
a humidity sensor.
Humidity sensor send value periodicly 2s (ignore time to read data from
sensor).
Code for my sender side below
//Implemented Humidity read data from pin 4
MyHumiditySensor mHumiditySensor = new MyHumiditySensor(4);
//Start node with a humidity
Echo.start(new DefaultNodeProfile(), new DeviceObject[]{mHumiditySensor});
//Loop to send out multicast address every 5s
while(true){
try {
Thread.sleep(5000);
//Print out console value read
System.out.println("value at "+(new Date()).toString()+"\t is:" +mHumiditySensor.getMeasuredValueOfRelativeHumidity()[0]);
//broadcast value read
mHumiditySensor.inform().reqInformMeasuredValueOfRelativeHumidity().send();
} catch (InterruptedException e) { e.printStackTrace();
}
}
Issue:
When I capture message from Wire Shark or received from PC, it not like I
desire. It just have some of message that sent from Raspberry Pi.
This is first way.
Link for image that I captured:
https://drive.google.com/open?id=0B1f9ijMhV6V_amQwM1ZTZnhQYkE
Can you help me to receive more than number message.
I know UDP send and receive message also depend on transmition environment, but I think in my wireless network it not lost many message like that
2017-04-07 8:09 GMT+07:00 Shigeru Owada <[email protected]>:
… 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)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#7 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AOcJEtLqA4sZmzQY5vT-KHgL2W525ALYks5rtYzQgaJpZM4McE1i>
.
|
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. |
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. Also, thank you again for using my library. Shigeru |
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!
The text was updated successfully, but these errors were encountered: