To be consistent with the other modules, the positioning server must be
called OwlPS Positioner instead of Positioning, and the executable
owlps-positionerd (even if the daemon mode is not implemented yet).
That's a big commit for a tiny change.
Differentiate the port on which the autocalibration hello messages are
sent to the aggregator by the listeners, and the one on which the
autocalibration orders are sent by the aggregator to the listeners.
This will allow to run a listener and an aggregator on the same machine
with autocalibration enabled.
Both in the listener and the aggregator, the option -a (autocalibration
port) has been replaced by the options -O (autocalibration order port)
and -H (autocalibration hello port). In the listener, the option -H was
previously used to set the hello delay; this is now the role of the -T
option.
The autocalibration requests are now sent on the same port as the
positioning request, by default. There was no real reason to send them
on a different port.
Modify the *time*() functions to avoid passing structures in arguments
(using const pointers instead) or returning structures (using result
arguments instead).
"start_time" was meaningless in the global data structures of owlps.h,
and could lead to errors in the aggregator, since it defines a field
start_time in one of its internal structures.
On *BSD, usleep() does not accept an argument greater than 1'000'000 (1
second). owl_msleep() decomposes its arguments to use sleep() and
usleep() calls.
This new type of request will only be used in owlps-positioning, to
distinct the calibration requests that are issued from a real
measurement and those that are generated by the self-calibration
process.
owl_mac_bytes_to_string() now uses a static buffer, so the caller do not
need to free the returned buffer manually. Because of this static
buffer, it is not thread-safe anymore, therefore we introduce
owl_mac_bytes_to_string_r() that is a thread-safe version.
Add some comments, add/remove some endianess conversions. That should be
OK now.
Noticeable changes in owlps.h:
- Type DIRECTION is now an alias for uint8_t instead of an enum.
- Type autocalibration_order now contains an uint8_t instead of an enum.
The use of integer types from inttypes.h & stdint.h should help with
portability issues. It will also force the data transmission between
different architectures to work as intended (if we handle endianess
conversions correctly!).
Abandon the old struct timeval and gettimeofday(). We now use the new
struct timespec and clock_gettime().
struct timespec has a nanosecond resolution, but we lower the resolution
to keep only milliseconds. The code is inspired from the Timestamp class
of the owlps-positioning.