Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Archived:SIR (Serial Infrared) communication using raw (physical) SIR frames

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Code ExampleCompatibility
Platform(s): S60 3rd Edition, MR
S60 3rd Edition (initial release)
Article
Created: User:Technical writer 1 (19 Oct 2007)
Last edited: hamishwillee (30 May 2013)

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:

  1. Different port number.
  2. 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:

  1. Optional XBOFs
  2. BOF // the starting byte should be 0xC0
  3. Payload (anything in this context)
  4. Frame Checksum calculated from payload, and
  5. 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).

This page was last modified on 30 May 2013, at 23:48.
124 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×