How
to Send Data: Tutorial
This tutorial describes how to send and receive data with the Serial
Communications Server.
All data sent from the serial device is 8-bit even on a Unicode system.
Create a TDesC8 Descriptor and fill the Descriptor
with the data to send.
Create a request object of type TRequestStatus.
Call RComm::Write() and set the aDes parameter
as a reference to the Descriptor, and set the aStatus parameter to the request
object.
The RComm API does not allow another request to be made until the first
request has completed.
The write request completes when the last character in the supplied
buffer has been written to the serial hardware. There are three alternative
ways the write request can complete:
If the aTimeOut parameter
was set with the RComm::Write() function then the request
completes with KErrTimedOut if the Descriptor was not filled
during the aTimeOut time.
If the write request
is in progress, the write request can be cancelled by calling WriteCancel().
A port can be configured
to automatically terminate data transfer requests early when various error
conditions occur.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.