ARCHITECTURE
write()
E355/E265 USER AND BEST PRACTICES GUIDE 21
write()
This copies the given data to system transmit buffers for transmission over the
communication port. The function may return before the data is actually sent. In
e355, the write() function works differently than a standard serial port. The
driver assumes that each write contains a whole packet and that a request/reply
type of protocol is running on the link that limits the number of outstanding
transmit packets in the buffers. Usually, a device port will have, at most, one
outstanding packet in the buffers. No packet is sent until a response is received.
There are a total of 7 transmit buffers shared among all channels. If a
communication protocol attempts to write when there are no buffers, the error
ENOSPC is returned. Each buffer allows up to 1024 bytes for iOS devices and
2048 bytes for Android and Windows devices.
Prototype int write(int handle, const char *buffer, int count);
Parameters
Return Values Returns the number of bytes sent, or -1 if an error occurred.
Reset_port_error()
Resets all error flags for the given communication channel.
Prototype int reset_port_error(int handle);
Parameters
Return Values Returns 0 if successful, or -1 if an error occurred.
handle The handle returned for the device by the open() call.
buffer The buffer from which to copy the data.
count The number of bytes to send.
handle The handle returned for the device by the open() call.