You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function will collapse when the second adjustment is applied to the current position.
auto bluetooth_enabled = SimpleBLE::Safe::Adapter::bluetooth_enabled(); if (!bluetooth_enabled.has_value()) { outMsg = "Bluetooth enabled status err"; }
using namespace winrt;
using namespace winrt::Windows::Devices::Bluetooth::Advertisement;
using namespace winrt::Windows::Devices::Bluetooth;
using namespace winrt::Windows::Devices::Bluetooth::GenericAttributeProfile;
using namespace winrt::Windows::Storage::Streams;
bool BLEIsLowEnergySupported() {
try
{
auto getadapter_op = Windows::Devices::Bluetooth::BluetoothAdapter::GetDefaultAsync();
auto adapter = getadapter_op.get();
if (adapter == nullptr) {
std::cerr << "No Bluetooth adapter found." << std::endl;
return false;
}
auto supported = adapter.IsLowEnergySupported();
if (supported == false) {
return false;
}
auto async = adapter.GetRadioAsync();
auto radio = async.get();
auto t = radio.State(); // 获取电脑蓝牙状态 0未知,1打开,2关闭,3硬件关闭或禁用
if (t != winrt::Windows::Devices::Radios::RadioState::On) {
return false;
}
return true;
}
catch (const winrt::hresult_error& e) {
std::wcerr << L"Exception: " << e.message().c_str() << std::endl;
return false;
}
catch (const std::exception& e) {
std::cerr << "Standard exception: " << e.what() << std::endl;
return false;
}
catch (...) {
std::cerr << "Unknown exception occurred." << std::endl;
return false;
}
This function will collapse when the second adjustment is applied to the current position.
auto bluetooth_enabled = SimpleBLE::Safe::Adapter::bluetooth_enabled(); if (!bluetooth_enabled.has_value()) { outMsg = "Bluetooth enabled status err"; }
STACK_TEXT:
00000080
78affab0 00007ff6
19e43039 : 0000000000000000 000001d3
9c1c2830 0000000000000000 00000000
00000000 : loveSockets!winrt::impl::factory_cache_entrywinrt::Windows::Devices::Radios::Radio,winrt::Windows::Devices::Radios::IRadioStatics::call<<lambda_d6ec5b0ce89a03db82adf8d9e7c2c76f> & __ptr64>+0x5200000080
78affb80 00007ff6
19de0c68 : 0000008078affc38 00000000
00000018 ffffffffffffffff 00007ff6
19de03c0 : loveSockets!SimpleBLE::AdapterBase::bluetooth_enabled+0x2900000080
78affbd0 00007ff6
19e05f5e : 0000000000000000 000001d3
9c1c2830 0000000000000000 00000000
00000000 : loveSockets!my_server::handle_open'::
2'::<lambda_1>::operator()+0x35800000080
78affd50 00007ffb
8abc1bb2 : 000001d39c1c53d0 00000000
00000000 0000000000000000 00000000
00000000 : loveSockets!std::thread::_Invoke<std::tuple<my_server::handle_open'::
2'::<lambda_1> >,0>+0xe00000080
78affd80 00007ffb
8b237374 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : ucrtbase!thread_start<unsigned int (__cdecl*)(void *),1>+0x4200000080
78affdb0 00007ffb
8d23cc91 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : KERNEL32!BaseThreadInitThunk+0x1400000080
78affde0 00000000
00000000 : 0000000000000000 00000000
00000000 0000000000000000 00000000
00000000 : ntdll!RtlUserThreadStart+0x21The text was updated successfully, but these errors were encountered: