Example #1
0
int main(int argc, char* argv[])
{
	// Some signals should lead to a normal shutdown of the daq stream client. Afterwards the program exists.
	signal( SIGTERM, &sigHandler);
	signal( SIGINT, &sigHandler);

	if ((argc<2) || (std::string(argv[1])=="-h") ) {
		std::cout << "syntax: " << argv[0] << " <stream server address> [ -q]" << std::endl;
		std::cout << "use option -q to print meta data only" << std::endl;
		return EXIT_SUCCESS;
	}
	
	if ((argc>=3) && (std::string(argv[2]) == "-q")) {
		signalContainer.setDataAsRawCb(dataCbQuiet);
	} else {
		signalContainer.setDataAsRawCb(rawCbVerbose);
	}

	signalContainer.setSignalMetaCb(signalMetaInformationCb);

	streamClient.setStreamMetaCb(streamMetaInformationCb);
	streamClient.setSignalContainer(&signalContainer);

	// connect to the daq stream service and give control to the receiving function.
	// returns on signal (terminate, interrupt) buffer overrun on the server side or loss of connection.
	streamClient.start(argv[1], hbm::streaming::DAQSTREAM_PORT);
	return EXIT_SUCCESS;
}
Example #2
0
int main(int argc, char* argv[])
{
	// Some signals should lead to a normal shutdown of the daq stream client. Afterwards the program exists.
	signal( SIGTERM, &sigHandler);
	signal( SIGINT, &sigHandler);

	if ((argc<2) || (std::string(argv[1])=="-h") ) {
		std::cout << "syntax: " << argv[0] << " <stream server address>" << std::endl;
		return EXIT_SUCCESS;
	}

	static const std::string streamMetaFilename = "streamMeta.dump";
	streamMetaFile.open(streamMetaFilename);

	signalContainer.setDataCb(dataCb);
	signalContainer.setSignalMetaCb(signalMetaInformationCb);

	streamClient.setStreamMetaCb(streamMetaInformationCb);
	streamClient.setSignalContainer(&signalContainer);

	// connect to the daq stream service and give control to the receiving function.
	// returns on signal (terminate, interrupt) buffer overrun on the server side or loss of connection.
	try {
		streamClient.start(argv[1], hbm::streaming::DAQSTREAM_PORT);
	} catch (const std::runtime_error& e) {
		std::cerr << e.what();
		return EXIT_FAILURE;
	}
	return EXIT_SUCCESS;
}
Example #3
0
int main(int argc, char* argv[])
{
	// Some signals should lead to a normal shutdown of the daq stream client. Afterwards the program exists.
	signal( SIGTERM, &sigHandler);
	signal( SIGINT, &sigHandler);

	if ((argc<2) || (std::string(argv[1])=="-h") ) {
		std::cout << "Subscribes all signals that become available." << std::endl;
		std::cout << "Each signal is expected to deliver a ramp with a defined slope." << std::endl;
		std::cout << std::endl;
		std::cout << "syntax: " << argv[0] << " <stream server address> <slope (default is " << rampValueDiff << ")>" << std::endl;
		return EXIT_SUCCESS;
	}

	if (argc==3) {
		char* pEnd;
		const char* pStart = argv[2];
		rampValueDiff = strtod(pStart, &pEnd);
		if (pEnd ==pStart) {
			std::cerr << "invalid slope value. Must be a number" << std::endl;
			return EXIT_FAILURE;
		}
	}

	signalContainer.setDataCb(dataCb);
	signalContainer.setSignalMetaCb(signalMetaInformationCb);

	streamClient.setStreamMetaCb(streamMetaInformationCb);
	streamClient.setSignalContainer(&signalContainer);

	// connect to the daq stream service and give control to the receiving function.
	// returns on signal (terminate, interrupt) buffer overrun on the server side or loss of connection.
	try {
		streamClient.start(argv[1], hbm::streaming::DAQSTREAM_PORT);
	} catch (const std::runtime_error& e) {
		std::cerr << e.what();
		return EXIT_FAILURE;
	}

	return EXIT_SUCCESS;
}