The communication over infrared is by built in ports. In early devices these were simply described as "COM1". The main problem is the need to be with not further than 40cm between devices, but there is a further problem that both transmitter and reciever must be in a straight line and not closer than 9cm. If the transmitter is closer that 9cm the receiver may be "blinded" by the infrared light source.
Java ME and IR ports
MIDlets can query available comm ports using the System.getProperty() method call with string "microedition.commports". This returns a comma-separated list of ports.
According to the MIDP spec, following convention should be used.
Port names contain a text abbreviation indicating port capabilities followed by a sequential number for the port. The following device name types should be used:
- COM#, where COM is for RS-232 ports and # is a number assigned to the port
- IR#, where IR is for IrDA IRCOMM ports and # is a number assigned to the port
The name of the port can then be combined with a comm: prefix as the URL string to be used to open a serial port connection.