/// <summary> /// Creates a list of tables to read from the meter. /// </summary> /// <param name="IncludedSections">EDL Sections to include</param> /// <returns>The list of tables to read.</returns> // Revision History // MM/DD/YY Who Version ID Number Description // -------- --- ------- -- ------ ---------------------------------------------------------- // 11/21/13 DLG 3.50.07 Overriding here to add ICS related tables. // 01/15/14 DLG 3.50.25 Added table 2529. // 03/14/14 AF 3.50.49 WR 464163 Call SetUpForICMEvents instead of Events to prevent the tables from being read twice. // 05/12/14 AF 3.50.92 WR 503772 Removed table 2529 from the list. It's not supported by the CE dll so no point in adding it. // protected override List <ushort> GetTablesToRead(EDLSections IncludedSections) { List <ushort> TableList = base.GetTablesToRead(IncludedSections); DateTime startTime = new DateTime(2000, 1, 1); byte byDataRecordCount = 0; byte byStatRecordCount = 0; byte byDataRecordSize = 0; ICSCommModule ICSModule = CommModule as ICSCommModule; if (ICSModule != null) { TableList.Add(2510); // ICS ERT Dimension Table TableList.Add(2509); // ICS ERT Configuration Table try { // Send the command to the meter to update the ERT data tables. ICSModule.UpdateERTDataTables(out byDataRecordCount, out byStatRecordCount, out byDataRecordSize); } catch { //Something went wrong. Make sure counts are zero. byDataRecordCount = 0; byStatRecordCount = 0; byDataRecordSize = 0; } //Only add the tables if procedure indicates that there is data in them. if (0 < byDataRecordCount) { TableList.Add(2508); // ICS ERT Data Table } if (0 < byStatRecordCount) { TableList.Add(2511); // ICS ERT Statistics Table } if ((IncludedSections & EDLSections.HistoryLog) == EDLSections.HistoryLog) { if (ProcedureResultCodes.COMPLETED == SetUpForICMEvents()) { TableList.Add(2521); // ICS Events Actual TableList.Add(2522); // ICS Events ID TableList.Add(2523); // ICS Events Log Control TableList.Add(2524); // ICS Log Data Table } } TableList.Add(2512); // ICS Module Configuration Table TableList.Add(2515); // ICS Module Data Table TableList.Add(2516); // ICS Module Status Table TableList.Add(2517); // ICS Cellular Configuration Table TableList.Add(2518); // ICS Cellular Data Table TableList.Add(2519); // ICS Cellular Status Table } return(TableList); }
/// <summary> /// Calls the procedures needed to populate the ICM event tables (2521 and 2524). Does not read the tables. /// </summary> /// <returns>The result of the procedure calls</returns> // Revision History // MM/DD/YY Who Version ID Issue# Description // -------- --- ------- -- ------ ------------------------------------------- // 03/14/14 AF 3.50.49 WR 464163 Created so that we can populate the event table without reading it // public ProcedureResultCodes SetUpForICMEvents() { ProcedureResultCodes Result = ProcedureResultCodes.UNRECOGNIZED_PROC; ICSCommModule ICSModule = CommModule as ICSCommModule; byte[] commandResponse; if (ICSModule != null) { if (ICSModule.FilterICSEvents() == ProcedureResultCodes.COMPLETED) { Result = ICSModule.UpdateEventTables(new DateTime(1970, 1, 1), DateTime.MaxValue, out commandResponse); } } return(Result); }
/// <summary> /// Logs on to the specified device. /// </summary> /// <returns>The response of the logon.</returns> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 09/17/09 RCG 2.30.00 Created // 04/09/14 jrf 3.50.68 WR458134 Generating a FatalError event and aborting test if we // can't communicate with the ICS module. // 10/31/14 jrf 4.00.82 WR 542694 Added support for identifying Bridge meter with signed authorizaion. protected PSEMResponse LogonToDevice() { PSEMResponse Response = PSEMResponse.Ok; CPSEM PSEM = new CPSEM(m_Comm); Response = PSEM.Identify(); if (Response != PSEMResponse.Ok) { // The meter may have been left in a bad state issuing Identify again // may reset the state in the meter. Response = PSEM.Identify(); } if (Response == PSEMResponse.Ok) { Response = PSEM.Negotiate(CPSEM.DEFAULT_MAX_PACKET_LEGNTH, CPSEM.DEFAULT_MAX_NUMBER_OF_PACKETS, m_uiBaudRate); } if (Response == PSEMResponse.Ok) { Response = PSEM.Logon("", CPSEM.DEFAULT_HH_PRO_USER_ID); } if (Response == PSEMResponse.Ok) { m_AmiDevice = CreateDevice(PSEM, m_AuthorizationKey); if (m_AuthorizationKey != null && m_AuthorizationKey.IsValid && m_AmiDevice.SignedAuthorizationState != null && m_AmiDevice.SignedAuthorizationState.Value != FeatureState.Disabled) { // We should use signed authorization to log on to the meter. m_AmiDevice.Authenticate(m_AuthorizationKey); } else { m_AmiDevice.Security(GetPasswords()); } ICSCommModule ICSModule = (null != m_AmiDevice) ? m_AmiDevice.CommModule as ICSCommModule : null; bool ICSCommError = false; if (null != ICSModule) { try { if (0 == ICSModule.ICMFirmwareVersionMajor) { ICSCommError = true; } } catch { ICSCommError = true; } if (true == ICSCommError) { //Cannot communicate with ICS comm module so display error OnFatalError(new ItronErrorEventArgs(Resources.LOGON_FAILED_ICS_COMM_ERROR, null)); Abort(); } } } return(Response); }
/// <summary> /// Creates the appropriate Comm Module class based on the Comm Module device class /// </summary> /// <param name="psem">The PSEM communications object for the current session</param> /// <param name="amiDevice">The Device Object for the current device</param> /// <returns>The Comm Module object.</returns> // Revision History // MM/DD/YY who Version Issue# Description // -------- --- ------- ------ --------------------------------------- // 02/17/10 RCG 2.40.15 Created // 10/11/11 AF 2.53.00 Added code for Cisco comm module. // 07/20/12 AF 2.60.46 201155 Removed the firmware version check and substituted a check // on the comm module id from Mfg table 17 // 01/16/13 mah 2.70.58 Added support for SL7000 Gateway // 03/26/13 mah 2.80.11 Added support for ICS devices and comm modules // 11/14/13 AF 3.50.03 Class re-architecture - replace CENTRON_AMI parameter // with CANSIDevice // 12/26/13 AF 3.50.16 TQ9484 Added code to deal with a Bridge meter in ChoiceConnect mode. Try // to avoid reading RFLAN tables // 11/17/14 jrf 4.00.89 TBD Added special identification of comm module types for Bridge meters in ChoicConnect mode. // 03/10/15 AF 4.10.05 WR569364 Added support for ITRK // public static CommModuleBase CreateCommModule(CPSEM psem, CANSIDevice amiDevice) { CommModuleBase NewCommModule = null; string CG_MESH_MODULE = "CISCO CGMesh Module "; string strCommModuleID = ""; if (amiDevice is SL7000_Gateway) { // This is a Cisco module NewCommModule = new CiscoCommModule(psem, amiDevice); } else if ((amiDevice is OpenWayITRJ) || (amiDevice is OpenWayPolyITRK) || (amiDevice is ICS_Gateway)) { // This is an ICS communications module NewCommModule = new ICSCommModule(psem, amiDevice); } else if ((amiDevice is IBridge) && (((IBridge)amiDevice).CurrentRegisterCommOpMode == OpenWayMFGTable2428.ChoiceConnectCommOpMode.ChoiceConnectOperationalMode)) { if (OpenWayMFGTable2428.ChoiceConnectCommMfgMode.ChoiceConnectManufacturingModeRFMesh == ((IBridge)amiDevice).ChoiceConnectManufacturedMode) { // This is a Cisco module NewCommModule = new CiscoCommModule(psem, amiDevice); } else if (OpenWayMFGTable2428.ChoiceConnectCommMfgMode.ChoiceConnectManufacturingModeRFLAN == ((IBridge)amiDevice).ChoiceConnectManufacturedMode) { // This is a RFLAN Module NewCommModule = new RFLANCommModule(psem, amiDevice); } } else { switch (amiDevice.CommModuleDeviceClass) { case ITR2_DEVICE_CLASS: case ITRL_DEVICE_CLASS: { try { RFLANMfgTable2065 table2065 = new RFLANMfgTable2065(psem); strCommModuleID = table2065.RFLANIdentification; } catch (PSEMException) { // It's possible that reading table 2065 could fail in a meter whose Comm Module // is not working. strCommModuleID = null; } catch (TimeOutException) { // It's possible that reading table 2065 could fail in a meter whose Comm Module // is not working. strCommModuleID = null; } if (null != strCommModuleID) { if (String.CompareOrdinal(strCommModuleID, CG_MESH_MODULE) == 0) { // This is a Cisco module NewCommModule = new CiscoCommModule(psem, amiDevice); } else { // This is a RFLAN or PrismLite Module NewCommModule = new RFLANCommModule(psem, amiDevice); } } else { // This is a Third Party or Unknown Comm Module NewCommModule = new CommModuleBase(psem, amiDevice); } break; } case ITRP_DEVICE_CLASS: { // This is a PLAN Comm Module NewCommModule = new PLANCommModule(psem, amiDevice); break; } default: { // This is a Third Party or Unknown Comm Module NewCommModule = new CommModuleBase(psem, amiDevice); break; } } } return(NewCommModule); }