示例#1
0
void CHardwareMonitor::GetInternalCurrent()
{
	std::vector<std::string> ret = ExecuteCommandAndReturn(szInternalCurrentCommand);
	if (ret.empty())
		return;
	std::string tmpline = ret[0];
	if (tmpline.find("curr=") == std::string::npos)
		return;
	tmpline = tmpline.substr(5);
	size_t pos = tmpline.find("'");
	if (pos != std::string::npos)
	{
		tmpline = tmpline.substr(0, pos);
	}

	float current = static_cast<float>(atof(tmpline.c_str()));
	if (current == 0)
		return; //hardly possible for a on board temp sensor, if it is, it is probably not working

	SendCurrent(1, current, "Internal Current");
}
示例#2
0
void CHardwareMonitor::GetInternalVoltage()
{
	std::vector<std::string> ret = ExecuteCommandAndReturn(szInternalVoltageCommand);
	if (ret.size() < 1)
		return;
	std::string tmpline = ret[0];
	if (tmpline.find("volt=") == std::string::npos)
		return;
	tmpline = tmpline.substr(5);
	size_t pos = tmpline.find("'");
	if (pos != std::string::npos)
	{
		tmpline = tmpline.substr(0, pos);
	}

	float voltage = static_cast<float>(atof(tmpline.c_str()));
	if (voltage == 0)
		return; //hardly possible for a on board temp sensor, if it is, it is probably not working

	SendVoltage(1, voltage, "Internal Voltage");
}
示例#3
0
void CHardwareMonitor::GetInternalTemperature()
{
	std::vector<std::string> ret = ExecuteCommandAndReturn(szInternalTemperatureCommand);
	if (ret.empty())
		return;
	std::string tmpline = ret[0];
	if (tmpline.find("temp=") == std::string::npos)
		return;
	tmpline = tmpline.substr(5);
	size_t pos = tmpline.find("'");
	if (pos != std::string::npos)
	{
		tmpline = tmpline.substr(0, pos);
	}

	float temperature = static_cast<float>(atof(tmpline.c_str()));
	if (temperature == 0)
		return; //hardly possible for a on board temp sensor, if it is, it is probably not working

	if ((temperature != 85) && (temperature > -273))
	{
		SendTempSensor(1, temperature, "Internal Temperature");
	}
}