Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Are you writing software to do this, or using some other existing tools? If the latter, what are they? If the former, please provide more detail about your application, especially things like programming language. Show code fragments to demonstrate what you have already tried. Code fragments should be posted on [CODE ] tags to preserve formatting.
In general, querying a device through a serial interface requires that the reply is received before a subsequent query is sent. Your tool or software must be able to handle this. If there are multiple tools running concurrently, then they must all use some convention to prevent concurrent access to the serial port. One common mechanism for this is the use of lock files. These behave like a mutex: if the lock file exists, wait until it is removed, and then create your own lock file, removing it when done, to allow other software to access the resource. To work correctly, all tools sharing the resource must agree on this use of a single lock file.
If you are programming the protocol used to manage the conversation between the host and the serial device, it is possible to tag replies with identifiers that the receiver uses to match replies with queries. This allows multiple outstanding queries to exist between the host and the device, and replies subsequently received can be correctly matched with the respective queries.
I'm sorry, but I don't understand what obstacle you are trying to overcome. It sounds like you are able to send a single query, and receive the accordant response. What is stopping you from performing this process iteratively?
The thing is th next... imagine that i need to communicate my pc with converter for to ask about 3 thing: velocity, charge of batteries and temperature.
Now I'm reading velocity iteratively but i need to send one more question for the charge and one more for the temperature, is this possible to do in gambas???? and while my pc is asking and receiving keep running the rest of the code??? I need a thread ? it's possible in gambas?
Well, perhaps my lack of understaing of gambas is the problem. I assume it is/has some kind of procedural programming language that includes looping. Can you show us the code that you use to iteratively query and read the one parameter that you are presently reading?
As I see it, your code should look something similar to this pseudo-code:
sendQuery( "velocity?" )
velocity = readReply()
sendQuery( "battery?" )
battery = readReply()
sendQuery( "temperature?" )
temperature = readReply()
There is nothing I could/would contribute by e-mail that I would not post here. Taking conversations off-line is contrary to the purpose of forums such as these.
Since your code seems to be doing some kind of monitoring function, I will speculate that one of it's principle constructs is a main loop, which performs other work in addition to the monitoring aspect. With respect to the posted psuedo-code, can you not simply add your 'rest of the code' to the main loop?
No matter what the overall construct of the program, what is stopping you from using the sequence of query-read pairs; one for each parameter you need to read? If your code reaches a point where it does one query, it should be able to simply do two more.
Is there something fundamentally different about gambas that makes this difficult or impossible? What programming construct is required to invoke the existing query?