コード例 #1
0
/* Stop programs and do general clean up
 *
 * @author Jan Itor
 */
static void stop_program(int reason)
{

	log_message("Stopping program...");

	/* Cease all captures */
	if (&sParameters_A.hCamera) {
		camera_abort(&sParameters_A);
		camera_uninit(&sParameters_A);
	}
	if (&sParameters_B.hCamera) {
		camera_abort(&sParameters_B);
		camera_uninit(&sParameters_B);
	}

	/* uninitialize io */
	io_uninit(&config);

	/* uninitialize filterwheel */
	filterwheel_uninit(&config);

	/* stop logging and return file handle */
	log_uninit();

	printf("Program stopped. Bye!\n");

	/* now terminate process */
	exit(reason);
}
コード例 #2
0
ファイル: io-cli.c プロジェクト: johannjacobsohn/so2-camera
int main(int argc, char *argv[])
{
	char *infile = argv[1];
	char *outfolder = argv[2];
	int rawdump = argv[3] ? 1 : 2;
	short *buffer;
	timeStruct time;
	int status = 1;
	sParameterStruct sSO2Parameters;
	sConfigStruct config;
	config.debug = 0;
	if (log_init(&config)) {
		printf("could not start log file, stop.\n");
	}
#ifdef BENCHMARK
	float startTime;
#endif

	if (argc < 3 || argc > 4) {
		printf("Usage: %s in.raw outfolder [write_raw_dump]\n", argv[0]);
		printf("i.e. %s tests/fixtures/testing_2014_09_22-23_43_55_984_cam_top.raw ./ 1\n", argv[0]);
		return 1;
	}
#ifdef BENCHMARK
	startTime = (float)clock() / CLOCKS_PER_SEC;
#endif

	buffer = getBufferFromFile(infile, 64);

	if(!buffer) return 1;

#ifdef BENCHMARK
	log_debug("reading file took %fms \n",
		  ((float)clock() / CLOCKS_PER_SEC - startTime) * 1000);
#endif

	parse_filename_to_timeStruct(infile, &time);

	sSO2Parameters.dTriggerPulseWidth = 15;
	sSO2Parameters.dExposureTime = 0;
	sSO2Parameters.dDarkCurrent = 0;
	sSO2Parameters.identifier = 'A';
	sSO2Parameters.stBuffer = buffer;
	sSO2Parameters.timestampBefore = &time;
	sSO2Parameters.dark = 0;
	sSO2Parameters.dExposureTime = 0.000000;

	config.dImageCounter = 0;
	config.dBufferlength = 1376256;
	config.dHistMinInterval = 350;
	config.dHistPercentage = 5;
	config.dInterFrameDelay = 10;
	config.dFixTime = 0.000000;
	config.cFileNamePrefix = "image";
	config.cConfigFileName = "";

	config.cImagePath = outfolder;
	config.processing = rawdump;

	io_init(&config);

	status = io_write(&sSO2Parameters, &config);
	if (status == 0) {
		log_debug("Converted %s to %s", infile, outfolder);
	} else {
		log_error("Something wrong writing to File.");
	}

	io_uninit(&config);
	free(buffer);
	return 0;
}