Refactor detection request task

The detection request task is the biggest asynchronous task so far. It
contained a lot of conditional statements. I have refactored them into
separate methods. Hence, also new methods were added to the client
controller which are related to setting the detection state.

While doing this I have also found legacy code, which set the state
after, for instance, a request failed. This, however, is not reasonable
anymore with the current controller-model design.

Signed-off-by: Konrad Reiche <konrad.reiche@gmail.com>