Use C++/WinRT in qlowenergycontroller_winrt
Most changes in this patch are direct translations of WRL-style API
calls to C++/WinRT, ideally with no change in caller-observable
behavior.
The C++/WinRT API provides error handling by means of exceptions. To
maintain caller-observable behavior, all API calls need to be secured by
a try-catch block. A few helpful macros are used to keep the translated
code readable:
- TRY(x): evaluates x, yields a bool that indicates if the evaluation
generated an API exception (true = no exception).
- HR(x): evaluates x, yields an HRESULT that corresponds to the
exception generated (S_OK = no exception).
- SAFE(x): yields a value corresponding to the evaluation of x, or
nullptr in case an API exception was generated.
Task-number: QTBUG-120665
Change-Id: Iaef4f04c61fca2265e4730fb44e99877b38dc168
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>