Ejemplo n.º 1
0
void message_set_logfile (const char* filename)
{
	if (g_logfile) {
		fclose (g_logfile);
		g_logfile = NULL;
	}

	if (filename)
		g_logfile = fopen (filename, "w");

	if (g_logfile) {
		g_lastchar = '\n';
#ifdef _WIN32
		g_timestamp = GetTickCount ();
#else
		gettimeofday (&g_timestamp, NULL);
#endif
		dc_datetime_t dt = {0};
		dc_ticks_t now = dc_datetime_now ();
		dc_datetime_gmtime (&dt, now);
		message ("DATETIME %u-%02u-%02uT%02u:%02u:%02uZ (%lu)\n",
			dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second,
			(unsigned long) now);
		message ("VERSION %s\n", dc_version (NULL));
	}
}
Ejemplo n.º 2
0
void print_version()
{
	if (version_printed)
		return;
	printf("Subsurface v%s,\n", subsurface_git_version());
	printf("built with libdivecomputer v%s\n", dc_version(NULL));
	print_qt_versions();
	int git_maj, git_min, git_rev;
	git_libgit2_version(&git_maj, &git_min, &git_rev);
	printf("built with libgit2 %d.%d.%d\n", git_maj, git_min, git_rev);
	version_printed = true;
}
Ejemplo n.º 3
0
QString ConfigureDiveComputer::dc_open(device_data_t *data)
{
	FILE *fp = NULL;
	dc_status_t rc;

	if (data->libdc_log)
		fp = subsurface_fopen(logfile_name, "w");

	data->libdc_logfile = fp;

	rc = dc_context_new(&data->context);
	if (rc != DC_STATUS_SUCCESS) {
		return tr("Unable to create libdivecomputer context");
	}

	if (fp) {
		dc_context_set_loglevel(data->context, DC_LOGLEVEL_ALL);
		dc_context_set_logfunc(data->context, logfunc, fp);
		fprintf(data->libdc_logfile, "Subsurface: v%s, ", subsurface_git_version());
		fprintf(data->libdc_logfile, "built with libdivecomputer v%s\n", dc_version(NULL));
	}

	rc = divecomputer_device_open(data);

	if (rc != DC_STATUS_SUCCESS) {
		report_error(errmsg(rc));
	} else {
		rc = dc_device_open(&data->device, data->context, data->descriptor, data->iostream);
	}

	if (rc != DC_STATUS_SUCCESS) {
		return tr("Could not a establish connection to the dive computer.");
	}

	setState(OPEN);

	return NULL;
}
Ejemplo n.º 4
0
static void print_version()
{
	printf("Subsurface v%s, ", subsurface_git_version());
	printf("built with libdivecomputer v%s\n", dc_version(NULL));
}
Ejemplo n.º 5
0
static void print_version()
{
	printf("Subsurface v%s, ", VERSION_STRING);
	printf("built with libdivecomputer v%s\n", dc_version(NULL));
}