Skip to content

Commit

Permalink
Export current and worst value of smart info
Browse files Browse the repository at this point in the history
  • Loading branch information
HO-COOH committed Mar 25, 2023
1 parent a5e6777 commit 3e3027e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions DiskInfo/DiskInfoLib.Test/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "pch.h"
#include "pch.h"
#include <iostream>
#include <span>
#include <fstream>
Expand All @@ -25,7 +25,12 @@ int main()
for (auto const& obj : info1.Attributes())
{
auto attr = obj.as<winrt::DiskInfoLibWinRT::SmartAttribute>();
std::wcout << attr.Id.data() << "\t" << attr.Name.data() << '\t' << attr.RawValue.data() << '\n';
std::wcout
<< attr.Id.data() << "\t"
<< attr.Name.data() << '\t'
<< attr.RawValue.data() << '\t'
<< attr.Current.data() <<'\t'
<< attr.Worst.data() << '\n';
}

auto tData1 = info1.TemperatureData();
Expand Down
2 changes: 2 additions & 0 deletions DiskInfo/DiskInfoLib/AtaSmartInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ namespace winrt::DiskInfoLibWinRT::implementation

attr.RawValue = rawValue;
attr.Threshold = std::format(L"{:0>2X}", threshold.ThresholdValue);
attr.Current = std::to_wstring(static_cast<int>(original.Attribute[j].CurrentValue)).data();
attr.Worst = std::to_wstring(static_cast<int>(original.Attribute[j].WorstValue)).data();

Attributes().Append(winrt::box_value(attr));
}
Expand Down
3 changes: 2 additions & 1 deletion DiskInfo/DiskInfoLib/AtaSmartInfo.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ namespace DiskInfoLibWinRT
//对应SMART_ATTRIBUTE
struct SmartAttribute
{

String Id;
String Name;
String RawValue;
String Threshold;
String Current;
String Worst;
};


Expand Down

0 comments on commit 3e3027e

Please sign in to comment.