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>
commita5552379ddabfaf2c8c3a3c5973910544f1b5a9a
parent3fe0851fca530f2b20a56414d39a57a5a2fa3fe6
authorMiguel Costa <miguel.costa@qt.io>
committerMiguel Costa <miguel.costa@qt.io>
commit timeTue, 30 Jul 2024 16:12:39 +0200