Want to read data for discovery RF node

6 posts / 0 new
Last post
erdeepakcs
Want to read data for discovery RF node

hello sir,
how can i read data using Gurux serial component for discovery RF nodes which are connected in meters. Because in discovery of node there is no fix length of data and also EOP is not there.

Kurumi
Kurumi's picture

Hi,

If there is no fixed length or EOP you must read data until all data is received.

Pseudo code is something like this:

serial.Send(Data to send, null);
do
{
serial.Receive(p);
}while(check that packet is received);

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

erdeepakcs

but when i set EOP to null and message is coming Either Count or EOP must be set.

Deepak

Kurumi
Kurumi's picture

Hi,

Set count to 1 if you do not know how many bytes to wait. One byte is read then you can check is packet fully received.

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi

erdeepakcs

i have set count to 1 and i am still getting same exception message. what condition should i apply to check packet is received in gurux serial.

Deepak

Kurumi
Kurumi's picture

Hi,

You must set it each time before calling Receive. We are resetting count after data is read.

Like this:

serial.Send(Data to send, null);
do
{
p.Count = 1;
serial.Receive(p);
}while(check that packet is received);

BR,

Mikko

________________________________________
Mikko Kurunsaari
Gurux Ltd
http://www.gurux.fi