SDK Home Glossary Index Left Right Up

DevComm class


Section contents


Overview

Defined in

ccomms.oxh

Description

Direct use of DevComm by applications is not encouraged

A single serial device driver can control many different instances of serial hardware. For a single driver the different instances are specified by providing unit numbers when the channel is opened. Unit numbers are 0 based. Each different piece of serial hardware requires a new DevComm to be opened. The serial device can be queried about its functionality — this includes such things as character framing, a range of data rates, whether it has a FIFO buffer or if it supports SIR (serial infra red - the physical layer of the IrDA standard).

In order to conserve battery power the serial hardware is kept switched off until the first read or write is issued. As this might lead to deadlock between two devices which are both waiting for a control line to go high, the serial hardware can be powered up by reading zero bytes from it.


Construction / destruction


NewDevComm - Constructor

Usage

this& = NewDevComm&:

Description

Creates a comms server object and returns a handle which allows the object to be manipulated.

Return Value
this& An value which represents the created object
Error Handling

If the object could not be created then an error is generated which should be trapped by an ONERR handler.

Example
  LOCAL this&

  this& = NewDevComm&:
  DeleteDevComm:(this&) 

DeleteDevComm - Destructor

Usage

DeleteDevComm:(BYREF this&)

Description

Destroys the serial device object.

Arguments
BYREF this& A handle to a serial device object
Example
  LOCAL this&

  this& = NewDevComm&:
  DeleteDevComm:(this&) 

Methods provided


DevCommBreakA

Usage

DevCommBreakA:(this&,time&,BYREF status&)

Description

Use this function to perform a break.

Arguments
this& A handle to a serial device object
time& A time period to break for
BYREF status& The request status used to contain completion information for the function.
Note

The current EPOC serial driver does not support breaking.

See Also

DevCommBreakCancel


DevCommBreakCancel

Usage

DevCommBreakCancel:(this&)

Description

Use this function to perform a break.

Arguments
this& A handle to a serial device object
Note

The current EPOC serial driver does not support breaking.

See Also

DevCommBreakA


DevCommCaps

Usage

DevCommCaps:(this&,caps&)

Description

Use this function to retrieve the capabilities of the serial port.

Arguments
this& A handle to a serial device object
caps& A handle to a Serial Capabilities object

DevCommClose

Usage

DevCommClose:(this&)

Description

Use this function to close an open serial port.

Arguments
this& A handle to a serial device object
See Also

DevCommOpen


DevCommConfig

Usage

DevCommConfig:(this&,config&)

Description

Use this function to read the current configuration of the serial port.

Arguments
this& A handle to a serial device object
config& A handle to a Comm Configuration object
See Also

DevCommSetConfig


DevCommOpen

Usage

result% = DevCommOpen%:(this&,unit&)

Description

Use this function to open a channel to the device driver. A single serial device driver may be able to control more than one device. The device driver can only be opened by a single process. While a process has a device handle to the channel, all further requests to open the same unit number will fail.

Arguments
this& A handle to a serial device object
unit& The unit number of the serial device required
Return Value
result% An error code
See Also

DevCommClose


DevCommQueryReceiveBuffer

Usage

count& = DevCommQueryReceiveBuffer&:(this&)

Description

Use this function to read the number of characters in the receive buffer

Arguments
this& A handle to a serial device object
Return Value
count& The number of characters currently in the receive buffer
See Also

DevCommReceiveBufferLength, DevCommResetBuffers, DevCommSetReceiveBufferLength


DevCommReadA

Usage

DevCommQueryReadA:(this&,des&,length&,BYREF status&)

Description

Use this function to read the number of characters in the receive buffer

Arguments
this& A handle to a serial device object
des& A descriptor to store the incoming data. The length of the descriptor is the default for the number of bytes to be read.
length& If not -1 an optional explicit length of data to be read. If present, this overrides the length of the descriptor default
BYREF status& The request status used to contain completion information for the function.
Notes

If a read is issued with a data length of zero (either explicitly or implicit in the descriptor) the ReadA will complete immediately with the side effect that the serial hardware will have been powered up.

See Also

DevCommReadCancel, DevCommReadOneOrMoreA


DevCommReadCancel

Usage

DevCommQueryReadCancel:(this&)

Description

Cancels any pending ReadA() or ReadOneOrMore() operation.

Arguments
this& A handle to a serial device object
See Also

DevCommReadA, DevCommReadOneOrMoreA


DevCommReadOneOrMoreA

Usage

DevCommQueryReadA:(this&,des&,length&,BYREF status&)

Description

Use this function to read the number of characters in the receive buffer

Arguments
this& A handle to a serial device object
des& A descriptor to store the incoming data. The length of the descriptor is the default for the number of bytes to be read.
length& If not -1 an optional explicit length of data to be read. If present, this overrides the length of the descriptor default
BYREF status& The request status used to contain completion information for the function.
Notes

If there is data in the serial driver’s buffer when ReadOneOrMoreA is called, it will read as much data as possible (up to the maximum length of the supplied buffer) and return immediately. If there is no data in the buffer, the request will complete as soon as the first character arrives at the serial hardware.

See Also

DevConfigReadA, DevConfigReadCancel


DevCommResetBuffers

Usage

DevCommQueryResetBuffers:(this&)

Description

Use this function to discard all data in the receive buffers.

Arguments
this& A handle to a serial device object
See Also

DevCommQueryReceiveBuffer


DevCommReceiveBufferLength

Usage

length& = DevCommReceiveBufferLength&:(this&)

Description

Use this function to read the number of characters in the receive buffer

Arguments
this& A handle to a serial device object
Return Value
length& The length of the receive buffer
See Also

DevCommSetReceiveBufferLength


DevCommSetConfig

Usage

result% = DevCommSetConfig%:(this&,config&)

Description

Use this function to set the configuration of the serial port.

Arguments
this& A handle to a serial device object
config& A handle to a CommConfig object
Return Value
result% An error code
See Also

DevCommConfig


DevCommSetReceiveBufferLength

Usage

result% = DevCommSetReceiveBufferLength%:(this&,length&)

Description

Use this function to set the length of the receive buffer.

Arguments
this& A handle to a serial device object
length& The length of the receive buffer
Return Value
result% An error code
See Also

DevCommReceiveBufferLength


DevCommSetSignals

Usage

DevCommSetSignals%:(this&,setMake&,clearMask&)

Description

Use this function to set or clear the indicated signal lines. All other lines are left in their current state.

Arguments
this& A handle to a serial device object
setMask& A bitmask indicating the control lines to set
clearMask& A bitmask indicating the control lines to clear
Return Value
result% An error code
See Also

DevCommSignals


DevCommSignals

Usage

signals& = DevCommSignals&:(this&)

Description

Returns the serial control lines.

Arguments
this& A handle to a serial device object
Return Value
signals& A bitmap containing the current control line status
See Also

DevCommSetSignals


DevCommWriteA

Usage

DevCommQueryWriteA:(this&,des&,length&,BYREF status&)

Description

Use this function to write data to a serial port.

Arguments
this& A handle to a serial device object
des& A descriptor to a buffer containing the data to be written to the serial port
length& An optional explicit length of data to be written. If not -1, this overrides the length of the descriptor default
BYREF status& The request status used to contain completion information for the function.
Notes

If a write is issued with a data length of zero (either explicitly or implicit in the descriptor) the WriteA will complete when the current handshaking configuration and the state of input control lines would allow any data to be actually written to the serial line. This functionality is useful to determine when serial devices come on line.

See Also

DevCommWriteCancel


DevCommWriteCancel

Usage

DevCommQueryWriteCancel:(this&)

Description

Cancel any pending WriteA operation.

Arguments
this& A handle to a serial device object
See Also

DevCommWriteA


  SDK Home Glossary Index Left Right Up