Re: how do i read and send data through a serial port (using a keyspan adaptor), reactions
Re: how do i read and send data through a serial port (using a keyspan adaptor), reactions
- Subject: Re: how do i read and send data through a serial port (using a keyspan adaptor), reactions
- From: Jasper Touwen <email@hidden>
- Date: Sat, 3 Aug 2002 00:40:17 +0200
Everybody thanks for the reactions... I see i've got a lot of work to
do. But for the record: a summary
General: ( from Jonathan Wight <email@hidden>)
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.
he has a class ready, forwarded when requested.
Example:
http://www.keyspan.com/support/developers/macosx/downloads/testserial.sit.
bin (thanks Aaron Tuller)
Complete Class: I've got a serial port class at
http://www.harmless.de/cocoa.html (thanks Andreas Mayer)
Search: freshmeat.net (a lot of code for linux or unix, not directly
cocoa, but usefull, not only for communication; thanks to Charles Bennet)
Reminder for myself: a lot of documentation about IOKit is available in
the developer directory and don't expect everything to be cocoa, this
time it is Darwin.
till next time...
Jasper
ps: i was glad i started reading 'the c-programming language' from brian
w. Kernighan and dennis m. Ritchie, otherwise i wouldn't understand one
word of every example in the IOKit (probably just as necessary to read
as Objective-C)
_______________________________________________
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.