Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

< Previous PageNext Page > Hide TOC

Accessing a Serial Device

To communicate with a serial device from your Mac OS X application, use I/O Kit functions to obtain a path to the device file for that device. Then, implement traditional UNIX serial port access using the POSIX termios API. Your application can read and write data using the device file.

Specifically, the sample code in this chapter demonstrates how to:

The sample code shown in this chapter is from an Xcode “CoreFoundation Tool” project. The project builds a tool that has no user interface and sends its output to the console. You can view the output either by running the tool within Xcode or by running the Console utility, which you can find at /Applications/Utilities/Console. You can, of course, write similar code without these restrictions. For detailed documentation on using Xcode, see http://developer.apple.com/referencelibrary/DeveloperTools/index.html.

Many functions, data types, and constants used in the sample code in this chapter are defined in header files in Kernel.framework, System.framework, or in the directory /usr/include (whose contents you can examine using the Terminal application, located in /Applications/Utilities/Terminal). Specific header files are noted where appropriate. Some functions and data types, such as those for working with the CFStringRef type, are defined in header files in CoreFoundation.framework.

Some functions and data types used in this chapter are described in UNIX man pages. To view the reference documentation for these, see Mac OS X Man Pages. Alternatively, you can view the documentation by typing manfunction_name (for example, man tcsetattr) in a Terminal window. Many of the code snippets in this chapter refer to specific man pages in the code comments.



< Previous PageNext Page > Hide TOC


Last updated: 2005-12-06




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice