#version 1 #include "@colors.h" #include "@grp\grp.h" #include "@mib2.mib" #include "@mibs\oajtersc.mib" //------------------------------------------------------------------------- // // Device : Jolt TerreScope family // Descriptor : tsj.dsc - TerreScope Main Window // //------------------------------------------------------------------------- //===================== start declarations ================================ #declare REGS := { i,j,m,k,l,tmp,oper_flag,setFlag,printFlag; // ykfix87 - 19.08.06 (I do not need 'noCommFlg','breakFlag','noPollCommFlg' now) currRSSI,currBIAS,currTEMP_K,currTEMP_C,currAirLink,currWireLink,tmpUnitOld; // ykfix55 - 16.03.03 maxv,checkstate,mi,curh,ctrlId,ver_type,rdThreshFile,commDownTime; // ykfix55 - 25.03.03 nProducts,nPrtTypes,id,currLoopback,currFusion,lbWorkMode,currRfLink,swVers; // ykfix66 - 28.07.04 wrLinkLabel,slaveRemoteLB,currPS1,currPS2,currHeatState,subDscOpenFlag; // ykfix70 - 17.01.05 } #declare VARS := { var,loadvar,openvar,monvar,polvar,starttime,currtime,values,valuesx; logMode,colectTime,startReqTime,currReqTime,logVar,logFileName,devLogLine; // ykfix55 - 6.02.03 fileName,fileNamePath,fileLines,threshName,threshMin,threshMax; flTitle,alrMsg,unitsy,pars,line1,name1,temp,temp1,t1,t2,temperatureUnit; // ykfix55 - 16.03.03 enterprise,varGenParams,varPollParams,varPhysStat,varCommStat,varOpen; fileName,gProductId; // ykfix61 - 21.09.03 gProductName,gProductHwVers,gWireLinkPrtType; // ykfix61 - 21.09.03 gWrLnkPortId,gWrLnkPortName; // ykfix61 - 21.09.03 } // ykfix61 - 22.09.03 - begin #declare ITEMS := { TER_ProductType := {type=NUMBER, object=oaJTerGenSubType} TER_MAC_Address := {type=OctetStr, object=oaJTerGenMACAddress} TER_IP_Address := {type=IPaddr, object=oaJTerGenIpAddr} TER_Comm_Mode := {type=NUMBER, object=oaJTerGenCommMode} TER_GateWay := {type=IPaddr, object=oaJTerGenGateWayAddr} TER_SW_Version := {type=NUMBER, object=oaJTerGenSwVersion} TER_HW_Version := {type=NUMBER, object=oaJTerGenHwVersion} TER_WireLinkPort := {type=NUMBER, object=oaJTerCommWireLinkPort} } TER_Gen_Params; #declare ITEMS := { TER_ProductTypeTXT := {type=TEXT, control=1101} TER_MAC_Address1 := {type=OctetStr, control=1102, minmax=6.6, format=%02X} TER_IP_Address1 := {type=IPaddr, control=1104} TER_Comm_Mode1 := {type=MENU, control=1110, first=1, menu=LAN_Mode, Router_Mode} TER_GateWay1 := {type=IPaddr, control=1105} TER_SW_Version1 := {type=NUMBER, control=1106, format=%d} TER_HW_VersionTXT := {type=TEXT, control=1107} TER_WireLinkPortTXT:= {type=TEXT, control=1109} } TER_Gen_ParamsTXT; // ykfix61 - 22.09.03 - end #declare ITEMS := { TER_WireLinkStatus := {type=MENU, object=oaJTerCommWireLinkStatus,control=1202, first=0, menu=Down, Up, Down} TER_AirLinkStatus := {type=MENU, object=oaJTerCommAirLinkStatus, control=1203, first=0, menu=Down, Up, Down} // ykfix66 - 28.07.04 - begin TER_FusionStatus := {type=MENU, object=oaJTerCommFusionStatus, control=1208, first=0, menu=Unsupported, Active, Passive} // ykfix66 - 28.07.04 - end } TER_Communication_Params; // ykfix66 - 28.07.04 - begin #declare ITEMS := { TER_WireLinkLabel := {type=MENU, control=202, first=0, // 0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback menu=-, F/O Flag :, Electrical Flag :} TER_ModeSelectStat := {type=MENU, object=oaJTerCommLoopbackStatus,control=1204, first=0, // 0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback menu=Unsupported, Normal, Local Loopback, RemoteLoopback} // ykfix67 - 9.08.04 TER_FusionMode := {type=MENU, object=oaJTerCommFusionMode, control=1207, first=0, // 0=Unsupported, 1=Disable, 2=Enable menu=Unsupported, Disable, Enable} TER_DevWorkMode1 := {type=TEXT, control=1205} TER_DevWorkMode2 := {type=TEXT, control=1206} } // ykfix66 - 28.07.04 - end #declare ITEMS := { TER_RSSI := {type=NUMBER, control=1301} TER_BIAS := {type=NUMBER, control=1302} TER_Temperature_K := {type=NUMBER, control=1303} TER_Temperature_C := {type=NUMBER, control=1304, format=%ld} // ykfix55 - 11.02.03 } TER_Current_Params; #declare ITEMS := { TER_MinRSSI := {type=NUMBER, control=3311} TER_MaxRSSI := {type=NUMBER, control=3411} TER_MinBIAS := {type=NUMBER, control=3312} TER_MaxBIAS := {type=NUMBER, control=3412} TER_MinTemp_K := {type=NUMBER, control=3313} // ykfix55 - 11.02.03 TER_MaxTemp_K := {type=NUMBER, control=3413} // ykfix55 - 11.02.03 TER_MinTemp_C := {type=NUMBER, control=3314, format=%ld} // ykfix55 - 11.02.03 TER_MaxTemp_C := {type=NUMBER, control=3414, format=%ld} // ykfix55 - 11.02.03 } TER_Thresholds; #declare ITEMS := { nid := {type=MENU, menu=RSSI, BIAS, Temperature} // ykfix70 - 8.09.04 - begin (I must put all comments out of the ITEM's body) uid := {type=MENU, menu=mV, V, K} // ykfix70 - 8.09.04 - end } #declare ITEMS := { SP_RSSI := {type=CHECK, control=2200, check=1, uncheck=0} SP_BIAS := {type=CHECK, control=2201, check=1, uncheck=0} SP_Temperature := {type=CHECK, control=2202, check=1, uncheck=0} } Spidometers; #declare ITEMS := { GR_RSSI := {type=CHECK, control=2300, check=1, uncheck=0} GR_BIAS := {type=CHECK, control=2301, check=1, uncheck=0} GR_Temperature := {type=CHECK, control=2302, check=1, uncheck=0} } Graphs; #declare ITEMS := { TEXT_STRING := {type=TEXT} // just for transformation objId := {type=ObjectID} } // ykfix51 - 9.10.02 - begin #declare ITEMS := { LOG_Mode := {type=CHECK, control=1500, check=1, uncheck=0} LOG_CollectionTime := {type=NUMBER, control=1501} LOG_FileName := {type=TEXT, control=1504} } LoggingParams; // ykfix51 - 9.10.02 - end //===================== end declarations ================================== doWhen(LOAD) { loadvar = 1; openvar = 0; polvar = 0; // noPollCommFlg = 0; // ykfix61 - 7.10.03 printFlag = 0; // 0=notPrint, 1=print (ykfix55 - 25.03.03) subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // monvar = 0; // ykfix55 - 6.02.03 // breakFlag = 0; // ykfix61 - 16.09.03 (I do not need it now because of "TIMEOUT" Block) // noCommFlg = 0; // ykfix61 - 16.09.03 (I do not need it now because of "TIMEOUT" Block) // ykfix55 - 16.03.03 - begin // Read 'TSJDEVTEMPUNITS' from the Device Params - start //--------------------------------------------------- temperatureUnit.0 = 0; // "Temperature Unit of measurement" Mode (0-unknown, 1=Celsius, 2=Kelvin) getDeviceParam(TSJDEVTEMPUNITS temperatureUnit.0 INTEGER); // get GLOBAL Device VAR { if (((temperatureUnit.0) != 1)& // if Units of Temperature measurement was 'unknown' && ((temperatureUnit.0) != 2)) { temperatureUnit.0= 1; // "Temperature Unit of measurement" Mode (0-unknown, 1=Celsius, 2=Kelvin) } } // end of ( getDeviceParam(TSJDEVTEMPUNITS ... ...) ) else // GLOBAL Device VAR is absent { temperatureUnit.0= 1; // "Temperature Unit of measurement" Mode (0-unknown, 1=Celsius, 2=Kelvin) setDeviceParam(TSJDEVTEMPUNITS temperatureUnit.0 INTEGER); // save GLOBAL Device VAR } // end of ( !getDeviceParam(TSJDEVTEMPUNITS ... ...) ) tmpUnitOld = (temperatureUnit.0); // to save beginning value // Read 'TSJDEVTEMPUNITS' from the Device Params - end //-------------------------------------------------- // Thresholds Values Initialization (Instead of doing it in both 'OPEN' & 'POLLING' Blocks) // ----- Get Thresholds from the file ---------------------------------------- fileName = "THRESH.TXT"; fileNamePath = "@DATA\\\DeviceName\\\fileName"; m = 0; // quantity of the entries in the File i=for(0>32767) { fileLines = getFileLine("\fileNamePath"); { m = (m + 1); // quantity of the entries in the File if ((m >= 5)& // if File exists and it is not Empty (first 4 lines are the Titles) && (m <= 8)) { // ykfix87 - 19.09.06 - begin (To remove Special symbols from the end of the string) l = getVarLength(fileLines.0); j = for(1>l) { k = (l-j); tmp = fileLines.0.k; if ((tmp >= 1)&&(tmp <= 31)) // Special symbols { fileLines.0.k = 0; // "End of Sting" symbol } // end of ( ((tmp >= 1)&&(tmp <= 31)) ) else { goto(ENDOFSTRINGGOOD); } // end of ( ((tmp < 1)||(tmp > 31)) ) } // end of ( for(1>l) ) :ENDOFSTRINGGOOD; // ykfix87 - 19.09.06 - end var = parse2words(fileLines.0 '\t' k); // fileLines.i = line in file "fileNamePath.SXX" (Input Text String) // separator = '\t' (tab) // var - Output ARRAY of Vars // k - quantity of entries in the ARRAY var.0 = str2var(TEXT_STRING var.0);// Threshold Parameter Name var.1 = str2var(TER_MinRSSI var.1);// 'Minimum' Threshold Value var.2 = str2var(TER_MaxRSSI var.2);// 'Maximum' Threshold Value if ((m >= 5)& && (m <= 6)) { threshName.(m-5) = "\var"; // Threshold Parameter Name threshMin.(m-5) = (var.1); // 'Minimum' Threshold Value threshMax.(m-5) = (var.2); // 'Maximum' Threshold Value } // end of ( ((m >= 5)&&(m <= 6)) ) else { if (((temperatureUnit.0) == 2)& // if "TEMP_K" line && (m == 7)) // "Temperature Unit of measurement" Mode (1=Celsius, 2=Kelvin) { threshName.2= "TEMP_K"; // Threshold Parameter Name threshMin.2 = (var.1); // 'Minimum' Threshold Value threshMax.2 = (var.2); // 'Maximum' Threshold Value threshName.3= "TEMP_C"; // Threshold Parameter Name threshMin.3 = ((var.1)-273); // 'Minimum' Threshold Value threshMax.3 = ((var.2)-273); // 'Maximum' Threshold Value } // end of ( ((m == 7)&&((temperatureUnit.0) == 2)) ) if (((temperatureUnit.0) == 1)& // if "TEMP_C" line && (m == 8)) // "Temperature Unit of measurement" Mode (1=Celsius, 2=Kelvin) { threshName.3= "TEMP_C"; // Threshold Parameter Name threshMin.3 = (var.1); // 'Minimum' Threshold Value threshMax.3 = (var.2); // 'Maximum' Threshold Value threshName.2= "TEMP_K"; // Threshold Parameter Name threshMin.2 = ((var.1)+273); // 'Minimum' Threshold Value threshMax.2 = ((var.2)+273); // 'Maximum' Threshold Value } // end of ( ((m == 8)&&((temperatureUnit.0) == 1)) ) } // end of ( ((m == 7)||(m == 8)) ) } //end of ((m >= 5) && (m <=8)) } // end of ( getFileLine(...) ) else // if File not exists or it is Empty or EOF { m = (m + 1); // quantity of the entries in the File if (m <= 4) { // to create Title of the File line1 = "Params\tMinimum\tMaximum"; flTitle = "T h r e s h o l d s Configuration"; saveVars(line1 "\fileNamePath" - flTitle); line1 = ""; saveVars(line1 "\fileNamePath" append -); //----------------------------- // to create Thresholds Values threshName.0 = "RSSI"; // Threshold Parameter Name threshMin.0 = 0; // 'Minimum' Threshold Value threshMax.0 = 0; // 'Maximum' Threshold Value line1 = "RSSI\t\threshMin.0\t\threshMax.0"; // ykfix64 - 17.11.03 saveVars(line1 "\fileNamePath" append -); //----------------------------- threshName.1 = "BIAS"; // Threshold Parameter Name threshMin.1 = 0; // 'Minimum' Threshold Value threshMax.1 = 0; // 'Maximum' Threshold Value line1 = "BIAS\t\threshMin.1\t\threshMax.1"; // ykfix64 - 17.11.03 saveVars(line1 "\fileNamePath" append -); //----------------------------- threshName.2 = "TEMP_K"; // Threshold Parameter Name threshMin.2 = 0; // 'Minimum' Threshold Value threshMax.2 = 0; // 'Maximum' Threshold Value line1 = "TEMP_K\t\threshMin.2\t\threshMax.2"; // ykfix64 - 17.11.03 saveVars(line1 "\fileNamePath" append -); //----------------------------- threshName.3 = "TEMP_C"; // Threshold Parameter Name threshMin.3 = -273; // 'Minimum' Threshold Value threshMax.3 = -273; // 'Maximum' Threshold Value // line1 = "TEMP_C\t\-273\t\-273"; // ykfix64 - 17.11.03 line1 = "TEMP_C\t\threshMin.3\t\threshMax.3"; // ykfix64 - 17.11.03 saveVars(line1 "\fileNamePath" append -); //----------------------------- } // end of ( (m <= 4) ) if ((m == 8)& // if "TEMP_C" line does not exist (only for the backward compatibility with old MV versions) && ((temperatureUnit.0) == 1)) // "Temperature Unit of measurement" Mode (1=Celsius, 2=Kelvin) { threshName.2= "TEMP_K"; // Threshold Parameter Name threshMin.2 = (var.1); // 'Minimum' Threshold Value (because Kelvin Temperature threshold already exists) threshMax.2 = (var.2); // 'Maximum' Threshold Value (because Kelvin Temperature threshold already exists) threshName.3= "TEMP_C"; // Threshold Parameter Name threshMin.3 = ((var.1)-273); // 'Minimum' Threshold Value threshMax.3 = ((var.2)-273); // 'Maximum' Threshold Value } // end of ( (((m+1) == 8)&&((temperatureUnit.0) == 1)) ) goto(ENDOFLOADTHRESHOLDS); } // end of ( !getFileLine(...) ) } // end of ( for(0>32767) ) :ENDOFLOADTHRESHOLDS; // ykfix55 - 16.03.03 - end // rdThreshFile = 1; // 0=not to read THRESH.TXT file, 1=to read THRESH.TXT file - to get thresholds values (ykfix55 - 16.03.03) currAirLink = 0; // var initialization currWireLink = 0; // var initialization currRfLink = 0; // var initialization (ykfix66 - 28.07.04) currLoopback = 0; // var initialization (ykfix66 - 28.07.04) currFusion = 0; // var initialization (ykfix66 - 28.07.04) // ykfix70 - 17.01.05 - begin currPS1 = 0; currPS2 = 0; currHeatState = 0; // ykfix70 - 17.01.05 - begin lbWorkMode = 0; // 0=Change Loopback only via HW switch, 1=Loopback can be changed via NMS - (ykfix65 - 30.03.04) slaveRemoteLB = 0; // "Slave Remote Loopback" Mode (0=disabled, 1=enable) - for Old Sw Versions always = 0 // ykfix66 - 28.07.04 - begin varCommStat.0 = 2; // [TER_WireLinkStatus] (1=Up, 2=Down) varCommStat.1 = 2; // [TER_AirLinkStatus] (1=Up, 2=Down) varCommStat.2 = 0; // [TER_FusionStatus] (0=Unsupported, 1=Active, 2=Passive) varCommStat.3 = 0; // [TER_ModeSelectStat] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) varCommStat.4 = 0; // [TER_FusionMode] (0=Unsupported, 1=Disable, 2=Enable) // ykfix70 - 17.01.05 - begin varCommStat.5 = 0; // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) varCommStat.6 = 0; // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) varCommStat.7 = 0; // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) // ykfix70 - 17.01.05 - begin // ykfix66 - 28.07.04 - end // Graphs/Spidometers Vars Initialization //--------------------------------------- maxv = 3; // Number of Parameters (CheckBoxes) // starttime = nmsTime; // in Seconds (ykfix55 - 6.02.03) i=for(0>(maxv-1)) { values.i = 0; valuesx.i = 0; } // end of ( for(0>(maxv-1)) ) checkstate = 0; // ykfix51 - 9.10.02 - begin // Read 'TSJDEVLOGMODE' from the Device Params - start //--------------------------------------------------- logMode.0 = 0; // "Save Parameters in LOG file" Mode (0-stop, 1-start) getDeviceParam(TSJDEVLOGMODE logMode.0 INTEGER); // get GLOBAL Device VAR { ; } // end of ( getDeviceParam(TSJDEVLOGMODE ... ...) ) else // GLOBAL Device VAR is absent { logMode.0 = 0; // "Save Parameters in LOG file" Mode (0-stop, 1-start) setDeviceParam(TSJDEVLOGMODE logMode.0 INTEGER); // save GLOBAL Device VAR } // end of ( !getDeviceParam(TSJDEVLOGMODE ... ...) ) // Read 'TSJDEVLOGMODE' from the Device Params - end //-------------------------------------------------- // Read 'TSJDEVCOLTIME' from the Device Params - start //---------------------------------------------------- colectTime.0 = 0; // "Data Collection Time" value (in seconds) getDeviceParam(TSJDEVCOLTIME colectTime.0 INTEGER); // get GLOBAL Device VAR { ; } // end of ( getDeviceParam(TSJDEVCOLTIME ... ...) ) else // GLOBAL Device VAR is absent { colectTime.0 = 0; // "Data Collection Time" value (in seconds) setDeviceParam(TSJDEVCOLTIME colectTime.0 INTEGER); // save GLOBAL Device VAR } // end of ( !getDeviceParam(TSJDEVCOLTIME ... ...) ) // Read 'TSJDEVCOLTIME' from the Device Params - end //-------------------------------------------------- startReqTime.0= (nmsTime - (colectTime.0)); // Last Request Time (to GET first RSSI,BIAS,Temperature,... Data immediately ) devLogLine.0 = "--- Start MegaVision NMS -------------------------------------------"; writeToDeviceLog("\devLogLine.0"); // ykfix51 - 9.10.02 - end loadvar = 0; } doWhen(OPEN) { bringToTop(); if(loadvar) { showMessage("Wait for complete initialization!"); close; } // end of ( (loadvar) ) openvar = 1; subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) setTitle("Wait, retreiving data..."); showControls(HIDE /1001,511,512,998); // for no Blink with white // showControls(HIDE /1101>1110); // for no Blink with white // ykfix66 - 28.07.04 - begin "Mode Select Status","Fusion Mode","Fusion Status" showControls(HIDE /202>204,207>208,1114,1115,1202>1208); // "WireLink Status","Air Link Status","Mode Select Status","Fusion Mode","Fusion Status" only for the swVers > 102 showControls(HIDE /1116>1118); // "PS#1","PS#2","Front Window Heating Status" Buttons (ykfix70 - 17.01.05) // showControls(DISABLE /302,402,412,1302,2201,2301,3312,3412); // BIAS is supported now! (ykfix55 - 12.02.03) showControls(DISABLE /1111>1118,1202,1203,1208,1310,1500>1501,1505,2000,2200>2202,2300>2302,3311>3314,3411>3414); // BIAS is supported now! (ykfix70 - 19.01.05) // ykfix66 - 28.07.04 - end setBitmap(/511 btspdm); setBitmap(/512 btline); showControls(DISABLE /1001,511,512); showControls(SHOW /511,512); // for no Blink with white (ykfix65 - 23.02.04) setControlColor(/1100,1200,1301,1504,3300,3311,3411 LGRAY LGRAY BLUE); // ykfix66 - 28.07.04 setControlColor(/1300,3301,3401,4000>4002 LGRAY LGRAY WHITE); setControlColor(/303>304 LGRAY LGRAY GREEN1);// ykfix67 - 9.08.04 setControlColor(/1205,1206,1204,1207 LGRAY LGRAY GREEN); // ykfix67 - 9.08.04 showCommIcons(/2000); // show the communication status // ykfix70 - 19.01.05 - begin setToolTip(/2 "Close Window"); setToolTip(/1111 "Change Device IP Address, Communication Mode or GateWay Address"); setToolTip(/1112 "Update Device parameters view"); setToolTip(/1113 "Perform Device Reset"); setToolTip(/1114 "Change Device Mode Select Status"); setToolTip(/1115 "Change Device Fusion Mode"); setToolTip(/1116 "Device Power Supply # 1 Activity Status"); setToolTip(/1117 "Device Power Supply # 2 Activity Status"); setToolTip(/1118 "Change Device Front Window Heating Status"); setToolTip(/1310 "Change Min/Max Thresholds for RSSI, Bias or Temperature"); setToolTip(/1505 "Accept parameters for the Logging process"); setToolTip(/2000 "Device Communication Status"); if (UserType != 1) // 1=SUPERVISOR { showError("Regular 'USER' is allowed only to view \n& the Terescope Parameters. \n& To change them, please, Login as 'SUPERVISOR'."); } // ykfix70 - 19.01.05 - end starttime = nmsTime; // in Seconds (ykfix55 - 6.02.03) // ykfix61 - 22.09.03 - begin fileName = "@terescoj\\products.txt"; // ykfix64 - 26.11.03 (unnecessary '\' symbol was removed) open(@ld\ld_vars1(fileName,gProductId,gProductName,gProductHwVers,gWireLinkPrtType) ); //=== Slots Configuration =========================================================== // // gProductId.1.(0...(nsR-1)) --> Products Ids used in this Device // gProductName.i --> Products Names // gProductHwVers.i --> Products HardWare Versions // gWireLinkPrtType.i --> Products WireLink Ports Types (for the UDP devices) // //=================================================================================== nProducts = getVarLength(gProductId.1); // Number of Entries in the "products.txt" file // nProducts = (nProducts - 1); // ykfix90 - 12.04.07 (I do not need it now) fileName = "@terescoj\\prttypes.txt"; // ykfix64 - 26.11.03 (unnecessary '\' symbol was removed) open(@iswitch\ld_vars(fileName,gWrLnkPortId,gWrLnkPortName) ); //=== Slots Configuration =========================================================== // // gWrLnkPortId.1.(0...(nsR-1)) --> Product's Types Id-s used in this Device // gWrLnkPortName.i --> Product's Types Descriptions // //=================================================================================== nPrtTypes = getVarLength(gWrLnkPortId.1); // Number of Entries in the "prttypes.txt" file // nPrtTypes = (nPrtTypes - 1); // ykfix90 - 12.04.07 (I do not need it now) // ykfix61 - 22.09.03 - end // --- GET OID -------------------------- enterprise = send(GET [sysObjectID]); ver_type = 0; call(verify_device_type); // -------------------------------------- // varreqOpen.0 = ""; // for Initialization purpouses // varrespOpen.0 = ""; // for Initialization purpouses // ykfix55 - 16.03.03 - begin ( I put this code in the "LOAD" block) // ----- Get Thresholds from the file ---------------------------------------- // to do it once either in the OPEN Block or in the POLLING Block // if (rdThreshFile == 1) // { // rdThreshFile = 0; // call(LOAD_THRESHOLDS); // } // end of ( (rdThreshFile == 1) ) // ykfix55 - 16.03.03 - end // ykfix51 - 9.10.02 - begin // Read 'TSJDEVLOGMODE' from the Device Params - start //--------------------------------------------------- getDeviceParam(TSJDEVLOGMODE logMode.0 INTEGER); // get GLOBAL Device VAR { ; } // end of ( getDeviceParam(TSJDEVLOGMODE ... ...) ) else // GLOBAL Device VAR is absent { logMode.0 = 0; // "Save Parameters in LOG file" Mode (0-stop, 1-start) setDeviceParam(TSJDEVLOGMODE logMode.0 INTEGER); // save GLOBAL Device VAR } // end of ( !getDeviceParam(TSJDEVLOGMODE ... ...) ) // Read 'TSJDEVLOGMODE' from the Device Params - end //-------------------------------------------------- // Read 'TSJDEVCOLTIME' from the Device Params - start //---------------------------------------------------- getDeviceParam(TSJDEVCOLTIME colectTime.0 INTEGER); // get GLOBAL Device VAR { ; } // end of ( getDeviceParam(TSJDEVCOLTIME ... ...) ) else // GLOBAL Device VAR is absent { colectTime.0 = 0; // "Data Collection Time" value (in seconds) setDeviceParam(TSJDEVCOLTIME colectTime.0 INTEGER); // save GLOBAL Device VAR } // end of ( !getDeviceParam(TSJDEVCOLTIME ... ...) ) // Read 'TSJDEVCOLTIME' from the Device Params - end //-------------------------------------------------- temp.0 = getRootDir(); logFileName.0 = "\temp\data\\\DeviceName.log"; logVar.0 = (logMode.0); // [LOG_Mode] logVar.1 = (colectTime.0); // [LOG_CollectionTime] logVar.2 = "\logFileName.0"; // [LOG_FileName] if ((logMode.0) == 0) // "Save Parameters in LOG file" Mode (0-stop, 1-start) { showControls(DISABLE /1503>1504); // "LOG file name" Group of controls } // end of ( ((logMode.0) == 0) ) else { showControls(ENABLE /1503>1504); // "LOG file name" Group of controls } // end of ( ((logMode.0) == 0) ) // showControls(DISABLE /1505); // "Change Logging Parameters" Button (I do it on the beginning - (ykfix70 - 19.01.05)) LoggingParams = logVar; // ykfix51 - 9.10.02 - end :START; // Get General Device Parameters : // ----- Product Type ------------ temp = send(GET TER_ProductType); { temp.0 = 0; } // end of ( send(GET...) ) // ykfix90 - 11.04.07 - begin (I am fixing the Agent's Bug, that responds Negative values for all 'Product types' more than 127) if ((temp.0) < 0) { temp.0 = (256 + (temp.0)); } // end of ( ((temp.0) < 0) ) // ykfix90 - 11.04.07 - end // ykfix61 - 22.09.03 - begin id = (temp.0); if ((id <= nProducts)& && (id >= 1)) { varGenParams.0 = var2str(TER_ProductTypeTXT gProductName.(id-1)); // [TER_ProductTypeTXT] } // end of ( ((id <= nProducts)&&(id >= 1)) ) else { varGenParams.0 = "Unknown"; } // end of ( ((id > nProducts)||(id < 1)) ) // ykfix61 - 22.09.03 - end // ykfix65 - 23.02.04 - end if (((id >= 41)& // for all TS4000 & TS5000 Terescope Devices Types && (id <= 42))& || ((id >= 48)& && (id <= 63))& || ((id >= 66)& && (id <= 81))& || ((id >= 84)& && (id <= 87))) { // setBitmap(/1001 BMP_TS5000_16); setBitmap(/1001 BMP_TS5000); } else // for all other Terescope Devices Types { setBitmap(/1001 BMP_TER_PICT); } showControls(SHOW /1001); // for no Blink with white // ykfix65 - 23.02.04 - end // ----- MAC Address ------------- temp = send(GET TER_MAC_Address); { temp.0 = 0,0,0,0,0,0; // ykfix64 - 3.12.03 } // end of ( send(GET...) ) varGenParams.1.0 = (temp.0.0); // [TER_MAC_Address] varGenParams.1.1 = (temp.0.1); // [TER_MAC_Address] varGenParams.1.2 = (temp.0.2); // [TER_MAC_Address] varGenParams.1.3 = (temp.0.3); // [TER_MAC_Address] varGenParams.1.4 = (temp.0.4); // [TER_MAC_Address] varGenParams.1.5 = (temp.0.5); // [TER_MAC_Address] // ----- IP Address -------------- temp = send(GET TER_IP_Address); { temp.0 = 0,0,0,0; // ykfix64 - 3.12.03 } // end of ( send(GET...) ) varGenParams.2.0 = (temp.0.0); // [TER_IP_Address] varGenParams.2.1 = (temp.0.1); // [TER_IP_Address] varGenParams.2.2 = (temp.0.2); // [TER_IP_Address] varGenParams.2.3 = (temp.0.3); // [TER_IP_Address] // ----- Communication_Mode ------ temp = send(GET TER_Comm_Mode); { temp.0 = 1; } // end of ( send(GET...) ) // ykfix89 - 15.02.07 - begin if (UserType == 1) // 1=SUPERVISOR { if (((temp.0) != 1)&&((temp.0) != 2)) { send(SET TER_Comm_Mode 0 1); // 1=LAN_mode { showMessage("Error occures by SETting \n& the Communication Mode [LAN_Mode] \n& in the \DeviceName Device"); goto(CONTINUEGETGATEWAY); } // end of ( send(SET...) ) temp = send(GET TER_Comm_Mode); { temp.0 = 1; } // end of ( send(GET...) ) } // end of ( (((temp.0) != 1)&&((temp.0) != 2)) ) } // end of ( (UserType == 1) ) // ykfix89 - 15.02.07 - end varGenParams.3= (temp.0); // [TER_Comm_Mode] :CONTINUEGETGATEWAY; // ----- GATEWAY Address --------- temp = send(GET TER_GateWay); { temp.0 = 0,0,0,0; // ykfix64 - 3.12.03 } // end of ( send(GET...) ) varGenParams.4.0 = (temp.0.0); // [TER_GateWay] varGenParams.4.1 = (temp.0.1); // [TER_GateWay] varGenParams.4.2 = (temp.0.2); // [TER_GateWay] varGenParams.4.3 = (temp.0.3); // [TER_GateWay] // ----- SoftWare Version -------- temp = send(GET TER_SW_Version); { temp.0 = 0; } // end of ( send(GET...) ) varGenParams.5= (temp.0); // [TER_SW_Version] swVers = (temp.0); // [TER_SW_Version] (ykfix66 - 28.07.04) // ----- HardWare Version -------- temp = send(GET TER_HW_Version); { temp.0 = 0; } // end of ( send(GET...) ) // ykfix90 - 11.04.07 - begin (I am fixing the Agent's Bug, that responds Negative values for all 'Product types' more than 127) if ((temp.0) < 0) { temp.0 = (256 + (temp.0)); } // end of ( ((temp.0) < 0) ) // ykfix90 - 11.04.07 - end // ykfix61 - 22.09.03 - begin id = (temp.0); if ((id <= nProducts)& && (id >= 1)) { varGenParams.6 = var2str(TER_HW_VersionTXT gProductHwVers.(id-1)); // [TER_HW_VersionTXT] } // end of ( ((id <= nProducts)&&(id >= 1)) ) else { varGenParams.6 = "Unknown"; } // end of ( ((id > nProducts)||(id < 1)) ) // ykfix61 - 22.09.03 - end // ----- WireLink Port Type ------ temp = send(GET TER_WireLinkPort); { temp.0 = 0; } // end of ( send(GET...) ) // ykfix61 - 22.09.03 - begin id = (temp.0); if ((id <= nPrtTypes)& && (id >= 1)) { // ykfix66 - 28.07.04 - begin if (id == 6) // WireLink Port Type is "4E1/4T1" { wrLinkLabel = 0; // 0=hiddenLine } // end of ( (id == 6) ) else { if ((id == 1)& // WireLink Port Type is "E1/T1" || (id == 2)) // WireLink Port Type is "Ethernet_10baseT" { wrLinkLabel= 2; // 2="Electrical Flag :" } // end of ( ((id == 1)||(id == 2)) ) else { wrLinkLabel= 1; // 1="F/O Flag :" } // end of ( ((id != 1)&&(id != 2)) ) } // end of ( (id != 6) ) // ykfix66 - 28.07.04 - end varGenParams.7 = var2str(TER_WireLinkPortTXT gWrLnkPortName.(id-1)); // [TER_WireLinkPortTXT] } // end of ( ((id <= nPrtTypes)&&(id >= 1)) ) else { varGenParams.7 = "Unknown"; } // end of ( ((id > nPrtTypes)||(id < 1)) ) // ykfix61 - 22.09.03 - end // ------------------------------- // varGenParams = send(GET TER_Gen_Params); // { // varGenParams.0 = 0; // [TER_ProductType] // varGenParams.1 = 0,0,0,0,0,0; // [TER_MAC_Address] // varGenParams.2 = 0,0,0,0; // [TER_IP_Address] // varGenParams.3 = 1; // [TER_Comm_Mode] // varGenParams.4 = 0,0,0,0; // [TER_GateWay] // varGenParams.5 = 0; // [TER_SW_Version] // varGenParams.6 = 0; // [TER_HW_Version] // varGenParams.7 = 0; // [TER_WireLinkPort] // } // isSimulation() // { // varGenParams.1 = str2var(TER_MAC_Address varGenParams.1); // } TER_Gen_ParamsTXT = varGenParams; // ykfix61 - 22.09.03 // ----- Rx Signal Strength Indication (RSSI) [Byte#0] ----------------------- // ----- BIAS [Byte#1] ----------------------- // ----- TEMPERATURE [Byte#2] ----------------------- // ----- Application Status [Byte#3 - Bits ## : 1,2,3,4,5] - (ykfix66 - 28.07.04) // --------------------------------------------------------------------------- // | Bits Positions | | | | | | | | || | | | | | | | || | | // | in the | 0| 1| 2| 3| 4| 5| 6| 7|| 8| 9|10|11|12|13|14|15||.....| // | OCTET STRING | | | | | | | | || | | | | | | | || | | // +-----------------+--+--+--+--+--+--+--+--++--+--+--+--+--+--+--+--++--+--+ // | Bits Positions | | | | | | | | || | | | | | | | || | | // | in coresp. Byte | 7| 6| 5| 4| 3| 2| 1| 0|| 7| 6| 5| 4| 3| 2| 1| 0||.....| // | in the NUMBER | | | | | | | | || | | | | | | | || | | // --------------------------------------------------------------------------- varCommStat.2 = 0; // [TER_RFLinkStatus] (0=Unsupported, 1=Up, 2=Down) (ykfix66 - 28.07.04) // ykfix55 - 12.03.02 - begin isSimulation() // Simulation Mode { temp = send(GET [oaJTerCommRSSI]); currRSSI = (temp.0); temp = send(GET [oaJTerCommBIAS]); currBIAS = (temp.0); temp = send(GET [oaJTerCommInternalTemp]); currTEMP_K = (temp.0); currTEMP_C = (currTEMP_K - 273); temp = send(GET [oaJTerCommAll]); // to get only 3-d byte: WireLink(Bit#2) & AirLink(Bit#1) & LoopbackWorkingMode(Bit#3) & RfLink Mode(Bit#4) (ykfix66 - 28.07.04) } // end of ( isSimulation() ) else // Real Mode { varPollParams= send(GET [oaJTerCommAll]); { varPollParams.0 = 0,0,0,4; // '11100000'=224, '11100001'=225, '11100010'=226 (ykfix64 - 3.12.03) // '11100011'=227, '11100100'=228, '11100101'=229 // '11100110'=230, '11100111'=231, '00000100'=4 } // end of ( send(GET...) ) temp.0 = 0; temp.0.0 = (varPollParams.0.3); // currBIAS = (((varPollParams.0.1) * 1000 * 54) / 255); currBIAS = (((varPollParams.0.1) * 54) / 255); // I was asked to show BIAS in [Volts] // ykfix66 - 28.07.04 - begin // Temperature formula was changed for the new SwVersions! if (swVers <= 102) { currTEMP_K = (((varPollParams.0.2) * 100 * 5) / 255); currTEMP_C = (currTEMP_K - 273); } else // swVers > 102 { currTEMP_C = ((((varPollParams.0.2) * 250) / 256) - 50); currTEMP_K = (currTEMP_C + 273); } // ykfix66 - 28.07.04 - end isBit(temp.0 2) // 1=Low Resolution (0 - 14000 mV) (Bit#5 in the 1-st Byte of the Number ==> Bit#2 in the OctetString) { // currRSSI = (((varPollParams.0.0) * 1000 * 13) / 255); // ykfix51 - 8.08.02 currRSSI = (((varPollParams.0.0) * 100 * 13) / 255); // ykfix51 - 8.08.02 } else // 0=High Resolution, (0 - 1000 mV) { // currRSSI = (((varPollParams.0.0) * 1000 * 1) / 255); // ykfix51 - 8.08.02 currRSSI = (((varPollParams.0.0) * 100 * 1) / 255); // ykfix51 - 8.08.02 } } // end of ( !isSimulation() ) // ykfix55 - 12.02.03 - end varPhysStat.0 = currRSSI; varPhysStat.1 = currBIAS; varPhysStat.2 = currTEMP_K; varPhysStat.3 = currTEMP_C; TER_Current_Params = varPhysStat; // ykfix66 - 28.07.04 - begin (I have replaced the Words "Up","Down" with corresponding GREEN or RED LEDs Bitmaps) // TER_Communication_Params = varCommStat; isBit(temp.0 5) // (Bit#2 in the 1-st Byte of the Number ==> Bit#5 in the OctetString) { varCommStat.0= 1; // [TER_WireLinkStatus] (1=Up, 2=Down) setBitmap(/1202 BMP_LED_G); } else { varCommStat.0= 2; // [TER_WireLinkStatus] (1=Up, 2=Down) setBitmap(/1202 BMP_LED_R); } isBit(temp.0 6) // (Bit#1 in the 1-st Byte of the Number ==> Bit#6 in the OctetString) { varCommStat.1= 1; // [TER_AirLinkStatus] (1=Up, 2=Down) setBitmap(/1203 BMP_LED_G); } else { varCommStat.1= 2; // [TER_AirLinkStatus] (1=Up, 2=Down) setBitmap(/1203 BMP_LED_R); } if (wrLinkLabel == 0) // 0=hiddenLine { showControls(HIDE /202,1202); // "Wire Link" Label and Status LED } else { showControls(SHOW /202,1202); // "Wire Link" Label and Status LED } TER_WireLinkLabel= wrLinkLabel; // "Wire Link" Label is 0="-", 1="F/O Flag", 2="Electrical Flag :" showControls(SHOW /203,1203); // Air RX Flag" Label and Status LED if (swVers > 102) { isBit(temp.0 3) // (Bit#4 in the 1-st Byte of the Number ==> Bit#3 in the OctetString) { varCommStat.2= 1; // [TER_RFLinkStatus] (1=Active, 2=Passive) } else { varCommStat.2= 2; // [TER_RFLinkStatus] (1=Active, 2=Passive) } // ykfix70 - 21.12.04 - begin isBit(temp.0 1) // (Bit#6 in the 1-st Byte of the Number ==> Bit#1 in the OctetString) { slaveRemoteLB= 1; // "Slave Remote Loopback" Mode (0=disabled, 1=enable) } else { slaveRemoteLB= 0; // "Slave Remote Loopback" Mode (0=disabled, 1=enable) } // ykfix70 - 21.12.04 - end isBit(temp.0 4) // (Bit#3 in the 1-st Byte of the Number ==> Bit#4 in the OctetString) { lbWorkMode = 1; // 0=Change Mode Select Status and Fusion Mode only via HW switch, 1=Mode Select Status and Fusion Mode can be changed via NMS - (ykfix65 - 30.03.04) // ykfix70 - 21.12.04 - begin if (slaveRemoteLB == 0) // "Slave Remote Loopback" Mode (0=disabled) - Old Sw Versions { TER_DevWorkMode1 = "Mode Select Status and Fusion Mode"; TER_DevWorkMode2 = "can be changed via NMS !"; } // end of ( (slaveRemoteLB == 0) ) else // "Slave Remote Loopback" Mode (1=enabled) - New Sw Versions { TER_DevWorkMode1 = "Mode Select Status controlled at Remote Unit."; TER_DevWorkMode2 = "Fusion Mode can be changed via NMS!"; } // end of ( (slaveRemoteLB == 1) ) // ykfix70 - 21.12.04 - end } else { lbWorkMode = 0; // 0=Change Mode Select Status and Fusion Mode only via HW switch, 1=Mode Select Status and Fusion Mode can be changed via NMS - (ykfix65 - 30.03.04) // ykfix70 - 21.12.04 - begin if (slaveRemoteLB == 0) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { TER_DevWorkMode1 = "Mode Select Status and Fusion Mode can be"; TER_DevWorkMode2 = "changed via Hardware Switches on Terescope!"; } // end of ( (slaveRemoteLB == 0) ) else // "Slave Remote Loopback" Mode (1=enabled) - New Sw Versions { TER_DevWorkMode1 = "Mode Select Status controlled at Remote Unit."; TER_DevWorkMode2 = "Terescope is under Hardware control!"; } // end of ( (slaveRemoteLB == 1) ) // ykfix70 - 21.12.04 - end } temp = send(GET [oaJTerCommLoopbackStatus]); { temp.0 = 0; // 0=Unsupported } varCommStat.3= (temp.0); // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) TER_ModeSelectStat= temp.0; // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) temp = send(GET [oaJTerCommFusionMode]); { temp.0 = 0; // 0=Unsupported } varCommStat.4= (temp.0); // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) TER_FusionMode= temp.0; // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) if ((varCommStat.4) == 2) // [oaJTerCommFusionMode] (2=Enable) { if ((varCommStat.2) == 1) // [TER_RFLinkStatus] (1=Active) { setBitmap(/1208 BMP_LED_G); // GREEN LED } // end of ( ((varCommStat.2) == 1) ) else // [TER_RFLinkStatus] (2=Passive) { setBitmap(/1208 BMP_LED_B); // BLACK LED } // end of ( ((varCommStat.2) != 1) ) } // end of ( ((varCommStat.4) == 2) ) else // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable) { setBitmap(/1208 BMP_LED_D); // GREY LED } // end of ( ((varCommStat.4) != 2) ) if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { // ykfix70 - 19.01.05 - begin if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) else // Fusion Status is Active { showControls(DISABLE /1114); // Mode Select Status "Config" Button } // end of ( ((((varCommStat.4) != 1)&&(((varCommStat.4) != 2)||((varCommStat.2) != 2)))||(slaveRemoteLB == 1)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) // ykfix70 - 19.01.05 - end } // end of ( (lbWorkMode == 1) ) else // 0=Change Mode Select Status and Fusion Mode only via HW switch { showControls(DISABLE /1114,1115); // "Config" Buttons } // end of ( (lbWorkMode != 1) ) // ykfix70 - 18.01.05 - begin // ykfix71 - 26.01.05 - begin temp = send(GET [oaJTerCommPS1State]); // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) { temp.0 = 0; // [oaJTerCommPS1State] (0=Unsupported) } varCommStat.5= (temp.0); // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) // ykfix71 - 26.01.05 - end if ((varCommStat.5) == 0) // [oaJTerCommPS1State] (0=Unsupported) { showControls(HIDE /1116); } // end of ( ((varCommStat.5) == 0) ) else { if ((varCommStat.5) == 2) // [oaJTerCommPS1State] (2=up) { setBitmap(/1116 BMP_PS_UP); // "PS Active" Bitmap } // end of ( ((varCommStat.5) == 2) ) else // [oaJTerCommPS1State] (1=down) { setBitmap(/1116 BMP_PS_DN); // "PS Not Act" Bitmap } // end of ( ((varCommStat.5) == 1) ) showControls(SHOW /1116); } // end of ( ((varCommStat.5) != 0) ) // ykfix71 - 26.01.05 - begin temp = send(GET [oaJTerCommPS2State]); // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) { temp.0 = 0; // [oaJTerCommPS2State] (0=Unsupported) } varCommStat.6= (temp.0); // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) // ykfix71 - 26.01.05 - end if ((varCommStat.6) == 0) // [oaJTerCommPS2State] (0=Unsupported) { showControls(HIDE /1117); } // end of ( ((varCommStat.6) == 0) ) else { if ((varCommStat.6) == 2) // [oaJTerCommPS2State] (2=up) { setBitmap(/1117 BMP_PS_UP); // "PS Active" Bitmap } // end of ( ((varCommStat.6) == 2) ) else // [oaJTerCommPS2State] (1=down) { setBitmap(/1117 BMP_PS_DN); // "PS Not Act" Bitmap } // end of ( ((varCommStat.6) == 1) ) showControls(SHOW /1117); } // end of ( ((varCommStat.6) != 0) ) // ykfix71 - 26.01.05 - begin temp = send(GET [oaJTerCommWindowHeatingMode]); // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) { temp.0 = 0; // [oaJTerCommWindowHeatingMode] (0=Unsupported) } varCommStat.7= (temp.0); // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) // ykfix71 - 26.01.05 - end if ((varCommStat.7) == 0) // [oaJTerCommWindowHeatingMode] (0=Unsupported) { showControls(HIDE /1118); } // end of ( ((varCommStat.7) == 0) ) else { if ((varCommStat.7) == 2) // [oaJTerCommWindowHeatingMode] (2=on) { setBitmap(/1118 BMP_HEAT_UP); // "Front Window Heating" Bitmap } // end of ( ((varCommStat.7) == 2) ) else // [oaJTerCommWindowHeatingMode] (1=off) { setBitmap(/1118 BMP_HEAT_DN); // "Front Window no Heating" Bitmap } // end of ( ((varCommStat.7) == 1) ) showControls(SHOW /1118); } // end of ( ((varCommStat.7) != 0) ) // ykfix70 - 18.01.05 - end showControls(SHOW /204,207>208,1114,1115,1204>1208); // "Mode Select Status","Fusion Mode","Fusion Status" only for the swVers > 102 } // end of ( (swVers > 102) ) // ykfix66 - 28.07.04 - end i=for(0>(maxv-1)) { Spidometers.i= 0; // 0=unChecked Graphs.i = 0; // 0=unChecked } // end of ( for(0>(maxv-1)) ) // --- Put Thresholds on the Controls --- TER_MinRSSI = (threshMin.0); // 'Minimum' Threshold Value TER_MaxRSSI = (threshMax.0); // 'Maximum' Threshold Value TER_MinBIAS = (threshMin.1); // 'Minimum' Threshold Value TER_MaxBIAS = (threshMax.1); // 'Maximum' Threshold Value TER_MinTemp_K = (threshMin.2); // 'Minimum' Threshold Value (ykfix55 - 11.02.03) TER_MaxTemp_K = (threshMax.2); // 'Maximum' Threshold Value (ykfix55 - 11.02.03) TER_MinTemp_C = (threshMin.3); // 'Minimum' Threshold Value (ykfix55 - 11.02.03) TER_MaxTemp_C = (threshMax.3); // 'Maximum' Threshold Value (ykfix55 - 11.02.03) // showControls(SHOW 1101>1110); // for no Blink with white // ykfix61 - 22.09.03 - begin if ((temperatureUnit.0) == 1) // 1=Celsius { showControls(DISABLE /403,413,1303); showControls(ENABLE /404>405,414>415,1304); } // end of ( ((temperatureUnit.0) == 1) ) else // 2=Kelvin { showControls(ENABLE /403,413,1303); showControls(DISABLE /404>405,414>415,1304); } // end of ( ((temperatureUnit.0) == 2) ) // ykfix61 - 22.09.03 - end // ykfix70 - 19.01.05 - begin if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) // ykfix70 - 19.01.05 - end showControls(ENABLE /2200>2202,2300>2302); // ykfix70 - 19.01.05 setTitle("TERESCOPE Devices Family: \DeviceName IP=\ipAddress"); openvar = 0; goto(FIRSTP); } doWhen(POLL) { if (loadvar) { quit; } // ykfix55 - 16.03.03 - begin ( I put this code in the "LOAD" block) // ----- Get Thresholds from the file ---------------------------------------- // to do it once or in the OPEN Block or in the POLLING Block // if (rdThreshFile == 1) // only by Adding the new Device on the Map // { // rdThreshFile = 0; // call(LOAD_THRESHOLDS); // } // end of ( (rdThreshFile == 1) ) // ykfix55 - 16.03.03 - end // ykfix55 - 6.02.03 - begin if (commOK) { // ----- Rx Signal Strength Indication (RSSI) [Byte#0] ----------------------- // ----- BIAS [Byte#1] ----------------------- // ----- TEMPERATURE [Byte#2] ----------------------- // ----- Application Status [Byte#3 - Bits ## : 1,2,3,4,5] - (ykfix66 - 28.07.04) // --------------------------------------------------------------------------- // | Bits Positions | | | | | | | | || | | | | | | | || | | // | in the | 0| 1| 2| 3| 4| 5| 6| 7|| 8| 9|10|11|12|13|14|15||.....| // | OCTET STRING | | | | | | | | || | | | | | | | || | | // +-----------------+--+--+--+--+--+--+--+--++--+--+--+--+--+--+--+--++--+--+ // | Bits Positions | | | | | | | | || | | | | | | | || | | // | in coresp. Byte | 7| 6| 5| 4| 3| 2| 1| 0|| 7| 6| 5| 4| 3| 2| 1| 0||.....| // | in the NUMBER | | | | | | | | || | | | | | | | || | | // --------------------------------------------------------------------------- varCommStat.2= 0; // [TER_RFLinkStatus] (0=Unsupported, 1=Up, 2=Down) (ykfix66 - 28.07.04) // ykfix54 - 4.12.02 - begin isSimulation() // Simulation Mode { temp = send(GET [oaJTerCommRSSI]); currRSSI = (temp.0); temp = send(GET [oaJTerCommBIAS]); currBIAS = (temp.0); temp = send(GET [oaJTerCommInternalTemp]); currTEMP_K = (temp.0); currTEMP_C = (currTEMP_K - 273); temp = send(GET [oaJTerCommAll]); // to get only 3-d byte: WireLink(Bit#2) & AirLink(Bit#1) & LoopbackWorkingMode(Bit#3) (ykfix65 - 30.03.04) } // end of ( isSimulation() ) else // Real Mode { varPollParams = send(GET [oaJTerCommAll]); { varPollParams.0 = 0,0,0,4; // '11100000'=224, '11100001'=225, '11100010'=226 (ykfix64 - 3.12.03) // '11100011'=227, '11100100'=228, '11100101'=229 // '11100110'=230, '11100111'=231, '00000100'=4 } // end of ( send(GET ...) ) temp.0 = 0; temp.0.0 = (varPollParams.0.3); // currBIAS = (((varPollParams.0.1) * 1000 * 54) / 255); currBIAS = (((varPollParams.0.1) * 54) / 255); // I was asked to show BIAS in [Volts] // ykfix66 - 28.07.04 - begin // Temperature formula was changed for the new SwVersions! if (swVers <= 102) { currTEMP_K = (((varPollParams.0.2) * 100 * 5) / 255); currTEMP_C = (currTEMP_K - 273); } else // swVers > 102 { currTEMP_C = ((((varPollParams.0.2) * 250) / 256) - 50); currTEMP_K = (currTEMP_C + 273); } // ykfix66 - 28.07.04 - end isBit(temp.0 2) // 1=Low Resolution (0 - 14000 mV) (Bit#5 in the 1-st Byte of the Number ==> Bit#2 in the OctetString) { // currRSSI = (((varPollParams.0.0) * 1000 * 13) / 255); // ykfix51 - 8.08.02 currRSSI = (((varPollParams.0.0) * 100 * 13) / 255); // ykfix51 - 8.08.02 } else // 0=High Resolution, (0 - 1000 mV) { // currRSSI = (((varPollParams.0.0) * 1000 * 1) / 255); // ykfix51 - 8.08.02 currRSSI = (((varPollParams.0.0) * 100 * 1) / 255); // ykfix51 - 8.08.02 } } // end of ( !isSimulation() ) // ykfix54 - 4.12.02 - end varPhysStat.0= currRSSI; varPhysStat.1= currBIAS; varPhysStat.2= currTEMP_K; varPhysStat.3= currTEMP_C; // ykfix66 - 28.07.04 - begin isBit(temp.0 5) // (Bit#2 in the 1-st Byte of the Number ==> Bit#5 in the OctetString) { varCommStat.0= 1; // [TER_WireLinkStatus] (1=Up, 2=Down) } else { varCommStat.0= 2; // [TER_WireLinkStatus] (1=Up, 2=Down) } isBit(temp.0 6) // (Bit#1 in the 1-st Byte of the Number ==> Bit#6 in the OctetString) { varCommStat.1= 1; // [TER_AirLinkStatus] (1=Up, 2=Down) } else { varCommStat.1= 2; // [TER_AirLinkStatus] (1=Up, 2=Down) } // ykfix55 - 6.02.03 - end if (swVers > 102) { isBit(temp.0 3) // (Bit#4 in the 1-st Byte of the Number ==> Bit#3 in the OctetString) { varCommStat.2= 1; // [TER_RFLinkStatus] (1=Active, 2=Passive) } else { varCommStat.2= 2; // [TER_RFLinkStatus] (1=Active, 2=Passive) } // ykfix70 - 21.12.04 - begin isBit(temp.0 1) // (Bit#6 in the 1-st Byte of the Number ==> Bit#1 in the OctetString) { slaveRemoteLB= 1; // "Slave Remote Loopback" Mode (0=disabled, 1=enable) } else { slaveRemoteLB= 0; // "Slave Remote Loopback" Mode (0=disabled, 1=enable) } // ykfix70 - 21.12.04 - end isBit(temp.0 4) // (Bit#3 in the 1-st Byte of the Number ==> Bit#4 in the OctetString) { lbWorkMode = 1; // 0=Change Mode Select Status and Fusion Mode only via HW switch, 1=Mode Select Status and Fusion Mode can be changed via NMS - (ykfix65 - 30.03.04) } else { lbWorkMode = 0; // 0=Change Mode Select Status and Fusion Mode only via HW switch, 1=Mode Select Status and Fusion Mode can be changed via NMS - (ykfix65 - 30.03.04) } temp = send(GET [oaJTerCommLoopbackStatus]); { temp.0 = 0; // 0=Unsupported } varCommStat.3= (temp.0); // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) temp = send(GET [oaJTerCommFusionMode]); { temp.0 = 0; // 0=Unsupported } varCommStat.4= (temp.0); // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) // ykfix71 - 26.01.05 - begin temp = send(GET [oaJTerCommPS1State]); // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) { temp.0 = 0; // [oaJTerCommPS1State] (0=Unsupported) } varCommStat.5= (temp.0); // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) temp = send(GET [oaJTerCommPS2State]); // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) { temp.0 = 0; // [oaJTerCommPS2State] (0=Unsupported) } varCommStat.6= (temp.0); // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) temp = send(GET [oaJTerCommWindowHeatingMode]); // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) { temp.0 = 0; // [oaJTerCommWindowHeatingMode] (0=Unsupported) } varCommStat.7= (temp.0); // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) // ykfix71 - 26.01.05 - end } // end of ( (swVers > 102) ) // ykfix66 - 28.07.04 - end // ykfix55 - 25.03.03 - begin currReqTime.0= nmsTime; // in Seconds (ykfix55 - 6.02.03) if (((logMode.0) == 1)& // "Save Parameters in LOG file" Mode (0-stop, 1-start) && ((colectTime.0) != 0)) // "Data Collection Time" value (in seconds) { if (pollInterval >= (colectTime.0)) { commDownTime = (3 * pollInterval); } // end of ( (pollInterval >= (colectTime.0)) ) else { commDownTime = (3 * (colectTime.0)); } // end of ( (pollInterval < (colectTime.0)) ) if (commDownTime < ((currReqTime.0) - (startReqTime.0))) // Time's Delta exceeds the "Data Collection Time" value (ykfix55 - 6.02.03) { if (printFlag == 0) // 0=notPrint (ykfix55 - 25.03.03) { printFlag = (printFlag + 1); } // end of ( (printFlag == 0) ) else // 1=print (ykfix55 - 25.03.03) { devLogLine.0= "--- SNMP communication was Down ------------------------------------"; writeToDeviceLog("\devLogLine.0"); } // end of ((printFlag != 0) ) } // end of ( (commDownTime < ((currReqTime.0) - (startReqTime.0))) ) if ((colectTime.0) <= ((currReqTime.0) - (startReqTime.0))) // Time's Delta exceeds the "Data Collection Time" value (ykfix55 - 6.02.03) { // To write Data into the Device's LOG file //----------------------------------------- devLogLine.0= ""; // temp1.0 = convertTime(currtime.0 FULL);// 'currenttime' in TEXT format ("DDD MMM dd hh:mm:ss YYYY") // temp1.0.24 = 0; // I have to remove symbol on the end of this String tmp = (varCommStat.0); temp1.1 = getWord(tmp TER_WireLinkStatus); tmp = (varCommStat.1); temp1.2 = getWord(tmp TER_AirLinkStatus); // ykfix66 - 28.07.04 - begin if (swVers > 102) { tmp = (varCommStat.2); temp1.3 = getWord(tmp TER_FusionStatus);// [oaJTerCommFusionStatus] (0=Unsupported, 1=Active, 2=Passive) tmp = (varCommStat.3); temp1.4 = getWord(tmp TER_ModeSelectStat); // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) tmp = (varCommStat.4); temp1.5 = getWord(tmp TER_FusionMode); // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) if ((varCommStat.4) != 2) // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable) { temp1.3 = "Disabled"; } if (wrLinkLabel > 0) // 1="F/O Flag", 2="Electrical Flag" field { if (wrLinkLabel == 2) // 2="Electrical Flag" { t1 = "ElectricalFlag"; } else // 2="F/O Flag" { t1 = "F/O_Flag"; } devLogLine.0= ", RSSI=\currRSSI, Bias=\currBIAS, Temp[K]=\currTEMP_K, Temp[C]=\currTEMP_C, \t1=\temp1.1, AirRxFlag=\temp1.2, ModeSelStat=\temp1.4, FusionMode=\temp1.5, FusionStat=\temp1.3"; } // end of ( (wrLinkLabel > 0) ) else // 0=hiddenLine { devLogLine.0= ", RSSI=\currRSSI, Bias=\currBIAS, Temp[K]=\currTEMP_K, Temp[C]=\currTEMP_C, AirRxLink=\temp1.2, ModeSelStat=\temp1.4, FusionMode=\temp1.5, FusionStat=\temp1.3"; } // end of ( (wrLinkLabel <= 0) ) } // end of ( (swVers > 102) ) else // [oaJTerCommLoopbackStatus] (0=Unsupported) { devLogLine.0 = ", RSSI=\currRSSI, Bias=\currBIAS, Temp[K]=\currTEMP_K, Temp[C]=\currTEMP_C, WireLink=\temp1.1, AirLink=\temp1.2"; } // end of ( (swVers <= 102) ) // ykfix66 - 28.07.04 - begin writeToDeviceLog("\devLogLine.0"); startReqTime.0 = (currReqTime.0); // ykfix55 - 6.02.03 } // end of ( ((colectTime.0) <= ((currReqTime.0) - (startReqTime.0))) ) } // end of ( (((logMode.0) == 1)&&((colectTime.0) != 0)) ) // ykfix55 - 25.03.03 - end // Send Trap/Alarm messages to the ALARMS.LOG file //================================================ // Rising Alarms //-------------- if ((currRSSI > (threshMax.0))& && ((threshMax.0) != 0)) // this Alarm must be sent { // tmp = (threshMax.0); // ykfix51 - 9.10.02 alrMsg = "SignalStrength [\currRSSI] is more then Max Threshold [\threshMax.0] "; // ykfix51 - 9.10.02 sendAlarm(101 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currRSSI < (threshMax.0))&&((threshMax.0) != 0)) ) // ykfix66 - 28.07.04 - begin (now Agent supports BIAS correctly) if ((currBIAS > (threshMax.1))& && ((threshMax.1) != 0)) // this Alarm must be sent { // tmp = (threshMax.1); // ykfix51 - 9.10.02 alrMsg = "BIAS [\currBIAS] is more then Max Threshold [\threshMax.1] "; // ykfix51 - 9.10.02 sendAlarm(101 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currBIAS < (threshMax.1))&&((threshMax.1) != 0)) ) // ykfix66 - 28.07.04 - end if ((temperatureUnit.0) == 1) // "Temperature Unit of measurement" Mode (1=Celsius) { if ((currTEMP_C > (threshMax.3))& && ((threshMax.3) != -273)) // this Alarm must be sent { alrMsg = "TEMPERATURE [\currTEMP_C] is more then Max Threshold [\threshMax.3] "; // ykfix51 - 9.10.02 sendAlarm(101 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currTEMP_C > (threshMax.3))&&((threshMax.3) != 227)) ) } // end of ( ((temperatureUnit.0) == 1) ) else // "Temperature Unit of measurement" Mode (2=Kelvin) { if ((currTEMP_K > (threshMax.2))& && ((threshMax.2) != 0)) // this Alarm must be sent { alrMsg = "TEMPERATURE [\currTEMP_K] is more then Max Threshold [\threshMax.2] "; // ykfix51 - 9.10.02 sendAlarm(101 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currTEMP_K > (threshMax.2))&&((threshMax.2) != 0)) ) } // end of ( ((temperatureUnit.0) == 2) ) // ykfix55 - 16.03.03 - end // Falling Alarms //-------------- if ((currRSSI < (threshMin.0))& && ((threshMin.0) != 0)) // this Alarm must be sent { // tmp = (threshMin.0); // ykfix51 - 9.10.02 alrMsg = "SignalStrength [\currRSSI] is less then Min Threshold [\threshMin.0] "; // ykfix51 - 9.10.02 sendAlarm(102 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currRSSI < (threshMin.0))&&((threshMin.0) != 0)) ) // ykfix66 - 28.07.04 - begin (now Agent supports BIAS correctly) if ((currBIAS < (threshMin.1))& && ((threshMin.1) != 0)) // this Alarm must be sent { // tmp = (threshMin.1); // ykfix51 - 9.10.02 alrMsg = "BIAS [\currBIAS] is less then Min Threshold [\threshMin.1] "; // ykfix51 - 9.10.02 sendAlarm(102 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currBIAS < (threshMin.1))&&((threshMin.1) != 0)) ) // ykfix66 - 28.07.04 - end if ((temperatureUnit.0) == 1) // "Temperature Unit of measurement" Mode (1=Celsius) { if ((currTEMP_C < (threshMin.3))& && ((threshMin.3) != -273)) // this Alarm must be sent { alrMsg = "TEMPERATURE [\currTEMP_C] is less then Min Threshold [\threshMin.3] "; // ykfix51 - 9.10.02 sendAlarm(102 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currTEMP_C < (threshMin.3))&&((threshMin.3) != 0)) ) } // end of ( ((temperatureUnit.0) == 1) ) else // "Temperature Unit of measurement" Mode (2=Kelvin) { if ((currTEMP_K < (threshMin.2))& && ((threshMin.2) != 0)) // this Alarm must be sent { alrMsg = "TEMPERATURE [\currTEMP_K] is less then Min Threshold [\threshMin.2] "; // ykfix51 - 9.10.02 sendAlarm(102 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((currTEMP_K > (threshMin.2))&&((threshMin.2) != 0)) ) } // end of ( ((temperatureUnit.0) == 2) ) // ykfix55 - 16.03.03 - end // Air Link is Up / Down //----------------------- if (currAirLink != (varCommStat.1)) // this Alarm must be sent ([TER_AirLinkStatus] (1=Up, 2=Down)) { if ((varCommStat.1) == 1) // [TER_AirLinkStatus] (1=Up) { alrMsg = ""; sendAlarm(103 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.0) == 1) ) else // [TER_AirLinkStatus] (2=Down) { alrMsg = ""; sendAlarm(104 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.1) != 1) ) currAirLink = (varCommStat.1); } // end of ( (currAirLink != (varCommStat.1)) ) // Wire Link is Up / Down //----------------------- // ykfix66 - 28.07.04 - begin if (wrLinkLabel > 0) // 1="F/O Flag", 2="Electrical Flag" field { if (currWireLink != (varCommStat.0))// this Alarm must be sent ([TER_AirLinkStatus] (1=Up, 2=Down)) { alrMsg = ""; if (wrLinkLabel == 1) // 1="F/O Flag" field { alrMsg = "F/O Flag"; } if (wrLinkLabel == 2) // 2="Electrical Flag" field { alrMsg = "Electrical Flag"; } if ((varCommStat.0) == 1) // [TER_WireLinkStatus] (1=Up) { sendAlarm(105 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.0) == 1) ) else // [TER_WireLinkStatus] (2=Down) { sendAlarm(106 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.0) != 1) ) currWireLink= (varCommStat.0); } // end of ( (currWireLink != (varCommStat.0)) ) } // end of ( (wrLinkLabel > 0) ) if (swVers > 102) { // Loopback Status (Normal/Local/Remote) //-------------------------------------- if (((varCommStat.3) != 0)& // this Alarm must be sent (if Mode Select Status feature is Supported in the Agent) && ((varCommStat.3) != currLoopback))// ([oaJTerCommLoopbackStatus] (1=Normal, 2=LocalLoopback, 3=RemoteLoopback)) { tmp = (varCommStat.3); temp1.4 = getWord(tmp TER_ModeSelectStat); // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) alrMsg = "\temp1.4"; sendAlarm(107 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } currLoopback= (varCommStat.3); // 1=Normal, 2=LocalLoopback, 3=RemoteLoopback // Fusion Mode (Disable/Enable) //----------------------------- if (((varCommStat.4) != 0)& // this Alarm must be sent (if Fusion feature is Supported in the Agent) && ((varCommStat.4) != currFusion))// [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) { tmp = (varCommStat.4); temp1.5 = getWord(tmp TER_FusionMode); // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) alrMsg = "\temp1.5"; sendAlarm(108 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } currFusion = (varCommStat.4); // 0=Unsupported, 1=Disable, 2=Enable // Fusion Status (Active/Passive) //------------------------------- if (((varCommStat.2) != 0)& // this Alarm must be sent (if Mode Select Status feature is Supported in the Agent) && ((varCommStat.2) != currRfLink))// ([oaJTerCommFusionStatus] (1=Active, 2=Passive)) { if ((varCommStat.4) == 2) // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) { tmp = (varCommStat.2); temp1.3 = getWord(tmp TER_FusionStatus); // [oaJTerCommFusionStatus] (0=Unsupported, 1=Active, 2=Passive) alrMsg = "\temp1.3"; } // end of ( ((varCommStat.4) == 2) ) else { alrMsg = "Disabled"; } // end of ( ((varCommStat.4) != 2) ) sendAlarm(109 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } currRfLink = (varCommStat.2); // 1=Active, 2=Passive // ykfix70 - 18.01.05 - begin // Power Supply # 1 (Active/not Active) //------------------------------------- if (((varCommStat.5) != 0)& // this Alarm must be sent (if PS # 1 feature is Supported in the Agent) && ((varCommStat.5) != currPS1)) // [oaJTerCommPS1State] (0=Unsupported, 1=down, 2=up) { alrMsg = "Power Supply # 1"; if ((varCommStat.5) == 1) // [oaJTerCommPS1State] (1=Down) { sendAlarm(111 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.5) == 1) ) else // [oaJTerCommPS1State] (2=up) { sendAlarm(110 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.5) != 1) ) } currPS1 = (varCommStat.5); // 0=Unsupported, 1=down, 2=up // Power Supply # 2 (Active/not Active) //------------------------------------- if (((varCommStat.6) != 0)& // this Alarm must be sent (if PS # 1 feature is Supported in the Agent) && ((varCommStat.6) != currPS2)) // [oaJTerCommPS2State] (0=Unsupported, 1=down, 2=up) { alrMsg = "Power Supply # 2"; if ((varCommStat.6) == 1) // [oaJTerCommPS2State] (1=Down) { sendAlarm(111 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.6) == 1) ) else // [oaJTerCommPS2State] (2=up) { sendAlarm(110 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.6) != 1) ) } currPS2 = (varCommStat.6); // 0=Unsupported, 1=down, 2=up // Front Window Heating (turned on/turned off) //-------------------------------------------- if (((varCommStat.7) != 0)& // this Alarm must be sent (if Front Window Heating feature is Supported in the Agent) && ((varCommStat.7) != currHeatState)) // [oaJTerCommWindowHeatingMode] (0=Unsupported, 1=off, 2=on) { alrMsg = ""; if ((varCommStat.7) == 1) // [oaJTerCommWindowHeatingMode] (1=off) { sendAlarm(113 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.7) == 1) ) else // [oaJTerCommWindowHeatingMode] (2=on) { sendAlarm(112 1 alrMsg); // First# = Trap#, Second# means (0=GenericTrap, 1=SpecificTrap), Third = Alarm Message } // end of ( ((varCommStat.7) != 1) ) } currHeatState = (varCommStat.7); // 0=Unsupported, 1=off, 2=on // ykfix70 - 18.01.05 - end } // end of ( (swVers > 102) ) // ykfix66 - 28.07.04 - end // noPollCommFlg= 0; // ykfix61 - 7.10.03 } // end of ( (commOK) ) else // if Communication is Down { varCommStat.0= 2; // [TER_WireLinkStatus] (1=Up, 2=Down) varCommStat.1= 2; // [TER_AirLinkStatus] (1=Up, 2=Down) currRSSI = 0; currBIAS = 0; currTEMP_K = 0; currTEMP_C = (currTEMP_K - 273); varPhysStat.0= currRSSI; // [TER_RSSI] varPhysStat.1= currBIAS; // [TER_BIAS] varPhysStat.2= currTEMP_K; // [TER_Temperature_K] varPhysStat.3= currTEMP_C; // [TER_Temperature_C] } // end of ( (!commOK) ) // ykfix55 - 6.02.03 - end if (isWindowOpen) { // ykfix55 - 6.02.03 - begin if (loadvar) { quit; } // ykfix61 - 16.09.03 - begin (I do not need it now because of "TIMEOUT" Block) // if (noCommFlg) // { // quit; // } // ykfix61 - 16.09.03 - end if (openvar) { // ykfix61 - 16.09.03 - begin (I do not need it now because of "TIMEOUT" Block) // if ((openvar.0) >= 3) // { // breakFlag = 1; // } // end of ( ((openvar.0) >= 3) ) // openvar.0 = (openvar.0) + 1; // ykfix61 - 16.09.03 - end quit; } // end of ( (openvar) ) if (polvar) { // ykfix61 - 16.09.03 - begin (I do not need it now because of "TIMEOUT" Block) // if ((polvar.0) >= 3) // ykfix30 - 5.08.99 (I changed '3' on '4') // { // breakFlag = 1; // } // end of ( ((polvar.0) >= 3) ) // polvar.0 = (polvar.0) + 1; // ykfix61 - 16.09.03 - end quit; } // end of ( (polvar) ) // ykfix55 - 6.02.03 - end :FIRSTP; polvar = 1; // polling loop is working now TER_Current_Params = varPhysStat;// ykfix51 - 9.10.02 // ykfix66 - 28.07.04 - begin (I have replaced the Words "Up","Down" with corresponding GREEN or RED LEDs Bitmaps) // TER_Communication_Params = varCommStat;// ykfix51 - 9.10.02 if ((varCommStat.0) == 1) // [TER_WireLinkStatus] (1=Up) { setBitmap(/1202 BMP_LED_G); } else // [TER_WireLinkStatus] (2=Down) { setBitmap(/1202 BMP_LED_R); } if ((varCommStat.1) == 1) // [TER_AirLinkStatus] (1=Up) { setBitmap(/1203 BMP_LED_G); } else // [TER_AirLinkStatus] (2=Down) { setBitmap(/1203 BMP_LED_R); } if (swVers > 102) { TER_ModeSelectStat= varCommStat.3; // [oaJTerCommLoopbackStatus] (0=Unsupported, 1=Normal, 2=LocalLoopback, 3=RemoteLoopback) TER_FusionMode = varCommStat.4; // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable, 2=Enable) if ((varCommStat.4) == 2) // [oaJTerCommFusionMode] (2=Enable) { if ((varCommStat.2) == 1) // [TER_RFLinkStatus] (1=Active) { setBitmap(/1208 BMP_LED_G); // GREEN LED } // end of ( ((varCommStat.2) == 1) ) else // [TER_RFLinkStatus] (2=Passive) { setBitmap(/1208 BMP_LED_B); // BLACK LED } // end of ( ((varCommStat.2) != 1) ) } // end of ( ((varCommStat.4) == 2) ) else // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable) { setBitmap(/1208 BMP_LED_D); // GREY LED } // end of ( ((varCommStat.4) != 2) ) if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { // ykfix70 - 19.01.05 - begin if (slaveRemoteLB == 0) // "Slave Remote Loopback" Mode (0=disabled) - Old Sw Versions { TER_DevWorkMode1= "Mode Select Status and Fusion Mode"; TER_DevWorkMode2= "can be changed via NMS !"; } // end of ( (slaveRemoteLB == 0) ) else // "Slave Remote Loopback" Mode (1=enabled) - New Sw Versions { TER_DevWorkMode1= "Mode Select Status controlled at Remote Unit."; TER_DevWorkMode2= "Fusion Mode can be changed via NMS!"; } // end of ( (slaveRemoteLB == 1) ) if (subDscOpenFlag == 0) // 0=SubDescriptorClosed, 1=SubDescriptorOpened { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) else // Fusion Status is Active { showControls(DISABLE /1114); // Mode Select Status "Config" Button } // end of ( ((((varCommStat.4) != 1)&&(((varCommStat.4) != 2)||((varCommStat.2) != 2)))||(slaveRemoteLB == 1)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (subDscOpenFlag == 0) ) // ykfix70 - 19.01.05 - end } // end of ( (lbWorkMode == 1) ) else // 0=Change Mode Select Status and Fusion Mode only via HW switch { // ykfix70 - 21.12.04 - begin if (slaveRemoteLB == 0) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { TER_DevWorkMode1= "Mode Select Status and Fusion Mode can be"; TER_DevWorkMode2= "changed via Hardware Switches on Terescope!"; } // end of ( (slaveRemoteLB == 0) ) else // "Slave Remote Loopback" Mode (1=enabled) - New Sw Versions { TER_DevWorkMode1= "Mode Select Status controlled at Remote Unit."; TER_DevWorkMode2= "Terescope is under Hardware control!"; } // end of ( (slaveRemoteLB == 1) ) // ykfix70 - 21.12.04 - end showControls(DISABLE /1114,1115); // "Config" Buttons } // end of ( (lbWorkMode != 1) ) // ykfix70 - 18.01.05 - begin if ((varCommStat.5) == 0) // [oaJTerCommPS1State] (0=Unsupported) { showControls(HIDE /1116); } // end of ( ((varCommStat.5) == 0) ) else { if ((varCommStat.5) == 2) // [oaJTerCommPS1State] (2=up) { setBitmap(/1116 BMP_PS_UP); // "PS Active" Bitmap } // end of ( ((varCommStat.5) == 2) ) else // [oaJTerCommPS1State] (1=down) { setBitmap(/1116 BMP_PS_DN); // "PS Not Act" Bitmap } // end of ( ((varCommStat.5) == 1) ) showControls(SHOW /1116); } // end of ( ((varCommStat.5) != 0) ) if ((varCommStat.6) == 0) // [oaJTerCommPS2State] (0=Unsupported) { showControls(HIDE /1117); } // end of ( ((varCommStat.6) == 0) ) else { if ((varCommStat.6) == 2) // [oaJTerCommPS2State] (2=up) { setBitmap(/1117 BMP_PS_UP); // "PS Active" Bitmap } // end of ( ((varCommStat.6) == 2) ) else // [oaJTerCommPS2State] (1=down) { setBitmap(/1117 BMP_PS_DN); // "PS Not Act" Bitmap } // end of ( ((varCommStat.6) == 1) ) showControls(SHOW /1117); } // end of ( ((varCommStat.6) != 0) ) if ((varCommStat.7) == 0) // [oaJTerCommWindowHeatingMode] (0=Unsupported) { showControls(HIDE /1118); } // end of ( ((varCommStat.7) == 0) ) else { if ((varCommStat.7) == 2) // [oaJTerCommWindowHeatingMode] (2=on) { setBitmap(/1118 BMP_HEAT_UP); // "Front Window Heating" Bitmap } // end of ( ((varCommStat.7) == 2) ) else // [oaJTerCommWindowHeatingMode] (1=off) { setBitmap(/1118 BMP_HEAT_DN); // "Front Window no Heating" Bitmap } // end of ( ((varCommStat.7) == 1) ) showControls(SHOW /1118); } // end of ( ((varCommStat.7) != 0) ) // ykfix70 - 18.01.05 - end } // end of ( (swVers > 102) ) // ykfix66 - 28.07.04 - end // ----- Create Array of Values & Time for Graphs/Spidometers -------------- currtime = nmsTime; // in Seconds (ykfix55 - 6.02.03) currtime = (currtime.0)-(starttime.0); currtime = (currtime.0)*100; // in Hundreeds of Seconds mi = moniInterval; i=for(0>(maxv-1)) { values.i = (varPhysStat.i); valuesx.i = currtime; } // end of ( for(0>(maxv-1)) ) grp\spdmUpdate(maxv,mi,values,valuesx); grp\lineUpdate(maxv,mi,values,valuesx); grp\barsUpdate(maxv,mi,values,valuesx); // ----- End - Array of Values & Time for Graphs/Spidometers --------------- } // end of ( isWindowOpen ) polvar = 0; quit; } // ykfix61 - 2.09.03 - begin (I have replaced "MONITOR" block with "TIMEOUT" block for performance optimization) doWhen(TIMEOUT) { // ykfix78 - 5.04.06 - begin (Not to send Alarms in the TIMEOUT Block) // if(isWindowOpen) // { // if (commOK) // { // alarmMsg(1 "Polling Terescope SNMP - TIMEOUT !"); // } // } // ykfix78 - 5.04.06 - end deleteRequests(); polvar.0 = 0; quit; } //doWhen(MONITOR 1) //{ // if (loadvar) // { // quit; // } // // ykfix55 - 6.02.03 - begin //// if (monvar) //// { //// quit; //// } //// monvar = 1; // // ykfix55 - 6.02.03 - end // if (commOK) // { // if ((noCommFlg != 0) || (breakFlag != 0)) // because of slow Agent or Communication losses // { //// ykfix55 - 6.02.03 - begin //// if (noCommFlg) //// { //// alarmMsg(1 "There was interuption of communication, now OK"); //// } //// ykfix55 - 6.02.03 - end // deleteRequests(); // noCommFlg = 0; // breakFlag = 0; // // --- GET OID ----------------------- // enterprise = send(GET [sysObjectID]); // ver_type = 0; // call(verify_device_type); // // ----------------------------------- // polvar = 0; //// monvar = 0; // ykfix55 - 6.02.03 // goto(START); // } // end of ( ((noCommFlg != 0) || (breakFlag != 0)) ) // } // end of ( (commOK) ) // else // if Communication Status is Down (not OK) // { //// monvar = 0; // ykfix55 - 6.02.03 // noCommFlg = 1; // quit; // } // end of ( (!commOK) ) //} // ykfix61 - 2.09.03 - end doWhen(CLICK /1111) // 'Device Parameters Configuration' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) varGenParams = TER_Gen_ParamsTXT; // ykfix61 - 22.09.03 // only to be compatible with UDP Management varOpen.0 = 0; // dummy varOpen.1 = (varGenParams.2); // [TER_IP_Address] varOpen.2 = (varGenParams.4); // [TER_GateWay] varOpen.3 = 0; // dummy varOpen.4 = (varGenParams.3); // [TER_Comm_Mode] setFlag = 0; // SET command for All Objects have not been created oper_flag = open(dev_prm(varOpen) DLG_DEV_PRM); if (oper_flag) { // ----- Set Communication_Mode --------------------------------------------- if ((varOpen.4) != (varGenParams.3)) // if Communication_Mode have been changed { send(SET TER_Comm_Mode 0 varOpen.4); { temp = var2str(TER_Comm_Mode varOpen.4); showMessage("Error occures by SETting \n& the Communication Mode [\temp] \n& in the \DeviceName Device"); TER_Comm_Mode1= varGenParams.3; // ykfix61 - 22.09.03 goto(ENDOFSETCOMMUNICMODE); } // end of ( send(SET...) ) TER_Comm_Mode1= varOpen.4; // ykfix61 - 22.09.03 setFlag = 1; // SET command for All Objects have been created successfuly } // end of ( ((varOpen.4) != (varGenParams.3)) ) :ENDOFSETCOMMUNICMODE; // ----- Set GATEWAY Address ------------------------------------------------ if (((varOpen.2.0) != (varGenParams.4.0))& // if Gateway_Address have been changed || ((varOpen.2.1) != (varGenParams.4.1))& || ((varOpen.2.2) != (varGenParams.4.2))& || ((varOpen.2.3) != (varGenParams.4.3))) { send(SET TER_GateWay 0 varOpen.2); { temp = var2str(TER_GateWay varOpen.2); showMessage("Error occures by SETting \n& the Gateway Address [\temp] \n& in the \DeviceName Device"); TER_GateWay1 = varGenParams.4; // ykfix61 - 22.09.03 goto(ENDOFSETGATEWAY); } // end of ( send(SET...) ) TER_GateWay1 = varOpen.2; // ykfix61 - 22.09.03 setFlag = 1; // SET command for All Objects have been created successfuly } // end of ( (Gateway_Address have been changed) ) :ENDOFSETGATEWAY; // ----- Set IP Address ----------------------------------------------------- if (((varOpen.1.0) != (varGenParams.2.0))& // if IP_Address have been changed || ((varOpen.1.1) != (varGenParams.2.1))& || ((varOpen.1.2) != (varGenParams.2.2))& || ((varOpen.1.3) != (varGenParams.2.3))) { send(SET TER_IP_Address 0 varOpen.1); { temp = var2str(TER_IP_Address varOpen.1); showMessage("Error occures by SETting \n& the IP Address [\temp] \n& in the \DeviceName Device"); TER_IP_Address1= varGenParams.2; // ykfix61 - 22.09.03 goto(ENDOFSETIP); } // end of ( send(SET...) ) TER_IP_Address1 = varOpen.1; // ykfix61 - 22.09.03 setFlag = 1; // SET command for All Objects have been created successfuly } // end of ( IP_Address have been changed ) :ENDOFSETIP; if (setFlag == 1) // if even one SET have been created successfuly { // ----- Save Running DB into the NVRAM DB Device -------------------------- send(SET [oaJTerGenSaveMode] 0 2); // 1=other, 2=allTerescopeParams { showMessage("Error occures by SAVing Running Configuration \n& in the NVRAM for the \DeviceName Device"); goto(ENDOFSETRESET); } // end of ( send(SET...) ) // // ----- Create Reset of Device -------------------------------------------- // send(SET [oaJTerGenRestart] 0 2); // 1=running, 2=deviceRestart // { // showMessage("Error occures by RESETing of the \DeviceName Device"); // } } // end of ( (setFlag == 1) ) :ENDOFSETRESET; } // end of ( (oper_flag) ) // ykfix70 - 19.01.05 - begin if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // ykfix70 - 19.01.05 - end } doWhen(CLICK /1112) // 'Refresh' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 goto(START); } doWhen(CLICK /1113) // 'Reset Device' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) getConfirm("Do you really want to execute \n& Reset for the \DeviceName Device?") { send(SETLeave [oaJTerGenRestart] 0 2);// 1=running, 2=deviceRestart } // end of ( getConfirm(...) ) // ykfix70 - 19.01.05 - begin if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // ykfix70 - 19.01.05 - end } // ykfix66 - 28.07.04 - begin doWhen(CLICK /1114) // 'Mode Select Status Config' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) oper_flag = open(dev_lb(varCommStat) DLG_DEV_LB); if (oper_flag) { TER_ModeSelectStat= varCommStat.3; // 0=Unsupported, 1=Normal, 2=LocalLoopback, 3=Remote Loopback } // end of ( (oper_flag) ) // ykfix70 - 19.01.05 - begin if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // ykfix70 - 19.01.05 - end } doWhen(CLICK /1115) // 'Fusion Mode Config' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) oper_flag = open(dev_fu(varCommStat) DLG_DEV_FU); if (oper_flag) { TER_FusionMode= varCommStat.4; // 0=Unsupported, 1=Disable, 2=Enable if ((varCommStat.4) == 2) // [oaJTerCommFusionMode] (2=Enable) { if ((varCommStat.2) == 1) // [TER_RFLinkStatus] (1=Active) { setBitmap(/1208 BMP_LED_G); // GREEN LED } // end of ( ((varCommStat.2) == 1) ) else // [TER_RFLinkStatus] (2=Passive) { setBitmap(/1208 BMP_LED_B); // BLACK LED } // end of ( ((varCommStat.2) != 1) ) } // end of ( ((varCommStat.4) == 2) ) else // [oaJTerCommFusionMode] (0=Unsupported, 1=Disable) { setBitmap(/1208 BMP_LED_D); // GREY LED } // end of ( ((varCommStat.4) != 2) ) } // end of ( (oper_flag) ) // ykfix70 - 19.01.05 - begin if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // ykfix70 - 19.01.05 - end } // ykfix66 - 28.07.04 - end // ykfix70 - 19.01.05 - begin doWhen(CLICK /1118) // 'Front Window Heating' Bitmap { // ykfix71 - 26.01.05 - begin if (lbWorkMode == 0) // 0=Change Mode Select Status and Fusion Mode only via HW switch { showMessage("Front Window Heating Mode can be changed only via Hardware Switches on Terescope!"); quit; } // end of ( (lbWorkMode != 1) ) // ykfix71 - 26.01.05 - end showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) oper_flag = open(dev_ht(varCommStat) DLG_DEV_FU); if (oper_flag) { if ((varCommStat.7) == 2) // [oaJTerCommWindowHeatingMode] (2=on) { setBitmap(/1118 BMP_HEAT_UP); // "Front Window Heating" Bitmap } // end of ( ((varCommStat.7) == 2) ) else // [oaJTerCommWindowHeatingMode] (1=off) { setBitmap(/1118 BMP_HEAT_DN); // "Front Window no Heating" Bitmap } // end of ( ((varCommStat.7) == 1) ) } // end of ( (oper_flag) ) if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) } // ykfix70 - 19.01.05 - end doWhen(CLICK /1310) // 'T h r e s h o l d s Configuration' Button { showControls(DISABLE /1111>1115,1118,1310,1500>1501,2200>2202,2300>2302); // ykfix70 - 19.01.05 subDscOpenFlag= 1; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) oper_flag = open(thresh_j(threshMin,threshMax,temperatureUnit) DLG_THRESH_J); // ykfix55 - 55.03.03 if (oper_flag) { // to create Title of the File line1 = "Params\tMinimum\tMaximum"; flTitle = "T h r e s h o l d s Configuration"; saveVars(line1 "\fileNamePath" - flTitle); line1 = ""; saveVars(line1 "\fileNamePath" append -); // to create Thresholds Values line1 = ""; temp = var2str(TEXT_STRING threshName.0); line1 = "\line1\temp"; temp = (threshMin.0); line1 = "\line1\t\temp"; temp = (threshMax.0); line1 = "\line1\t\temp"; saveVars(line1 "\fileNamePath" append -); line1 = ""; temp = var2str(TEXT_STRING threshName.1); line1 = "\line1\temp"; temp = (threshMin.1); line1 = "\line1\t\temp"; temp = (threshMax.1); line1 = "\line1\t\temp"; saveVars(line1 "\fileNamePath" append -); line1 = ""; temp = var2str(TEXT_STRING threshName.2); line1 = "\line1\temp"; temp = (threshMin.2); line1 = "\line1\t\temp"; temp = (threshMax.2); line1 = "\line1\t\temp"; saveVars(line1 "\fileNamePath" append -); // ykfix55 - 16.03.03 - begin ('TEMP_C' entry) line1 = ""; temp = var2str(TEXT_STRING threshName.3); line1 = "\line1\temp"; temp = (threshMin.3); line1 = "\line1\t\temp"; temp = (threshMax.3); line1 = "\line1\t\temp"; saveVars(line1 "\fileNamePath" append -); if ((temperatureUnit.0) != tmpUnitOld) // if Units of Temperature measurement were changed (1=Celsius, 2=Kelvin) { setDeviceParam(TSJDEVTEMPUNITS temperatureUnit.0 INTEGER); // save GLOBAL Device VAR tmpUnitOld = (temperatureUnit.0); } // ykfix55 - 16.03.03 - end // ykfix61 - 22.09.03 - begin if ((temperatureUnit.0) == 1) // 1=Celsius { showControls(DISABLE /403,413,1303); showControls(ENABLE /404>405,414>415,1304); } // end of ( ((temperatureUnit.0) == 1) ) else // 2=Kelvin { showControls(ENABLE /403,413,1303); showControls(DISABLE /404>405,414>415,1304); } // end of ( ((temperatureUnit.0) == 2) ) // ykfix61 - 22.09.03 - end TER_MinRSSI = (threshMin.0); TER_MaxRSSI = (threshMax.0); TER_MinBIAS = (threshMin.1); TER_MaxBIAS = (threshMax.1); TER_MinTemp_K= (threshMin.2); // ykfix55 - 11.02.03 TER_MaxTemp_K= (threshMax.2); // ykfix55 - 11.02.03 TER_MinTemp_C= (threshMin.3); // ykfix55 - 11.02.03 TER_MaxTemp_C= (threshMax.3); // ykfix55 - 11.02.03 } // end of ( (oper_flag) ) // ykfix70 - 19.01.05 - begin if (swVers > 102) { if (lbWorkMode == 1) // 1=Mode Select Status and Fusion Mode can be changed via NMS { if ((((varCommStat.4) == 1)& // [oaJTerCommFusionMode] (1=Disable) || (((varCommStat.4) == 2)& // [oaJTerCommFusionMode] (2=Enable) && ((varCommStat.2) == 2)))& // [oaJTerCommFusionStatus] (2=Passive) && (slaveRemoteLB == 0)) // "Slave Remote Loopback" Mode (0=disabled) - for Old Sw Versions always = 0 { if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1114); // Mode Select Status "Config" Button } // end of ( (UserType == 1) ) } // end of ( ((((varCommStat.4) == 1)||(((varCommStat.4) == 2)&&((varCommStat.2) == 2)))&&(slaveRemoteLB == 0)) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1115); // Fusion Mode "Config" Button } // end of ( (UserType == 1) ) } // end of ( (lbWorkMode == 1) ) } // end of ( (swVers > 102) ) if (UserType == 1) // 1=SUPERVISOR { showControls(ENABLE /1111>1113,1118,1310,1500>1501); } // end of ( (UserType == 1) ) showControls(ENABLE /2200>2202,2300>2302); subDscOpenFlag= 0; // 0=SubDescriptorClosed, 1=SubDescriptorOpened (ykfix70 - 19.01.05) // ykfix70 - 19.01.05 - end } // ykfix51 - 9.10.02 - begin doWhen(CLICK /1500) // "Log the RSSI, BIAS, Temperature" CheckBox { logMode.0 = LOG_Mode; // "Save Parameters in LOG file" Mode (0-stop, 1-start) if ((logMode.0) == 0) // "Save Parameters in LOG file" Mode (0-stop, 1-start) { showControls(DISABLE /1503>1504); // "LOG file name" Group of controls } // end of ( ((logMode.0) == 0) ) else { showControls(ENABLE /1503>1504); // "LOG file name" Group of controls } // end of ( ((logMode.0) != 0) ) showControls(ENABLE /1505); // "Change Logging Parameters" Button } doWhen(CLICK /1501) // "Collection Time" EditBox (in the seconds) { colectTime.0 = LOG_CollectionTime; // "CollectionTime" Mode (in the seconds) showControls(ENABLE /1505); // "Change Logging Parameters" Button } doWhen(CLICK /1505) // "Change Logging Parameters" Button { if (((logMode.0) == (logVar.0))& // [LOG_Mode] - have not been changed && ((colectTime.0) == (logVar.1))) // [LOG_CollectionTime] - have not been changed { showMessage("No changes were made in the Logging Parameters!"); } // end of ( (((logMode.0) == (logVar.0))&&((colectTime.0) == (logVar.1))) ) else { if ((logMode.0) != (logVar.0)) // [LOG_Mode] - have been changed { setDeviceParam(TSJDEVLOGMODE logMode.0 INTEGER); // save GLOBAL Device VAR logVar.0 = (logMode.0); if ((logMode.0) == 0) { devLogLine.0= "--- Stop data collection ------------------------------------------"; writeToDeviceLog("\devLogLine.0"); } // end of ( ((logMode.0) == 0) ) else { devLogLine.0= "--- Start data collection ------------------------------------------"; printFlag = 0; // 0=notPrint, 1=print (ykfix55 - 25.03.03) writeToDeviceLog("\devLogLine.0"); } // end of ( ((logMode.0) != 0) ) } // end of ( ((logMode.0) != (logVar.0)) ) if ((colectTime.0) != (logVar.1)) // [LOG_Mode] - have been changed { setDeviceParam(TSJDEVCOLTIME colectTime.0 INTEGER); // save GLOBAL Device VAR logVar.1 = (colectTime.0); devLogLine.0= "--- Collection Time have been changed to \colectTime seconds ----------------"; writeToDeviceLog("\devLogLine.0"); } // end of ( ((colectTime.0) != (logVar.1)) ) } // end of ( (((logMode.0) != (logVar.0))||((colectTime.0) != (logVar.1))) ) showControls(DISABLE /1505); // "Change Logging Parameters" Button } // ykfix51 - 9.10.02 - end doWhen(CLICK /2200>2202,2300>2302) { ctrlId = clickId; if(ctrlId >= 2300) // lines { curh = (ctrlId - 2300); checkstate = Graphs.curh; } // end of ( (ctrlId >= 2300) ) else // spdms { curh = (ctrlId - 2200); checkstate = Spidometers.curh; } // end of ( (ctrlId < 2300) ) name1 = getWord(curh nid); unitsy = getWord(curh uid); doWhen(CLICK /2200>2202) { if (checkstate == 0) // because I do not have arrays of Items { grp\spdmClose(curh); quit; } // end of ( (checkstate == 0) ) } doWhen(CLICK /2300>2302) { if (checkstate == 0) // if close 8=1+7 // because I do not have arrays of Items { grp\lineClose(curh); quit; } // end of ( (checkstate == 0) ) } // Opening window with Line. // For example. // Line(Open $3 ^1); // ^1 - description // - ^1.0 - name1 ( maximum 15 characters ) // - ^1.1 - name2 ( maximum 23 characters ) // - ^1.2 - unitsy ( maximum 15 characters ) // - ^1.3 - max ( maximum value )(maxy) // - ^1.4 - lower ( lower value ) (miny) // - ^1.5 - upper ( upper value ) //used only for spdm // - ^1.6 - unitsx ( maximum 15 characters ) // - ^1.7 - maxx (maxx) //used only for Line // - ^1.8 - minx (minx) //used only for Line // - ^1.9 - show_flag: 0=absolute,1-relative,2-persents // - ^1.10- monitor_interval // - ^1.11- control graph or 0 // - ^1.12- control legend or 0; // $3 - handle (number(0-15) pars.0="\name1 [\unitsy]"; pars.1="\name1 [\unitsy]"; pars.2=unitsy; pars.6="t"; //if "t" it's time // pars.8=time;//minx =current time pars.8=0;//minx pars.9=0;//0- absolute,1-relative show_flag pars.10=moniInterval; // pars.7=300;//maxx 5 min pars.7=(pars.10)*60; //maxx if((pars.7)>300) { pars.7=300 //=5min } pars.11=0; pars.12=0; //MinMax if (curh == 0) // in case of RSSI { pars.3=1500; // maxy (ykfix54 - 4.12.02) pars.4=0; // miny pars.5=1500; // upper value (used only for spdm) (ykfix54 - 4.12.02) } // end of ( (curh == 0) ) else { if (curh == 1) // in case of BIAS { pars.3=54; // maxy (ykfix66 - 28.07.04) pars.4=0; // miny pars.5=54; // upper value (used only for spdm) (ykfix66 - 28.07.04) } // end of ( (curh == 1) ) else { if (curh == 2) // in case of TEMPERATURE { pars.3=500; // maxy pars.4=0; // miny pars.5=500; // upper value (used only for spdm) (ykfix54 - 4.12.02) } // end of ( (curh == 2) ) else // other cases { pars.3=25; // maxy pars.4=0; // miny pars.5=25; // upper value (used only for spdm) (ykfix54 - 4.12.02) } // end of ( (curh != 2) ) } // end of ( (curh 1= 1) ) } // end of ( (curh != 0) ) // pars.5=(pars.3)-((pars.3)/10); // upper value (used only for spdm) (ykfix54 - 4.12.02) doWhen(CLICK /2200>2202) { grp\spdmOpen(curh,pars); // curh number(haNDLE THAT USER SETS) grp\grpTile(); } doWhen(CLICK /2300>2302) { grp\lineOpen(curh,pars); grp\grpTile(); } } doWhen(CLICK /32767) // Line Close { curh=$0; grp\lineClose(curh); Graphs.curh=0; } doWhen(CLICK /32766) // Spdm Close { curh=$0; grp\spdmClose(curh); Spidometers.curh=0; } doWhen(CLICK /2) // 'Close' Button { close(1); } //doWhen(CLICK /998) // 'Help' Button //{ // showHelp(@nddmhelp CONTEXT 713); //} //---- LOAD_THRESHOLDS -------------------------------------------------------- (ykfix55 - 16.03.03 - Block was removed) //---- verify_device_type ----------------------------------------------------- :verify_device_type { isSimulation() { return; } // end of ( isSimulation() ) //Enterprise = 1.3.6.1.4.1.629.102.1.1 - TSJ t1=enterpriseId; t2=str2var(objId t1); if ((enterprise.0) == (t2.0)) { ver_type=0; return; } // end of ( ((enterprise.0) == (t2.0)) ) if (ver_type == 0) { ver_type = ver_type + 1; showMessage("\DeviceName is not a \DeviceStrType device \n& Received SysObjID=\enterprise \n& Please check the IP Address via Describe"); close; quit; } // end of ( (ver_type == 0) ) return; } //-----------------------------------------------------------------------------