Programming IrComm3 wire raw
This article describes SIR (serial infrared) coding in Symbian OS / Series60 by using raw (physical) SIR frames.
The port info (RCommServ/GetPortInfo) returns IrComm 3 wire raw (in Nokia 3650, Series60 1.2, SymbianOS 6.1).
Irscopesrc.zip contains the source code, installation file (irscope.sis) in \install directory and three jpeg images (\data directory), which show the irscope in action:
Irscopepic1 shows the output from Actisys ACT-IR2000UL USB IR port.
Irscopepic2 and 3 show the output from Sony RMT-V197 IR remote controller (valinnat means options and takaisin means back, the language of Nokia 3650 from which the pictures were taken is Finnish).
The program (irscope.sis) is developed by using Visual C++, Series60 SDK 1.2 and it is tested in Nokia 3650 (SymbianOS 6.1/Series60 1.2). It works in EPOC emulator too, but it does not open/configure ircomm port nor receive (RX) / transmit (TX).
General structure of the IrScope
The classes:
| irscopeaknctrl | Handles GUI controls (queries and lists) for setting communication parameters and creates CErrorUI instance, which is used for handling error/leave situations. Settable parameters for communications are bps, data bits, stop bits and receive/transmit timeout. |
| irscopeengine | The engine (observer) class which creates receive (irscoperx) and transmit (irscopetx) classes and manages the communication and sets/gets communication parameters. |
| irscoperx | Receiving (RX) active object. |
| irscopetx | Transmitting (TX) active object. |
| reporter | Virtual class for printing the output from the IR port. |
... plus the standard Symbian stuff: container, view, app, appui and document classes.
You can start scanning by selecting scan from menu. Pressing left softkey stops the scanning. Make sure that IR is not active (do not select infrared from connections when using IrScope), i.e. IR active sign is not blinking!
The IrScope cannot read the port if IR is active, the program works fine, but nothing comes on the screen if IR is active.
Communication parameters could be set via comms menu, the comms params are shown on the upper part of the IrScope screen, e.g. 9600,8,1 means 9600 bps, 8 data bits and 1 stop bit.
Opening and configuring the serial (IR) port
The "magic" trick is the loading of ECUART comms module and open serial port (COMM::0) instead of IRCOMM and setting ESIREnable (portConfig().iSIREnable).
_LIT(KLddName, "ECOMM");
#if defined (__WINS__)
_LIT(KPddName, "ECDRV");
#else
_LIT(KPddName, "EUART1");
#endif
// Communication modules
_LIT(KRS232, "ECUART");
_LIT(KIrDA, "IRCOMM");
_LIT(KCommPort, "COMM::0");
// Load device drivers
TInt err = User::LoadPhysicalDevice(KPddName);
if ((err != KErrNone)
&& (err != KErrAlreadyExists))
User::Leave(err);
err = User::LoadLogicalDevice(KLddName);
if ((err != KErrNone)
&& (err != KErrAlreadyExists))
User::Leave(err);
StartC32();
User::LeaveIfError(iCommServ.Connect());
err = iCommServ.LoadCommModule(KRS232);
TInt err = iComm.Open(iCommServ, KCommPort, ECommExclusive);
TCommCaps commCaps;
iComm.Caps(commCaps);
//Nokia 3650 (maybe other Nokia Series60 models too!?)
//Raw IR (PHY) frames work although commCaps returns KErrNotSupported
/*if (((commCaps().iRate & iBps) == 0) ||
((commCaps().iDataBits & iDataBits) == 0) ||
((commCaps().iStopBits & iStopBits) == 0) ||
((commCaps().iSIR & ESIREnable) == 0))
User::Leave(KErrNotSupported);*/
TCommConfig portConfig;
iComm.Config(portConfig);
portConfig().iHandshake = 0;
portConfig().iDataBits = iDataBits;
portConfig().iStopBits = iStopBits;
portConfig().iParity = EParityNone;
portConfig().iSIREnable = ESIREnable;
portConfig().iSIRSettings = KConfigSIRPulseWidthMaximum;
portConfig().iRate = iBps;
User::LeaveIfError(iComm.SetConfig(portConfig));
Receive and transmit active objects
Two active objects are needed, one for receive and the other for transmit. The engine class, irscopeengine, creates receiving and transmitting active objects, irscoperx and irscopetx. Active objects can handle only one request at any time, so that is why two active objects (classes) are needed. Receiving active object signals the engine to inform about incoming data and sets a new read request.
{
iEngine.RxDataAvail(iRxData);
ReadComm();
}
The transmitting class can send the last data chunk received as ascii data thru IR port.
{
if (!IsActive())
{
iTxData.Copy(aTxData);
iTxComm.Write(iTxStatus, iTxTimeOut, iTxData);
SetActive();
}
}
Further development ideas
This little utility could be developed further quite easily. For example:
a slider control to set SIR pulse width
( KConfigSIRPulseWidthMinimum - KConfigSIRPulseWidthMaximum),
usage of the export methods of the
CPlainText class to write text to a stream (e.g. to a sequential file); CEikEdwin Text method gets a CPlainText* pointer
to the Edwin's document contents,
adding a parser system to display data as hexadecimal or binary instead of plain ascii text.
...
Download
irscope.sis | irscopesrc.zip |






> Programming IrComm3 wire raw
> Programming IrComm3 wire raw
> Programming IrComm3 wire raw
Re: Programming IrComm3 wire raw
I installed this app on my 3650. I want to reproduce the signals of my Sony TV remote.
I set the bps, databits and stop bits as per the remote controls specs.
After selecting "scan" from the menu, I read the signal for "volume +" the remote. Then i did a "TX" of the signal.
The TV does not react to this signal.
What am i doing wrong?
thank you.
Re: Programming IrComm3 wire raw
it can be ported to S60 3rd edition, the change here is to use COMM::2 which is the SIR port and also before making serial settings of 9600, 8, N, 1 etc changes SIR must be disable by ESIRDisable then renable see the code here http://discussion.forum.nokia.com/forum/showthread.php?t=116167
Re: Programming IrComm3 wire raw
Suppose I need to send an AT command to some mobile (having IR input) using the above program with Nokia 3230. Can I send a direct command like this:
void CIrScopeTx::WriteComm(const TDesC& aTxData){
if (!IsActive())
{
iTxData.Copy(_L("ATD0123456789;"));
iTxComm.Write(iTxStatus, iTxTimeOut, iTxData);
SetActive();
}
}
Or is there sny other method to achieve it?