unix - C++ Serial Port Question -


Problem : I have a device in my hand that scans those graphic color barcodes on all the packaging. I is a track device that I will automatically use to slide the device. This track device functions by taking the ascii code through the serial port, I need to work in FileMaker on the Mac. So there is no terminal program, etc ...

What I have achieved yet : I bought a keypane USB / serial adapter. I was able to send commands to the device using a program called ZTerm. Example: "C, 7 ^ M ^ J"

I was able to do the same in the terminal using this command: screen /dev/tty.KeySerial1 57600 and then type in the above command type (But when I type I just kill Control-M and Control-J for the carriage return and line feed)

I now have a plug-in for the filemaker (in C ++ course) ) I'm writing. Whatever I did in C ++, I want to get it so that when I can install that plug-in in the filemaker, I can call one of those tasks and take the whole process in the right place.

I'm able to connect to the device, but I can not talk with it. It is not giving any kind of answer.

I have tried to connect to the device (successfully) using:

  FILE * comport; If ({comport = fopen ("/ dev / tty.KeySerial1", "w")) == NULL} {...}  

and

 < Code> Int FD; FD = Open ("/ dev / tty.KeySerial1", O_RDWR | O_NOCTTY | O_NDELAY);  

I have tried so far to talk to this device:

  fputs ("c, 7 ^ m ^ j", well Conduct oneself);  

or

  fprintf (comport, "c, 7 ^ m ^ j"); Four buffers [] = {'C', ',', '7', '^' or  

or

, M ',' ^ ',' J '}; Fillet (buffer, 1, size (buffer), comport);  

or

  FILIT ('C, 7 ^ M ^ J', 1, 1, COMPORT);  Question : When I was connected to the device from the terminal and using ZTerm, I was able to determine my baud rate of 57600. I think why this might not be the answer here but I do not know how to do it ... Does anyone know how to do this? I tried to do this, but it does not work:  
  comport-> BaudRate = 57600;  

There are many class solutions but they are included in all calls such as termios.h and stdio.h. I do not have this, and for whatever reason, I can not get them to download. I have downloaded some examples, but they have 20 files and they are calling all the other files which I can not find (as listed above). Do I need to find them and if so? I do not have enough information about C ++, is there a website where I can download the library ??

Another solution is to put those terminal commands in C ++. Is there a way to do this?

So this is driving me crazy. I'm not a C + + guy, I only know basic programming concepts. Is anyone a C ++ expert? I ideally want that I can already work using such functions, such as Fillit, Fatte stuff, thanks!

sending a ^ and then does not send an M control- M, the way you do it The easiest way to send a control character is to use the code.

ps ^ M carriage returns i.e. "\ r" and ^ J is Liffeyed "\ n"


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -