Initial C version
This commit is contained in:
parent
fa0e309875
commit
d5b097c6ec
33 changed files with 123 additions and 1969 deletions
|
@ -14,19 +14,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <HarmonyLinkStruct.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "Enums/EDevice.h"
|
||||
#include "Enums/EPlatform.h"
|
||||
#include "Enums/ESteamDeck.h"
|
||||
#include "Core.h"
|
||||
|
||||
namespace HarmonyLinkLib
|
||||
typedef struct
|
||||
{
|
||||
// Struct to represent a specific device with both platform and device type
|
||||
struct FDevice : HarmonyLinkStruct
|
||||
{
|
||||
EPlatform platform = EPlatform::UNKNOWN;
|
||||
EDevice device = EDevice::UNKNOWN;
|
||||
ESteamDeck steam_deck_model = ESteamDeck::NONE;
|
||||
};
|
||||
}
|
||||
bool has_battery;
|
||||
bool is_connected_to_ac;
|
||||
unsigned char battery_percent;
|
||||
} FBattery;
|
||||
|
||||
HARMONYLINKLIB_API void FBattery_print(const FBattery* self);
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
// Copyright (c) 2024 Jordon Brooks
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
|
||||
#include "HarmonyLinkStruct.h"
|
||||
|
||||
namespace HarmonyLinkLib
|
||||
{
|
||||
struct FBattery : HarmonyLinkStruct
|
||||
{
|
||||
bool has_battery;
|
||||
bool is_connected_to_ac;
|
||||
uint8_t battery_percent;
|
||||
|
||||
void to_string() const {
|
||||
std::wcout << "Battery present: " << (has_battery ? "'Yes'" : "'No'") << '\n';
|
||||
std::wcout << "Connected to AC: " << (is_connected_to_ac ? "'Yes'" : "'No'") << '\n';
|
||||
std::wcout << "Battery percent: '" << static_cast<int>(battery_percent) << "%'" << '\n';
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
// Copyright (c) 2024 Jordon Brooks
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <unordered_set>
|
||||
#include "FString.h"
|
||||
|
||||
#include "HarmonyLinkStruct.h"
|
||||
|
||||
namespace HarmonyLinkLib
|
||||
{
|
||||
struct FCPUInfo : HarmonyLinkStruct
|
||||
{
|
||||
FString VendorID;
|
||||
FString Model_Name;
|
||||
uint32_t Physical_Cores = 0;
|
||||
uint32_t Logical_Cores = 0;
|
||||
std::unordered_set<FString> Flags;
|
||||
|
||||
void print() const
|
||||
{
|
||||
wprintf(L"VendorID: '%hs'\n", VendorID.c_str());
|
||||
wprintf(L"Model_Name: '%hs'\n", Model_Name.c_str());
|
||||
wprintf(L"Physical_Cores: '%d'\n", Physical_Cores);
|
||||
wprintf(L"Logical_Cores: '%d'\n", Logical_Cores);
|
||||
|
||||
// Initialize a string to hold all flags
|
||||
std::string allFlags;
|
||||
for (const auto& flag : Flags) {
|
||||
allFlags += std::string(flag.c_str()) + " "; // Append each flag followed by a space
|
||||
}
|
||||
|
||||
// Remove the trailing space
|
||||
if (!allFlags.empty()) {
|
||||
allFlags.pop_back();
|
||||
}
|
||||
|
||||
wprintf(L"Flags: '%hs'\n", allFlags.c_str());
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
// Copyright (c) 2024 Jordon Brooks
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "FString.h"
|
||||
#include "HarmonyLinkStruct.h"
|
||||
|
||||
namespace HarmonyLinkLib
|
||||
{
|
||||
struct FOSVerInfo : HarmonyLinkStruct {
|
||||
// 'name' represents the operating system's name, e.g., "Ubuntu" in Linux or "Windows" in Windows systems.
|
||||
FString name;
|
||||
|
||||
// 'version' is a numerical representation of the OS version. In Linux, it might be the kernel version,
|
||||
// whereas in Windows, it could be the major version number like 10 for Windows 10.
|
||||
uint32_t version = 0;
|
||||
|
||||
// 'id' is a unique identifier for the OS. In Linux, it might be a lower-case string like "ubuntu".
|
||||
// In Windows, this could map to the edition ID, such as "Professional".
|
||||
FString id;
|
||||
|
||||
// 'version_id' is a string representing the specific version of the OS.
|
||||
// For example, "20.04" in Ubuntu or "1909" in Windows 10.
|
||||
FString version_id;
|
||||
|
||||
// 'version_codename' is a codename for the OS version, if available.
|
||||
// This is common in Linux distributions (e.g., "focal" for Ubuntu 20.04) but not typically used in Windows.
|
||||
FString version_codename;
|
||||
|
||||
// 'pretty_name' is a more readable version of the name, potentially including the version and codename.
|
||||
// For example, "Ubuntu 20.04 LTS (Focal Fossa)" or "Windows 10 Pro".
|
||||
FString pretty_name;
|
||||
|
||||
// 'variant_id' is an identifier for the specific variant of the OS, if available.
|
||||
// For example, in Linux distributions, this might be "desktop" for the desktop edition,
|
||||
// "server" for the server edition, or "core" for a minimal installation. It helps distinguish
|
||||
// between different flavors or editions of the same version.
|
||||
// On the Steam Deck, this is set to "steamdeck".
|
||||
FString variant_id;
|
||||
|
||||
void print() const
|
||||
{
|
||||
wprintf(L"Name: '%hs'\n", name.c_str());
|
||||
wprintf(L"Version: '%d'\n", version);
|
||||
wprintf(L"ID: '%hs'\n", id.c_str());
|
||||
wprintf(L"Version ID: '%hs'\n", version_id.c_str());
|
||||
wprintf(L"Version Codename: '%hs'\n", version_codename.c_str());
|
||||
wprintf(L"Pretty Name: '%hs'\n", pretty_name.c_str());
|
||||
wprintf(L"Variant ID: '%hs'\n", variant_id.c_str());
|
||||
}
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue