This page was last modified 10:09, 23 August 2007.
KIJ000076 - Nokia 5140 IRComm port name
From Forum Nokia Wiki
Nokia 5140 IRComm port name
|
KIJ000076
|
Overview
| The IRComm connection does not work if the "comm:IR0" port name is used. The non-standard name "nokiacomm:IR0" should be used instead.
|
Reported against
| Series 40 2nd Edition, Nokia 5140, software version 3.09
|
Date identified
| September 14, 2004
|
Symptoms
| -
|
Detailed description
| The URL used when requesting an IRComm link should be "nokiacomm:IR0" instead of the public specification ("comm:IR0"). However, the behavior of the API remains the same as before, in other words, it is a connection based on GCF.
|
How to reproduce
| -
|
Solution
| Requesting an IRComm link in the Nokia 5140 device differs from the MIDP 2.0 Specification in usage of URL. In MIDP 2.0 the IRComm link is opened using: "comm :<port_name"> and in the Nokia 5140 implementation the IRComm link is opened using: "nokiacomm:<port_name"> Port numbers can be queried using System.getProperty("microedition.commports") Nokia 5140 returns "IR0" which can be used with URL: nokiacomm for opening the connection. The following example code requests the IRComm port as defined in the MIDP 2.0 Specification and if ConnectionNotFoundException is thrown, it tries to open the connection using the Nokia Proprietary IRComm API, which is working in Nokia 5140. try { Connector.open("comm:IR0"); } catch (ConnectionNotFoundException cnfe) { //Cannot open connection //Let’s try the Nokia 5140 way try { Connector.open("nokiacomm:IR0....."); } catch (ConnectionNotFoundException cnfe) { //Handle possible exception } // Do whatever, read or write }
|