Fri, 18 Jul 2014 16:57:27 +0200
New screen layout
/***************************************************************************** * Copyright (C) 2008-2014 * * Michiel Broek <mbroek at mbse dot eu> * * This file is part of the mbsePi-apps * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2, or (at your option) any * later version. * * mbsePi-apps is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with EC-65K; see the file COPYING. If not, write to the Free * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *****************************************************************************/ #include "mash.h" #include "xutil.h" #include "labview-lvm.h" char lvm_name[PATH_MAX] = ""; void create_lvm(char *filename, char *progname, char *data) { FILE *lvm_file; struct timeval now; struct tm ptm; int i; /* NOTE: in het voorbeeld wordt een , als separator gebruikt, hollandse locale ? */ snprintf(lvm_name, PATH_MAX, "/var/local/log/%s/%s", progname, filename); /* Rename excisting ... */ if (access(lvm_name, F_OK)) { /* * 2 options: * Append, so return here. * Rename file and create a new one */ } gettimeofday(&now, NULL); localtime_r(&now.tv_sec, &ptm); if ((lvm_file = fopen(lvm_name, "w"))) { fprintf(lvm_file, "LabVIEW Measurement\r\n"); fprintf(lvm_file, "Separator Tab\r\n"); fprintf(lvm_file, "Decimal_Separator .\r\n"); fprintf(lvm_file, "Writer_Version 2\r\n"); fprintf(lvm_file, "Reader_Version 2\r\n"); fprintf(lvm_file, "Multi_Headings No\r\n"); fprintf(lvm_file, "Date %04d/%02d/%02d\r\n", ptm.tm_year + 1900, ptm.tm_mon + 1, ptm.tm_mday); fprintf(lvm_file, "Time %02d:%02d:%02d.000\r\n", ptm.tm_hour, ptm.tm_min, ptm.tm_sec); fprintf(lvm_file, "X_Columns One\r\n"); fprintf(lvm_file, "Description Tcontrol Logfile\r\n"); fprintf(lvm_file, "Time_Pref Absolute\r\n"); fprintf(lvm_file, "Operator harrie\r\n"); fprintf(lvm_file, "***End_of_Header***\r\n"); fprintf(lvm_file, "\r\n"); fprintf(lvm_file, "Channels 9\r\n"); fprintf(lvm_file, "Samples 1 1 1 1 1 1 1 1 1\r\n"); fprintf(lvm_file, "Date"); for (i = 1; i <= 9; i++) fprintf(lvm_file, " %04d/%02d/%02d", ptm.tm_year + 1900, ptm.tm_mon + 1, ptm.tm_mday); fprintf(lvm_file, "\r\n"); fprintf(lvm_file, "Time"); for (i = 1; i <= 9; i++) fprintf(lvm_file, " %02d:%02d:%02d.000", ptm.tm_hour, ptm.tm_min, ptm.tm_sec); fprintf(lvm_file, "\r\n"); fprintf(lvm_file, "X_Dimension Time Time Time Time Time Time Time Time Time\r\n"); fprintf(lvm_file, "X0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0 0.0000000000000000E+0\r\n"); fprintf(lvm_file, "Delta_X 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000 1.000000\r\n"); fprintf(lvm_file, "***End_of_Header***\r\n"); fprintf(lvm_file, "X_Value Untitled Untitled 1 Untitled 2 Untitled 3 Untitled 4 Untitled 5 Untitled 6 Untitled 7 Untitled 8 Comment\r\n"); } }