Added "GET /2/dmi" API endpoint.

This commit is contained in:
XMRig 2021-01-20 22:54:02 +07:00
parent 9a02007900
commit 8471f7fad3
No known key found for this signature in database
GPG key ID: 446A53638BE94409
17 changed files with 263 additions and 74 deletions

View file

@ -20,6 +20,7 @@
#include "hw/dmi/DmiMemory.h"
#include "3rdparty/rapidjson/document.h"
#include "hw/dmi/DmiTools.h"
@ -190,3 +191,28 @@ const char *xmrig::DmiMemory::type() const
{
return dmi_memory_device_type(m_type);
}
#ifdef XMRIG_FEATURE_API
rapidjson::Value xmrig::DmiMemory::toJSON(rapidjson::Document &doc) const
{
using namespace rapidjson;
auto &allocator = doc.GetAllocator();
Value out(kObjectType);
out.AddMember("slot", m_slot.toJSON(doc), allocator);
out.AddMember("type", StringRef(type()), allocator);
out.AddMember("form_factor", StringRef(formFactor()), allocator);
out.AddMember("size", m_size, allocator);
out.AddMember("speed", m_speed, allocator);
out.AddMember("rank", m_rank, allocator);
out.AddMember("voltage", m_voltage, allocator);
out.AddMember("width", m_width, allocator);
out.AddMember("total_width", m_totalWidth, allocator);
out.AddMember("vendor", m_vendor.toJSON(doc), allocator);
out.AddMember("product", m_product.toJSON(doc), allocator);
out.AddMember("bank", m_bank.toJSON(doc), allocator);
return out;
}
#endif