The Serial Communications Server API includes functionality to detect and configure an Infrared port.
These steps show the functionality of the Serial Communications Server API for Infrared. At the end of these steps, the port is set to Infrared mode. A port set to Infrared mode may still require further configuration specific to the Infrared driver. This further configuration is not included in this tutorial.
Load the CSY and open a port.
Get the
capabilities of the port by calling RComm::Caps()
Get the Infrared capabilities by checking the bits in TCommCaps.iSIR with the three bitmasks KCapsSIR115kbps, KCapsSIR2400bpsOnly, and KCapsSIR4Mbps.
If any of the bitmasks show the bit as set, then the port has Infrared capability. The infra-red characteristic of the port can be determined from the value TCommCapsV01.iSIRSettings.To use the port as an Infrared port, follow these steps:
RComm::Config()
with the aConfig
parameter set to the TCommConfigV01
object to get
the port configuration.
TCommConfigV01
object.
RComm::Config()
with the TCommConfigV01
object as the aConfig
parameter.
The port is now set to Infrared mode.
TCommCaps ourCapabilities; User::LeaveIfError(commPort.Caps (ourCapabilities)); if ((ourCapabilities ().iSIR & KCapsSIR115kbps) || (ourCapabilities ().iSIR & KCapsSIR2400bpsOnly) || (ourCapabilities ().iSIR & KCapsSIR4Mbps)) { // IR is supported, so enable it TCommConfig portSettings; User::LeaveIfError(commPort.Config (portSettings)); portSettings ().iSIREnable = ESIREnable; User::LeaveIfError (commPort.SetConfig (portSettings)); }