This has been an attempt to extend existing FileHandle to behave like POSIX
file descriptor for input/output resources/devices too.
This will now provide an abstract indicator/handle any arbitrary file or device
type resource. May be in future, sockets too.
In order to correctly detect availability of read/write a FileHandle, we needed
a select or poll mechanisms. We opted for poll as POSIX defines in
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html Currently,
mbed::poll() just spins and scans filehandles looking for any events we are
interested in. In future, his spinning behaviour will be replaced with
condition variables.
In retarget.cpp we have introduced an mbed::fdopen() function which is
equivalent to C fdopen(). It attaches a std stream to our FileHandle stream.
newlib-nano somehow does not seem to call isatty() so retarget doesn't work for
device type file handles. We handle this by checking ourselves in
mbed::fdopen() if we wish to attach our stream to std stream. We also turn off
buffering by C library as our stuff will be buffered already.
sigio() is also provided, matching the API of the Socket class, with a view to
future unification. As well as unblocking poll(), _poll_change calls the user
sigio callback if an event happens, i.e., when FileHandle becomes
readable/writable.
Best way to enable MBED_DEPRICATED APIs to be properly rendered
requires using the doxygen preprocessor. This means all device_has
labels need to also be defined or the default DOXYGEN_ONLY label
applied to the API headers which this commit does. ASYNCH currently
exluded.
stop using scope for \addtogroup. It was placing class methods into the
group documentation instead of the class documentation. The new style is
to explicitly tag the class as @ingroup. This new method will allow the
class to be linked in the group page, and the class page will contain
the detailed documentation of the class methods.
This commit adds a `baud` argument for Serial and RawSerial objects:
- there is a new `Serial` constructor with a mandatory baud rate
argument. The old constructor also got a `baud` argument with a
default value (to keep backward compatibility).
- the `RawSerial` constructor also got a `baud` argument with a default
value.
There's also a new configuration parameter (`default-serial-baud-rate`)
that can be used to specify the default value of the above `baud`
arguments.