Exemplo n.º 1
0
void
Interface::interfaceReport(Args& args)
{
	const char*		delimiter;
	const char*		timestamp;

	delimiter = args.getDelimiter();

	if (delimiter == NULL)
	{
		printf("%-*s : %d\n",
			maximumFieldLabelWidth(),
			"Device number",
			0);
		printf("%-*s : 0x%02X\n",
			maximumFieldLabelWidth(),
			"Device type",
			versionResponse_.getInterfaceType());

		printf("%-*s : %s, %d.%d.%d",
			maximumFieldLabelWidth(),
			"Device description",
			getModel(),
			versionResponse_.getVersionMajor(),
			versionResponse_.getVersionMinor(),
			versionResponse_.getVersionRelease());

		if (versionResponse_.getInterfaceType()
			== FRONIUS_INTERFACE_RS_232)
		{
			printf(", %s", decodeSolarNetStatus());
		}
		printf("\n");
	}
	else
	{
		timestamp = Utils::getTimestamp(args);
		delimiter = args.getDelimiter();
		CHECK_PTR(delimiter);

		printf("%s%s", timestamp, delimiter);
		printf("0%s", delimiter);
		printf("0x%02X%s", versionResponse_.getInterfaceType(),
			delimiter);
		printf("%s %d.%d.%d",
			getModel(),
			versionResponse_.getVersionMajor(),
			versionResponse_.getVersionMinor(),
			versionResponse_.getVersionRelease());
		if (versionResponse_.getInterfaceType()
			== FRONIUS_INTERFACE_RS_232)
		{
			printf(" %s", decodeSolarNetStatus());
		}
		printf("%s", delimiter);
		printf("\n");
	}
}
Exemplo n.º 2
0
void
SensorCard::displayNowHeader(Args& args)
{
	const char*	delimiter;

	delimiter = args.getDelimiter();
	CHECK_PTR(delimiter);

	printf("Chan. 1 Temperature now%s", delimiter);
	printf("Chan. 2 Temperature now%s", delimiter);
	printf("Irradiance now%s", delimiter);
	printf("Chan. 1 Value now%s", delimiter);
	printf("Chan. 2 Value now%s", delimiter);
}
Exemplo n.º 3
0
void
Interface::reportHeader(Args& args)
{
	const char*	delimiter;

	delimiter = args.getDelimiter();

	assert(delimiter != NULL);

	printf("Time%s", delimiter);
	printf("Device Number%s", delimiter);
	printf("Device Type%s", delimiter);
	printf("Description%s", delimiter);
	printf("\n");
}
Exemplo n.º 4
0
void
SensorCard::displayTotalHeader(Args& args)
{
	const char*	delimiter;

	delimiter = args.getDelimiter();
	CHECK_PTR(delimiter);

	printf("Chan. 1 Minimum Temperature total (F or C)%s", delimiter);
	printf("Chan. 1 Maximum Temperature total (F or C)%s", delimiter);
	printf("Chan. 2 Minimum Temperature total (F or C)%s", delimiter);
	printf("Chan. 2 Maximum Temperature total (F or C)%s", delimiter);
	printf("Irradiance Maximum total (Watts/meter2)%s", delimiter);
	printf("Chan. 1 Maximum value total%s", delimiter);
	printf("Chan. 2 Maximum value total%s", delimiter);
}
Exemplo n.º 5
0
void
SensorCard::report(Args& args)
{
	NowData		nowData;
	CumulativeData	dayData;
	CumulativeData	yearData;
	CumulativeData	totalData;

	deviceInfoReport(maximumFieldLabelWidth(), args);

	switch(args.getReportType())
	{
		case Args::ReportTypeNow:
			getNowData(nowData);
			displayNowData(args, nowData);
			break;
		case Args::ReportTypeDay:
			getDayData(dayData);
			displayCumulativeData(args, "today", dayData);
			break;
		case Args::ReportTypeYear:
			getYearData(yearData);
			displayCumulativeData(args, "year", yearData);
			break;
		case Args::ReportTypeTotal:
			getTotalData(totalData);
			displayCumulativeData(args, "total", totalData);
			break;
		case Args::ReportTypeAll:
			getNowData(nowData);
			getDayData(dayData);
			getYearData(yearData);
			getTotalData(totalData);
			displayNowData(args, nowData);
			displayCumulativeData(args, "today", dayData);
			displayCumulativeData(args, "year", yearData);
			displayCumulativeData(args, "total", totalData);
			break;
		default:
			assert(0);
	}

	if (args.getDelimiter() != NULL)
	{
		printf("\n");
	}
}
Exemplo n.º 6
0
void
SensorCard::displayNowData(Args& args, NowData& data)
{
	const char*	delimiter = args.getDelimiter();

	if (delimiter == NULL)
	{
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			"Chan. 1 Temperature now",
			Utils::getValue(data.temperatureChan1));
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			"Chan. 2 Temperature now",
			Utils::getValue(data.temperatureChan2));
		printf("%-*s : %s watts/meter2\n",
			maximumFieldLabelWidth(),
			"Irradiance now",
			Utils::getValue(data.irradiance));
		printf("%-*s : %s\n",
			maximumFieldLabelWidth(),
			"Chan. 1 Value now",
			Utils::getValue(data.digitalChan1Value));
		printf("%-*s : %s\n",
			maximumFieldLabelWidth(),
			"Chan. 2 Value now",
			Utils::getValue(data.digitalChan2Value));
	}
	else
	{
		printf("%s%s",
			Utils::getValue(data.temperatureChan1), delimiter);
		printf("%s%s",
			Utils::getValue(data.temperatureChan2), delimiter);
		printf("%s%s",
			Utils::getValue(data.irradiance), delimiter);
		printf("%s%s",
			Utils::getValue(data.digitalChan1Value), delimiter);
		printf("%s%s",
			Utils::getValue(data.digitalChan2Value), delimiter);
	}
}
Exemplo n.º 7
0
void
SensorCard::displayCumulativeData(
	Args& args,
	const char* timePeriod,
	CumulativeData& data)
{
	const char*	delimiter = args.getDelimiter();

	if (delimiter == NULL)
	{
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			Utils::strCat(
				"Chan. 1 Minimum Temperature ", timePeriod),
			Utils::getValue(data.temperatureChan1Minimum));
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			Utils::strCat(
				"Chan. 1 Maximum Temperature ", timePeriod),
			Utils::getValue(data.temperatureChan1Maximum));
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			Utils::strCat(
				"Chan. 2 Minimum Temperature ", timePeriod),
			Utils::getValue(data.temperatureChan2Minimum));
		printf("%-*s : %s degrees\n",
			maximumFieldLabelWidth(),
			Utils::strCat(
				"Chan. 2 Maximum Temperature ", timePeriod),
			Utils::getValue(data.temperatureChan2Maximum));
		printf("%-*s : %s watts/meter2\n",
			maximumFieldLabelWidth(),
			Utils::strCat("Irradiance Maximum ", timePeriod),
			Utils::getValue(data.temperatureChan2Maximum));
		printf("%-*s : %s\n",
			maximumFieldLabelWidth(),
			Utils::strCat("Chan. 1 Maximum value ", timePeriod),
			Utils::getValue(data.digitalChan1ValueMaximum));
		printf("%-*s : %s\n",
			maximumFieldLabelWidth(),
			Utils::strCat("Chan. 2 Maximum value ", timePeriod),
			Utils::getValue(data.digitalChan2ValueMaximum));
	}
	else
	{
		printf("%s%s",
			Utils::getValue(data.temperatureChan1Minimum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.temperatureChan1Maximum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.temperatureChan2Minimum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.temperatureChan2Maximum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.irradianceMaximum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.digitalChan1ValueMaximum),
			delimiter);
		printf("%s%s",
			Utils::getValue(data.digitalChan2ValueMaximum),
			delimiter);
	}
}