Skip to content
Snippets Groups Projects
swlevel.pnl 11.7 KiB
Newer Older
V 11
1
LANG:1 0 
PANEL,-1 -1 251 88 N "_3DFace" 1
"$station"
"main()
{
  //Point to show the swlevel of a certain station
  
  station = $station;
  station_text.text = station;
  
  baseDP = station+\":LOFAR_PermSW_Daemons_SoftwareMonitor\";
  if (navFunct_dpReachable(baseDP)) {
    if (dpExists(baseDP)) {
      showLevels();
    } else {
      station_text.foreCol(\"Lofar_dpdoesnotexist\");
    }
  } else {
      station_text.foreCol(\"Lofar_dpOffline\");
""0  1
E "#uses \"navPanel.ctl\"
string station = \"\";
string baseDP=\"\";
bool bDoubleClicked  = false;
// routine for single mouse click
void click(string name) {
  // set delay in case double click was meant
  delay(0, 100); 
  if (!bDoubleClicked) {
    navPanel_setEvent(name,\"EventClick\");
  }
}

// routine for double mouse click
void dblClick(string name) {
  // indicate this is a doubleClick
  bDoubleClicked = true;   
  if (name == station) baseDP=station+\":LOFAR\";

  if (dpExists(baseDP) ) {
    LOG_DEBUG(\"swlevel.pnl:DoubleClick|Setting currentDatapoint from : \"+g_currentDatapoint+\" to \"+baseDP);
    g_currentDatapoint=baseDP;
    if (name == station) {
      navPanel_setEvent(station,\"ChangePanel\");
    } else {
      //we also have to set the tabctrl to think this was initiated from the ProcessesTab, otherwise we will get the wrong panel.
      navPanel_setEvent(\"Processes\",\"ChangeTab\");
    }
  }
  
  // set delay to avoid click event will be triggered
  delay(0, 500);
  bDoubleClicked = false;  
}                       

// routine for right mouse click
void rClick(string name) {

}                       

// ****************************************
// Name: showLogging   
// ****************************************
//    Connects to the given datapoint .logMsg it's historical data (if any)
//    and logs all
//           
// ****************************************
showLevels()
{
  LOG_TRACE(\"swlevel.pnl:showLevels| Entered for DP:\" ,baseDP);
	
  string dpLvl = baseDP+\".SWLevel\";
  string systemName = dpSubStr(dpLvl,DPSUB_SYS);
  string bareDP     = dpSubStr(dpLvl,DPSUB_DP_EL_CONF_DET_ATT);

  if (navFunct_dpReachable(dpLvl)) {
    if(dpExists(dpLvl)) {
      // gather the historical data:
      dyn_dyn_anytype tab;
      int z;
      time tStart;
      time tStop;
      tStop = getCurrentTime();
      tStart = tStop - 15*3600; // 15 hours of history
      if (systemName != MainDBName) {     
        query = \"SELECT ALL '_original.._value','_original.._stime' FROM '\" + dpLvl + \"' REMOTE'\"+systemName +\"' TIMERANGE(\\\"\" +
                formatTime(\"%Y.%m.%d %H:%M:%S\",tStart) + \"\\\",\\\"\" +
                formatTime(\"%Y.%m.%d %H:%M:%S\",tStop) + \"\\\",1,0) LAST 15\";
      } else {
        query = \"SELECT ALL '_original.._value','_original.._stime' FROM '\" + dpLvl + \"' TIMERANGE(\\\"\" +
                formatTime(\"%Y.%m.%d %H:%M:%S\",tStart) + \"\\\",\\\"\" +
                formatTime(\"%Y.%m.%d %H:%M:%S\",tStop) + \"\\\",1,0) LAST 15\";
      }

      dpQuery(query, tab);
      for(z=2;z<dynlen(tab);z++) {
        addLevel(tab[z][2],tab[z][3]);
      }
      // connect to levels
      if (dpConnect(\"updateLevel\",dpLvl,
                                  dpLvl+\":_original.._stime\",
                                  dpLvl+\":_online.._invalid\") == -1) {
        LOG_ERROR(\"swlevel.pnl:showLevels|Couldn't connect to \"+dpLvl+ \" \" + getLastError());
      }
    } else {
      LOG_DEBUG(\"swlevel.pnl:showLevels|error connecting to: \"+ dpLvl);
    }    
  } else {
    station_text.foreCol(\"Lofar_dpOffline\");
  }
}

// ****************************************
// Name: updateLevel   
// ****************************************
//    callback for showLevels
//           
// ****************************************
updateLevel(string dp1, int lvl,
            string dp2, string changed,
            string dp3, bool invalid)
{
  LOG_TRACE(\"swlevel.pnl:showLevelsg|Level: \"+lvl);
  if (invalid) {
    station_text.foreCol(\"Lofar_invalid\");
  } else {
    station_text.foreCol(\"_WindowText\");
    addLevel(lvl,changed);
  }
}

// ****************************************
// Name: addLevel   
// ****************************************
//    fill the 15 timestamped SWlevels for this Database
//           
// ****************************************
addLevel(int lvl,string changed)
{
  LOG_TRACE(\"swlevel.pnl:addlevel|lvl: \" + lvl);

  string toolTip = changed+\"<br>  level: \"+lvl;
  
  string lvlcolor=\"\";
  if (lvl == 0) {
    lvlcolor=\"red\";
  } else if (lvl == 1) {
    lvlcolor=\"{255,170,0}\";     //orange
  } else if (lvl >= 2 && lvl < 6) {
    lvlcolor=\"yellow\";
  } else if (lvl == 6) {
    lvlcolor=\"green\";
  } else {
    lvlcolor = \"white\";
  }

  string oldlvl=\"white\";
  string oldToolTip = \"\";
  for (int i=15-filled; i< 15 ;i++) {
    // get the original color and tooltip from the next right point and move it to this point
    getValue(\"level\"+(i+1)+\"_text\",\"backCol\",oldlvl);
    setValue(\"level\"+(i)+\"_text\",\"backCol\",oldlvl);
    getValue(\"level\"+(i+1)+\"_text\",\"toolTipText\",oldToolTip);
    setValue(\"level\"+(i)+\"_text\",\"toolTipText\",oldToolTip);
  }
  // set new values
  setValue(\"level15_text\",\"backCol\",lvlcolor);
  setValue(\"level15_text\",\"toolTipText\",toolTip);
  if (filled < 14) filled++;
}


" 0
 2
"CBRef" "1"
"EClose" E
""
DISPLAY_LAYER, 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
LAYER, 0 
1
LANG:1 0 
6 16
"station_highLight"
""
1 240 10 E E E 1 E 0 E N "_Transparent" E N "Lofar_highLight" E E
 "main()
{
  rClick();
}" 0
 "main()
{
  dblClick();
}" 0

16 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
"main()
{
  dpConnect( \"swlevel_stationCallback\",true,DPNAME_NAVIGATOR + g_navigatorID +\".objectTrigger\" );
}

void swlevel_stationCallback(string dp1, bool aTrig) {
  
  LOG_DEBUG(\"swlevel.pnl:swlevel_stationCallback|ObjectTrigger Callback on: \"+dp1+\" trigger: \"+aTrig);
  LOG_DEBUG(\"swlevel.pnl:swlevel_stationCallback|Found highlight : \" + highlight + \" Looking for station\");
  bool bHighlight=false;
  if (dynContains(highlight,station)) {
    bHighlight=true;
  }
  LOG_DEBUG(\"swlevel.pnl:swlevel_stationCallback|Highlight request: \"+bHighlight);
  station_highLight.visible = bHighlight;
  
}

" 0
 "main()
{
  click();
}" 0
 0 1 1 2 1 E 1 0 1 2 1 1 E 0 8 33 23
6 0
"level1_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

0 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -180 -140 1 E 230 150 234 159
2 1
"station_text"
""
1 5 10 E E E 1 E 1 E N "_WindowText" E N "_Transparent" E E
 "main()
{
  rClick(station);
}" 0
 "main(int x, int y)
{
  dblClick(station);
}" 0

1 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(station);
}" 0
 0 1 1 2 1 E U  0 E 5 10 33 23
0 2 2 "0s" 0 0 0 192 0 0  5 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,50,0,0,0,0,0
0 1
LANG:1 5 cs001
6 2
"level2_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

2 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -175 -140 1 E 230 150 234 159
6 3
"level3_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

3 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -170 -140 1 E 230 150 234 159
6 4
"level4_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

4 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -165 -140 1 E 230 150 234 159
6 5
"level5_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

5 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -160 -140 1 E 230 150 234 159
6 6
"level6_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

6 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -155 -140 1 E 230 150 234 159
6 7
"level7_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

7 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -150 -140 1 E 230 150 234 159
6 8
"level8_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

8 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -145 -140 1 E 230 150 234 159
6 9
"level9_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

9 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -140 -140 1 E 230 150 234 159
6 10
"level10_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

10 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -135 -140 1 E 230 150 234 159
6 11
"level11_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

11 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -130 -140 1 E 230 150 234 159
6 12
"level12_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

12 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -125 -140 1 E 230 150 234 159
6 13
"level13_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

13 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -120 -140 1 E 230 150 234 159
6 14
"level14_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

14 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -115 -140 1 E 230 150 234 159
6 15
"level15_text"
""
1 230 150 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 "main()
{
  rClick(this.name);
}" 0
 "main(int x, int y)
{
  dblClick(this.name);
}" 0

15 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E "main(int x, int y)
{
  click(this.name);
}" 0
 0 1 1 2 1 E 1 0 1 -110 -140 1 E 230 150 234 159
0
LAYER, 1 
1
LANG:1 0 
0
LAYER, 2 
1
LANG:1 0 
0
LAYER, 3 
1
LANG:1 0 
0
LAYER, 4 
1
LANG:1 0 
0
LAYER, 5 
1
LANG:1 0 
0
LAYER, 6 
1
LANG:1 0 
0
LAYER, 7 
1
LANG:1 0 
0
0