Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix windows release build compilation #16

Merged
merged 1 commit into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions windows/src/helper/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ namespace universal_ble

std::string to_uuidstr(winrt::guid guid);


/// To call async functions synchronously
template <typename async_t>
static auto async_get(async_t const &async)
Expand All @@ -43,9 +42,9 @@ namespace universal_ble
{
throw FlutterError(winrt::to_string(err.message()));
}
catch (const std::exception &err)
catch (...)
{
throw FlutterError(err.what());
throw FlutterError("Unknown error");
}
}

Expand Down
16 changes: 6 additions & 10 deletions windows/src/universal_ble_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -785,10 +785,6 @@ namespace universal_ble
std::cout << "WriteValueLog: " << winrt::to_string(err.message()) << " ErrorCode: " << std::to_string(errorCode) << std::endl;
result(FlutterError(std::to_string(errorCode), winrt::to_string(err.message())));
}
catch (const std::exception &err)
{
result(FlutterError("WriteFailed", err.what()));
}
catch (...)
{
result(FlutterError("WriteFailed", "Unknown error"));
Expand Down Expand Up @@ -904,7 +900,8 @@ namespace universal_ble
flutter::EncodableList results = flutter::EncodableList();
for (auto &&deviceInfo : devices)
{
try{
try
{
BluetoothLEDevice device = co_await BluetoothLEDevice::FromIdAsync(deviceInfo.Id());
auto deviceId = _mac_address_to_str(device.BluetoothAddress());
// Filter by services
Expand Down Expand Up @@ -932,7 +929,10 @@ namespace universal_ble
universalScanResult.set_name(winrt::to_string(deviceInfo.Name()));
universalScanResult.set_is_paired(deviceInfo.Pairing().IsPaired());
results.push_back(flutter::CustomEncodableValue(universalScanResult));
}catch(...){ }
}
catch (...)
{
}
}
result(results);
}
Expand All @@ -942,10 +942,6 @@ namespace universal_ble
std::cout << "GetConnectedDeviceLog: " << winrt::to_string(err.message()) << " ErrorCode: " << std::to_string(errorCode) << std::endl;
result(FlutterError(std::to_string(errorCode), winrt::to_string(err.message())));
}
catch (const std::exception &err)
{
result(FlutterError(err.what()));
}
catch (...)
{
std::cout << "Unknown error GetConnectedDevicesAsync" << std::endl;
Expand Down