Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ Serial Port Question
    primarykey
    data
    text
    <p><strong>Problem</strong>: I have a hand held device that scans those graphic color barcodes on all packaging. There is a track device that I can use that will slide the device automatically. This track device functions by taking ascii code through a serial port. I need to get this thing to work in FileMaker on a Mac. So no terminal programs, etc...</p> <p><strong>What I've got so far</strong>: I bought a Keyspan USB/Serial adapter. Using a program called ZTerm I was successful in sending commands to the device. Example: "C,7^M^J"</p> <p>I was also able to do the same thing in Terminal using this command: screen /dev/tty.KeySerial1 57600 and then type in the same command above(but when I typed in I just hit Control-M and Control-J for the carriage return and line feed)</p> <p>Now I'm writing a plug-in for FileMaker(in C++ of course). I want to get what I did above happen in C++ so when I install that plug-in in FileMaker I can just call one of those functions and have the whole process take place right there.</p> <p>I'm able to connect to the device, but I can't talk to it. It is not responding to anything.</p> <p>I've tried connecting to the device(successfully) using these:</p> <pre><code>FILE *comport; if ((comport = fopen("/dev/tty.KeySerial1", "w")) == NULL){...} </code></pre> <p>and</p> <pre><code>int fd; fd = open("/dev/tty.KeySerial1", O_RDWR | O_NOCTTY | O_NDELAY); </code></pre> <p>This is what I've tried so far in way of talking to the device:</p> <pre><code>fputs ("C,7^M^J",comport); </code></pre> <p><em>or</em></p> <pre><code>fprintf(comport,"C,7^M^J"); </code></pre> <p><em>or</em></p> <pre><code>char buffer[] = { 'C' , ',' , '7' , '^' , 'M' , '^' , 'J' }; fwrite (buffer , 1 , sizeof(buffer) , comport ); </code></pre> <p><em>or</em></p> <pre><code>fwrite('C,7^M^J', 1, 1, comport); </code></pre> <p><strong>Questions</strong>: When I connected to the device from Terminal and using ZTerm, I was able to set my baud rate of 57600. I think that may be why it isn't responding here. But I don't know how to do it here.... Does any one know how to do that? I tried this, but it didn't work:</p> <pre><code>comport-&gt;BaudRate = 57600; </code></pre> <p>There are a lot of class solutions out there but they all call these include files like termios.h and stdio.h. I don't have these and, for whatever reason, I can't find them to download. I've downloaded a few examples but there are like 20 files in them and they're all calling other files I can't find(like the ones listed above). Do I need to find these and if so where? I just don't know enough about C++ Is there a website where I can download libraries??</p> <p>Another solution might be to put those terminal commands in C++. Is there a way to do that?</p> <p>So this has been driving me crazy. I'm not a C++ guy, I only know basic programming concepts. Is anyone out there a C++ expert? I ideally I'd like this to just work using functions I already have, like those fwrite, fputs stuff. Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload