mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 19:23:28 +02:00
adding computer changes to the platofrm
This commit is contained in:
parent
c1c2efc71d
commit
5cbb39a48e
13 changed files with 70 additions and 21 deletions
|
@ -38,3 +38,8 @@ void AndroidInstance::enumerateMemory() {
|
|||
ram["totalMemory"]="";
|
||||
_memory.push_back(ram);
|
||||
}
|
||||
|
||||
void AndroidInstance::::enumerateComputer(){
|
||||
//no implememntation at this time
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace platform {
|
|||
void enumerateCpu() override;
|
||||
void enumerateMemory() override;
|
||||
void enumerateGpu() override;
|
||||
void enumerateComputer () override;
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
|
|
@ -40,3 +40,8 @@ void LinuxInstance::enumerateMemory() {
|
|||
|
||||
_memory.push_back(ram);
|
||||
}
|
||||
|
||||
void LinuxInstance::::enumerateComputer(){
|
||||
//no implememntation at this time
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace platform {
|
|||
void enumerateCpu() override;
|
||||
void enumerateMemory() override;
|
||||
void enumerateGpu() override;
|
||||
void enumerateComputer () override;
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
|
|
@ -64,16 +64,6 @@ void MACOSInstance::enumerateCpu() {
|
|||
cpu["cpuNumCores"] = std::thread::hardware_concurrency();
|
||||
|
||||
_cpu.push_back(cpu);
|
||||
|
||||
|
||||
//get system name
|
||||
size_t len=0;
|
||||
sysctlbyname("hw.model",NULL, &len, NULL, 0);
|
||||
char* model = (char *) malloc(sizeof(char)*len+1);
|
||||
sysctlbyname("hw.model", model, &len, NULL,0);
|
||||
|
||||
_computerModel=std::string(model);
|
||||
free(model);
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateGpu() {
|
||||
|
@ -98,3 +88,24 @@ void MACOSInstance::enumerateMemory() {
|
|||
#endif
|
||||
_memory.push_back(ram);
|
||||
}
|
||||
|
||||
void MACOSInstance::enumerateComputer(){
|
||||
#ifdef Q_OS_MAC
|
||||
|
||||
//get system name
|
||||
size_t len=0;
|
||||
sysctlbyname("hw.model",NULL, &len, NULL, 0);
|
||||
char* model = (char *) malloc(sizeof(char)*len+1);
|
||||
sysctlbyname("hw.model", model, &len, NULL,0);
|
||||
|
||||
|
||||
json computer;
|
||||
computer["computerModel"]=std::string(model);
|
||||
|
||||
_computer.push_back(computer);
|
||||
|
||||
free(model);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ namespace platform {
|
|||
void enumerateCpu() override;
|
||||
void enumerateMemory() override;
|
||||
void enumerateGpu() override;
|
||||
void enumerateComputer () override;
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
||||
#endif //hifi_winplatform_h
|
||||
#endif //hifi_macosplatform_h
|
||||
|
|
|
@ -81,3 +81,8 @@ void WINInstance::enumerateMemory() {
|
|||
#endif
|
||||
_memory.push_back(ram);
|
||||
}
|
||||
|
||||
void WINInstance::enumerateComputer(){
|
||||
//no implememntation at this time
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace platform {
|
|||
void enumerateCpu() override;
|
||||
void enumerateMemory() override;
|
||||
void enumerateGpu() override;
|
||||
|
||||
void enumerateComputer () override;
|
||||
};
|
||||
} // namespace platform
|
||||
|
||||
|
|
|
@ -78,6 +78,10 @@ json platform::getMemory(int index) {
|
|||
return _instance->getMemory(index);
|
||||
}
|
||||
|
||||
std::string platform::getComputerModel(){
|
||||
return _instance->getComputerModel();
|
||||
int platform::getNumComputer(){
|
||||
return _instance->getNumComputer();
|
||||
}
|
||||
|
||||
json platform::getComputer(int index){
|
||||
return _instance->getComputer(index);
|
||||
}
|
||||
|
|
|
@ -32,7 +32,8 @@ json getDisplay(int index);
|
|||
int getNumMemory();
|
||||
json getMemory(int index);
|
||||
|
||||
std::string getComputerModel();
|
||||
int getNumComputer();
|
||||
json getComputer(int index);
|
||||
} // namespace platform
|
||||
|
||||
#endif // hifi_platform_h
|
||||
|
|
|
@ -8,13 +8,13 @@
|
|||
|
||||
|
||||
#include "platform.h"
|
||||
|
||||
#include <QtGlobal>
|
||||
#include "platformInstance.h"
|
||||
#include <QtGlobal>
|
||||
|
||||
using namespace platform;
|
||||
|
||||
bool Instance::enumeratePlatform() {
|
||||
enumerateComputer();
|
||||
enumerateCpu();
|
||||
enumerateGpu();
|
||||
enumerateMemory();
|
||||
|
@ -47,6 +47,14 @@ json Instance::getGPU(int index) {
|
|||
return _gpu.at(index);
|
||||
}
|
||||
|
||||
json Instance::getComputer(<#int index#>){
|
||||
if(index >=(int) _computer.size()){
|
||||
return json();
|
||||
}
|
||||
|
||||
return _computer.at(index);
|
||||
|
||||
}
|
||||
json Instance::getDisplay(int index) {
|
||||
assert(index <(int) _display.size());
|
||||
|
||||
|
@ -65,7 +73,6 @@ Instance::~Instance() {
|
|||
_memory.clear();
|
||||
}
|
||||
|
||||
|
||||
if (_gpu.size() > 0) {
|
||||
_gpu.clear();
|
||||
}
|
||||
|
@ -73,4 +80,8 @@ Instance::~Instance() {
|
|||
if (_display.size() > 0) {
|
||||
_display.clear();
|
||||
}
|
||||
|
||||
if(_computer.size()>0){
|
||||
_computer.clear();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,11 +31,13 @@ public:
|
|||
int getNumDisplay() { return (int)_display.size(); }
|
||||
json getDisplay(int index);
|
||||
|
||||
std::string getComputerModel(){return _computerModel;}
|
||||
int getNumComputer() {return (int)_computer.size();}
|
||||
json getComputer(int index);
|
||||
|
||||
void virtual enumerateCpu()=0;
|
||||
void virtual enumerateMemory()=0;
|
||||
void virtual enumerateGpu()=0;
|
||||
void virtual enumerateComputer()=0;
|
||||
|
||||
virtual ~Instance();
|
||||
|
||||
|
@ -44,7 +46,7 @@ protected:
|
|||
std::vector<json> _memory;
|
||||
std::vector<json> _gpu;
|
||||
std::vector<json> _display;
|
||||
std::string _computerModel;
|
||||
std::vector<json> _computer;
|
||||
};
|
||||
|
||||
} // namespace platform
|
||||
|
|
|
@ -26,10 +26,12 @@ namespace platform {
|
|||
static const char* displayCoordsRight { "coordinatesright"};
|
||||
static const char* displayCoordsTop { "coordinatestop"};
|
||||
static const char* displayCoordsBottom { "coordinatesbottom"};
|
||||
static const char* computerModel { "computerModel"};
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
} // namespace platform
|
||||
} // namespace plaform::jsonKeys
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue