/lab/sipmscan/fieldpoint_standalone/.rootrc |
---|
0,0 → 1,10 |
#Rint.Logon: /afs/p-ng.si/home/gkukec/private/Gasper/Programi/rootlogon.C |
Gui.DefaultFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.MenuFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.MenuHiFont: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.DocFixedFont: -*-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.DocPropFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.IconFont: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 |
Gui.StatusFont: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 |
Root.MemStat: 1 |
Root.ObjectStat: 1 |
/lab/sipmscan/fieldpoint_standalone/Makefile |
---|
0,0 → 1,57 |
# Makefile tutorial: https://www.gnu.org/software/make/manual/html_node/index.html#SEC_Contents |
# Make variables ---------------------------------------------------- |
# ROOT include and libraries |
ROOTINC=$(shell root-config --incdir) |
ROOTLIB=$(shell root-config --libs) |
GRROOTLIB=$(shell root-config --cflags --glibs) |
# Source and debug directories |
SRC=./src |
DBG=./dbg |
IDIR=./include |
BIN=./bin |
DICT=./dict |
LDIR=./lib |
# Includes and libraries |
INC=-I. -I$(ROOTINC) |
LIBS=$(ROOTLIB) -L. -lm |
# Specific variables for the main program |
TARGET=root_app |
FILES=$(SRC)/root_app.C |
HEADER=$(IDIR)/root_app.h $(IDIR)/root_include.h |
# ------------------------------------------------------------------- |
# Base rules -------------------------------------------------------- |
# Make the main program and libraries |
#all: libtest.so $(TARGET) |
all: $(TARGET) |
# Rules for making the main program |
$(TARGET): $(FILES) |
@echo "\n# Generating dictionary GuiDict.C ---------------------------" |
rootcint -f $(DICT)/GuiDict.C -c -p $(INC) $(CPPFLAGS) $(IDIR)/root_app.h $(DICT)/GuiLinkDef.h |
@echo "\n# Checking to see if bin directory already exists -----------" |
if [ ! -d "$(BIN)" ];then mkdir $(BIN); fi |
@echo "\n# Compiling main program ------------------------------------" |
$(CXX) $(INC) -fPIC -g -Wall $(FILES) $(DICT)/GuiDict.C $(CPPFLAGS) -o ./bin/$(TARGET) $(GRROOTLIB) -lstdc++ |
cp -f ./input/start.sh ./ |
@echo "\n# Compilation successful ------------------------------------" |
@echo "# Use ./start.sh to run the program -------------------------" |
# ------------------------------------------------------------------- |
# Cleaning rules ---------------------------------------------------- |
# Rules for cleaning the installation |
clean: |
@echo "# Cleaning the installation directory -------------------------" |
rm -fr $(DICT)/*Dict.C $(DICT)/*Dict.h ./bin ./lib start.sh $(SRC)/$(TARGET)_C.d $(SRC)/$(TARGET)_C.so *.o |
# ------------------------------------------------------------------- |
/lab/sipmscan/fieldpoint_standalone/dict/GuiLinkDef.h |
---|
0,0 → 1,18 |
#ifdef __CINT__ |
#pragma link off all globals; |
#pragma link off all classes; |
#pragma link off all functions; |
//#pragma link C++ class TGMdiSubwindow+; |
#pragma link C++ class TGAppMainFrame+; |
//#pragma link C++ function MyEventHandler; |
//#pragma link C++ function GetDebug; |
//#pragma link C++ function MyRedraw; |
//#pragma link C++ function MyTimer; |
//#pragma link C++ class daq; |
#endif |
/lab/sipmscan/fieldpoint_standalone/doc/README |
---|
0,0 → 1,34 |
----------------------- |
1. Program description: |
This is a program for monitoring the fieldpoint temperature sensor (National Instruments FP RTD-122) in the F9 photon detectors laboratory. As an output, it produces a formatted text output and an optional ROOT plot. Note that this program will only work on computers connected to the IJS network (IP = 178.172.43.*). |
----------------------------- |
2. Installation instructions: |
Make sure environmental variables for ROOT are set and that there is an installation of ROOT with MySQL support on the running computer (./configure --enable-mysql). |
Installation is done by using |
> make |
Run the program with |
> ./start.sh |
Clean the installation by using |
> make clean |
--------------- |
3. Program use: |
Program use is straight-forward: |
- Fieldpoint channel selects the channel we wish to get temperature from. |
- Start and end time determine the data range to be retrieved from the MySQL database. |
- Draw to last time point selects the data range between start time and the most current point in the database. |
- Output data settings determine what kind of format should be used for timestamps in the text output (local time, UNIX timestamp). |
- Update button updates the plot, Export button exports the plot (saved in folder ./fieldpoint) and Close button closes the application. |
- At any change in start or end times and updating the plot, the text output (saved in folder ./fieldpoint) is also updated. |
------------------------------- |
4. Time difference - Important! |
Data saved in the MySQL database have a time shift to the current local time. To fix this time shift use the ./time_offset script (password needed to connect to f9lab04), followed by the installation instructions above (make). The timing of old datapoints can still be wrong! |
/lab/sipmscan/fieldpoint_standalone/doc/configuration.txt |
---|
0,0 → 1,61 |
$BASE/.rootrc: |
This file is for setting ROOT environment. See the following to properly use it: |
https://root.cern.ch/root/html/TAttText.html |
ftp://root.cern.ch/root/doc/ROOTUsersGuideHTML/ch02s07.html |
https://root.cern.ch/root/roottalk/roottalk01/2867.html |
Here is an example of a .rootrc file: |
Gui.DefaultFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.MenuFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.MenuHiFont: -*-helvetica-bold-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.DocFixedFont: -*-courier-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.DocPropFont: -*-helvetica-medium-r-normal-*-14-*-*-*-*-*-iso8859-1 |
Gui.IconFont: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 |
Gui.StatusFont: -*-helvetica-medium-r-normal-*-12-*-*-*-*-*-iso8859-1 |
Root.MemStat: 1 |
Root.ObjectStat: 1 |
If needed we can also add additional instructions in a C file and run it on each ROOT login: |
Rint.Logon: /path/to/rootlogon.C |
/--------------------------- |
/--- rootlogon.C ----------- |
/--------------------------- |
{ |
TStyle *mystyle = new TStyle("mystyle", "My own ROOT style"); |
mystyle->SetCanvasBorderMode(0); |
mystyle->SetFrameBorderMode(0); |
mystyle->SetPalette(1,0); |
mystyle->SetOptTitle(0); |
mystyle->SetCanvasColor(0); |
mystyle->SetStatFontSize(0.024); |
mystyle->SetStatBorderSize(1); |
mystyle->SetStatColor(kGray); |
mystyle->SetStatX(0.925); |
mystyle->SetStatY(0.925); |
mystyle->SetStatW(0.13); |
mystyle->SetTextFont(132); |
mystyle->SetTextSize(0.08); |
mystyle->SetLabelSize(0.03,"xyz"); |
mystyle->SetLabelOffset(0.01,"xyz"); |
mystyle->SetPadTickX(1); |
mystyle->SetPadTickY(1); |
mystyle->SetCanvasDefX(100); |
mystyle->SetCanvasDefY(50); |
mystyle->SetCanvasDefW(900); |
mystyle->SetCanvasDefH(600); |
mystyle->SetPadBottomMargin(0.1); |
mystyle->SetPadTopMargin(0.04); |
mystyle->SetPadLeftMargin(0.125); |
mystyle->SetPadRightMargin(0.04); |
gROOT->SetStyle("mystyle"); |
cout << "Setting custom style from /path/to/.rootlogon.C" << endl; |
return; |
} |
/lab/sipmscan/fieldpoint_standalone/include/root_app.h |
---|
0,0 → 1,45 |
#ifndef __ROOT_APP_H__ |
#define __ROOT_APP_H__ |
#define winWidth 900 |
#define winHeight 600 |
#define WINDOW_NAME "Fieldpoint FP RTD 122 temperature sensor" |
#include "root_include.h" |
class TGAppMainFrame |
{ |
RQ_OBJECT("TGAppMainFrame") |
protected: |
TGMainFrame *fMain; |
void AppLayout(); |
public: |
TGAppMainFrame(const TGWindow *p, int w, int h); |
virtual ~TGAppMainFrame(); |
void CloseWindow(); |
TRootEmbeddedCanvas *displayCanvas; |
TGComboBox *tempCh; |
TGComboBox *tempDay[2]; |
TGComboBox *tempMonth[2]; |
TGComboBox *tempYear[2]; |
TGComboBox *tempHour[2]; |
TGComboBox *tempMinute[2]; |
TGComboBox *tempSecond[2]; |
TGCheckButton *tempEndOn; |
TGComboBox *datSettings; |
TGTextButton *updateTemp; |
TGTextButton *exportTemp; |
TGTextButton *closeTemp; |
void fieldpoint(int *timerange, int selch); |
void UpdateTempPlot(); |
void TempEndToggle(); |
void ExportTempPlot(); |
}; |
#endif |
/lab/sipmscan/fieldpoint_standalone/include/root_include.h |
---|
0,0 → 1,231 |
#ifndef _root_include_h_ |
#define _root_include_h_ |
// ROOT base includes |
#ifndef ROOT_TRootBrowser |
#include "TRootBrowser.h" |
#endif |
#ifndef ROOT_IOstream |
#include "Riostream.h" |
#endif |
#ifndef ROOT_TSystem |
#include "TSystem.h" |
#endif |
#ifndef ROOT_TApplication |
#include "TApplication.h" |
#endif |
#ifndef ROOT_TROOT |
#include "TROOT.h" |
#endif |
#ifndef ROOT_TQObject |
#include "TQObject.h" |
#endif |
#ifndef ROOT_RQ_Object |
#include "RQ_OBJECT.h" |
#endif |
#ifndef ROOT_TGClient |
#include "TGClient.h" |
#endif |
#ifndef ROOT_TGResourcePool |
#include "TGResourcePool.h" |
#endif |
#ifndef ROOT_TEnv |
#include "TEnv.h" |
#endif |
// ROOT GUI frame includes |
#ifndef ROOT_TGFrame |
#include "TGFrame.h" |
#endif |
#ifndef ROOT_TGDockableFrame |
#include "TGDockableFrame.h" |
#endif |
#ifndef ROOT_TGMenu |
#include "TGMenu.h" |
#endif |
#ifndef ROOT_TGMdiDecorFrame |
#include "TGMdiDecorFrame.h" |
#endif |
#ifndef ROOT_TGMdiFrame |
#include "TGMdiFrame.h" |
#endif |
#ifndef ROOT_TGMdiMainFrame |
#include "TGMdiMainFrame.h" |
#endif |
#ifndef ROOT_TGMdiMenu |
#include "TGMdiMenu.h" |
#endif |
#ifndef ROOT_TGMdi |
#include "TGMdi.h" |
#endif |
#ifndef ROOT_TG3DLine |
#include "TG3DLine.h" |
#endif |
#ifndef ROOT_TGStatusBar |
#include "TGStatusBar.h" |
#endif |
// ROOT GUI builder incudes (not needed) |
#ifndef ROOT_TRootGuiBuilder |
#include "TRootGuiBuilder.h" |
#endif |
#ifndef ROOT_TGuiBldHintsButton |
#include "TGuiBldHintsButton.h" |
#endif |
#ifndef ROOT_TGuiBldHintsEditor |
#include "TGuiBldHintsEditor.h" |
#endif |
#ifndef ROOT_TGuiBldEditor |
#include "TGuiBldEditor.h" |
#endif |
#ifndef ROOT_TGuiBldDragManager |
#include "TGuiBldDragManager.h" |
#endif |
// ROOT GUI object includes |
#ifndef ROOT_TGListBox |
#include "TGListBox.h" |
#endif |
#ifndef ROOT_TGNumberEntry |
#include "TGNumberEntry.h" |
#endif |
#ifndef ROOT_TGScrollBar |
#include "TGScrollBar.h" |
#endif |
#ifndef ROOT_TGFileDialog |
#include "TGFileDialog.h" |
#endif |
#ifndef ROOT_TGShutter |
#include "TGShutter.h" |
#endif |
#ifndef ROOT_TGButtonGroup |
#include "TGButtonGroup.h" |
#endif |
#ifndef ROOT_TGCanvas |
#include "TGCanvas.h" |
#endif |
#ifndef ROOT_TGButton |
#include "TGButton.h" |
#endif |
#ifndef ROOT_TGTextEdit |
#include "TGTextEdit.h" |
#endif |
#ifndef ROOT_TGLabel |
#include "TGLabel.h" |
#endif |
#ifndef ROOT_TGView |
#include "TGView.h" |
#endif |
#ifndef ROOT_TGTab |
#include "TGTab.h" |
#endif |
#ifndef ROOT_TGListView |
#include "TGListView.h" |
#endif |
#ifndef ROOT_TGSplitter |
#include "TGSplitter.h" |
#endif |
#ifndef ROOT_TGListTree |
#include "TGListTree.h" |
#endif |
#ifndef ROOT_TGToolTip |
#include "TGToolTip.h" |
#endif |
#ifndef ROOT_TGToolBar |
#include "TGToolBar.h" |
#endif |
#ifndef ROOT_TRootEmbeddedCanvas |
#include "TRootEmbeddedCanvas.h" |
#endif |
#ifndef ROOT_TCanvas |
#include "TCanvas.h" |
#endif |
#ifndef ROOT_TGComboBox |
#include "TGComboBox.h" |
#endif |
#ifndef ROOT_TGProgressBar |
#include "TGProgressBar.h" |
#endif |
#ifndef ROOT_TGTextEntry |
#include "TGTextEntry.h" |
#endif |
#ifndef ROOT_TGMsgBox |
#include "TGMsgBox.h" |
#endif |
#ifndef ROOT_TGSlider |
#include "TGSlider.h" |
#endif |
#ifndef ROOT_TGFSContainer |
#include "TGFSContainer.h" |
#endif |
#ifndef ROOT_TGFSComboBox |
#include "TGFSComboBox.h" |
#endif |
// ROOT File browser includes |
#ifndef ROOT_TSystemDir |
#include "TSystemDirectory.h" |
#endif |
#ifndef ROOT_TTree |
#include "TTree.h" |
#endif |
#ifndef ROOT_TFile |
#include "TFile.h" |
#endif |
// ROOT plotting includes |
#ifndef ROOT_TPaveStats |
#include "TPaveStats.h" |
#endif |
#ifndef ROOT_TGraph2D |
#include "TGraph2D.h" |
#endif |
#ifndef ROOT_TLatex |
#include "TLatex.h" |
#endif |
#ifndef ROOT_TGraphErrors |
#include "TGraphErrors.h" |
#endif |
#ifndef ROOT_TStyle |
#include "TStyle.h" |
#endif |
#ifndef ROOT_TPaletteAxis |
#include "TPaletteAxis.h" |
#endif |
#ifndef ROOT_TGraph |
#include "TGraph.h" |
#endif |
#ifndef ROOT_TH1F |
#include "TH1F.h" |
#endif |
#ifndef ROOT_TH2F |
#include "TH2F.h" |
#endif |
#ifndef ROOT_TF1 |
#include "TF1.h" |
#endif |
#ifndef ROOT_TSpectrum |
#include "TSpectrum.h" |
#endif |
#ifndef ROOT_TVirtualFitter |
#include "TVirtualFitter.h" |
#endif |
#ifndef ROOT_TMath |
#include "TMath.h" |
#endif |
#ifndef ROOT_TRandom |
#include "TRandom.h" |
#endif |
// ROOT MYSQL includes |
#ifndef ROOT_TSQLServer |
#include <TSQLServer.h> |
#endif |
#ifndef ROOT_TSQLResult |
#include <TSQLResult.h> |
#endif |
#ifndef ROOT_TSQLRow |
#include <TSQLRow.h> |
#endif |
#endif |
/lab/sipmscan/fieldpoint_standalone/include/workstation.h |
---|
0,0 → 1,10 |
#ifndef _workstation_h_ |
#define _workstation_h_ |
// Debug signal |
#define DBGSIG 0 |
// Time offset |
#define TIMEOFF +1754 |
#endif |
/lab/sipmscan/fieldpoint_standalone/input/start.sh |
---|
0,0 → 1,3 |
#!/bin/bash |
./bin/root_app |
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |
Index: sipmscan/fieldpoint_standalone/input/workstation.h.in |
=================================================================== |
--- sipmscan/fieldpoint_standalone/input/workstation.h.in (nonexistent) |
+++ sipmscan/fieldpoint_standalone/input/workstation.h.in (revision 136) |
@@ -0,0 +1,10 @@ |
+#ifndef _workstation_h_ |
+#define _workstation_h_ |
+ |
+// Debug signal |
+#define DBGSIG 0 |
+ |
+// Time offset |
+#define TIMEOFF 0 |
+ |
+#endif |
Index: sipmscan/fieldpoint_standalone/src/offset.cc |
=================================================================== |
--- sipmscan/fieldpoint_standalone/src/offset.cc (nonexistent) |
+++ sipmscan/fieldpoint_standalone/src/offset.cc (revision 136) |
@@ -0,0 +1,32 @@ |
+#include <stdio.h> |
+#include <stdlib.h> |
+#include <unistd.h> |
+ |
+int main() |
+{ |
+ FILE *fp, *fpout; |
+ |
+ fp = fopen("../dbg/time_offset.txt","r"); |
+ fpout = fopen("../dbg/time_offset_out.txt","w"); |
+ |
+ int hosttime, hometime, difftime; |
+ fscanf(fp, "%d\n%d", &hosttime, &hometime); |
+ |
+ if(hosttime >= hometime) |
+ { |
+ difftime = hosttime - hometime; |
+// printf("Host = %d\nHome = %d\nDifference = +%d\n", hosttime, hometime, difftime); |
+ fprintf(fpout, "+%d", difftime); |
+ } |
+ else |
+ { |
+ difftime = hometime - hosttime; |
+// printf("Host = %d\nHome = %d\nDifference = -%d\n", hosttime, hometime, difftime); |
+ fprintf(fpout, "-%d", difftime); |
+ } |
+ |
+ fclose(fpout); |
+ fclose(fp); |
+ |
+ return 0; |
+} |
Index: sipmscan/fieldpoint_standalone/src/root_app.C |
=================================================================== |
--- sipmscan/fieldpoint_standalone/src/root_app.C (nonexistent) |
+++ sipmscan/fieldpoint_standalone/src/root_app.C (revision 136) |
@@ -0,0 +1,809 @@ |
+#include "../include/root_app.h" |
+#include "../include/workstation.h" |
+ |
+#include <stdio.h> |
+#include <stdlib.h> |
+#include <unistd.h> |
+ |
+// Main window constructor (+layout) --------------------------------- |
+ |
+TGAppMainFrame::TGAppMainFrame(const TGWindow *p, int w, int h) |
+{ |
+ // Define main window and menubar |
+ fMain = new TGMainFrame(p, w, h, kVerticalFrame); |
+ |
+ AppLayout(); |
+ fMain->SetWindowName(WINDOW_NAME); |
+ fMain->MapSubwindows(); |
+ fMain->MapWindow(); |
+ fMain->Layout(); |
+} |
+ |
+TGAppMainFrame::~TGAppMainFrame() |
+{ |
+ fMain->Cleanup(); |
+ delete fMain; |
+} |
+ |
+// Closing main window and checking about information ---------------- |
+ |
+void TGAppMainFrame::CloseWindow() |
+{ |
+ fMain->Cleanup(); |
+ delete fMain; |
+ gApplication->Terminate(0); |
+} |
+ |
+// ------------------------------------------------------------------- |
+ |
+// ------------------------------------------------------------------- |
+ |
+// Separate functions ----------------------------------------- |
+void GetTime(int intime, char *outtime) |
+{ |
+ time_t rawtime; |
+ struct tm * timeinfo; |
+ if(intime < 0) |
+ time(&rawtime); |
+ else |
+ rawtime = (time_t)intime; |
+ timeinfo = localtime(&rawtime); |
+ sprintf(outtime, "%s", asctime(timeinfo)); |
+ int len = strlen(outtime); |
+ if(len) outtime[len-1] = 0; |
+} |
+ |
+// ---------------------------------------------------------- |
+ |
+// Temperature sensor functions ----------------------------- |
+const char* dbname = "mysql://f9lab08.ijs.si/f9phdet"; |
+const char* tblname = "fprtd122"; |
+const char* username = "f9daq"; |
+const char* userpass = "f9lab"; |
+ |
+// Get the temperature from MYSQL database |
+double GetTemperature(int ch, const char *s) |
+{ |
+ int bin=5+7*4-ch*4; |
+ char hex[16]; |
+ strncpy(hex, (const char *) &s[bin], 4); |
+ hex[4]=0; |
+ int ix; |
+ sscanf (hex,"%x",&ix); |
+ //printf("0x%s\t",hex); |
+ return (ix/65535.)*1050.-200.; |
+} |
+ |
+// Transform local time to timestamp |
+int GetTimeStamp(int *intime) |
+{ |
+ time_t rawtime; |
+ struct tm * timeinfo; |
+ time(&rawtime); |
+ timeinfo = localtime(&rawtime); |
+ |
+ if(DBGSIG) |
+ printf("%d.%d.%d, %d:%d:%d\n", intime[0], intime[1], intime[2], intime[3], intime[4], intime[5]); |
+ |
+ timeinfo->tm_mday = intime[0]; |
+ timeinfo->tm_mon = intime[1] - 1; |
+ timeinfo->tm_year = intime[2] - 1900; |
+ timeinfo->tm_hour = intime[3]; |
+ timeinfo->tm_min = intime[4]; |
+ timeinfo->tm_sec = intime[5]; |
+ |
+ return (int)mktime(timeinfo); |
+} |
+ |
+// Get data from MYSQL database |
+void TGAppMainFrame::fieldpoint(int *timerange, int selch) |
+{ |
+ char humantime[256]; |
+ |
+ // Display selected timestamps |
+ GetTime(timerange[0], humantime); |
+ printf("Minimum time set to: %s (%d)\n", humantime, timerange[0]); |
+ if(timerange[1] != -1) |
+ { |
+ GetTime(timerange[1], humantime); |
+ printf("Maximum time set to: %s (%d)\n", humantime, timerange[1]); |
+ } |
+ printf("Selected fieldpoint channel: %d\n", selch); |
+ printf("\n"); |
+ |
+ // Database settings |
+ TSQLServer *db = TSQLServer::Connect(dbname, username, userpass); |
+ printf("Server info: %s\n", db->ServerInfo()); |
+ TSQLRow *row; |
+ TSQLResult *res; |
+ |
+ if(DBGSIG) |
+ { |
+ // list databases available on server |
+ printf("\nList all databases on server %s\n", db->GetHost()); |
+ res = db->GetDataBases(); |
+ while ((row = res->Next())) { |
+ printf("%s\n", row->GetField(0)); |
+ delete row; |
+ } |
+ delete res; |
+ |
+ // list tables in database "test" (the permission tables) |
+ printf("\nList all tables in database \"f9phdet\" on server %s\n", db->GetHost()); |
+ res = db->GetTables("f9phdet"); |
+ while ((row = res->Next())) { |
+ printf("%s\n", row->GetField(0)); |
+ delete row; |
+ } |
+ delete res; |
+ |
+ // list columns in table "runcatalog" in database "mysql" |
+ printf("\nList all columns in table \"f9phdet\" in database \"f9rtd122\" on server %s\n", db->GetHost()); |
+ res = db->GetColumns("f9phdet", "fprtd122"); |
+ while ((row = res->Next())) { |
+ printf("%s\n", row->GetField(0)); |
+ delete row; |
+ } |
+ delete res; |
+ } |
+ |
+ // query database and print results |
+ char sql[1000] = "SELECT status,data,timestamp FROM fprtd122 WHERE status='A272727272727272748' AND substring(data,1,4)='A00C' "; |
+ if(timerange[1] == -1) |
+ sprintf(sql,"%s AND timestamp>='%d'", sql, timerange[0]); |
+ else |
+ sprintf(sql,"%s AND timestamp>='%d' AND timestamp<='%d'", sql, timerange[0], timerange[1]); |
+ if(DBGSIG) |
+ printf("%s\n",sql); |
+ |
+ res = db->Query(sql); |
+ |
+ int nrows = res->GetRowCount(); |
+ printf("\nGot %d rows in result\n", nrows); |
+ |
+ // Printing and plotting |
+ char timeval[256]; |
+ TGraph *gr; |
+ double *x, *y; |
+ double firsttime, lasttime; |
+ |
+ gr = new TGraph(nrows); |
+ gr->SetLineColor(kRed); |
+ gr->SetLineWidth(1); |
+ gr->SetMarkerColor(kBlack); |
+ gr->SetMarkerSize(0.8); |
+ gr->SetMarkerStyle(20); |
+ gr->SetTitle("Temperature sensor;Time;Temperature (deg.)"); |
+ |
+ FILE *fp; |
+ fp = fopen("./fieldpoint/dataout_fieldpoint.txt", "w"); |
+ |
+ if(DBGSIG) |
+ printf("Time\tTemperature\n"); |
+ for (int i = 0; i < nrows; i++) { |
+ row = res->Next(); |
+ |
+ GetTime((int)atof(row->GetField(2))-TIMEOFF, timeval); |
+ x = new double; |
+ y = new double; |
+ |
+ *x = atof(row->GetField(2))-TIMEOFF; |
+ *y = GetTemperature(selch,row->GetField(1)); |
+ gr->SetPoint(i,*x,*y); |
+ |
+ if(i == 0) firsttime = *x; |
+ else if(i == nrows-1) lasttime = *x; |
+ |
+ if(datSettings->GetSelected() == 0) |
+ { |
+ fprintf(fp, "%s\t%d\t%f\n",timeval,(int)*x,*y); |
+ if(DBGSIG) |
+ printf("%s\t%d\t%f\n",timeval,(int)*x,*y); |
+ } |
+ else if(datSettings->GetSelected() == 1) |
+ { |
+ fprintf(fp, "%s\t%f\n",timeval,*y); |
+ if(DBGSIG) |
+ printf("%s\t%f\n",timeval,*y); |
+ } |
+ else if(datSettings->GetSelected() == 2) |
+ { |
+ fprintf(fp, "%d\t%f\n",(int)*x,*y); |
+ if(DBGSIG) |
+ printf("%d\t%f\n",(int)*x,*y); |
+ } |
+ |
+ delete x; |
+ delete y; |
+ |
+ delete row; |
+ } |
+ |
+ fclose(fp); |
+ |
+ delete res; |
+ delete db; |
+ |
+ TCanvas *gCanvas = displayCanvas->GetCanvas(); |
+ gCanvas->SetGrid(); |
+ gr->GetXaxis()->SetTimeDisplay(1); |
+ gr->GetXaxis()->SetTimeFormat("%H:%M, %d.%m."); |
+ gr->GetXaxis()->SetTimeOffset(0); |
+ gr->GetXaxis()->SetLabelSize(0.027); |
+ gr->GetXaxis()->SetLabelOffset(0.015); |
+ gr->GetXaxis()->SetTitleSize(0.038); |
+ gr->GetXaxis()->SetTitleOffset(1.2); |
+ gr->GetYaxis()->SetLabelSize(0.027); |
+ gr->GetYaxis()->SetTitleSize(0.038); |
+ gr->GetXaxis()->SetNdivisions(-507); |
+ gr->GetXaxis()->SetRange(firsttime,lasttime); |
+ gr->GetXaxis()->SetRangeUser(firsttime,lasttime); |
+ gr->Draw("APL"); |
+ |
+ gCanvas->Modified(); |
+ gCanvas->Update(); |
+} |
+ |
+// Update the temperature plot |
+void TGAppMainFrame::UpdateTempPlot() |
+{ |
+ int stime[6]; |
+ int etime[6]; |
+ |
+ int timestamp[2]; |
+ |
+ time_t rtime; |
+ int curyear; |
+ time(&rtime); |
+ curyear = (int)(localtime(&rtime))->tm_year+1900; |
+ |
+ int leapy = 0; |
+ |
+ // Getting the start time |
+ stime[0] = (int)(tempDay[0]->GetSelected())+1; |
+ stime[2] = curyear - (int)(tempYear[0]->GetSelected()); |
+ if(DBGSIG) |
+ printf("%d, %d, %d\n", stime[2], curyear, (int)(tempYear[0]->GetSelected())); |
+ stime[3] = (int)(tempHour[0]->GetSelected()); |
+ stime[4] = (int)(tempMinute[0]->GetSelected()); |
+ stime[5] = (int)(tempSecond[0]->GetSelected()); |
+ |
+ switch( tempMonth[0]->GetSelected() ) |
+ { |
+ case 0: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 1: |
+ if( stime[2]%4 == 0) |
+ leapy = 1; |
+ |
+ if( (leapy == 1) && (stime[0] > 29) ) |
+ { |
+ stime[0] = 29; |
+ tempDay[0]->Select(28); |
+ } |
+ else if( (leapy == 0) && (stime[0] > 28) ) |
+ { |
+ stime[0] = 28; |
+ tempDay[0]->Select(27); |
+ } |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 2: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 3: |
+ if(stime[0] > 30) |
+ { |
+ stime[0] = 30; |
+ tempDay[0]->Select(29); |
+ } |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 4: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 5: |
+ if(stime[0] > 30) |
+ { |
+ stime[0] = 30; |
+ tempDay[0]->Select(29); |
+ } |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 6: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 7: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 8: |
+ if(stime[0] > 30) |
+ { |
+ stime[0] = 30; |
+ tempDay[0]->Select(29); |
+ } |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 9: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 10: |
+ if(stime[0] > 30) |
+ { |
+ stime[0] = 30; |
+ tempDay[0]->Select(29); |
+ } |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ case 11: |
+ stime[1] = (int)(tempMonth[0]->GetSelected())+1; |
+ break; |
+ default: |
+ break; |
+ } |
+ |
+ timestamp[0] = GetTimeStamp(stime); |
+ if(DBGSIG) |
+ printf("Start time: %d\n", timestamp[0]); |
+ |
+ // Getting the end time |
+ etime[0] = (int)(tempDay[1]->GetSelected())+1; |
+ etime[2] = curyear - (int)(tempYear[1]->GetSelected()); |
+ etime[3] = (int)(tempHour[1]->GetSelected()); |
+ etime[4] = (int)(tempMinute[1]->GetSelected()); |
+ etime[5] = (int)(tempSecond[1]->GetSelected()); |
+ |
+ switch( tempMonth[1]->GetSelected() ) |
+ { |
+ case 0: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 1: |
+ if( etime[2]%4 == 0) |
+ leapy = 1; |
+ |
+ if( (leapy == 1) && (etime[0] > 29) ) |
+ { |
+ etime[0] = 29; |
+ tempDay[1]->Select(28); |
+ } |
+ else if( (leapy == 0) && (etime[0] > 28) ) |
+ { |
+ etime[0] = 28; |
+ tempDay[1]->Select(27); |
+ } |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 2: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 3: |
+ if(etime[0] > 30) |
+ { |
+ etime[0] = 30; |
+ tempDay[1]->Select(29); |
+ } |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 4: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 5: |
+ if(etime[0] > 30) |
+ { |
+ etime[0] = 30; |
+ tempDay[1]->Select(29); |
+ } |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 6: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 7: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 8: |
+ if(etime[0] > 30) |
+ { |
+ etime[0] = 30; |
+ tempDay[1]->Select(29); |
+ } |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 9: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 10: |
+ if(etime[0] > 30) |
+ { |
+ etime[0] = 30; |
+ tempDay[1]->Select(29); |
+ } |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ case 11: |
+ etime[1] = (int)(tempMonth[1]->GetSelected())+1; |
+ break; |
+ default: |
+ break; |
+ } |
+ |
+ if( tempEndOn->IsDown() ) |
+ timestamp[1] = -1; |
+ else |
+ timestamp[1] = GetTimeStamp(etime); |
+ if(DBGSIG) |
+ printf("End time: %d\n", timestamp[1]); |
+ |
+ fieldpoint(timestamp, tempCh->GetSelected()); |
+} |
+ |
+// Export the temperature plot to pdf |
+void TGAppMainFrame::ExportTempPlot() |
+{ |
+ TCanvas *gCanvas = displayCanvas->GetCanvas(); |
+ gCanvas->Modified(); |
+ gCanvas->Update(); |
+ gCanvas->SaveAs("./fieldpoint/plotout_fieldpoint.pdf"); |
+} |
+ |
+// Toggle the endtime settings for temperature sensor |
+void TGAppMainFrame::TempEndToggle() |
+{ |
+ if( tempEndOn->IsDown() ) |
+ { |
+ tempDay[1]->SetEnabled(kFALSE); |
+ tempMonth[1]->SetEnabled(kFALSE); |
+ tempYear[1]->SetEnabled(kFALSE); |
+ tempHour[1]->SetEnabled(kFALSE); |
+ tempMinute[1]->SetEnabled(kFALSE); |
+ tempSecond[1]->SetEnabled(kFALSE); |
+ } |
+ else |
+ { |
+ tempDay[1]->SetEnabled(kTRUE); |
+ tempMonth[1]->SetEnabled(kTRUE); |
+ tempYear[1]->SetEnabled(kTRUE); |
+ tempHour[1]->SetEnabled(kTRUE); |
+ tempMinute[1]->SetEnabled(kTRUE); |
+ tempSecond[1]->SetEnabled(kTRUE); |
+ } |
+} |
+ |
+// -------------------------------------------------------------- |
+ |
+// Setting the application layout ------------------------------------ |
+ |
+void TGAppMainFrame::AppLayout() |
+{ |
+// Fieldpoint window ------------------------ |
+ |
+ TGLayoutHints *f0 = new TGLayoutHints(kLHintsLeft | kLHintsTop,2,2,2,2); |
+ TGLayoutHints *f0centerx = new TGLayoutHints(kLHintsCenterX,2,2,2,2); |
+ TGLayoutHints *f0centery = new TGLayoutHints(kLHintsLeft | kLHintsCenterY,2,2,2,2); |
+ TGLayoutHints *f1 = new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,2,2,2,2); |
+ TGLayoutHints *f2 = new TGLayoutHints(kLHintsExpandX,2,2,2,2); |
+ |
+ TGHorizontalFrame *fH1, *fH2; |
+ TGGroupFrame *fG1; |
+ TGLabel *lab; |
+ |
+ time_t rtime; |
+ int yearrange[2]; |
+ int subwin[2]; |
+ char ctemp[256]; |
+ |
+ subwin[0] = winWidth-10; |
+ subwin[1] = 6.6*winHeight/12; |
+ |
+ // Display canvas for temperature sensor |
+ displayCanvas = new TRootEmbeddedCanvas("displayCanvas",fMain,subwin[0],subwin[1]); |
+ fMain->AddFrame(displayCanvas, f0centerx); |
+ TCanvas *gCanvas = displayCanvas->GetCanvas(); |
+ gCanvas->SetGridx(); |
+ gCanvas->SetGridy(); |
+ |
+ fG1 = new TGGroupFrame(fMain, "Temperature sensor settings"); |
+ // Channel selector |
+ fH1 = new TGHorizontalFrame(fG1, subwin[0], 30); |
+ lab = new TGLabel(fH1, "Fieldpoint channel:"); |
+ fH1->AddFrame(lab, f0centery); |
+ tempCh = new TGComboBox(fH1, 200); |
+ tempCh->AddEntry("0", 0); |
+ tempCh->AddEntry("1", 1); |
+ tempCh->AddEntry("2", 2); |
+ tempCh->AddEntry("3", 3); |
+ tempCh->AddEntry("4", 4); |
+ tempCh->AddEntry("5", 5); |
+ tempCh->AddEntry("6", 6); |
+ tempCh->AddEntry("7", 7); |
+ tempCh->Resize(50,22); |
+ tempCh->Select(1); |
+ fH1->AddFrame(tempCh, f0centery); |
+ fG1->AddFrame(fH1, f2); |
+ |
+ // Start and stop time ------------------------ |
+ time(&rtime); |
+ |
+ lab = new TGLabel(fG1, "Start time:"); |
+ fG1->AddFrame(lab, f0); |
+ fH1 = new TGHorizontalFrame(fG1, subwin[0], 30); |
+ // Start day |
+ lab = new TGLabel(fH1, "\tDay: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempDay[0] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 31; i++) |
+ { |
+ sprintf(ctemp, "%d", i+1); |
+ tempDay[0]->AddEntry(ctemp, i); |
+ } |
+ tempDay[0]->Resize(50,22); |
+ tempDay[0]->Select((int)(localtime(&rtime))->tm_mday-1); |
+ fH1->AddFrame(tempDay[0], f0centery); |
+ |
+ // Start month |
+ lab = new TGLabel(fH1, " Month: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempMonth[0] = new TGComboBox(fH1, 200); |
+ tempMonth[0]->AddEntry("January", 0); |
+ tempMonth[0]->AddEntry("February", 1); |
+ tempMonth[0]->AddEntry("March", 2); |
+ tempMonth[0]->AddEntry("April", 3); |
+ tempMonth[0]->AddEntry("May", 4); |
+ tempMonth[0]->AddEntry("June", 5); |
+ tempMonth[0]->AddEntry("July", 6); |
+ tempMonth[0]->AddEntry("August", 7); |
+ tempMonth[0]->AddEntry("September", 8); |
+ tempMonth[0]->AddEntry("October", 9); |
+ tempMonth[0]->AddEntry("November", 10); |
+ tempMonth[0]->AddEntry("December", 11); |
+ tempMonth[0]->Resize(80,22); |
+ tempMonth[0]->Select((int)(localtime(&rtime))->tm_mon); |
+ fH1->AddFrame(tempMonth[0], f0centery); |
+ |
+ // Start year |
+ yearrange[0] = 2010; |
+ yearrange[1] = (int)(localtime(&rtime))->tm_year+1900; |
+ |
+ lab = new TGLabel(fH1, " Year: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempYear[0] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < (yearrange[1]-yearrange[0])+1; i++) |
+ { |
+ sprintf(ctemp, "%d", yearrange[1]-i); |
+ tempYear[0]->AddEntry(ctemp, i); |
+ } |
+ tempYear[0]->Resize(60,22); |
+ tempYear[0]->Select(0); |
+ fH1->AddFrame(tempYear[0], f0centery); |
+ |
+ // Start hour |
+ lab = new TGLabel(fH1, " Hour: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempHour[0] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 24; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempHour[0]->AddEntry(ctemp, i); |
+ } |
+ tempHour[0]->Resize(50,22); |
+ tempHour[0]->Select(7); |
+ fH1->AddFrame(tempHour[0], f0centery); |
+ |
+ // Start minute |
+ lab = new TGLabel(fH1, " Minute: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempMinute[0] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 60; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempMinute[0]->AddEntry(ctemp, i); |
+ } |
+ tempMinute[0]->Resize(50,22); |
+ tempMinute[0]->Select(0); |
+ fH1->AddFrame(tempMinute[0], f0centery); |
+ |
+ // Start second |
+ lab = new TGLabel(fH1, " Second: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempSecond[0] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 60; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempSecond[0]->AddEntry(ctemp, i); |
+ } |
+ tempSecond[0]->Resize(50,22); |
+ tempSecond[0]->Select(0); |
+ fH1->AddFrame(tempSecond[0], f0centery); |
+ |
+ fG1->AddFrame(fH1, f2); |
+ |
+ // Use the end time or not |
+ tempEndOn = new TGCheckButton(fG1, "Draw to last time point (ON/OFF)"); |
+ tempEndOn->Resize(100,22); |
+ tempEndOn->SetState(kButtonUp); |
+ fG1->AddFrame(tempEndOn, f0); |
+ |
+ lab = new TGLabel(fG1, "End time:"); |
+ fG1->AddFrame(lab, f0); |
+ fH1 = new TGHorizontalFrame(fG1, subwin[0], 30); |
+ // End day |
+ lab = new TGLabel(fH1, "\tDay: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempDay[1] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 31; i++) |
+ { |
+ sprintf(ctemp, "%d", i+1); |
+ tempDay[1]->AddEntry(ctemp, i); |
+ } |
+ tempDay[1]->Resize(50,22); |
+ tempDay[1]->Select((int)(localtime(&rtime))->tm_mday-1); |
+ fH1->AddFrame(tempDay[1], f0centery); |
+ |
+ // End month |
+ lab = new TGLabel(fH1, " Month: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempMonth[1] = new TGComboBox(fH1, 200); |
+ tempMonth[1]->AddEntry("January", 0); |
+ tempMonth[1]->AddEntry("February", 1); |
+ tempMonth[1]->AddEntry("March", 2); |
+ tempMonth[1]->AddEntry("April", 3); |
+ tempMonth[1]->AddEntry("May", 4); |
+ tempMonth[1]->AddEntry("June", 5); |
+ tempMonth[1]->AddEntry("July", 6); |
+ tempMonth[1]->AddEntry("August", 7); |
+ tempMonth[1]->AddEntry("September", 8); |
+ tempMonth[1]->AddEntry("October", 9); |
+ tempMonth[1]->AddEntry("November", 10); |
+ tempMonth[1]->AddEntry("December", 11); |
+ tempMonth[1]->Resize(80,22); |
+ tempMonth[1]->Select((int)(localtime(&rtime))->tm_mon); |
+ fH1->AddFrame(tempMonth[1], f0centery); |
+ |
+ // End year |
+ time(&rtime); |
+ yearrange[0] = 2010; |
+ yearrange[1] = (int)(localtime(&rtime))->tm_year+1900; |
+ |
+ lab = new TGLabel(fH1, " Year: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempYear[1] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < (yearrange[1]-yearrange[0])+1; i++) |
+ { |
+ sprintf(ctemp, "%d", yearrange[1]-i); |
+ tempYear[1]->AddEntry(ctemp, i); |
+ } |
+ tempYear[1]->Resize(60,22); |
+ tempYear[1]->Select(0); |
+ fH1->AddFrame(tempYear[1], f0centery); |
+ |
+ // End hour |
+ lab = new TGLabel(fH1, " Hour: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempHour[1] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 24; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempHour[1]->AddEntry(ctemp, i); |
+ } |
+ tempHour[1]->Resize(50,22); |
+ tempHour[1]->Select(18); |
+ fH1->AddFrame(tempHour[1], f0centery); |
+ |
+ // End minute |
+ lab = new TGLabel(fH1, " Minute: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempMinute[1] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 60; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempMinute[1]->AddEntry(ctemp, i); |
+ } |
+ tempMinute[1]->Resize(50,22); |
+ tempMinute[1]->Select(0); |
+ fH1->AddFrame(tempMinute[1], f0centery); |
+ |
+ // End second |
+ lab = new TGLabel(fH1, " Second: "); |
+ fH1->AddFrame(lab, f0centery); |
+ tempSecond[1] = new TGComboBox(fH1, 200); |
+ for(int i = 0; i < 60; i++) |
+ { |
+ if(i < 10) |
+ sprintf(ctemp, "0%d", i); |
+ else |
+ sprintf(ctemp, "%d", i); |
+ tempSecond[1]->AddEntry(ctemp, i); |
+ } |
+ tempSecond[1]->Resize(50,22); |
+ tempSecond[1]->Select(0); |
+ fH1->AddFrame(tempSecond[1], f0centery); |
+ |
+ fG1->AddFrame(fH1, f2); |
+ // Start and stop time ------------------------ |
+ |
+ // Dataout settings |
+ fH1 = new TGHorizontalFrame(fG1, subwin[0], 30); |
+ lab = new TGLabel(fH1, "Output data settings: "); |
+ fH1->AddFrame(lab, f0centery); |
+ datSettings = new TGComboBox(fH1, 200); |
+ datSettings->AddEntry("Export local time and UNIX timestamp", 0); |
+ datSettings->AddEntry("Export only local time", 1); |
+ datSettings->AddEntry("Export only UNIX timestamp", 2); |
+ datSettings->Resize(300,22); |
+ datSettings->Select(0); |
+ fH1->AddFrame(datSettings, f0centery); |
+ |
+ fG1->AddFrame(fH1, f2); |
+ |
+ // Control buttons |
+ fH2 = new TGHorizontalFrame(fG1, subwin[0], 30); |
+ fH1 = new TGHorizontalFrame(fH2, subwin[0], 30); |
+ updateTemp = new TGTextButton(fH1, "Update"); |
+ updateTemp->SetTextJustify(36); |
+ updateTemp->SetWrapLength(-1); |
+ updateTemp->Resize(80,22); |
+ fH1->AddFrame(updateTemp, f0); |
+ |
+ exportTemp = new TGTextButton(fH1, "Export"); |
+ exportTemp->SetTextJustify(36); |
+ exportTemp->SetWrapLength(-1); |
+ exportTemp->Resize(80,22); |
+ fH1->AddFrame(exportTemp, f0); |
+ |
+ closeTemp = new TGTextButton(fH1, "Close"); |
+ closeTemp->SetTextJustify(36); |
+ closeTemp->SetWrapLength(-1); |
+ closeTemp->Resize(80,22); |
+ fH1->AddFrame(closeTemp, f0); |
+ fH2->AddFrame(fH1, f0centerx); |
+ |
+ fG1->AddFrame(fH2, f2); |
+ |
+ fMain->AddFrame(fG1, f1); |
+ |
+ // Action connections |
+ updateTemp->Connect("Clicked()", "TGAppMainFrame", this, "UpdateTempPlot()"); |
+ tempEndOn->Connect("Clicked()", "TGAppMainFrame", this, "TempEndToggle()"); |
+ exportTemp->Connect("Clicked()", "TGAppMainFrame", this, "ExportTempPlot()"); |
+ closeTemp->Connect("Clicked()", "TGAppMainFrame", this, "CloseWindow()"); |
+ |
+// Fieldpoint window ------------------------ |
+ |
+} |
+ |
+// ------------------------------------------------------------------- |
+ |
+// Main function ----------------------------------------------------- |
+ |
+void root_app() |
+{ |
+ new TGAppMainFrame(gClient->GetRoot(), winWidth, winHeight); |
+} |
+ |
+int main(int argc, char **argv) |
+{ |
+ TApplication theApp("TGAppMainFrame", &argc, argv); |
+ root_app(); |
+ theApp.Run(); |
+ |
+ return 0; |
+} |
+ |
+// ------------------------------------------------------------------- |
Index: sipmscan/fieldpoint_standalone/time_offset.sh |
=================================================================== |
--- sipmscan/fieldpoint_standalone/time_offset.sh (nonexistent) |
+++ sipmscan/fieldpoint_standalone/time_offset.sh (revision 136) |
@@ -0,0 +1,32 @@ |
+#!/bin/bash |
+ |
+if [ "$1" == "reset" ]; then |
+ cp ./input/workstation.h.in ./include/workstation.h |
+ echo "Resetting the time offset to 0s." |
+else |
+ ssh f9daq@f9lab04.ijs.si << EOF > ./dbg/time_offset.txt |
+ date +%s |
+EOF |
+ date +%s >> ./dbg/time_offset.txt |
+ |
+ cd ./src |
+ |
+ g++ -o offset offset.cc |
+ ./offset |
+ rm ./offset |
+ |
+ cd .. |
+ |
+ if [ -f ./dbg/time_offset_out.txt ]; then |
+ offset=$(cat ./dbg/time_offset_out.txt) |
+ echo "The offset of MySQL database is ${offset}s." |
+ |
+ sed "s/define TIMEOFF 0/define TIMEOFF $offset/g" ./input/workstation.h.in > ./include/workstation.h |
+ |
+ rm ./dbg/time_offset_out.txt |
+ fi |
+ |
+ rm ./dbg/time_offset.txt |
+fi |
+ |
+exit 0 |
/sipmscan/fieldpoint_standalone/time_offset.sh |
---|
Property changes: |
Added: svn:executable |
## -0,0 +1 ## |
+* |
\ No newline at end of property |