/// <summary> /// This method executes the enter/exit test mode. /// </summary> /// <param name="modeType">TestMode Type</param> /// <param name="timeInTestMode">time for the meter to remain in test minutes</param> /// <param name="pulseWeight">actual test mode kh</param> /// /// <param name="pulseQuantity">Quantity to be measured in test mode</param> /// <returns>The result of the test mode operation.</returns> // MM/DD/YY who Version Issue# Description // -------- --- ------- -------- --------------------------------------- // 06/23/17 CFB 4.72.02 WR767058 Created // public virtual ItronDeviceResult EnterExitTestMode(TestMode modeType, byte timeInTestMode, float pulseWeight, uint pulseQuantity) { ItronDeviceResult Result = ItronDeviceResult.ERROR; ProcedureResultCodes ProcResult = ProcedureResultCodes.INVALID_PARAM; byte[] ProcParam = new byte[8]; OpenWayMFGTable2170 Table2170 = new OpenWayMFGTable2170(m_PSEM, Table00); byte[] ProcResponse; PSEMBinaryWriter PSEMWriter = new PSEMBinaryWriter(new MemoryStream(ProcParam)); bool blnWaitResponse = true; int iSeconds = 0; //Pulse Weight Test value should be in increments of 0.025 so multiply by 40 float fPulseWeightParam = pulseWeight * 40; PSEMWriter.Write((byte)modeType); PSEMWriter.Write(timeInTestMode); PSEMWriter.Write(pulseQuantity); PSEMWriter.Write((ushort)fPulseWeightParam); ProcResult = ExecuteProcedure(Procedures.ENTER_EXIT_TEST_MODE, ProcParam, out ProcResponse); if (ProcedureResultCodes.COMPLETED == ProcResult) { if (TestMode.ENTER_TEST_MODE == modeType) { //If we are entering test mode then we will wait //while IsInTestMode property is false. blnWaitResponse = false; } while (blnWaitResponse == IsInTestMode && 5 > iSeconds) { //Check mode every 1 sec. for 5 sec. System.Threading.Thread.Sleep(1000); iSeconds += 1; } } switch (ProcResult) { case ProcedureResultCodes.COMPLETED: { //Success Result = ItronDeviceResult.SUCCESS; break; } case ProcedureResultCodes.NO_AUTHORIZATION: { //Isc error Result = ItronDeviceResult.SECURITY_ERROR; break; } default: { //General Error Result = ItronDeviceResult.ERROR; break; } } return(Result); }
/// <summary> /// Constructor /// </summary> /// <param name="psem">The PSEM communications object.</param> /// <param name="Table0">The Table 0 object for the current device.</param> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 06/17/09 MMD N/A Created public OpenWayMFGTable2170(CPSEM psem, CTable00 Table0) : base(psem, 2170, OpenWayMFGTable2170.GetTableSize(Table0)) { }