mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
(Linux) Added the BlueZ library as a dependency
This commit is contained in:
parent
2cf100bbf5
commit
3296969b4e
|
|
@ -18,6 +18,12 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
|
#if defined(__linux__) && !defined(__ANDROID__)
|
||||||
|
#include <bluetooth/bluetooth.h>
|
||||||
|
#include <bluetooth/hci.h>
|
||||||
|
#include <bluetooth/hci_lib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__APPLE__) && !defined(__IOS__)
|
#if defined(__APPLE__) && !defined(__IOS__)
|
||||||
#include "BluetoothStatusApple.h"
|
#include "BluetoothStatusApple.h"
|
||||||
#include <IOKit/ps/IOPSKeys.h>
|
#include <IOKit/ps/IOPSKeys.h>
|
||||||
|
|
@ -195,26 +201,8 @@ void SystemStatus::getStatusBluetooth()
|
||||||
hasBluetooth = true;
|
hasBluetooth = true;
|
||||||
|
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
const std::string sysEntry {"/sys/class/rfkill"};
|
if (hci_get_route(nullptr) == 0)
|
||||||
auto entries {Utils::FileSystem::getDirContent(sysEntry, false)};
|
|
||||||
for (auto& entry : entries) {
|
|
||||||
if (Utils::FileSystem::exists(entry + "/type")) {
|
|
||||||
std::string type;
|
|
||||||
std::ifstream fileStream;
|
|
||||||
fileStream.open(entry + "/type");
|
|
||||||
getline(fileStream, type);
|
|
||||||
fileStream.close();
|
|
||||||
if (Utils::String::toLower(type) == "bluetooth") {
|
|
||||||
std::string state;
|
|
||||||
fileStream.open(entry + "/state");
|
|
||||||
getline(fileStream, state);
|
|
||||||
fileStream.close();
|
|
||||||
if (std::stoi(state) == 1)
|
|
||||||
hasBluetooth = true;
|
hasBluetooth = true;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mHasBluetooth = hasBluetooth;
|
mHasBluetooth = hasBluetooth;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue