< Home < Developers < Development Support < Documentation

## 4 Beaming (Infrared Communication)

Table of Contents | < Previous | Next > | Index

| Title - Palm OS® Programmer's Companion vol. II: Communications 4 Beaming (Infrared Communication) IR Library IrDA Stack Accessing the IR Library Summary of Beaming |  |  |  | The Palm OS® provides three levels of support for beaming, or infrared communication (IR): The Exchange Manager provides a high-level interface that handles all of the communication details transparently. See the "Object Exchange" chapter for more information. The Serial Manager provides a virtual driver that implements the IrComm protocol. To use IrComm, you specify sysFileCVirtIrComm as the port you want to open and use the Serial Manager APIs to send and receive data on that port. See the "Serial Communication" chapter for information on how to use the Serial Manager APIs. The IR Library provides a low-level, direct interface to the IR communications capabilities of the Palm OS. It is designed for applications that want more direct access to the IR capabilities than the Exchange Manager provides. This chapter discusses the IR Library. ## IR Library The IR (InfraRed) library is a shared library that provides a direct interface to the IR communications capabilities of the Palm OS. It is designed for applications that want more direct access to the IR capabilities than the exchange manager provides. The IR support provided by the Palm OS is compliant with the IrDA specifications. IrDA (Infrared Data Association), is an industry body consisting of representatives from a number of companies involved in IR development. For a good introduction to the IrDA standards, see the IrDA web site at:
    http://www.IrDA.org/
## IrDA Stack The IrDA stack comprises a number of protocol layers, of which some are required and some are optional. The complete stack looks something like Figure 4.1. Figure 4.1 IrDA Protocol Stack The SIR/FIR layer is purely hardware. The SIR (Serial IR) layer supports speeds up to 115k bps while the FIR (Fast IR) layer supports speeds up to 4M bps. IrLAP is the IR Link Access Protocol that provides a data pipe between IrDA devices. IrLMP, the IR Link Management Protocol, manages multiple sessions using the IrLAP. Tiny TP is a lightweight transfer protocol on which some higher-level IrDA layers are built. One or more of SIR/FIR must be implemented, and Tiny TP, IrLMP and IrLAP must also be implemented. IrComm provides serial and parallel port emulation over an IR link and is optional (it is not currently supported in the Palm OS). IrLAN provides an access point to Local Area Network protocol adapters. It too is optional (and is not supported in the Palm OS). OBEX is an object exchange protocol that can be used (for instance) to transfer business cards, calendar entries or other objects between devices. It too is optional and is supported in the Palm OS. The capabilities of OBEX are made available through the exchange manager; there is no direct API for it. The Palm OS implements all the required protocol layers (SIR, IrLAP, IrLMP, and Tiny TP), as well as the OBEX layer, to support the Exchange Manager. Palm IIITM devices provide SIR (Serial IR) hardware supporting the following speeds: 2400, 9600, 19200, 38400, 57600, and 115200 bps. The software (IrOpen) currently limits bandwidth to 57600 bps by default, but you can specify a connection speed of up to 115200 bps if desired. The stack is capable of connection-based or connectionless sessions. IrLMP Information Access Service (IAS) is a component of the IrLMP protocol that you will see mentioned in the interface. IAS provides a database service through which devices can register information about themselves and retrieve information about other devices and the services they offer. ## Accessing the IR Library Before you can use the IR library, you must obtain a reference number for it by calling the function SysLibFind, as in this example:
    err = SysLibFind(irLibName, &refNum);
This function returns the library reference number in the refNum parameter. This parameter is passed to most of the other functions in the IR library. ## Summary of Beaming #####
IR Library Functions
IrAdvanceCredit | IrIsNoProgress
IrBind | IrIsRemoteBusy
IrClose | IrLocalBusy
IrConnectIrLap | IrMaxRxSize
IrConnectReq | IrMaxTxSize
IrConnectRsp | IrOpen
IrDataReq | IrSetConTypeLMP
IrDisconnectIrLap | IrSetConTypeTTP
IrDiscoverReq | IrSetDeviceInfo
IrIsIrLapConnected | IrTestReq
IrIsMediaBusy | IrUnbind
#####
IR Library IAS Database Functions
IrIAS_Add | IrIAS_GetUserString
IrIAS_GetInteger | IrIAS_GetUserStringCharSet
IrIAS_GetIntLsap | IrIAS_GetUserStringLen
IrIAS_GetObjectID | IrIAS_Next
IrIAS_GetOctetString | IrIAS_Query
IrIAS_GetOctetStringLen | IrIAS_SetDeviceName
IrIAS_GetType | IrIAS_StartResult