Archived:SIR (Serial Infrared) communication using raw (physical) SIR frames
Article Metadata
Code Example
Compatibility
Article
Overview
When developing a Symbian C++ application that uses SIR (serial infrared) communication using raw (physical) SIR frames to communicate with another type of IR-capable device, a serial port is opened to send and receive bytes via IR.
This SIR routine is explained in the article Programming IrComm3 wire raw and the glass term example in S60 3rd Edition examples demonstrates this.
This works, however, only in S60 devices which do not take IrDA framing into consideration. IrDA-compliant devices simply discard the received frames silently if the frames are not IrDA compliant.
Description
Using a port under ECUART means bypassing some IrDA protocol layers. This could be stated, in a simplified way, as "talking directly to the IrDA hardware." There are certain differences in the HW implementations that may cause compatibility problems if an application is using this low-level interface.
The differences in this case are:
- Different port number.
- Different handling of IRLAP framing and transparency elements.
For some devices, the ECUART level is "below" the frame handling - this means that if anything is sent over EUART, communication in both directions should be properly framed:
- Optional XBOFs
- BOF // the starting byte should be 0xC0
- Payload (anything in this context)
- Frame Checksum calculated from payload, and
- EOF // The ending byte should be oxc1
The FCS needs to be calculated based on the payload. The CalculateCRC() method can be used to calculate the FCS based on the payload bits (0 to 5). The FCS table (fcstab) is available in the File:IRDASampleEx.zip
void CIRDASampleExAppUi::CalculateCRC()
{
TUint pppsendcrc,pppreccrc;
iFrame.SetLength(11);
iFrame[0] = 0x41; // Payload bits( 0 to 5)
iFrame[1] = 0x42;
iFrame[2] = 0x49;
iFrame[3] = 0x45;
iFrame[4] = 0x45;
iFrame[5] = 0x46;
iFrmPointer = iFrame.Ptr();
pppsendcrc = pppfcs16(PPPINITFCS,iFrmPointer,FRM_SIZE-4);
iFrame[6] = pppsendcrc & 0xff; // FCS bit
iFrame[7] = (pppsendcrc>>8) & 0xff;
}
TUint CIRDASampleExAppUi::pppfcs16(TUint fcs, const TUint16 *cp, TInt len)
{
ASSERT( sizeof (TUint16) == 2);
for ( ; len>0; len--)
fcs = (fcs >> 8) ^ fcstab[(fcs ^ *cp++) & 0xff];
fcs ^= 0xffff; // complement
return (fcs);
}
The following devices require packet-level framing and use port 2 for SIR communication:
Nokia E60
Nokia E61
Nokia E70
Nokia N71
Nokia N73
Nokia N80
Nokia N92
Nokia N93
Nokia N95
The following devices do not require packet-level framing and use port 1 for SIR communication:
Nokia 5500
Nokia E50
Nokia E62
This was tested with Nokia E60, Nokia E61 (frame compatible), and Nokia 5500, Nokia E50 (not frame compatible).


(no comments yet)