×
Namespaces

Variants
Actions

Archived:Non-standard IRComm port name must be used on Nokia 5140 (Known Issue)

From Nokia Developer 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
Tested with
Devices(s): Nokia 5140, software version 3.09
CompatibilityArticle
Created: User:Technical writer 1 (14 Sep 2004)
Last edited: hamishwillee (22 Oct 2013)

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.

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.

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

 nokiacomm:<port_name>

Port numbers can be queried using:

  System.getProperty("microedition.commports")

The 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
}
This page was last modified on 22 October 2013, at 07:29.
54 page views in the last 30 days.
×