Skip to content
Snippets Groups Projects
main.pnl 18 KiB
Newer Older
V 11
1
LANG:1 0 
PANEL,-1 -1 1010 745 N "_3DFace" 0
"main()
{
  // Initialise the Panel
  navPanel_initPanel(\"fw_viewBox\");

  strPanelName    = \"antennaField\";
  strModuleName   = myModuleName();  

  baseDP=g_currentDatapoint;
 
  dyn_string core   = coreStations;
  dyn_string remote = remoteStations;
  dyn_string europe = europeStations;
  string ccu        = navFunct_bareDBName(CEPDBName);
  string mcu        = navFunct_bareDBName(MainDBName);
  dynAppend(stationList,core);                      
  dynAppend(stationList,remote);
  dynAppend(stationList,europe);                      
  dynAppend(stationList,ccu);                      
  dynAppend(stationList,mcu);  
 


//
// Callback for dpConnect to action point.
// If there is an action required this point will tell so
//
void doAction(string aDP, string anAction) {
  LOG_DEBUG(\"swlevel.pnl:doAction| Action required. found: \" + anAction);
  // split action into essentials
  dyn_string actionString;
  if (!navFunct_splitAction(anAction,actionString)) {
    return;
  }
  LOG_DEBUG(\"swlevel.pnl:doAction|found actionString: \" + actionString);
  
  // Reload
  if (actionString[1] == \"Reload\") {
    return;
  } else if (actionString[1] == \"DistChanged\") {
    return;
  }
}
" 0
 E E E E 1 -1 -1 0  20 30
""0  1
E "#uses \"navPanel.ctl\"

dyn_string stationList;
dyn_string SWLevelRefNames;
dyn_string datastreamRefNames;
dyn_string swCtrlRefNames;
dyn_string memAndHDDRefNames;
dyn_string stationViewRefNames;
string strPanelName;
string strModuleName;
string baseDP=\"\";
dyn_string station_procList;
dyn_string station_result;

void prepareHardwareList() {

  g_stationList = stationList;
}  


void clearSWLevelRefNames() {
  // remove all symbols because new ones will be added
  for (int i=1; i <= dynlen(SWLevelRefNames); i++) {
    removeSymbol(strModuleName,\"\",SWLevelRefNames[i]);
  }
  dynClear(SWLevelRefNames);
}

void clearDatastreamRefNames() {
  // remove all symbols because new ones will be added
  for (int i=1; i <= dynlen(datastreamRefNames); i++) {
    removeSymbol(strModuleName,\"\",datastreamRefNames[i]);
  }
  dynClear(datastreamRefNames);
}

void clearSwCtrlRefNames() {
  // remove all symbols because new ones will be added
  for (int i=1; i <= dynlen(swCtrlRefNames); i++) {
    removeSymbol(strModuleName,\"\",swCtrlRefNames[i]);
  }
  dynClear(swCtrlRefNames);
}

void clearMemAndHDDRefNames() {
  // remove all symbols because new ones will be added
  for (int i=1; i <= dynlen(memAndHDDRefNames); i++) {
    removeSymbol(strModuleName,\"\",memAndHDDRefNames[i]);
  }
  dynClear(memAndHDDRefNames);
}

void clearStationViewRefNames() {
  // remove all symbols because new ones will be added
  for (int i=1; i <= dynlen(stationViewRefNames); i++) {
    removeSymbol(strModuleName,\"\",stationViewRefNames[i]);
  }
  dynClear(stationViewRefNames);
}
  dynClear(station_result);
  dynClear(station_procList);
    

  // set the hardware selectable items for this screen
  prepareHardwareList();
    
        
  if (dynlen(SWLevelRefNames) > 0) {
    clearSWLevelRefNames();
  }

  if (dynlen(datastreamRefNames) > 0) {
    clearDatastreamRefNames();
  }

  if (dynlen(swCtrlRefNames) > 0) {
    clearSwCtrlRefNames();
  }

  if (dynlen(memAndHDDRefNames) > 0) {
    clearMemAndHDDRefNames();
  }

  if (dynlen(stationViewRefNames) > 0) {
    clearStationViewRefNames();
  addSWLevels();

  addDatastreams();
  
  addSWCtrlers();
  
  
 
 
  // trigger that the panel values are calculated and ready
  dynClear(highlight);
  dynClear(strHighlight);
  
  // set panel to ready
  g_objectReady=true;
  navPanel_setEvent(\"main.pnl:redraw\",\"Update\");
  int xPos_AddSymbol = 0; 
  int yPos_AddSymbol = 18; 
  int ref = 1;
  string addPanelName    = \"objects/swlevel.pnl\";
  //loop over list and prepare panel with all stations and swlevel objects   
  for (int i=1; i<= dynlen(stationList); i++) {

    SWLevelRefNames[i]=\"stationSW\"+(i);
      
    if (  addSymbol(  strModuleName,                   // Stay in this modul
                      \"\",                              // Name of this panel
                      addPanelName,                    // Panel to add
                      SWLevelRefNames[ref],            // Ref of the addedPanel
                      makeDynString( \"$station:\" + stationList[i]) ,     // Define all $values
                      xPos_AddSymbol,                  // Xpos of the AddedSymbol
                      yPos_AddSymbol,                  // Ypos of the AddedSymbol
                      0,                               // angle
                      1    ,1                          // zoomX , zoomY
        ) < 0 ) {
	  LOG_ERROR(\"swlevel.pnl:addSWLevels|Error Appending swlevel for: \" + stationList[i] + \" in this panel.\");
}

void addDatastreams() {
  int xPos_AddSymbol = 150; 
  int yPos_AddSymbol = 18; 
  int ref = 1;
  string addPanelName    = \"objects/datastreamLevel.pnl\";
  //loop over list and prepare panel with all datastreamobjects   
  for (int i=1; i<= dynlen(stationList); i++) {
    //skip CCU and MCU machines
    if (strpos(stationList[i],\"MCU\") >=0 ||strpos(stationList[i],\"CCU\") >=0) continue;

    datastreamRefNames[i]=\"datastream\"+(i);
      
    if (  addSymbol(  strModuleName,                   // Stay in this modul
                      \"\",                              // Name of this panel
                      addPanelName,                    // Panel to add
                      datastreamRefNames[ref],         // Ref of the addedPanel
                      makeDynString( \"$station:\" + stationList[i]) ,     // Define all $values
                      xPos_AddSymbol,                  // Xpos of the AddedSymbol
                      yPos_AddSymbol,                  // Ypos of the AddedSymbol
                      0,                               // angle
                      1    ,1                          // zoomX , zoomY
        ) < 0 ) {
	  LOG_ERROR(\"swlevel.pnl:addDatastreams|Error datastream for : \" + stationList[i] + \" in this panel.\");
}

void addSWCtrlers() {
  int xPos_AddSymbol = 235; 
  int yPos_AddSymbol = 28;
  int ref = 1;
  //loop over list and prepare panel with all datastreamobjects   
  for (int i=1; i<= dynlen(stationList); i++) {
    //CCU and MCU machines different layout
    if (strpos(stationList[i],\"MCU\") >=0 ) {
      addPanelName    = \"objects/Processes/MCUSWLevelView.pnl\";
    } else if( strpos(stationList[i],\"CCU\") >=0) {
      addPanelName    = \"objects/Processes/CCUSWLevelView.pnl\";
    } else {
      addPanelName    = \"objects/Processes/stationSWLevelView.pnl\";
    }
    swCtrlRefNames[i]=\"swCtrl\"+(i);
      
    if (  addSymbol(  strModuleName,                   // Stay in this modul
                      \"\",                              // Name of this panel
                      addPanelName,                    // Panel to add
                      swCtrlRefNames[ref],         // Ref of the addedPanel
                      makeDynString( \"$station:\" + stationList[i]) ,     // Define all $values
                      xPos_AddSymbol,                  // Xpos of the AddedSymbol
                      yPos_AddSymbol,                  // Ypos of the AddedSymbol
                      0,                               // angle
                      1    ,1                          // zoomX , zoomY
        ) < 0 ) {
	  LOG_ERROR(\"swlevel.pnl:addSWCtrlers|Error swCtrl for : \" + stationList[i] + \" in this panel.\");
          }
    yPos_AddSymbol += 10;
    ref++;
    //CCU and MCU machines different layout
    if (strpos(stationList[i],\"MCU\") >=0 ) {
//      addMCUProcesses(stationList[i]+\":\");
    } else if( strpos(stationList[i],\"CCU\") >=0) {
//      addCCUProcesses(stationList[i]+\":\");
    } else {
      addStationProcesses(stationList[i]+\":\");
    }
  }
  dpSet(DPNAME_NAVIGATOR + g_navigatorID + \".processesList\",station_result);

}

void addStationProcesses(string selectedStation) {
    if (!navFunct_dpReachable(selectedStation)) {
    return;
  }
  int z;
  dyn_dyn_anytype tab;
  //PermSW + PermSW_Daemons
  string query=\"SELECT '_original.._value' FROM 'LOFAR_PermSW_*.status.state' REMOTE '\" +selectedStation + \"'\";
  
  dpQuery(query, tab);
  LOG_TRACE(\"main.pnl:addStationProcesses|Found: \"+ tab);
  

  dyn_string aDS=navFunct_getDynString(tab, 2,1);
  dynSortAsc(aDS);
  for(z=1;z<=dynlen(aDS);z++){
    
    // strip .status.state from station_result
    string aS = dpSubStr(aDS[z],DPSUB_SYS_DP);

    // keep Path to work with
    string path=aS;
    

    // strip all including PermsSW out of the string
    strreplace(aS,selectedStation+dpSubStr(baseDP,DPSUB_DP)+\"_PermSW_\",\"\");

    // Remainder should be PermsSW Programs + Daemons  split on _ 
    dyn_string spl=strsplit(aS,\"_\");
    if (dynlen(spl) > 1) { // Daemon
      dynAppend(station_result,navFunct_dpStripLastElement(path)+\",\"+spl[2]+\",\"+path);
      dynAppend(station_procList,path);
    } else {   // Program
      dynAppend(station_result,\",\"+spl[1]+\",\"+path);
      if (spl[1] != \"Daemons\") {
        dynAppend(station_procList,path);
      }
    }
  LOG_TRACE(\"main.pnl:addStationProcesses|station_result composed: \"+ station_result);  
}

void addMemAndHDD() {
  int xPos_AddSymbol = 625; 
  int yPos_AddSymbol = 28; 
  int ref = 1;
  string addPanelName    = \"objects/Hardware/System_MemAndHDD.pnl\";
  //loop over list and prepare panel with all MainInfo   
  for (int i=1; i<= dynlen(stationList); i++) {

    memAndHDDRefNames[i]=\"memAndHDD\"+(i);
      
    if (  addSymbol(  strModuleName,                   // Stay in this modul
                      \"\",                              // Name of this panel
                      addPanelName,                    // Panel to add
                      memAndHDDRefNames[ref],         // Ref of the addedPanel
                      makeDynString( \"$station:\" + stationList[i]) ,     // Define all $values
                      xPos_AddSymbol,                  // Xpos of the AddedSymbol
                      yPos_AddSymbol,                  // Ypos of the AddedSymbol
                      0,                               // angle
                      1    ,1                          // zoomX , zoomY
        ) < 0 ) {
	  LOG_ERROR(\"main.pnl:addMemAndHDD|Error memAndHDD for : \" + stationList[i] + \" in this panel.\");
          }
    yPos_AddSymbol += 10;
    ref++;
  }
}

void addStationView() {
  int xPos_AddSymbol = 665; 
  int yPos_AddSymbol = 28; 
  int ref = 1;
  string addPanelName    = \"objects/Hardware/Station_mainView.pnl\";
  //loop over list and prepare panel with all MainInfo   
  for (int i=1; i<= dynlen(stationList); i++) {
    //skip CCU and MCU machines
    if (strpos(stationList[i],\"MCU\") >=0 ||strpos(stationList[i],\"CCU\") >=0) continue;

    stationViewRefNames[i]=\"memAndHDD\"+(i);
      
    if (  addSymbol(  strModuleName,                   // Stay in this modul
                      \"\",                              // Name of this panel
                      addPanelName,                    // Panel to add
                      stationViewRefNames[ref],         // Ref of the addedPanel
                      makeDynString( \"$station:\" + stationList[i]) ,     // Define all $values
                      xPos_AddSymbol,                  // Xpos of the AddedSymbol
                      yPos_AddSymbol,                  // Ypos of the AddedSymbol
                      0,                               // angle
                      1    ,1                          // zoomX , zoomY
        ) < 0 ) {
	  LOG_ERROR(\"main.pnl:addStationView|Error stationView for : \" + stationList[i] + \" in this panel.\");
 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 
2 4
"PRIMITIVE_TEXT4"
""
1 65 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
4 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 65 10 107 23
0 2 2 "0s" 0 0 0 192 0 0  65 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 7 swlevel
6 21
"RECTANGLE1"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "green" E E
 E E
6 0 0 0 0 0
E E E
0
1
LANG:1 7 Level 6

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 0.7142857142857143 -10 60 1 E 140 140 150 210
6 22
"RECTANGLE2"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "yellow" E E
 E E
7 0 0 0 0 0
E E E
0
1
LANG:1 9 Level 2-5

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 0.7142857142857143 -10 110 1 E 140 140 150 210
6 23
"RECTANGLE3"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N {255,170,0} E E
 E E
8 0 0 0 0 0
E E E
0
1
LANG:1 7 Level 1

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 0.7142857142857143 -10 160 1 E 140 140 150 210
6 24
"RECTANGLE4"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "red" E E
 E E
9 0 0 0 0 0
E E E
0
1
LANG:1 7 Level 0

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 0.7142857142857143 -10 210 1 E 140 140 150 210
2 25
"PRIMITIVE_TEXT5"
""
1 155 2 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
10 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 155 2 196 15
0 2 2 "0s" 0 0 0 192 0 0  155 2 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 6 stream
6 26
"RECTANGLE5"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "green" E E
 E E
11 0 0 0 0 0
E E E
0
1
LANG:1 13 datastream on

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 1.428571428571429 75 -40 1 E 140 140 150 210
6 27
"RECTANGLE6"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "red" E E
 E E
12 0 0 0 0 0
E E E
0
1
LANG:1 14 datastream off

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 1.428571428571429 75 60 1 E 140 140 150 210
4 28
"LINE1"
""
1 230 0 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
13 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 2 1 2 1 E  230 0 230 509
2 29
"PRIMITIVE_TEXT6"
""
1 160 15 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
14 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 160 15 167 28
0 2 2 "0s" 0 0 0 192 0 0  160 15 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 1 0
2 30
"PRIMITIVE_TEXT7"
""
1 190 15 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
15 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 190 15 197 28
0 2 2 "0s" 0 0 0 192 0 0  190 15 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 1 1
6 31
"RECTANGLE7"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "green" E E
 E E
16 0 0 0 0 0
E E E
0
1
LANG:1 13 datastream on

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 1.428571428571429 466 -40 1 E 140 140 150 210
6 32
"RECTANGLE8"
""
1 140 140 E E E 1 E 1 E N {0,0,0} E N "red" E E
 E E
17 0 0 0 0 0
E E E
0
1
LANG:1 14 datastream off

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E 1 0 1.428571428571429 466 60 1 E 140 140 150 210
4 33
"LINE2"
""
1 621 0 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
18 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 2 1 2 1 E  621 0 621 509
2 34
"PRIMITIVE_TEXT8"
""
1 249 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
19 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 249 10 271 23
0 2 2 "0s" 0 0 0 192 0 0  249 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw1
2 35
"PRIMITIVE_TEXT9"
""
1 329 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
20 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 329 10 351 23
0 2 2 "0s" 0 0 0 192 0 0  329 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw2
2 36
"PRIMITIVE_TEXT10"
""
1 380 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
21 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 380 10 402 23
0 2 2 "0s" 0 0 0 192 0 0  380 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw3
2 37
"PRIMITIVE_TEXT11"
""
1 420 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
22 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 420 10 442 23
0 2 2 "0s" 0 0 0 192 0 0  420 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw4
2 38
"PRIMITIVE_TEXT12"
""
1 460 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
23 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 460 10 482 23
0 2 2 "0s" 0 0 0 192 0 0  460 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw5
2 39
"PRIMITIVE_TEXT13"
""
1 542 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
24 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 542 10 564 23
0 2 2 "0s" 0 0 0 192 0 0  542 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 3 sw6
4 41
"LINE4"
""
1 0 510 E E E 1 E 1 E N {0,0,0} E N {255,255,255} E E
 E E
26 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 2 1 2 1 E  0 510 1010 510
2 42
"PRIMITIVE_TEXT14"
""
1 10 516 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
27 0 0 0 0 0
E E E
0
1
LANG:1 0 

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 10 516 124 529
0 2 2 "0s" 0 0 0 192 0 0  10 516 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 18 CEPobservationView
2 44
"PRIMITIVE_TEXT16"
""
1 627 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
LANG:1 18 DiskSpace & Memory

1
"dashclr"N "_Transparent"
E E 0 1 1 2 1 E U  0 E 627 10 657 23
0 2 2 "0s" 0 0 0 192 0 0  627 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1
LANG:1 6 D    M
2 45
"PRIMITIVE_TEXT17"
""
1 668 10 E E E 1 E 1 E N "_WindowText" E N "_Window" E E
 E E
30 0 0 0 0 0
E E E
0
1
LANG:1 22 Temperature & Humidity
E E 0 1 1 2 1 E U  0 E 668 10 695 23
0 2 2 "0s" 0 0 0 192 0 0  668 10 1
1
LANG:1 34 MS Shell Dlg 2,8,-1,5,75,0,0,0,0,0
0 1