Do not use a fixed 5 second delay after having a started a windows
sensor application, instead try to access the shared memory area
repeatedly and only give up after 10 seconds. Please note that for this
feature to be usable the sensor app must be found in PATH.
- Move opening and closing of a win32 shared memory area into helper
functions. shm_open ensures that the data pointer is valid and
otherwise gets rid of the opened file handle right away. shm_close
cleans up both the handle and the data pointer if needed.
- Redo the initial check for presence of a sensor tool that uses a
shared memory area for its sensor data by using the above two
functions
- Port all sensor value reading to use shm_open/shm_close as well
This gets rid of some code duplication and also lowers the indentation
level in several areas which hopefully makes the code a bit easier to
read. Additionally all the win32 API calls are limited to two functions.