Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how do i read and send data through a serial port (using a keyspan adaptor)



Hi Jasper,

I'm working on a GPS management program using the Garmin protocol so I have
some experience with what you're dealing with.

A serial port is represented by a unix device file - which you read to and
write from just like you would read/write a real file. The device files are
all located in the /dev/ directory. When you plug-in your keyspan adaptor
have a look for a file inside /dev/ that matchs this pattern "cu.*USA*" -
that'll be the file representing the serial port.

To locate the correct device file programatically I query IOKit and ask it
for all devices that respond to the RS232 protocol and then present a choice
to the user asking which serial port he/she wants to connect to. Then I open
the serial port and read/write to it. I use the NSFileHandle class to do
most of the IO work for me.

I have a CSerialPort class that does all of the above, plus allows you to
get/set baud rates and other serial port parameters. I'll forward it along
if you'd like.

An in-development screenshot of my software is available here:

http://homepage.mac.com/jwight/Geode/Screenshots/002.jpg

And some info on it is available on this page:

http://opentopic.groundspeak.com/0/OpenTopic?a=tpc&s=1750973553&f=5740990093
&m=5640965015

I will be supporting the NMEA protocol in the fullness of time.

Jon.

On 07/31/2002 15:54, "Jasper Touwen" <email@hidden> wrote:

> Hello list,
>
> I finally found a target to program for. But probably it isn't the most
> easiest thing to do for someone with my experience. (quite a newbie, I
> would say;-). But this is what i want to do: Build a program for
> navigation with a sailboat.
>
> I did some searching and reading about using equipment inboard. I
> decided to start with reading the NMEA-protocol from my GPS, and so
> start with building a smaller program for just reading from a GPS and
> later expand it from reading maps etc....
>
> I know the NMEA-protocol is read through a serial port.
> So here's the first issue: How do i program a serial port, reading and
> sending data etc and use fake data for it, so i can test when i'm in the
> train or something like that.
>
>
> I'll use a keyspan for the connection, so it'll be through USB.
>
>
>
> Any pointers, examples, advice, help would be very appreciated.
>
>
> Regards Jasper.
> (perhaps it would be easier to send offlist some advice, and i'll
> combine it lateron. Because this question is quite general.)
> _______________________________________________
> cocoa-dev mailing list | email@hidden
> Help/Unsubscribe/Archives:
> http://www.lists.apple.com/mailman/listinfo/cocoa-dev
> Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >how do i read and send data through a serial port (using a keyspan adaptor) (From: Jasper Touwen <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.