WAIT_DATA()

Asked by William Sallum

Hi !

I´m porting libmodbus to a non-Linux microcontroller-based device, and I need to understand how the function WAIT_DATA() works.
Then I could port it to another language.

Could someone help me please?

thanks in advance

william

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Stéphane Raimbault
Solved:
Last query:
Last reply:
Revision history for this message
Stéphane Raimbault (sra) said :
#1

It's just a macro with a select (POSIX system call), a macro is used because I need to call it more than one time and I don't want a function with too many parameters.

Revision history for this message
William Sallum (wsallum) said :
#2

Ok Stéphane, so basically the purpose of WAIT_DATA() is check if there is data to be read from serial port or socket, setting a timeout of " tv " . The data read is stored into descriptor " mb_param->fd ".

After that, the " read " command consumes the receive buffer from " fd " and store into " p_msg ".

Am I right ?

thanks

william

Revision history for this message
Best Stéphane Raimbault (sra) said :
#3

2010/4/14 William Sallum <email address hidden>:
> Question #107314 on libmodbus changed:
> https://answers.launchpad.net/libmodbus/+question/107314
>
>    Status: Answered => Open
>
> William Sallum is still having a problem:
> Ok Stéphane, so basically the purpose of WAIT_DATA() is check if there
> is data to be read from serial port or socket, setting a timeout of  "
> tv  " . The data read is stored into descriptor " mb_param->fd ".
>
> After that, the " read " command  consumes the receive buffer from " fd
> " and store into " p_msg ".
>
> Am I right ?
>

Yes.

PS: Take care to fetch the code from github (see link on home page).

Revision history for this message
William Sallum (wsallum) said :
#4

Thank you Stéphane.

PS: Ok ! (I was fetching the code from libmodbus-2.0.3).

Revision history for this message
William Sallum (wsallum) said :
#5

Thanks Stéphane Raimbault, that solved my question.

Revision history for this message
Stéphane Raimbault (sra) said :
#6

LinkedIn
------------

I'd like to add you to my professional network on LinkedIn.

- Stéphane Raimbault

Stéphane Raimbault
Open Source Project Leader and Software developer at Makina Corpus
Nantes Area, France

Confirm that you know Stéphane Raimbault
https://www.linkedin.com/e/-aas06-gl21467g-3g/isd/2469859640/j6b8ymmq/

--
(c) 2011, LinkedIn Corporation