From ff1e8275479b0cca54d90a2eaa6cc9cf3a5e38e1 Mon Sep 17 00:00:00 2001
From: qq_40317179 <15201119555@139.com>
Date: Thu, 19 Dec 2024 14:18:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=AB=99=E6=8E=A5=E5=8F=A3=E6=95=B4?=
=?UTF-8?q?=E5=90=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Attribute/CommandAttribute.cs | 22 +
.../ConnectBase/ConnectInstBase.cs | 543 +
.../ConnectBase/SSH/SshInfo.cs | 29 +
.../ConnectBase/SSH/SshInstBase.cs | 355 +
.../ConnectBase/Socket/Encrypt.cs | 118 +
.../Socket/SocketClientInstBase.cs | 445 +
.../Socket/SocketServerInstBase.cs | 346 +
.../ConnectBase/Socket/Sockets.cs | 98 +
.../ConnectBase/Visa32/Visa32.cs | 779 +
.../ConnectBase/Visa32/Visa32InstBase.cs | 813 +
.../Ericsson/EricssonBaseStationTester.cs | 5276 +++++
.../BaseStation/Ericsson/MoShellResult.cs | 299 +
.../Huawei/HuaweiBaseStationTester.cs | 12786 ++++++++++++
.../BaseStation/Nokia/Model/AlarmsInfoRoot.cs | 60 +
.../BaseStation/Nokia/Model/NokiaBaseRoot.cs | 912 +
.../Nokia/NokiaBaseStationTester.cs | 3056 +++
.../Virtual/VirtualBaseStationTester.cs | 168 +
.../Manage/Converters/NumberEnumConverter.cs | 62 +
.../ZTE/Manage/DistinctItemComparer.cs | 26 +
.../Manage/EasyApi/EasyApiENodesBExtension.cs | 2461 +++
.../Manage/EasyApi/EasyApiQuickExtension.cs | 16964 ++++++++++++++++
.../EasyApi/EasyApiRelationExtension.cs | 91 +
.../BaseStation/ZTE/Manage/Logger.cs | 63 +
.../ZTE/Manage/Management/CellExtension.cs | 25 +
.../Manage/Management/CmtaskmngExtension.cs | 41 +
.../Manage/Management/CurrentAreaExtension.cs | 221 +
.../Manage/Management/MoHandleExtension.cs | 167 +
.../ZTE/Manage/Management/NEExtension.cs | 58 +
.../Manage/Management/PlannedAreaExtension.cs | 337 +
.../Management/ReportConfigNRExtension.cs | 82 +
.../BaseStation/ZTE/Manage/MoConfigTask.cs | 70 +
.../ZTE/Manage/Models/AttrFilter.cs | 12 +
.../ZTE/Manage/Models/Carrier/CarrierUL.cs | 719 +
.../Manage/Models/Cell/CellMobileStandard.cs | 46 +
.../ZTE/Manage/Models/Cell/CellModel.cs | 26 +
.../MoConfigArgExternalEUtranCellFDDLTE.cs | 32 +
.../Models/Cell/MoQueryResultCarrierUL.cs | 24 +
.../Cell/MoQueryResultExternalNrCellLTE.cs | 101 +
.../Models/Cell/MoQueryResultNRCarrier.cs | 27 +
.../Models/Cell/MoQueryResultNRCellCU.cs | 62 +
.../Models/Cell/MoQueryResultNRCellDU.cs | 77 +
.../Models/Cmtaskmng/TaskStatusResult.cs | 24 +
.../Models/CurrentArea/DataExportArg.cs | 34 +
.../Models/CurrentArea/DataExportResult.cs | 12 +
.../Manage/Models/CurrentArea/FileFormat.cs | 11 +
.../Manage/Models/CurrentArea/LicenseModel.cs | 138 +
.../Models/CurrentArea/ModataQueryArg.cs | 31 +
.../MoQueryResultENBCUCPFunction.cs | 23 +
.../Manage/Models/EasyApi/CellDefiningSSB.cs | 33 +
.../Manage/Models/EasyApi/CellParameter.cs | 80 +
.../ZTE/Manage/Models/EasyApi/InterFHoA1A2.cs | 122 +
.../Manage/Models/EasyApi/MoConfigArgCell.cs | 29 +
.../Models/EasyApi/MoConfigArgLockCell.cs | 22 +
.../Models/EasyApi/MoDataQueryResult.cs | 624 +
.../Models/EasyApi/MoGetQueryCellsResult.cs | 26 +
.../Models/EasyApi/ModataQueryCellsResult.cs | 58 +
.../EasyApi/ModataQueryCellsResultCell.cs | 190 +
.../EasyApi/ModataQueryCellsResultCellCU.cs | 63 +
.../EasyApi/QueryNEsUseMoQueryResult.cs | 44 +
.../Models/EasyApi/SetCellAdminStatus.cs | 33 +
.../Manage/Models/EasyApi/SetCellThresho.cs | 105 +
.../Manage/Models/EasyApi/ThreshoValues.cs | 21 +
.../ZTE/Manage/Models/ErrorMessage.cs | 16 +
.../ZTE/Manage/Models/General/CellObject.cs | 13 +
.../ZTE/Manage/Models/General/NEObject.cs | 18 +
.../ZTE/Manage/Models/MoConfigArgBaseT.cs | 16 +
.../ZTE/Manage/Models/MoConfigArgObject.cs | 16 +
.../BaseStation/ZTE/Manage/Models/MoFilter.cs | 12 +
.../Manage/Models/MoHandle/MocQueryResult.cs | 98 +
.../BaseStation/ZTE/Manage/Models/MoOp.cs | 13 +
.../ZTE/Manage/Models/MoQueryResultBaseT.cs | 25 +
.../Models/MoQueryResultMsRATPriFDDLTE.cs | 22 +
.../Models/MoQueryResultNRPhysicalCellDU.cs | 177 +
.../NetworkElement/MesResultNEObject.cs | 150 +
.../NetworkElement/MoQueryResultSctp.cs | 39 +
.../NetworkElement/SubnetworksResultObject.cs | 31 +
.../NetworkElement/TreeResultNEObject.cs | 44 +
.../Manage/Models/PlannedArea/Authority.cs | 12 +
.../Models/PlannedArea/GetResultTask.cs | 19 +
.../PlannedArea/PlannedareaActivateArg.cs | 11 +
.../Models/PlannedArea/ValidationArg.cs | 13 +
.../MoConfigArgEUtranRelationFDDLTE.cs | 32 +
.../MoConfigArgEutranCellRelation.cs | 37 +
.../MoConfigArgExternalEutranCellFDD.cs | 24 +
.../Relations/MoConfigArgExternalNRCellCU.cs | 16 +
.../Relations/MoConfigArgExternalNrCellLTE.cs | 87 +
.../Relations/MoConfigArgNRCellRelation.cs | 33 +
.../MoConfigArgNRExternalCellRelation.cs | 13 +
.../Relations/MoConfigArgNrNiborRelaFDDLTE.cs | 39 +
.../Relations/MoConfigArgSsbMeasInfo.cs | 13 +
.../MoQueryResultEUtranRelationFDDLTE.cs | 52 +
.../MoQueryResultEutranCellRelation.cs | 30 +
.../MoQueryResultExternalEUtranCellFDDLTE.cs | 82 +
.../MoQueryResultExternalEutranCellFDD.cs | 52 +
.../MoQueryResultExternalNRCellCU.cs | 3334 +++
.../Relations/MoQueryResultNRCellRelation.cs | 552 +
.../Models/Relations/MoQueryResultNbrCell.cs | 14 +
.../MoQueryResultNeighbouringRelationFDD.cs | 14 +
.../MoQueryResultNrNiborRelaFDDLTE.cs | 28 +
.../MoConfigArgA2_A3_A5eventOffset.cs | 44 +
.../MoConfigArgA2rsrpThreshold.cs | 12 +
.../ReportConfigNR/MoConfigArgCarrier.cs | 1419 ++
.../ReportConfigNR/MoConfigArgEutranFreq.cs | 12 +
.../MoConfigArgEutranFreqRelation.cs | 13 +
.../MoConfigArgFrequencyBandList.cs | 13 +
.../MoConfigArgGlobalSwitchInformation.cs | 12 +
.../ReportConfigNR/MoConfigArgHysteresis.cs | 14 +
.../MoConfigArgLteA1_A2_A3_A4.cs | 12 +
.../Models/ReportConfigNR/MoConfigArgLteA5.cs | 13 +
.../ReportConfigNR/MoConfigArgLteToNrB1.cs | 13 +
.../ReportConfigNR/MoConfigArgLteToNrB2.cs | 13 +
.../ReportConfigNR/MoConfigArgMeasConfig.cs | 12 +
.../ReportConfigNR/MoConfigArgMeasObjEUTRA.cs | 14 +
.../ReportConfigNR/MoConfigArgMobilityCtrl.cs | 15 +
.../Models/ReportConfigNR/MoConfigArgNRA1.cs | 168 +
.../ReportConfigNR/MoConfigArgNRFreq.cs | 15 +
.../MoConfigArgNRFreqParaFDDLTE.cs | 11 +
.../MoConfigArgNRInterFCovHo.cs | 34 +
.../MoConfigArgNRInterFMeasConfig.cs | 18 +
.../MoConfigArgNROpenInterFHo.cs | 27 +
.../MoConfigArgNrRatMeasCfgLTE.cs | 14 +
.../MoConfigArgReportConfigNR.cs | 12 +
.../MoConfigArgSwitchA3_A4_A5.cs | 15 +
.../MoConfigArgSwitchLTEB1_B2.cs | 15 +
.../MoConfigArgSwitchNRB1_B2.cs | 15 +
.../MoConfigArgUeEUtranMeasurementLTE.cs | 15 +
.../MoConfigArgblindA2Strategy.cs | 12 +
.../MoConfigArgmethodLTEtoNR.cs | 12 +
.../ReportConfigNR/MoConfigArgnLPsHoSwch.cs | 12 +
.../ReportConfigNR/MoConfigArgratPriority8.cs | 12 +
.../MoConfigArgsADirectMigSwch.cs | 12 +
.../MoConfigArgsSBToMeasBitmap.cs | 15 +
.../MoConfigArgsrd4ForCoverage.cs | 12 +
.../MoConfigResultNRFreqRelation.cs | 13 +
.../MoQueryResultCUEUtranCellFDDLTE.cs | 1134 ++
.../MoQueryResultCellMeasGroupLTE.cs | 150 +
.../MoQueryResultEUtranCellMeasFDDLTE.cs | 253 +
.../ReportConfigNR/MoQueryResultEutranFreq.cs | 16 +
.../MoQueryResultEutranFreqRelation.cs | 15 +
.../MoQueryResultFrequencyBandList.cs | 15 +
.../MoQueryResultGNBCUCPFunction.cs | 32 +
.../MoQueryResultGlobalSwitch.cs | 218 +
.../MoQueryResultGlobalSwitchInformation.cs | 29 +
.../MoQueryResultInterRATCovHo.cs | 70 +
.../ReportConfigNR/MoQueryResultMeasConfig.cs | 14 +
.../MoQueryResultMeasObjEUTRA.cs | 19 +
.../MoQueryResultMobilityCtrl.cs | 41 +
.../MoQueryResultNRCloseInterFRATHo.cs | 24 +
.../ReportConfigNR/MoQueryResultNRFreq.cs | 15 +
.../MoQueryResultNRFreqParaFDDLTE.cs | 42 +
.../MoQueryResultNRFreqRelation.cs | 15 +
.../MoQueryResultNRInterFCovHo.cs | 84 +
.../MoQueryResultNRInterFMeasConfig.cs | 20 +
.../MoQueryResultNRIntraFCovHo.cs | 75 +
.../MoQueryResultNROpenInterFHo.cs | 23 +
.../MoQueryResultNROpenInterFRATHo.cs | 24 +
.../MoQueryResultNrRatMeasCfgLTE.cs | 88 +
.../MoQueryResultUeEUtranMeasurementLTE.cs | 40 +
.../MoQueryResultUeRATMeasurementLTE.cs | 37 +
.../ZTE/Manage/Models/ReturnMessage.cs | 12 +
.../ZTE/Manage/Models/TreeFilter.cs | 12 +
.../BaseStation/ZTE/Manage/Models/eventId.cs | 63 +
.../ZTE/Manage/Models/neListObject.cs | 19 +
.../BaseStation/ZTE/Manage/Models/netype.cs | 15 +
.../ZTE/Manage/Models/rptAmount.cs | 18 +
.../ZTE/Manage/Models/rptInterval.cs | 24 +
.../ZTE/Manage/Models/rptQuantity.cs | 18 +
.../ZTE/Manage/Models/timeToTrigger.cs | 26 +
.../ZTE/Manage/Models/triggerQuantity.cs | 13 +
.../BaseStation/ZTE/Manage/ZTEClient.cs | 199 +
.../BaseStation/ZTE/Manage/ZTETask.cs | 59 +
.../BaseStation/ZTE/ZTEBaseStationTester.cs | 2836 +++
.../BaseStation/ZTEBaseStationTester.cs | 36 -
Admin.NET/MTNet.Application/Entity/Cell.cs | 134 +-
.../MTNet.Application/Enum/DeviceTypeEnum.cs | 5 +-
.../IEricssonBaseStationTester.cs | 11 +
.../IBaseStation/IHuaweiBaseStationTester.cs | 11 +
.../IBaseStation/INokiaBaseStationTester.cs | 39 +
.../IBaseStation/IVirtualBaseStationTester.cs | 11 +
.../IBaseStation/IZTEBaseStationTester.cs | 83 +
.../IDAL/IBaseStationTester.cs | 190 +-
.../IDAL/Utils/Algorithms.cs | 64 +
.../IDAL/Utils/EnumHelper.cs | 177 +
.../IDAL/Utils/ErrorCodeHelper.cs | 84 +
.../IDAL/Utils/IEnumerableHelper.cs | 101 +
.../IDAL/Utils/TaskHelper.cs | 48 +
Admin.NET/MTNet.Application/Job/CellJob.cs | 109 +-
.../SeedData/DeviceSeedData.cs | 2 +-
.../Service/Device/BaseStationService.cs | 2 +-
.../Service/Device/Dto/CellInput.cs | 88 +-
190 files changed, 63838 insertions(+), 73 deletions(-)
create mode 100644 Admin.NET/MTNet.Application/Attribute/CommandAttribute.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/ConnectInstBase.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/SSH/SshInfo.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/SSH/SshInstBase.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Socket/Encrypt.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Socket/SocketClientInstBase.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Socket/SocketServerInstBase.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Socket/Sockets.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32.cs
create mode 100644 Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32InstBase.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/EricssonBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/MoShellResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Huawei/HuaweiBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Nokia/Model/AlarmsInfoRoot.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Nokia/Model/NokiaBaseRoot.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Nokia/NokiaBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Virtual/VirtualBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Converters/NumberEnumConverter.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/DistinctItemComparer.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/EasyApi/EasyApiENodesBExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/EasyApi/EasyApiQuickExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/EasyApi/EasyApiRelationExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Logger.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/CellExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/CmtaskmngExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/CurrentAreaExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/MoHandleExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/NEExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/PlannedAreaExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Management/ReportConfigNRExtension.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/MoConfigTask.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/AttrFilter.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Carrier/CarrierUL.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/CellMobileStandard.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/CellModel.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoConfigArgExternalEUtranCellFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoQueryResultCarrierUL.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoQueryResultExternalNrCellLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoQueryResultNRCarrier.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoQueryResultNRCellCU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cell/MoQueryResultNRCellDU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Cmtaskmng/TaskStatusResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/CurrentArea/DataExportArg.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/CurrentArea/DataExportResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/CurrentArea/FileFormat.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/CurrentArea/LicenseModel.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/CurrentArea/ModataQueryArg.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ENBCUCPFunction/MoQueryResultENBCUCPFunction.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/CellDefiningSSB.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/CellParameter.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/InterFHoA1A2.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/MoConfigArgCell.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/MoConfigArgLockCell.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/MoDataQueryResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/MoGetQueryCellsResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/ModataQueryCellsResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/ModataQueryCellsResultCell.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/ModataQueryCellsResultCellCU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/QueryNEsUseMoQueryResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/SetCellAdminStatus.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/SetCellThresho.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/EasyApi/ThreshoValues.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ErrorMessage.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/General/CellObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/General/NEObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoConfigArgBaseT.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoConfigArgObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoFilter.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoHandle/MocQueryResult.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoOp.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoQueryResultBaseT.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoQueryResultMsRATPriFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/MoQueryResultNRPhysicalCellDU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/NetworkElement/MesResultNEObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/NetworkElement/MoQueryResultSctp.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/NetworkElement/SubnetworksResultObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/NetworkElement/TreeResultNEObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/PlannedArea/Authority.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/PlannedArea/GetResultTask.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/PlannedArea/PlannedareaActivateArg.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/PlannedArea/ValidationArg.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgEUtranRelationFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgEutranCellRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgExternalEutranCellFDD.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgExternalNRCellCU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgExternalNrCellLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgNRCellRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgNRExternalCellRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgNrNiborRelaFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoConfigArgSsbMeasInfo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultEUtranRelationFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultEutranCellRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultExternalEUtranCellFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultExternalEutranCellFDD.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultExternalNRCellCU.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultNRCellRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultNbrCell.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultNeighbouringRelationFDD.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/Relations/MoQueryResultNrNiborRelaFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgA2_A3_A5eventOffset.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgA2rsrpThreshold.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgCarrier.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgEutranFreq.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgEutranFreqRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgFrequencyBandList.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgGlobalSwitchInformation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgHysteresis.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgLteA1_A2_A3_A4.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgLteA5.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgLteToNrB1.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgLteToNrB2.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgMeasConfig.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgMeasObjEUTRA.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgMobilityCtrl.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNRA1.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNRFreq.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNRFreqParaFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNRInterFCovHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNRInterFMeasConfig.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNROpenInterFHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgNrRatMeasCfgLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgReportConfigNR.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgSwitchA3_A4_A5.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgSwitchLTEB1_B2.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgSwitchNRB1_B2.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgUeEUtranMeasurementLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgblindA2Strategy.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgmethodLTEtoNR.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgnLPsHoSwch.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgratPriority8.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgsADirectMigSwch.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgsSBToMeasBitmap.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigArgsrd4ForCoverage.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoConfigResultNRFreqRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultCUEUtranCellFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultCellMeasGroupLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultEUtranCellMeasFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultEutranFreq.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultEutranFreqRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultFrequencyBandList.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultGNBCUCPFunction.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultGlobalSwitch.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultGlobalSwitchInformation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultInterRATCovHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultMeasConfig.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultMeasObjEUTRA.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultMobilityCtrl.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRCloseInterFRATHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRFreq.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRFreqParaFDDLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRFreqRelation.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRInterFCovHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRInterFMeasConfig.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNRIntraFCovHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNROpenInterFHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNROpenInterFRATHo.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultNrRatMeasCfgLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultUeEUtranMeasurementLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReportConfigNR/MoQueryResultUeRATMeasurementLTE.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/ReturnMessage.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/TreeFilter.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/eventId.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/neListObject.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/netype.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/rptAmount.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/rptInterval.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/rptQuantity.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/timeToTrigger.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/Models/triggerQuantity.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/ZTEClient.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/Manage/ZTETask.cs
create mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTE/ZTEBaseStationTester.cs
delete mode 100644 Admin.NET/MTNet.Application/DriverLibrary/BaseStation/ZTEBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/IBaseStation/IEricssonBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/IBaseStation/IHuaweiBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/IBaseStation/INokiaBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/IBaseStation/IVirtualBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/IBaseStation/IZTEBaseStationTester.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/Utils/Algorithms.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/Utils/EnumHelper.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/Utils/ErrorCodeHelper.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/Utils/IEnumerableHelper.cs
create mode 100644 Admin.NET/MTNet.Application/IDAL/Utils/TaskHelper.cs
diff --git a/Admin.NET/MTNet.Application/Attribute/CommandAttribute.cs b/Admin.NET/MTNet.Application/Attribute/CommandAttribute.cs
new file mode 100644
index 00000000..1ba85bf3
--- /dev/null
+++ b/Admin.NET/MTNet.Application/Attribute/CommandAttribute.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTNet.Application
+{
+ ///
+ /// 指定属性对应的的指令
+ ///
+ [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]//通过 AttributeUsageAttribute 限定定义特性可以应用在哪种类型上。
+ public class CommandAttribute : Attribute
+ {
+ public string Command { get; set; }
+
+ public CommandAttribute(string command)
+ {
+ Command = command;
+ }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/ConnectInstBase.cs b/Admin.NET/MTNet.Application/ConnectBase/ConnectInstBase.cs
new file mode 100644
index 00000000..ef8416d3
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/ConnectInstBase.cs
@@ -0,0 +1,543 @@
+using MTNet.Application.Entity;
+using MTNet.Application.IDAL.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ public class ConnectInstBase
+ {
+ DeviceAddrConfig _addrConfig = new DeviceAddrConfig();
+ SocketClientInstBase _socketClient;
+ Visa32InstBase _visa32;
+ protected SshInstBase _sshInstBase;
+
+ ///
+ /// 是否异步读取信息
+ ///
+ public bool IsAsynchronous { get; set; } = false;
+
+ public DeviceAddrConfig AddrConfig { get => _addrConfig; set => _addrConfig = value; }
+
+ public int Timeout { get; set; } = 5000;
+
+ ///
+ /// 构造函数
+ ///
+ /// 设备地址信息配置
+ public ConnectInstBase(DeviceAddrConfig addrConfig)
+ {
+ _addrConfig = addrConfig;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ {
+ if (_addrConfig.CommunicationTypeConfig == CommunicationTypeEnum.Socket)
+ {
+ _visa32 = new Visa32InstBase(_addrConfig.RealAddrConfig);
+ _visa32.SetTimeOut(300000);
+ }
+ else
+ {
+ _visa32 = new Visa32InstBase(_addrConfig.AddrConfig);
+ _visa32.SetTimeOut(300000);
+ }
+ _visa32.DeviceName = _addrConfig.DeviceTypeConfig.GetDescription();
+ }
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ _socketClient = new SocketClientInstBase(_addrConfig.AddrConfig, _addrConfig.PortConfig);
+ _socketClient.DeviceName = _addrConfig.DeviceTypeConfig.GetDescription();
+ break;
+ case CommunicationTypeEnum.SSH:
+ _sshInstBase = new SshInstBase(_addrConfig.AddrConfig, _addrConfig.PortConfig, _addrConfig.UserName, _addrConfig.Password);
+ _sshInstBase.DeviceName = _addrConfig.DeviceTypeConfig.GetDescription();
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 针对使用脉冲查询的轴,进行单独的设备连接
+ ///
+ ///
+ ///
+ ///
+ public int Connect(string ipAddress, int port)
+ {
+ _socketClient = new SocketClientInstBase(ipAddress, port);
+ _socketClient.DeviceName = _addrConfig.DeviceTypeConfig.GetDescription();
+ _socketClient.IsAsynchronous = IsAsynchronous;
+ return _socketClient.Connect();
+ }
+
+ ///
+ /// 设备连接
+ ///
+ ///
+ public virtual int Connect()
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ {
+ rtn += _visa32.Connect();
+ _visa32.SetTimeOut(300000);
+ }
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ _socketClient.IsAsynchronous = IsAsynchronous;
+ rtn += _socketClient.Connect();
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.Connect();
+ break;
+ default:
+ break;
+ }
+ }
+
+ return rtn;
+ }
+
+ public virtual int SetTimeout(int timeInMS)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn = _visa32.SetTimeOut(timeInMS);
+ return rtn;
+ }
+
+ ///
+ /// 关闭连接
+ ///
+ ///
+ public virtual int Close()
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Close();
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.Close();
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.Close();
+ break;
+ default:
+ break;
+ }
+ }
+ return rtn;
+ }
+
+ public int CheckOpc()
+ {
+ int rtn = 0;
+
+ return rtn;
+ }
+
+ ///
+ /// 查询上条指令是否执行完成
+ ///
+ public void CheckOPC()
+ {
+ DateTime dateOld = DateTime.Now;
+ TimeSpan timespan = new TimeSpan(0);
+ bool connect = false;
+ while (timespan.TotalMilliseconds < 1000)
+ {
+ timespan = DateTime.Now - dateOld;
+ connect = CheckStatus();
+ if (connect == true)
+ {
+ break;
+ }
+ }
+ }
+
+ ///
+ /// 查询状态
+ ///
+ ///
+ private bool CheckStatus()
+ {
+ string Value = "";
+ int rtn = Read("*OPC?", out Value);
+ if (rtn == Visa32.VI_SUCCESS || rtn == 1)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ ///
+ /// 发送指令
+ ///
+ /// 字符串指令
+ ///
+ public virtual int Write(string cmdStr)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Write(cmdStr);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdStr);
+ break;
+ case CommunicationTypeEnum.SSH:
+ //rtn += _sshInstBase.SendCommand(cmdStr, out var _);
+ //rtn += _sshInstBase.RunCommand(cmdStr, out var _);
+ rtn += _sshInstBase.SendCommandAsync(cmdStr, out var _);
+ break;
+ default:
+ break;
+ }
+ }
+ Thread.Sleep(10);
+ return rtn;
+ }
+
+ public virtual int Write(string cmdStr, string endStr)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Write(cmdStr, endStr);
+ else
+ {
+ cmdStr += endStr;
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdStr);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommandAsync(cmdStr, out var _);
+ break;
+ default:
+ break;
+ }
+ }
+ Thread.Sleep(10);
+ return rtn;
+ }
+
+ ///
+ /// 发送指令
+ ///
+ /// 字节数组指令
+ ///
+ public virtual int Write(byte[] cmdbyte)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Write(Encoding.Default.GetString(cmdbyte));
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ break;
+ case CommunicationTypeEnum.Socket:
+ //rtn += _socketClient.SendData(Encoding.UTF8.GetString(cmdbyte));
+ rtn += _socketClient.SendData(cmdbyte);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommand(cmdbyte, out var _);
+ break;
+ default:
+ break;
+ }
+ }
+ return rtn;
+ }
+
+ public virtual int WirteFromFile(string strFilename, int iDatalen)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.WirteFromFile(strFilename, iDatalen);
+ return rtn;
+ }
+ private object _objLock = new object();
+ ///
+ /// 查询指令,先发送,再查询
+ ///
+ /// 发送的指令
+ /// 接收到的信息
+ ///
+ public virtual int Read(string cmdStr, out string rtnStr, int waitTime = 2)
+ {
+ lock (_objLock)
+ {
+ int rtn = 0;
+ byte[] cmdbyte;
+ byte[] rtnbyte = new byte[10000];
+ int byteCount = 0;
+ var timeOut = TimeSpan.FromSeconds(30);
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Read(cmdStr, out rtnStr, waitTime);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnStr = "";
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdStr);
+ Thread.Sleep(waitTime);
+ try
+ {
+ var taskReceive = Task.Run(() =>
+ {
+ string content = string.Empty;
+ _socketClient.ReceiveData(out content);
+ return content;
+ }).TimeoutAfter(timeOut);
+ taskReceive.Wait();
+ rtnStr = taskReceive.Result;
+ }
+ catch (TimeoutException ex)
+ {
+ //SystemLogger.Logger.Error($"Read Command {cmdStr} Timeout!", ex);
+ throw ex;
+ }
+
+ //rtn += _socketClient.ReceiveData(out rtnStr);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommand(cmdStr, out rtnStr);
+ break;
+ default:
+ rtnStr = "";
+ break;
+ }
+ }
+ return rtn;
+ }
+ }
+
+ public virtual int Read(string cmdStr, out double rtnDb, int waitTime = 2)
+ {
+ int rtn = 0;
+ string rtnStr = "";
+ rtn += Read(cmdStr, out rtnStr, waitTime);
+ if (!double.TryParse(rtnStr, out rtnDb))
+ {
+ // DeviceControlLogger.Logger.Error("Read Command " + cmdStr + " Error !", new Exception("Value Convert Faild !"));
+ // throw new DeviceException("Read Command " + cmdStr + " Error !");
+ }
+ return rtn;
+ }
+
+ public virtual int Read(string cmdStr, out int rtnInt, int waitTime = 2)
+ {
+ int rtn = 0;
+ double rtnDb = 0;
+ rtn += Read(cmdStr, out rtnDb, waitTime);
+ rtnInt = Convert.ToInt32(rtnDb);
+ return rtn;
+ }
+
+ ///
+ /// 查询指令,先发送,再接收
+ ///
+ /// 发送指令
+ /// 接受到的信息
+ ///
+ public virtual int Read(string cmdStr, out byte[] rtnbyte, int waitTime = 2)
+ {
+ int rtn = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Read(cmdStr, out rtnbyte, waitTime);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdStr);
+ Thread.Sleep(waitTime);
+ rtn += _socketClient.ReceiveData(out rtnbyte);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommand(cmdStr, out var result);
+ rtnbyte = Encoding.ASCII.GetBytes(result);
+ break;
+ default:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ }
+ }
+ return rtn;
+ }
+
+ ///
+ /// 查询指令,先发送,再接收
+ ///
+ /// 发送指令
+ /// 接受到的信息
+ ///
+ public virtual int Read(byte[] cmdbyte, out byte[] rtnbyte, int waitTime = 2)
+ {
+ int rtn = 0;
+ int byteCount = 0;
+
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Read(Encoding.Default.GetString(cmdbyte), out rtnbyte, waitTime);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdbyte);
+ Thread.Sleep(waitTime);
+ rtn += _socketClient.ReceiveData(out rtnbyte);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommand(cmdbyte, out var result);
+ rtnbyte = Encoding.ASCII.GetBytes(result);
+ break;
+ default:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ }
+ }
+ return rtn;
+ }
+
+ public virtual int Read(byte[] cmdbyte, int rtnbyteLength, out byte[] rtnbyte, int waitTime = 2)
+ {
+ int rtn = 0;
+ int byteCount = 0;
+
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.Read(Encoding.Default.GetString(cmdbyte), out rtnbyte, waitTime);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.SendData(cmdbyte);
+ Thread.Sleep(waitTime);
+ rtn += _socketClient.ReceiveData(rtnbyteLength, out rtnbyte);
+ break;
+ case CommunicationTypeEnum.SSH:
+ rtn += _sshInstBase.SendCommand(cmdbyte, out var result);
+ rtnbyte = Encoding.ASCII.GetBytes(result);
+ break;
+ default:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ }
+ }
+ return rtn;
+ }
+ ///
+ /// 只接收指令
+ ///
+ /// 接收到的信息
+ ///
+ public virtual int ReadOnly(out string rtnStr)
+ {
+ int rtn = 0;
+ byte[] rtnbyte = new byte[1000];
+ int byteCount = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.ReadOnly(out rtnStr);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnStr = "";
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.ReceiveData(out rtnStr);
+ break;
+ default:
+ rtnStr = "";
+ break;
+ }
+ }
+ return rtn;
+ }
+
+ public virtual int ReadOnly(out double rtnDb)
+ {
+ int rtn = 0;
+ string rtnStr = "";
+ rtn += ReadOnly(out rtnStr);
+ if (!double.TryParse(rtnStr, out rtnDb))
+ {
+ // DeviceControlLogger.Logger.Error("ReadOnly Command Error !", new Exception("Value Convert Faild !"));
+ // throw new DeviceException("Check Command Error !");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 只接收信息
+ ///
+ /// 接收到的信息
+ ///
+ public virtual int ReadOnly(out byte[] rtnbyte)
+ {
+ int rtn = 0;
+ int byteCount = 0;
+ if (_addrConfig.UseVisaProgrammerConfig)
+ rtn += _visa32.ReadOnly(out rtnbyte);
+ else
+ {
+ switch (_addrConfig.CommunicationTypeConfig)
+ {
+ case CommunicationTypeEnum.GPIB:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ case CommunicationTypeEnum.Socket:
+ rtn += _socketClient.ReceiveData(out rtnbyte);
+ break;
+ default:
+ rtnbyte = new byte[1] { 0 };
+ break;
+ }
+ }
+ return rtn;
+ }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInfo.cs b/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInfo.cs
new file mode 100644
index 00000000..c757b265
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInfo.cs
@@ -0,0 +1,29 @@
+using MTNet.Application;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ public class SshInfo
+ {
+ string _host = "";
+ [Description("Set SSH Host."), Category("SSH Parameters"), PropertyOrder(1), DisplayName("Host"), Browsable(true), ReadOnly(false)]
+ public string Host { get => _host; set => _host = value; }
+
+ int _port = 22;
+ [Description("Set SSH Port."), Category("SSH Parameters"), PropertyOrder(2), DisplayName("Port"), Browsable(true), ReadOnly(false)]
+ public int Port { get => _port; set => _port = value; }
+
+ string _userName = "";
+ [Description("Set SSH UserName."), Category("SSH Parameters"), PropertyOrder(3), DisplayName("UserName"), Browsable(true), ReadOnly(false)]
+ public string UserName { get => _userName; set => _userName = value; }
+
+ string _password = "";
+ [Description("Set SSH Password."), Category("SSH Parameters"), PropertyOrder(4), DisplayName("Password"), Browsable(true), ReadOnly(false)]
+ public string Password { get => _password; set => _password = value; }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInstBase.cs b/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInstBase.cs
new file mode 100644
index 00000000..9cfb7807
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/SSH/SshInstBase.cs
@@ -0,0 +1,355 @@
+using Renci.SshNet;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+
+namespace MTNet.Application.ConnectBase
+{
+ public class SshInstBase
+ {
+ public SshInstBase()
+ {
+
+ }
+
+ public SshInstBase(string ipAddress, int port, string userName, string password)
+ {
+ IpAddress = ipAddress;
+ Port = port;
+ UserName = userName;
+ Password = password;
+ }
+
+ public string IpAddress { get; }
+ public int Port { get; }
+ public string UserName { get; }
+ public string Password { get; }
+
+ private SshInfo _sshInfo;
+ public SshClient SshClient;
+ public SftpClient SftpClient;
+
+ ///
+ /// 设备名称
+ ///
+ public string DeviceName { get; set; } = "Deivce1";
+
+ ///
+ /// 设备信息,主要是包括设备名称,通信地址,端口号等
+ ///
+ public string Info { get; set; } = "";
+
+ ///
+ /// 连接状态
+ ///
+ public bool ConnectStatus { get; set; } = false;
+
+ ///
+ /// 初始化
+ ///
+ private void InitSSH()
+ {
+ if (!IPAddress.TryParse(IpAddress, out _))
+ {
+ //DeviceControlLogger.Logger.Error("Error", new Exception($"IP Address {IpAddress} Error"));//错误;
+ //throw new DeviceException($"IP Address {IpAddress} Error");
+ }
+
+ _sshInfo = new SshInfo();
+ _sshInfo.Host = IpAddress;
+ _sshInfo.Port = Port;
+ _sshInfo.UserName = UserName;
+ _sshInfo.Password = Password;
+ }
+
+ ///
+ /// 连接服务端
+ ///
+ public virtual int Connect()
+ {
+ int rtn = 0;
+ try
+ {
+ if (!ConnectStatus)
+ {
+ InitSSH();
+ Info = $"{DeviceName}\t{IpAddress}\t";
+
+ SshClient = new SshClient(_sshInfo.Host, _sshInfo.Port, _sshInfo.UserName, _sshInfo.Password);
+ SshClient.Connect();
+
+ rtn = 0;
+ ConnectStatus = true;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Connect Successed");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ //DeviceControlLogger.Logger.Error($"{Info} Connect Failed", ex);
+ //throw new DeviceException($"{Info} Connect Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 停止
+ ///
+ public virtual int Close()
+ {
+ int rtn = 0;
+
+ if (SshClient != null && ConnectStatus)
+ {
+ try
+ {
+ SshClient.Disconnect();
+ SshClient.Dispose();
+ SshClient = null;
+
+ rtn = 0;
+ ConnectStatus = false;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} DisConnect Successed");
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ //DeviceControlLogger.Logger.Error($"{Info} DisConnect Failed", ex);
+ //throw new DeviceException($"{Info} DisConnect Failed");
+ }
+ }
+ return rtn;
+ }
+
+ public virtual int SendCommand(byte[] sendData, out string result)
+ {
+ string cmdText = Encoding.Default.GetString(sendData);
+ return SendCommand(cmdText, out result);
+ }
+
+ ///
+ /// 同步执行命令,每次只能执行单次命令操作,发送指令方式与RunCommand()一致,无法实现连续操作
+ ///
+ public virtual int SendCommand(string cmdText, out string result)
+ {
+ if (cmdText == null || cmdText.Length == 0)
+ throw new Exception("Command text is null.");
+
+ if (!SshClient.IsConnected)
+ throw new Exception("Client not connect.");
+
+ int rtn = 0;
+ try
+ {
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Write:" + cmdText);
+
+ var sshCommand = SshClient.CreateCommand(cmdText);
+ if (sshCommand == null)
+ throw new Exception("SSHCommand is null.");
+
+ sshCommand.Execute();
+
+ if (!string.IsNullOrWhiteSpace(sshCommand.Error))
+ throw new Exception(sshCommand.Error);
+
+ result = sshCommand.Result;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Read:" + result);
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH SendCommand Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+
+ ///
+ /// 对服务器发送指令,并接收实时回馈,但是无法进行连续指令输入
+ /// 如果是有两条指令执行,需要通过“;”符号分隔,比方说:cd/home; ls
+ ///
+ public int RunCommand(string cmdText, out string result)
+ {
+ if (cmdText == null || cmdText.Length == 0)
+ throw new Exception("Command text is null.");
+
+ if (!SshClient.IsConnected)
+ throw new Exception("Client not connect.");
+
+ int rtn = 0;
+ try
+ {
+ var sshCommand = SshClient.RunCommand(cmdText);
+ if (sshCommand == null)
+ throw new Exception("SSHCommand is null.");
+
+ if (!string.IsNullOrWhiteSpace(sshCommand.Error))
+ throw new Exception(sshCommand.Error);
+
+ result = sshCommand.Result;
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH RunCommand Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+
+ ///
+ /// 异步执行命令,每次只能执行单次命令操作,发送指令方式与RunCommand()一致,无法实现连续操作
+ ///
+ public int SendCommandAsync(string cmdText, out string result)
+ {
+ if (cmdText == null || cmdText.Length == 0)
+ throw new Exception("Command text is null.");
+
+ if (!SshClient.IsConnected)
+ throw new Exception("Client not connect.");
+
+ int rtn = 0;
+ try
+ {
+ var sshCommand = SshClient.CreateCommand(cmdText);
+ if (sshCommand == null)
+ throw new Exception("SSHCommand is null.");
+
+ if (!string.IsNullOrWhiteSpace(sshCommand.Error))
+ throw new Exception(sshCommand.Error);
+
+ var asyncExecute = sshCommand.BeginExecute();
+ //var reader = new System.IO.StreamReader(sshCommand.OutputStream);
+ //string outStr;
+ //while ((outStr = reader.ReadLine()) != null)
+ //{
+ // //RecvMessage(outStr);
+ //}
+
+ //result = sshCommand.EndExecute(asyncExecute);
+
+ result = sshCommand.Result;
+ //RecvMessage(result);
+ //DeviceControlLogger.Logger.Info($"SendCommandAsync run command:{cmdText},result:{result}");
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH SendCommandAsync Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+
+ ///
+ /// 通过流 发送即时命令
+ ///
+ public int SendCommandToShellStream(string cmdText, ShellStream shellStream, out string result)
+ {
+ //if (cmdText == null || cmdText.Length == 0)
+ // throw new Exception("Command text is null.");
+
+ if (!SshClient.IsConnected)
+ throw new Exception("Client not connect.");
+
+ int rtn = 0;
+ StreamReader reader = null;
+ try
+ {
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} ShellStream Write:" + cmdText);
+
+ reader = new StreamReader(shellStream);
+ StreamWriter sw = new StreamWriter(shellStream);
+ sw.AutoFlush = true;
+ sw.WriteLine(cmdText);
+ Thread.Sleep(500);//此延时为等待执行结果返回,未加可能会导致读取结果为空
+ while (shellStream.Length == 0)
+ {
+ Thread.Sleep(500);
+ }
+ result = reader.ReadToEnd();
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} ShellStream Read:" + result);
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH SendCommandToShellStream Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+
+ ///
+ /// 上传单个文件到服务器,返回上传结果,成功返回空字符串,失败返回失败原因字符串
+ ///
+ public int UploadFile(string localFileName, string serverFileName, out string result)
+ {
+ int rtn = 0;
+ try
+ {
+ using (var sftp = new SftpClient(_sshInfo.Host, _sshInfo.Port, _sshInfo.UserName, _sshInfo.Password))
+ {
+ sftp.Connect();
+ using (var fileStream = File.OpenRead(localFileName))
+ {
+ sftp.UploadFile(fileStream, serverFileName, true, null);
+ }
+ sftp.Disconnect();
+ sftp.Dispose();
+ result = string.Empty;
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH UploadFile Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+
+ ///
+ /// 从服务器下载文件,返回下载结果,成功返回空字符串,失败返回失败原因字符串
+ ///
+ public int DownloadFile(string serverFileName, string localSavePath, out string result)
+ {
+ int rtn = 0;
+ try
+ {
+ using (var sftp = new SftpClient(_sshInfo.Host, _sshInfo.Port, _sshInfo.UserName, _sshInfo.Password))
+ {
+ sftp.Connect();
+ using (var fileStream = File.OpenWrite(localSavePath))
+ {
+ sftp.DownloadFile(serverFileName, fileStream);
+ }
+ sftp.Disconnect();
+ sftp.Dispose();
+ result = string.Empty;
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ result = $"SSH DownloadFile Error,{ex.Message}";
+ //SystemLogger.Logger.Error(result, ex);
+ }
+ return rtn;
+ }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Socket/Encrypt.cs b/Admin.NET/MTNet.Application/ConnectBase/Socket/Encrypt.cs
new file mode 100644
index 00000000..ad534d40
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Socket/Encrypt.cs
@@ -0,0 +1,118 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+
+ ///
+ /// 数据DES加密
+ ///
+ public class Encrypt
+ {
+ private byte[] iba_mIV = new byte[8]; //向量
+ private byte[] iba_mKey = new byte[8]; //密钥
+ private DESCryptoServiceProvider io_DES = new DESCryptoServiceProvider();
+
+ public Encrypt()
+ {
+ this.iba_mKey[0] = 0x95;
+ this.iba_mKey[1] = 0xc4;
+ this.iba_mKey[2] = 0xf6;
+ this.iba_mKey[3] = 0x49;
+ this.iba_mKey[4] = 0xac;
+ this.iba_mKey[5] = 0x61;
+ this.iba_mKey[6] = 0xa3;
+ this.iba_mKey[7] = 0xe2;
+ this.iba_mIV[0] = 0xf9;
+ this.iba_mIV[1] = 0x6a;
+ this.iba_mIV[2] = 0x65;
+ this.iba_mIV[3] = 0xb8;
+ this.iba_mIV[4] = 0x4a;
+ this.iba_mIV[5] = 0x23;
+ this.iba_mIV[6] = 0xfe;
+ this.iba_mIV[7] = 0xc6;
+ this.io_DES.Key = this.iba_mKey;
+ this.io_DES.IV = this.iba_mIV;
+ }
+ ///
+ /// 初始化加密向量与密钥 长度为8
+ ///
+ /// 向量
+ /// 密钥
+ public Encrypt(byte[] iba_mIV, byte[] iba_mKey)
+ {
+ this.io_DES.IV = iba_mIV;
+ this.io_DES.Key = iba_mKey;
+ }
+ ///
+ /// 解密
+ ///
+ ///
+ ///
+ public string doDecrypt(string as_Data)
+ {
+ ICryptoTransform lo_ICT = this.io_DES.CreateDecryptor(this.io_DES.Key, this.io_DES.IV);
+ try
+ {
+ byte[] lba_bufIn = this.FromHexString(as_Data);//Encoding.UTF8.GetString(Convert.FromBase64String(
+ byte[] lba_bufOut = lo_ICT.TransformFinalBlock(lba_bufIn, 0, lba_bufIn.Length);
+ return Encoding.UTF8.GetString(lba_bufOut);
+ }
+ catch
+ {
+ return as_Data;
+ }
+ }
+ ///
+ /// 加密
+ ///
+ ///
+ ///
+ public string doEncrypt(string as_Data)
+ {
+ ICryptoTransform lo_ICT = this.io_DES.CreateEncryptor(this.io_DES.Key, this.io_DES.IV);
+ try
+ {
+ byte[] lba_bufIn = Encoding.UTF8.GetBytes(as_Data);
+ byte[] lba_bufOut = lo_ICT.TransformFinalBlock(lba_bufIn, 0, lba_bufIn.Length);
+ return GetHexString(lba_bufOut);//Convert.ToBase64String(Encoding.UTF8.GetBytes();
+ }
+ catch
+ {
+ return "";
+ }
+ }
+ ///
+ /// 转换2进制
+ ///
+ ///
+ ///
+ private byte[] FromHexString(string as_value)
+ {
+ byte[] lba_buf = new byte[Convert.ToInt32((int)(as_value.Length / 2))];
+ for (int li_i = 0; li_i < lba_buf.Length; li_i++)
+ {
+ lba_buf[li_i] = Convert.ToByte(as_value.Substring(li_i * 2, 2), 0x10);
+ }
+ return lba_buf;
+ }
+ ///
+ /// 字节转字符串
+ ///
+ ///
+ ///
+ private string GetHexString(byte[] aba_buf)
+ {
+ StringBuilder lsb_value = new StringBuilder();
+ foreach (byte lb_byte in aba_buf)
+ {
+ lsb_value.Append(Convert.ToString(lb_byte, 0x10).PadLeft(2, '0'));
+ }
+ return lsb_value.ToString();
+ }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketClientInstBase.cs b/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketClientInstBase.cs
new file mode 100644
index 00000000..1502d669
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketClientInstBase.cs
@@ -0,0 +1,445 @@
+using MTNet.Application.IDAL.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ /*********
+ * Socket通信客户端类,使用方法如下:
+ * 1)实例化 SocketClientInstBase(IPAddress ipaddress, int port)/SocketClientInstBase(IPAddress ipaddress, int port, string deviceName)/SocketClientInstBase(IPAddress ipaddress, int port, string deviceName,bool IsCatchDeviceControlLog);
+ * 2)建立连接 Connect();
+ * 3)发送或结收数据 SendData(string SendData)/EndReader(IAsyncResult ir)
+ * 4)断开连接 Close()
+ *********/
+ public class SocketClientInstBase
+ {
+
+ ///
+ /// 设备名称
+ ///
+ public string DeviceName { get; set; } = "Deivce1";
+ ///
+ /// 设备信息,主要是包括设备名称,通信地址,端口号等
+ ///
+ public string Info { get; set; } = "";
+ ///
+ /// 连接状态
+ ///
+ public bool ConnectStatus { get; set; } = false;
+ ///
+ /// 是否打印Log,即正常信息
+ ///
+ //public bool IsCatchDeviceControlLog { get; set; } = false;
+ ///
+ /// 是否异步读取信息
+ ///
+ public bool IsAsynchronous { get; set; } = false;
+ ///
+ /// 当前管理对象
+ ///
+ Sockets _sockets;
+ ///
+ /// 客户端
+ ///
+ TcpClient _client;
+ ///
+ /// 当前连接服务端地址
+ ///
+ public string IPaddress { get; set; }
+ ///
+ /// 当前连接服务端端口号
+ ///
+ public int Port { get; set; }
+ ///
+ /// 服务端IP+端口
+ ///
+ IPEndPoint _ip;
+ ///
+ /// 发送与接收使用的流
+ ///
+ NetworkStream _nStream;
+
+
+ public SocketClientInstBase()
+ {
+
+ }
+
+
+ ///
+ /// 构造函数
+ ///
+ /// IP地址
+ /// 端口号
+ public SocketClientInstBase(string ipaddress, int port)
+ {
+ this.IPaddress = ipaddress;
+ this.Port = port;
+ }
+
+ ///
+ /// 构造函数
+ ///
+ /// IP地址
+ /// 端口号
+ /// 设备名称
+ public SocketClientInstBase(string ipaddress, int port, string deviceName)
+ {
+ this.IPaddress = ipaddress;
+ this.Port = port;
+ this.DeviceName = deviceName;
+ }
+
+
+ ///
+ /// 初始化Socket
+ ///
+ ///
+ ///
+ private void InitSocket(string ipaddress, int port)
+ {
+ IPaddress = ipaddress;
+ Port = port;
+ if (!IPAddress.TryParse(IPaddress, out var addr))
+ {
+ //DeviceControlLogger.Logger.Error("Error", new Exception($"IP Address {IPaddress} Error"));//错误;
+ //throw new DeviceException($"IP Address {IPaddress} Error");
+ }
+ _ip = new IPEndPoint(addr, Port);
+ _client = new TcpClient();
+ }
+
+ ///
+ /// 初始化Socket
+ ///
+ ///
+ ///
+ private void InitSocket()
+ {
+ if (!IPAddress.TryParse(IPaddress, out var addr))
+ {
+ //DeviceControlLogger.Logger.Error("Error", new Exception($"IP Address {IPaddress} Error"));//错误;
+ //throw new DeviceException($"IP Address {IPaddress} Error");
+ }
+ _ip = new IPEndPoint(addr, Port);
+ _client = new TcpClient();
+ }
+
+ ///
+ /// 连接服务端
+ ///
+ public virtual int Connect()
+ {
+ int rtn = 0;
+ try
+ {
+ if (!ConnectStatus)
+ {
+ InitSocket();
+ Info = DeviceName + "\t" + _ip.ToString() + "\t";
+ _client.Connect(_ip);
+ _nStream = new NetworkStream(_client.Client, true);
+ _sockets = new Sockets(_ip, _client, _nStream);
+ rtn = 0;
+ ConnectStatus = true;
+ if (IsAsynchronous)
+ _sockets.nStream.BeginRead(_sockets.RecBuffer, 0, _sockets.RecBuffer.Length, new AsyncCallback(EndReader), _sockets);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Connect Successed");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ //DeviceControlLogger.Logger.Error($"{Info} Connect Failed", ex);
+ //throw new DeviceException($"{Info} Connect Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 异步读取
+ ///
+ public virtual void EndReader(IAsyncResult ir)
+ {
+ Sockets s = ir.AsyncState as Sockets;
+ try
+ {
+ if (s != null)
+ {
+ if (!ConnectStatus && _client == null)
+ {
+ _sockets.nStream.Close();
+ _sockets.nStream.Dispose();
+ return;
+ }
+ s.Offset = s.nStream.EndRead(ir);
+ _sockets.nStream.BeginRead(_sockets.RecBuffer, 0, _sockets.RecBuffer.Length, new AsyncCallback(EndReader), _sockets);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Read:" + Encoding.Default.GetString(_sockets.RecBuffer));
+ }
+ }
+ catch (Exception skex)
+ {
+ Sockets sks = s;
+ sks.ex = skex;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", skex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+
+ }
+ ///
+ /// 停止
+ ///
+ public virtual int Close()
+ {
+ Sockets sks = new Sockets();
+ int rtn = 0;
+
+ if (_client != null && ConnectStatus)
+ {
+ try
+ {
+ _client.Client.Shutdown(SocketShutdown.Both);
+ Thread.Sleep(10);
+ _client.Close();
+ ConnectStatus = false;
+ _client = null;
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} DisConnect Successed");
+ }
+ catch (Exception ex)
+ {
+ rtn = -1;
+ sks.ex = ex;
+ //DeviceControlLogger.Logger.Error($"{Info} DisConnect Failed", sks.ex);
+ //throw new DeviceException($"{Info} DisConnect Failed");
+ }
+ }
+ return rtn;
+ }
+ ///
+ /// 发送消息
+ ///
+ public int SendData(string SendData)
+ {
+ int rtn = 0;
+ try
+ {
+ if (_client == null || !ConnectStatus)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = new Exception($"{Info} The Client Is Not Connet");
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Send Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Send Data Failed");
+ }
+ if (ConnectStatus) //如果连接则发送
+ {
+ if (_nStream == null)
+ {
+ _nStream = _client.GetStream();
+ }
+ byte[] buffer = Encoding.UTF8.GetBytes(SendData);
+ _nStream.Write(buffer, 0, buffer.Length);
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Write:" + SendData);
+ }
+ }
+ catch (Exception skex)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Send Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Send Data Failed");
+ }
+ return rtn;
+ }
+
+ public int SendData(byte[] SendData)
+ {
+ int rtn = 0;
+ try
+ {
+ if (_client == null || !ConnectStatus)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = new Exception($"{Info} The Client Is Not Connect");
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Send Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Send Data Failed");
+ }
+ if (ConnectStatus) //如果连接则发送
+ {
+ if (_nStream == null)
+ {
+ _nStream = _client.GetStream();
+ }
+ _nStream.Write(SendData, 0, SendData.Length);
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Write:" + Algorithms.ConvertByteArrayToString(SendData));
+ }
+ }
+ catch (Exception skex)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Send Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Send Data Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 接收消息,同步操作
+ ///
+ public virtual int ReceiveData(out byte[] byteData)
+ {
+ int rtn = 0;
+ byteData = new byte[1024 * 1024];
+ try
+ {
+ if (_client == null || !ConnectStatus)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = new Exception($"{Info} The Client Is Not Connect");
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+ if (ConnectStatus) //如果连接则读取
+ {
+ if (_nStream == null)
+ {
+ _nStream = _client.GetStream();
+ }
+ _nStream.Read(byteData, 0, byteData.Length);
+ byte[] finalData = Algorithms.Decode(byteData);
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Read:" + Encoding.Default.GetString(finalData));
+ }
+ }
+ catch (Exception skex)
+ {
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ rtn = -1;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+ return rtn;
+ }
+
+ public virtual int ReceiveData(int length, out byte[] byteData)
+ {
+ int rtn = 0;
+ byteData = new byte[length];
+ try
+ {
+ if (_client == null || !ConnectStatus)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = new Exception($"{Info} The Client Is Not Connect");
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+ if (ConnectStatus) //如果连接则读取
+ {
+ if (_nStream == null)
+ {
+ _nStream = _client.GetStream();
+ }
+ _nStream.Read(byteData, 0, byteData.Length);
+ if (byteData.Length != length)
+ {
+ //SystemLogger.Logger.Error($"{Info} Read: package length = {byteData.Length},content = {Algorithms.ConvertByteArrayToString(byteData)} ");
+ return rtn;
+ }
+ byte[] finalData = Algorithms.Decode(byteData);
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Read:" + Encoding.Default.GetString(finalData));
+ }
+ }
+ catch (Exception skex)
+ {
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ rtn = -1;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+ return rtn;
+ }
+
+ public virtual int ReceiveData(out string strData)
+ {
+ byte[] byteData = new byte[1024 * 1024];
+ strData = string.Empty;
+ int rtn = 0;
+ try
+ {
+ if (_client == null || !ConnectStatus)
+ {
+ rtn = -1;
+ Sockets sks = new Sockets();
+ sks.ex = new Exception($"{Info} The Client Is Not Connet");
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ //throw new DeviceException($"{Info} Read Data Failed");
+ }
+ if (ConnectStatus) //如果连接则发送
+ {
+ if (_nStream == null)
+ {
+ _nStream = _client.GetStream();
+ }
+ _nStream.Read(byteData, 0, byteData.Length);
+ if (byteData != null && byteData.Length > 0)
+ {
+ byte[] finalData = Algorithms.Decode(byteData);
+ strData = Encoding.Default.GetString(finalData);
+ rtn = 0;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{Info} Read:" + strData);
+ }
+
+ }
+ }
+ catch (Exception skex)
+ {
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ rtn = -1;
+ sks.ClientDispose = true;
+ //DeviceControlLogger.Logger.Error($"{Info} Read Data Failed", sks.ex);
+ ////throw new DeviceException($"{Info} Read Data Failed");
+ }
+ return rtn;
+ }
+
+
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketServerInstBase.cs b/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketServerInstBase.cs
new file mode 100644
index 00000000..aa79e8d0
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Socket/SocketServerInstBase.cs
@@ -0,0 +1,346 @@
+using MTNet.Application.IDAL.Utils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ ///
+ /// Tcp同步服务端,SocketObject继承抽象类
+ /// 服务端采用TcpListener封装.
+ /// 使用Semaphore 来控制并发,每次处理5个.最大处理5000
+ ///
+ public class SocketServerInstBase
+ {
+ //委托传消息
+ //public delegate void PushSockets(Sockets sockets);
+ //public PushSockets pushSockets;
+
+ bool _isStop = false;
+ object _obj = new object();
+ ///
+ /// 是否打印Log,即正常信息
+ ///
+ bool _IsCatchDeviceControlLog = false;
+ public bool IsCatchDeviceControlLog { get => _IsCatchDeviceControlLog; set => _IsCatchDeviceControlLog = value; }
+ ///
+ /// 信号量
+ ///
+ private Semaphore _semap = new Semaphore(5, 5000);
+ ///
+ /// 客户端队列集合
+ ///
+ public List _clientList = new List();
+ ///
+ /// 服务端
+ ///
+ private TcpListener _listener;
+ ///
+ /// 当前IP地址
+ ///
+ private string _ipaddress;
+ ///
+ /// 欢迎消息
+ ///
+ public string _boundary = "";
+ ///
+ /// 当前监听端口
+ ///
+ private int _port;
+ ///
+ /// 当前IP,端口对象
+ ///
+ private IPEndPoint _ip;
+
+ public SocketServerInstBase()
+ {
+ }
+
+ public SocketServerInstBase(string ipAddress, int port)
+ {
+ this._ipaddress = ipAddress;
+ this._port = port;
+ }
+
+ public SocketServerInstBase(string ipAddress, int port, bool IsCatchDeviceControlLog)
+ {
+ this._ipaddress = ipAddress;
+ this._port = port;
+ this._IsCatchDeviceControlLog = IsCatchDeviceControlLog;
+ }
+
+ ///
+ /// 初始化服务端对象
+ ///
+ /// IP地址
+ /// 监听端口
+ public void InitSocket()
+ {
+ IPAddress addr;
+ if (!IPAddress.TryParse(_ipaddress, out addr))
+ {
+ //DeviceControlLogger.Logger.Error("错误", new Exception("配置的IP地址" + _ipaddress + "错误!"));//错误;
+ //throw new DeviceException("IP地址" + _ipaddress + "错误!");
+ }
+ _listener = new TcpListener(addr, _port);
+ }
+ ///
+ /// 启动监听,并处理连接
+ ///
+ public int Connect()
+ {
+ int rtn = 0;
+ try
+ {
+ _listener.Start();
+ Thread AccTh = new Thread(new ThreadStart(delegate
+ {
+ while (true)
+ {
+ if (_isStop != false)
+ {
+ break;
+ }
+ GetAcceptTcpClient();
+ Thread.Sleep(1);
+ }
+ }));
+ AccTh.Start();
+ rtn = 0;
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(_ipaddress.ToString() + " " + _port.ToString() + " 启动监听成功!");
+ }
+ catch (SocketException skex)
+ {
+ Sockets sks = new Sockets();
+ sks.ex = skex;
+ rtn = -1;
+ //DeviceControlLogger.Logger.Error(_ipaddress.ToString() + " " + _port.ToString() + " 连接失败!", skex);
+ //throw new DeviceException(_ipaddress.ToString() + " " + _port.ToString() + " 连接失败!");
+ }
+ return rtn;
+ }
+ ///
+ /// 停止
+ ///
+ public int Close()
+ {
+ int rtn = 0;
+ if (_listener != null)
+ {
+ _listener.Stop();
+ _listener = null;
+ _isStop = true;
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(_ipaddress.ToString() + " " + _port.ToString() + " 停止监听!");
+ }
+ return rtn;
+ }
+ ///
+ /// 等待处理新的连接
+ ///
+ private void GetAcceptTcpClient()
+ {
+ try
+ {
+ if (_listener != null && _listener.Pending())
+ {
+ _semap.WaitOne();
+ TcpClient tclient = _listener.AcceptTcpClient();
+ //维护客户端队列
+ Socket socket = tclient.Client;
+ NetworkStream stream = new NetworkStream(socket, true); //承载这个Socket
+ Sockets sks = new Sockets(tclient.Client.RemoteEndPoint as IPEndPoint, tclient, stream);
+ sks.NewClientFlag = true;
+
+ //加入客户端集合.
+ AddClientList(sks);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(sks.Ip.ToString() + " " + " 连接成功!");
+
+ //推送新客户端
+ //客户端异步接收
+ sks.nStream.BeginRead(sks.RecBuffer, 0, sks.RecBuffer.Length, new AsyncCallback(EndReader), sks);
+
+ //主动向客户端发送一条连接成功信息
+ if (stream.CanWrite)
+ {
+ if (!string.IsNullOrEmpty(_boundary))
+ {
+ byte[] buffer = Encoding.UTF8.GetBytes(_boundary);
+ stream.Write(buffer, 0, buffer.Length);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(sks.Ip.ToString() + " " + " Send:" + Encoding.Default.GetString(buffer));
+ }
+ }
+ _semap.Release();
+ }
+ }
+ catch
+ {
+ return;
+ }
+ }
+
+ public event EventHandler ReceivHandler;
+
+ ///
+ /// 异步接收发送的信息.
+ ///
+ ///
+ private void EndReader(IAsyncResult ir)
+ {
+ Sockets sks = ir.AsyncState as Sockets;
+ if (sks != null && _listener != null)
+ {
+ try
+ {
+ if (sks.NewClientFlag || sks.Offset != 0)
+ {
+ sks.NewClientFlag = false;
+ sks.Offset = sks.nStream.EndRead(ir);
+ sks.nStream.BeginRead(sks.RecBuffer, 0, sks.RecBuffer.Length, new AsyncCallback(EndReader), sks);
+ ReceivHandler?.Invoke(sks, null);
+
+ byte[] reveiveBuffer = sks.RecBuffer;
+ Array.Resize(ref reveiveBuffer, sks.Offset);
+ var str = Algorithms.ConvertByteArrayToString(reveiveBuffer);
+ string receiveData = Encoding.Default.GetString(reveiveBuffer);
+
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(sks.Ip.ToString() + " Read:" + receiveData);
+ }
+ }
+ catch (Exception skex)
+ {
+ lock (_obj)
+ {
+ //移除异常类
+ _clientList.Remove(sks);
+ Sockets sk = sks;
+ sk.ClientDispose = true;//客户端退出
+ sk.ex = skex;
+ //DeviceControlLogger.Logger.Error($"{sks.Ip} Read:{Encoding.Default.GetString(sks.RecBuffer)} error.", skex);
+ //DeviceControlLogger.Logger.Error($"{sks.Ip} 客户端已经关闭!", skex);
+ ////throw new DeviceException(sks.Ip.ToString() + "客户端已经关闭!");
+ }
+ }
+ }
+ }
+ ///
+ /// 加入队列.
+ ///
+ ///
+ private void AddClientList(Sockets sk)
+ {
+ //虽然有信号量,还是用lock增加系数
+ lock (_obj)
+ {
+ Sockets sockets = _clientList.Find(o => { return o.Ip == sk.Ip; });
+ //如果不存在则添加,否则更新
+ if (sockets == null)
+ {
+ _clientList.Add(sk);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(sk.Ip.ToString() + " 客户端加入列表成功!");
+ }
+ else
+ {
+ _clientList.Remove(sockets);
+ _clientList.Add(sk);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Error(sk.Ip.ToString() + " 客户端加入列表失败!");
+ //throw new DeviceException(sk.Ip.ToString() + "客户端加入失败!");
+ }
+ }
+ }
+ ///
+ /// 向所有在线的客户端发送信息.
+ ///
+ /// 发送的文本
+ public void SendToAll(string SendData)
+ {
+ try
+ {
+ Parallel.ForEach(_clientList, new ParallelOptions() { MaxDegreeOfParallelism = 5 }, item =>
+ {
+ if (item != null)
+ SendToClient(item.Ip, SendData);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(item.Ip.ToString() + " Send Data:" + SendData + " Successed!");
+ });
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Error("向所有客户端发送数据失败!", ex);
+ //throw new DeviceException("向所有客户端发送数据失败");
+ }
+ }
+ ///
+ /// 向某一位客户端发送信息
+ ///
+ /// 客户端IP+端口地址
+ /// 发送的数据包
+ public void SendToClient(IPEndPoint ip, string SendData)
+ {
+ try
+ {
+ Sockets sks = _clientList.Find(o => { return o.Ip == ip; });
+ if (sks == null || !sks.Client.Connected || sks.ClientDispose)
+ {
+ //没有连接时,标识退出
+ Sockets ks = new Sockets();
+ sks.ClientDispose = true;//标识客户端下线
+ sks.ex = new Exception("客户端无连接");
+ _clientList.Remove(sks);
+
+ //DeviceControlLogger.Logger.Error(sks.Ip.ToString() + "客户端无连接!", sks.ex);
+ }
+ if (sks.Client.Connected)
+ {
+ //获取当前流进行写入.
+ NetworkStream nStream = sks.nStream;
+ if (nStream.CanWrite)
+ {
+ byte[] buffer = Encoding.UTF8.GetBytes(SendData);
+ nStream.Write(buffer, 0, buffer.Length);
+ }
+ else
+ {
+ //避免流被关闭,重新从对象中获取流
+ nStream = sks.Client.GetStream();
+ if (nStream.CanWrite)
+ {
+ byte[] buffer = Encoding.UTF8.GetBytes(SendData);
+ nStream.Write(buffer, 0, buffer.Length);
+ //if (_IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info(sks.Ip.ToString() + "Send Data:" + SendData + "Successed!");
+ }
+ else
+ {
+ //如果还是无法写入,那么认为客户端中断连接.
+ _clientList.Remove(sks);
+ Sockets ks = new Sockets();
+ sks.ClientDispose = true;//如果出现异常,标识客户端下线
+ sks.ex = new Exception("客户端无连接");
+ //DeviceControlLogger.Logger.Error(sks.Ip.ToString() + "客户端无连接!", sks.ex);
+ }
+ }
+ }
+ }
+ catch (Exception skex)
+ {
+ Sockets sks = new Sockets();
+ sks.ClientDispose = true;//如果出现异常,标识客户端退出
+ sks.ex = skex;
+ //DeviceControlLogger.Logger.Error(ip.ToString() + "Send Data Fail!", skex);
+ //throw new DeviceException("给客户端" + ip.ToString() + "发送数据失败");
+ }
+ }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Socket/Sockets.cs b/Admin.NET/MTNet.Application/ConnectBase/Socket/Sockets.cs
new file mode 100644
index 00000000..525cd380
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Socket/Sockets.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ //
+ /// 自定义Socket对象
+ ///
+ public class Sockets
+ {
+ ///
+ /// 空构造
+ ///
+ public Sockets()
+ {
+ }
+ ///
+ /// 创建Sockets对象
+ ///
+ /// Ip地址
+ /// TcpClient
+ /// 承载客户端Socket的网络流
+ public Sockets(IPEndPoint ip, TcpClient client, NetworkStream ns)
+ {
+ Ip = ip;
+ Client = client;
+ nStream = ns;
+ }
+ ///
+ /// 创建Sockets对象
+ ///
+ /// 用户名
+ /// 密码
+ /// Ip地址
+ /// TcpClient
+ /// 承载客户端Socket的网络流
+ public Sockets(string name, string pass, IPEndPoint ip, TcpClient client, NetworkStream ns)
+ {
+ UserName = name;
+ Password = pass;
+ Ip = ip;
+ Client = client;
+ nStream = ns;
+ }
+
+ ///
+ /// 接收缓冲区
+ ///
+ public byte[] RecBuffer { get; set; } = new byte[8 * 1024];
+ ///
+ /// 发送缓冲区
+ ///
+ public byte[] SendBuffer { get; set; } = new byte[8 * 1024];
+ ///
+ /// 异步接收后包的大小
+ ///
+ public int Offset { get; set; }
+ ///
+ /// 用户名
+ ///
+ public string UserName { get; }
+ ///
+ /// 密码
+ ///
+ public string Password { get; }
+ ///
+ /// 当前IP地址,端口号
+ ///
+ public IPEndPoint Ip { get; }
+ ///
+ /// 客户端主通信程序
+ ///
+ public TcpClient Client { get; }
+ ///
+ /// 承载客户端Socket的网络流
+ ///
+ public NetworkStream nStream { get; }
+ ///
+ /// 发生异常时不为null.
+ ///
+ public Exception ex { get; set; }
+ ///
+ /// 新客户端标识.如果推送器发现此标识为true,那么认为是客户端上线
+ /// 仅服务端有效
+ ///
+ public bool NewClientFlag { get; set; }
+ ///
+ /// 客户端退出标识.如果服务端发现此标识为true,那么认为客户端下线
+ /// 客户端接收此标识时,认为客户端异常.
+ ///
+ public bool ClientDispose { get; set; }
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32.cs b/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32.cs
new file mode 100644
index 00000000..3a8fab7c
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32.cs
@@ -0,0 +1,779 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace MTNet.Application.ConnectBase
+{
+ public sealed class Visa32
+ {
+ // --------------------------------------------------------------------------------
+ // Adapted from visa32.bas which was distributed by VXIplug&play Systems Alliance
+ // Distributed By Agilent Technologies, Inc.
+ // --------------------------------------------------------------------------------
+ // Title : visa32.cs
+ // Date : 03-06-2009
+ // Purpose : VISA definitions for C#
+ // -------------------------------------------------------------------------
+ public const int VI_SPEC_VERSION = 4194304;
+
+
+ #region - Resource Template Functions and Operations ----------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#141", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOpenDefaultRM(out int sesn);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#128", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGetDefaultRM(out int sesn);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#129", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viFindRsrc(int sesn, string expr, out int vi, out int retCount, StringBuilder desc);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#130", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viFindNext(int vi, StringBuilder desc);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#146", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viParseRsrc(int sesn, string desc, ref short intfType, ref short intfNum);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#147", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viParseRsrcEx(int sesn, string desc, ref short intfType, ref short intfNum, StringBuilder rsrcClass, StringBuilder expandedUnaliasedName, StringBuilder aliasIfExists);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#131", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOpen(int sesn, string viDesc, int mode, int timeout, out int vi);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#132", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viClose(int vi);
+
+ #region viGetAttribute Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#133", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGetAttribute(int vi, int attrName, out byte attrValue);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#133", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGetAttribute(int vi, int attrName, out short attrValue);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#133", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGetAttribute(int vi, int attrName, out int attrValue);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#133", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGetAttribute(int vi, int attrName, StringBuilder attrValue);
+ #endregion
+
+ #region viSetAttribute Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#134", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viSetAttribute(int vi, int attrName, byte attrValue);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#134", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viSetAttribute(int vi, int attrName, short attrValue);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#134", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viSetAttribute(int vi, int attrName, int attrValue);
+ #endregion
+
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#142", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viStatusDesc(int vi, int status, StringBuilder desc);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#143", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viTerminate(int vi, short degree, int jobId);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#144", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viLock(int vi, int lockType, int timeout, string requestedKey, StringBuilder accessKey);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#145", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUnlock(int vi);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#135", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viEnableEvent(int vi, int eventType, short mechanism, int context);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#136", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viDisableEvent(int vi, int eventType, short mechanism);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#137", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viDiscardEvents(int vi, int eventType, short mechanism);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#138", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viWaitOnEvent(int vi, int inEventType, int timeout, ref int outEventType, ref int outEventContext);
+
+ public delegate int viEventHandler(int vi, int eventType, int context, int userHandle);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#139", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viInstallHandler(int vi, int eventType, viEventHandler handler, int UserHandle);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#140", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUninstallHandler(int vi, int eventType, viEventHandler handler, int userHandle);
+ #endregion
+
+ #region - Basic I/O Operations --------------------------------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#256", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viRead(int vi, byte[] buffer, int count, out int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#277", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viReadAsync(int vi, byte[] buffer, int count, out int jobId);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#219", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viReadToFile(int vi, string filename, int count, ref int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#257", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viWrite(int vi, byte[] buffer, int count, out int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#278", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viWriteAsync(int vi, byte[] buffer, int count, out int jobId);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#218", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viWriteFromFile(int vi, string filename, int count, ref int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#258", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viAssertTrigger(int vi, short protocol);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#259", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viReadSTB(int vi, ref short status);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#260", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viClear(int vi);
+ #endregion
+
+ #region - Formatted and Buffered I/O Operations ---------------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#267", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viSetBuf(int vi, short mask, int bufSize);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#268", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viFlush(int vi, short mask);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#202", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viBufWrite(int vi, byte[] buffer, int count, out int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#203", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viBufRead(int vi, byte[] buffer, int count, out int retCount);
+
+ #region viPrintf Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, string arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, int arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, short arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, double arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#269", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viPrintf(int vi, string writeFmt, byte arg);
+ #endregion
+
+ #region viSPrintf Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, string arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, int arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, short arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, double arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#204", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSPrintf(int vi, StringBuilder buffer, string writeFmt, byte arg);
+ #endregion
+
+ #region viScanf Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int count, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int count, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int count, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int count, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int count, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, StringBuilder arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, ref int stringSize, StringBuilder arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, out int arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, out short arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, out float arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, out double arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#271", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viScanf(int vi, string readFmt, out byte arg);
+ #endregion
+
+ #region viSScanf Overloads
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int count, int[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int count, short[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int count, float[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int count, double[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int count, byte[] arr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, StringBuilder arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, ref int stringSize, StringBuilder arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, out int arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, out short arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, out float arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, out double arg);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#206", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
+ public static extern int viSScanf(int vi, string buffer, string readFmt, out byte arg);
+ #endregion
+
+ #endregion
+
+ #region - Memory I/O Operations -------------------------------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#273", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn8(int vi, short accSpace, int offset, out byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#274", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut8(int vi, short accSpace, int offset, byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#261", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn16(int vi, short accSpace, int offset, out short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#262", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut16(int vi, short accSpace, int offset, short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#281", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn32(int vi, short accSpace, int offset, out int val32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#282", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut32(int vi, short accSpace, int offset, int val32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#283", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn8(int vi, short accSpace, int offset, int length, byte[] buf8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#284", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut8(int vi, short accSpace, int offset, int length, byte[] buf8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#285", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn16(int vi, short accSpace, int offset, int length, short[] buf16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#286", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut16(int vi, short accSpace, int offset, int length, short[] buf16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#287", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn32(int vi, short accSpace, int offset, int length, int[] buf32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#288", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut32(int vi, short accSpace, int offset, int length, int[] buf32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#200", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMove(int vi, short srcSpace, int srcOffset, short srcWidth, short destSpace, int destOffset, short destWidth, int srcLength);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#201", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveAsync(int vi, short srcSpace, int srcOffset, short srcWidth, short destSpace, int destOffset, short destWidth, int srcLength, out int jobId);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#263", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMapAddress(int vi, short mapSpace, int mapOffset, int mapSize, short accMode, int suggested, out int address);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#264", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUnmapAddress(int vi);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#275", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPeek8(int vi, int address, out byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#276", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPoke8(int vi, int address, byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#265", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPeek16(int vi, int address, out short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#266", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPoke16(int vi, int address, short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#289", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPeek32(int vi, int address, out int val32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#290", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPoke32(int vi, int address, int val32);
+
+ #region 64-bit Extension Functions
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#220", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn64(int vi, short accSpace, int offset, out long val64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#221", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut64(int vi, short accSpace, int offset, long val64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#222", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn8Ex(int vi, short accSpace, long offset, out byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#223", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut8Ex(int vi, short accSpace, long offset, byte val8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#224", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn16Ex(int vi, short accSpace, long offset, out short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#225", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut16Ex(int vi, short accSpace, long offset, short val16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#226", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn32Ex(int vi, short accSpace, long offset, out int val32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#227", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut32Ex(int vi, short accSpace, long offset, int val32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#228", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viIn64Ex(int vi, short accSpace, long offset, out long val64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#229", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viOut64Ex(int vi, short accSpace, long offset, long val64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#230", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn64(int vi, short accSpace, int offset, int length, long[] buf64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#231", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut64(int vi, short accSpace, int offset, int length, long[] buf64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#232", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn8Ex(int vi, short accSpace, long offset, int length, byte[] buf8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#233", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut8Ex(int vi, short accSpace, long offset, int length, byte[] buf8);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#234", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn16Ex(int vi, short accSpace, long offset, int length, short[] buf16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#235", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut16Ex(int vi, short accSpace, long offset, int length, short[] buf16);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#236", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn32Ex(int vi, short accSpace, long offset, int length, int[] buf32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#237", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut32Ex(int vi, short accSpace, long offset, int length, int[] buf32);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#238", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveIn64Ex(int vi, short accSpace, long offset, int length, long[] buf64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#239", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveOut64Ex(int vi, short accSpace, long offset, int length, long[] buf64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#240", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveEx(int vi, short srcSpace, long srcOffset, short srcWidth, short destSpace, long destOffset, short destWidth, int srcLength);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#241", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMoveAsyncEx(int vi, short srcSpace, long srcOffset, short srcWidth, short destSpace, long destOffset, short destWidth, int srcLength, out int jobId);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#242", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMapAddressEx(int vi, short mapSpace, long mapOffset, int mapSize, short accMode, int suggested, out int address);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#243", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMemAllocEx(int vi, int memSize, out long offset);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#244", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMemFreeEx(int vi, long offset);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#245", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPeek64(int vi, int address, out long val64);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#246", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern void viPoke64(int vi, int address, long val64);
+ #endregion
+ #endregion
+
+ #region - Shared Memory Operations ----------------------------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#291", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMemAlloc(int vi, int memSize, out int offset);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#292", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMemFree(int vi, int offset);
+ #endregion
+
+ #region - Interface Specific Operations -----------------------------------------
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#208", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGpibControlREN(int vi, short mode);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#210", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGpibControlATN(int vi, short mode);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#211", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGpibSendIFC(int vi);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#212", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGpibCommand(int vi, string buffer, int count, out int retCount);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#213", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viGpibPassControl(int vi, short primAddr, short secAddr);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#209", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viVxiCommandQuery(int vi, short mode, int devCmd, out int devResponse);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#214", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viAssertUtilSignal(int vi, short line);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#215", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viAssertIntrSignal(int vi, short mode, int statusID);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#216", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viMapTrigger(int vi, short trigSrc, short trigDest, short mode);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#217", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUnmapTrigger(int vi, short trigSrc, short trigDest);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#293", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUsbControlOut(int vi, short bmRequestType, short bRequest, short wValue, short wIndex, short wLength, byte[] buf);
+ [DllImportAttribute("VISA32.DLL", EntryPoint = "#294", ExactSpelling = true, CharSet = CharSet.Ansi, SetLastError = true)]
+ public static extern int viUsbControlIn(int vi, short bmRequestType, short bRequest, short wValue, short wIndex, short wLength, byte[] buf, out short retCnt);
+ #endregion
+
+ #region - Constants -------------------------------------------------------------
+
+ #region - Attributes ------------------------------------------------------------
+ public const int VI_ATTR_RSRC_CLASS = -1073807359;
+ public const int VI_ATTR_RSRC_NAME = -1073807358;
+ public const int VI_ATTR_RSRC_IMPL_VERSION = 1073676291;
+ public const int VI_ATTR_RSRC_LOCK_STATE = 1073676292;
+ public const int VI_ATTR_MAX_QUEUE_LENGTH = 1073676293;
+ public const int VI_ATTR_USER_DATA = 1073676295;
+ public const int VI_ATTR_FDC_CHNL = 1073676301;
+ public const int VI_ATTR_FDC_MODE = 1073676303;
+ public const int VI_ATTR_FDC_GEN_SIGNAL_EN = 1073676305;
+ public const int VI_ATTR_FDC_USE_PAIR = 1073676307;
+ public const int VI_ATTR_SEND_END_EN = 1073676310;
+ public const int VI_ATTR_TERMCHAR = 1073676312;
+ public const int VI_ATTR_TMO_VALUE = 1073676314;
+ public const int VI_ATTR_GPIB_READDR_EN = 1073676315;
+ public const int VI_ATTR_IO_PROT = 1073676316;
+ public const int VI_ATTR_DMA_ALLOW_EN = 1073676318;
+ public const int VI_ATTR_ASRL_BAUD = 1073676321;
+ public const int VI_ATTR_ASRL_DATA_BITS = 1073676322;
+ public const int VI_ATTR_ASRL_PARITY = 1073676323;
+ public const int VI_ATTR_ASRL_STOP_BITS = 1073676324;
+ public const int VI_ATTR_ASRL_FLOW_CNTRL = 1073676325;
+ public const int VI_ATTR_RD_BUF_OPER_MODE = 1073676330;
+ public const int VI_ATTR_RD_BUF_SIZE = 1073676331;
+ public const int VI_ATTR_WR_BUF_OPER_MODE = 1073676333;
+ public const int VI_ATTR_WR_BUF_SIZE = 1073676334;
+ public const int VI_ATTR_SUPPRESS_END_EN = 1073676342;
+ public const int VI_ATTR_TERMCHAR_EN = 1073676344;
+ public const int VI_ATTR_DEST_ACCESS_PRIV = 1073676345;
+ public const int VI_ATTR_DEST_BYTE_ORDER = 1073676346;
+ public const int VI_ATTR_SRC_ACCESS_PRIV = 1073676348;
+ public const int VI_ATTR_SRC_BYTE_ORDER = 1073676349;
+ public const int VI_ATTR_SRC_INCREMENT = 1073676352;
+ public const int VI_ATTR_DEST_INCREMENT = 1073676353;
+ public const int VI_ATTR_WIN_ACCESS_PRIV = 1073676357;
+ public const int VI_ATTR_WIN_BYTE_ORDER = 1073676359;
+ public const int VI_ATTR_GPIB_ATN_STATE = 1073676375;
+ public const int VI_ATTR_GPIB_ADDR_STATE = 1073676380;
+ public const int VI_ATTR_GPIB_CIC_STATE = 1073676382;
+ public const int VI_ATTR_GPIB_NDAC_STATE = 1073676386;
+ public const int VI_ATTR_GPIB_SRQ_STATE = 1073676391;
+ public const int VI_ATTR_GPIB_SYS_CNTRL_STATE = 1073676392;
+ public const int VI_ATTR_GPIB_HS488_CBL_LEN = 1073676393;
+ public const int VI_ATTR_CMDR_LA = 1073676395;
+ public const int VI_ATTR_VXI_DEV_CLASS = 1073676396;
+ public const int VI_ATTR_MAINFRAME_LA = 1073676400;
+ public const int VI_ATTR_MANF_NAME = -1073807246;
+ public const int VI_ATTR_MODEL_NAME = -1073807241;
+ public const int VI_ATTR_VXI_VME_INTR_STATUS = 1073676427;
+ public const int VI_ATTR_VXI_TRIG_STATUS = 1073676429;
+ public const int VI_ATTR_VXI_VME_SYSFAIL_STATE = 1073676436;
+ public const int VI_ATTR_WIN_BASE_ADDR = 1073676440;
+ public const int VI_ATTR_WIN_SIZE = 1073676442;
+ public const int VI_ATTR_ASRL_AVAIL_NUM = 1073676460;
+ public const int VI_ATTR_MEM_BASE = 1073676461;
+ public const int VI_ATTR_ASRL_CTS_STATE = 1073676462;
+ public const int VI_ATTR_ASRL_DCD_STATE = 1073676463;
+ public const int VI_ATTR_ASRL_DSR_STATE = 1073676465;
+ public const int VI_ATTR_ASRL_DTR_STATE = 1073676466;
+ public const int VI_ATTR_ASRL_END_IN = 1073676467;
+ public const int VI_ATTR_ASRL_END_OUT = 1073676468;
+ public const int VI_ATTR_ASRL_REPLACE_CHAR = 1073676478;
+ public const int VI_ATTR_ASRL_RI_STATE = 1073676479;
+ public const int VI_ATTR_ASRL_RTS_STATE = 1073676480;
+ public const int VI_ATTR_ASRL_XON_CHAR = 1073676481;
+ public const int VI_ATTR_ASRL_XOFF_CHAR = 1073676482;
+ public const int VI_ATTR_WIN_ACCESS = 1073676483;
+ public const int VI_ATTR_RM_SESSION = 1073676484;
+ public const int VI_ATTR_VXI_LA = 1073676501;
+ public const int VI_ATTR_MANF_ID = 1073676505;
+ public const int VI_ATTR_MEM_SIZE = 1073676509;
+ public const int VI_ATTR_MEM_SPACE = 1073676510;
+ public const int VI_ATTR_MODEL_CODE = 1073676511;
+ public const int VI_ATTR_SLOT = 1073676520;
+ public const int VI_ATTR_INTF_INST_NAME = -1073807127;
+ public const int VI_ATTR_IMMEDIATE_SERV = 1073676544;
+ public const int VI_ATTR_INTF_PARENT_NUM = 1073676545;
+ public const int VI_ATTR_RSRC_SPEC_VERSION = 1073676656;
+ public const int VI_ATTR_INTF_TYPE = 1073676657;
+ public const int VI_ATTR_GPIB_PRIMARY_ADDR = 1073676658;
+ public const int VI_ATTR_GPIB_SECONDARY_ADDR = 1073676659;
+ public const int VI_ATTR_RSRC_MANF_NAME = -1073806988;
+ public const int VI_ATTR_RSRC_MANF_ID = 1073676661;
+ public const int VI_ATTR_INTF_NUM = 1073676662;
+ public const int VI_ATTR_TRIG_ID = 1073676663;
+ public const int VI_ATTR_GPIB_REN_STATE = 1073676673;
+ public const int VI_ATTR_GPIB_UNADDR_EN = 1073676676;
+ public const int VI_ATTR_DEV_STATUS_BYTE = 1073676681;
+ public const int VI_ATTR_FILE_APPEND_EN = 1073676690;
+ public const int VI_ATTR_VXI_TRIG_SUPPORT = 1073676692;
+ public const int VI_ATTR_TCPIP_ADDR = -1073806955;
+ public const int VI_ATTR_TCPIP_HOSTNAME = -1073806954;
+ public const int VI_ATTR_TCPIP_PORT = 1073676695;
+ public const int VI_ATTR_TCPIP_DEVICE_NAME = -1073806951;
+ public const int VI_ATTR_TCPIP_NODELAY = 1073676698;
+ public const int VI_ATTR_TCPIP_KEEPALIVE = 1073676699;
+ public const int VI_ATTR_4882_COMPLIANT = 1073676703;
+ public const int VI_ATTR_USB_SERIAL_NUM = -1073806944;
+ public const int VI_ATTR_USB_INTFC_NUM = 1073676705;
+ public const int VI_ATTR_USB_PROTOCOL = 1073676711;
+ public const int VI_ATTR_USB_MAX_INTR_SIZE = 1073676719;
+ public const int VI_ATTR_JOB_ID = 1073692678;
+ public const int VI_ATTR_EVENT_TYPE = 1073692688;
+ public const int VI_ATTR_SIGP_STATUS_ID = 1073692689;
+ public const int VI_ATTR_RECV_TRIG_ID = 1073692690;
+ public const int VI_ATTR_INTR_STATUS_ID = 1073692707;
+ public const int VI_ATTR_STATUS = 1073692709;
+ public const int VI_ATTR_RET_COUNT = 1073692710;
+ public const int VI_ATTR_BUFFER = 1073692711;
+ public const int VI_ATTR_RECV_INTR_LEVEL = 1073692737;
+ public const int VI_ATTR_OPER_NAME = -1073790910;
+ public const int VI_ATTR_GPIB_RECV_CIC_STATE = 1073693075;
+ public const int VI_ATTR_RECV_TCPIP_ADDR = -1073790568;
+ public const int VI_ATTR_USB_RECV_INTR_SIZE = 1073693104;
+ public const int VI_ATTR_USB_RECV_INTR_DATA = -1073790543;
+ #endregion
+
+ #region - Event Types -----------------------------------------------------------
+ public const int VI_EVENT_IO_COMPLETION = 1073684489;
+ public const int VI_EVENT_TRIG = -1073799158;
+ public const int VI_EVENT_SERVICE_REQ = 1073684491;
+ public const int VI_EVENT_CLEAR = 1073684493;
+ public const int VI_EVENT_EXCEPTION = -1073799154;
+ public const int VI_EVENT_GPIB_CIC = 1073684498;
+ public const int VI_EVENT_GPIB_TALK = 1073684499;
+ public const int VI_EVENT_GPIB_LISTEN = 1073684500;
+ public const int VI_EVENT_VXI_VME_SYSFAIL = 1073684509;
+ public const int VI_EVENT_VXI_VME_SYSRESET = 1073684510;
+ public const int VI_EVENT_VXI_SIGP = 1073684512;
+ public const int VI_EVENT_VXI_VME_INTR = -1073799135;
+ public const int VI_EVENT_TCPIP_CONNECT = 1073684534;
+ public const int VI_EVENT_USB_INTR = 1073684535;
+ public const int VI_ALL_ENABLED_EVENTS = 1073709055;
+ #endregion
+
+ #region - Completion and Error Codes --------------------------------------------
+ public const int VI_SUCCESS = 0;
+ public const int VI_SUCCESS_EVENT_EN = 1073676290;
+ public const int VI_SUCCESS_EVENT_DIS = 1073676291;
+ public const int VI_SUCCESS_QUEUE_EMPTY = 1073676292;
+ public const int VI_SUCCESS_TERM_CHAR = 1073676293;
+ public const int VI_SUCCESS_MAX_CNT = 1073676294;
+ public const int VI_SUCCESS_DEV_NPRESENT = 1073676413;
+ public const int VI_SUCCESS_TRIG_MAPPED = 1073676414;
+ public const int VI_SUCCESS_QUEUE_NEMPTY = 1073676416;
+ public const int VI_SUCCESS_NCHAIN = 1073676440;
+ public const int VI_SUCCESS_NESTED_SHARED = 1073676441;
+ public const int VI_SUCCESS_NESTED_EXCLUSIVE = 1073676442;
+ public const int VI_SUCCESS_SYNC = 1073676443;
+ public const int VI_WARN_QUEUE_OVERFLOW = 1073676300;
+ public const int VI_WARN_CONFIG_NLOADED = 1073676407;
+ public const int VI_WARN_NULL_OBJECT = 1073676418;
+ public const int VI_WARN_NSUP_ATTR_STATE = 1073676420;
+ public const int VI_WARN_UNKNOWN_STATUS = 1073676421;
+ public const int VI_WARN_NSUP_BUF = 1073676424;
+ public const int VI_WARN_EXT_FUNC_NIMPL = 1073676457;
+ public const int VI_ERROR_SYSTEM_ERROR = -1073807360;
+ public const int VI_ERROR_INV_OBJECT = -1073807346;
+ public const int VI_ERROR_RSRC_LOCKED = -1073807345;
+ public const int VI_ERROR_INV_EXPR = -1073807344;
+ public const int VI_ERROR_RSRC_NFOUND = -1073807343;
+ public const int VI_ERROR_INV_RSRC_NAME = -1073807342;
+ public const int VI_ERROR_INV_ACC_MODE = -1073807341;
+ public const int VI_ERROR_TMO = -1073807339;
+ public const int VI_ERROR_CLOSING_FAILED = -1073807338;
+ public const int VI_ERROR_INV_DEGREE = -1073807333;
+ public const int VI_ERROR_INV_JOB_ID = -1073807332;
+ public const int VI_ERROR_NSUP_ATTR = -1073807331;
+ public const int VI_ERROR_NSUP_ATTR_STATE = -1073807330;
+ public const int VI_ERROR_ATTR_READONLY = -1073807329;
+ public const int VI_ERROR_INV_LOCK_TYPE = -1073807328;
+ public const int VI_ERROR_INV_ACCESS_KEY = -1073807327;
+ public const int VI_ERROR_INV_EVENT = -1073807322;
+ public const int VI_ERROR_INV_MECH = -1073807321;
+ public const int VI_ERROR_HNDLR_NINSTALLED = -1073807320;
+ public const int VI_ERROR_INV_HNDLR_REF = -1073807319;
+ public const int VI_ERROR_INV_CONTEXT = -1073807318;
+ public const int VI_ERROR_QUEUE_OVERFLOW = -1073807315;
+ public const int VI_ERROR_NENABLED = -1073807313;
+ public const int VI_ERROR_ABORT = -1073807312;
+ public const int VI_ERROR_RAW_WR_PROT_VIOL = -1073807308;
+ public const int VI_ERROR_RAW_RD_PROT_VIOL = -1073807307;
+ public const int VI_ERROR_OUTP_PROT_VIOL = -1073807306;
+ public const int VI_ERROR_INP_PROT_VIOL = -1073807305;
+ public const int VI_ERROR_BERR = -1073807304;
+ public const int VI_ERROR_IN_PROGRESS = -1073807303;
+ public const int VI_ERROR_INV_SETUP = -1073807302;
+ public const int VI_ERROR_QUEUE_ERROR = -1073807301;
+ public const int VI_ERROR_ALLOC = -1073807300;
+ public const int VI_ERROR_INV_MASK = -1073807299;
+ public const int VI_ERROR_IO = -1073807298;
+ public const int VI_ERROR_INV_FMT = -1073807297;
+ public const int VI_ERROR_NSUP_FMT = -1073807295;
+ public const int VI_ERROR_LINE_IN_USE = -1073807294;
+ public const int VI_ERROR_NSUP_MODE = -1073807290;
+ public const int VI_ERROR_SRQ_NOCCURRED = -1073807286;
+ public const int VI_ERROR_INV_SPACE = -1073807282;
+ public const int VI_ERROR_INV_OFFSET = -1073807279;
+ public const int VI_ERROR_INV_WIDTH = -1073807278;
+ public const int VI_ERROR_NSUP_OFFSET = -1073807276;
+ public const int VI_ERROR_NSUP_VAR_WIDTH = -1073807275;
+ public const int VI_ERROR_WINDOW_NMAPPED = -1073807273;
+ public const int VI_ERROR_RESP_PENDING = -1073807271;
+ public const int VI_ERROR_NLISTENERS = -1073807265;
+ public const int VI_ERROR_NCIC = -1073807264;
+ public const int VI_ERROR_NSYS_CNTLR = -1073807263;
+ public const int VI_ERROR_NSUP_OPER = -1073807257;
+ public const int VI_ERROR_INTR_PENDING = -1073807256;
+ public const int VI_ERROR_ASRL_PARITY = -1073807254;
+ public const int VI_ERROR_ASRL_FRAMING = -1073807253;
+ public const int VI_ERROR_ASRL_OVERRUN = -1073807252;
+ public const int VI_ERROR_TRIG_NMAPPED = -1073807250;
+ public const int VI_ERROR_NSUP_ALIGN_OFFSET = -1073807248;
+ public const int VI_ERROR_USER_BUF = -1073807247;
+ public const int VI_ERROR_RSRC_BUSY = -1073807246;
+ public const int VI_ERROR_NSUP_WIDTH = -1073807242;
+ public const int VI_ERROR_INV_PARAMETER = -1073807240;
+ public const int VI_ERROR_INV_PROT = -1073807239;
+ public const int VI_ERROR_INV_SIZE = -1073807237;
+ public const int VI_ERROR_WINDOW_MAPPED = -1073807232;
+ public const int VI_ERROR_NIMPL_OPER = -1073807231;
+ public const int VI_ERROR_INV_LENGTH = -1073807229;
+ public const int VI_ERROR_INV_MODE = -1073807215;
+ public const int VI_ERROR_SESN_NLOCKED = -1073807204;
+ public const int VI_ERROR_MEM_NSHARED = -1073807203;
+ public const int VI_ERROR_LIBRARY_NFOUND = -1073807202;
+ public const int VI_ERROR_NSUP_INTR = -1073807201;
+ public const int VI_ERROR_INV_LINE = -1073807200;
+ public const int VI_ERROR_FILE_ACCESS = -1073807199;
+ public const int VI_ERROR_FILE_IO = -1073807198;
+ public const int VI_ERROR_NSUP_LINE = -1073807197;
+ public const int VI_ERROR_NSUP_MECH = -1073807196;
+ public const int VI_ERROR_INTF_NUM_NCONFIG = -1073807195;
+ public const int VI_ERROR_CONN_LOST = -1073807194;
+ public const int VI_ERROR_NPERMISSION = -1073807192;
+ #endregion
+
+ #region - Other VISA Definitions ------------------------------------------------
+ public const short VI_FIND_BUFLEN = 256;
+ public const short VI_NULL = 0;
+ public const short VI_TRUE = 1;
+ public const short VI_FALSE = 0;
+ public const short VI_INTF_GPIB = 1;
+ public const short VI_INTF_VXI = 2;
+ public const short VI_INTF_GPIB_VXI = 3;
+ public const short VI_INTF_ASRL = 4;
+ public const short VI_INTF_TCPIP = 6;
+ public const short VI_INTF_USB = 7;
+ public const short VI_PROT_NORMAL = 1;
+ public const short VI_PROT_FDC = 2;
+ public const short VI_PROT_HS488 = 3;
+ public const short VI_PROT_4882_STRS = 4;
+ public const short VI_PROT_USBTMC_VENDOR = 5;
+ public const short VI_FDC_NORMAL = 1;
+ public const short VI_FDC_STREAM = 2;
+ public const short VI_LOCAL_SPACE = 0;
+ public const short VI_A16_SPACE = 1;
+ public const short VI_A24_SPACE = 2;
+ public const short VI_A32_SPACE = 3;
+ public const short VI_OPAQUE_SPACE = -1;
+ public const short VI_UNKNOWN_LA = -1;
+ public const short VI_UNKNOWN_SLOT = -1;
+ public const short VI_UNKNOWN_LEVEL = -1;
+ public const short VI_QUEUE = 1;
+ public const short VI_HNDLR = 2;
+ public const short VI_SUSPEND_HNDLR = 4;
+ public const short VI_ALL_MECH = -1;
+ public const short VI_ANY_HNDLR = 0;
+ public const short VI_TRIG_ALL = -2;
+ public const short VI_TRIG_SW = -1;
+ public const short VI_TRIG_TTL0 = 0;
+ public const short VI_TRIG_TTL1 = 1;
+ public const short VI_TRIG_TTL2 = 2;
+ public const short VI_TRIG_TTL3 = 3;
+ public const short VI_TRIG_TTL4 = 4;
+ public const short VI_TRIG_TTL5 = 5;
+ public const short VI_TRIG_TTL6 = 6;
+ public const short VI_TRIG_TTL7 = 7;
+ public const short VI_TRIG_ECL0 = 8;
+ public const short VI_TRIG_ECL1 = 9;
+ public const short VI_TRIG_PANEL_IN = 27;
+ public const short VI_TRIG_PANEL_OUT = 28;
+ public const short VI_TRIG_PROT_DEFAULT = 0;
+ public const short VI_TRIG_PROT_ON = 1;
+ public const short VI_TRIG_PROT_OFF = 2;
+ public const short VI_TRIG_PROT_SYNC = 5;
+ public const short VI_READ_BUF = 1;
+ public const short VI_WRITE_BUF = 2;
+ public const short VI_READ_BUF_DISCARD = 4;
+ public const short VI_WRITE_BUF_DISCARD = 8;
+ public const short VI_IO_IN_BUF = 16;
+ public const short VI_IO_OUT_BUF = 32;
+ public const short VI_IO_IN_BUF_DISCARD = 64;
+ public const short VI_IO_OUT_BUF_DISCARD = 128;
+ public const short VI_FLUSH_ON_ACCESS = 1;
+ public const short VI_FLUSH_WHEN_FULL = 2;
+ public const short VI_FLUSH_DISABLE = 3;
+ public const short VI_NMAPPED = 1;
+ public const short VI_USE_OPERS = 2;
+ public const short VI_DEREF_ADDR = 3;
+ public const int VI_TMO_IMMEDIATE = 0;
+ public const int VI_TMO_INFINITE = -1;
+ public const short VI_NO_LOCK = 0;
+ public const short VI_EXCLUSIVE_LOCK = 1;
+ public const short VI_SHARED_LOCK = 2;
+ public const short VI_LOAD_CONFIG = 4;
+ public const short VI_NO_SEC_ADDR = -1;
+ public const short VI_ASRL_PAR_NONE = 0;
+ public const short VI_ASRL_PAR_ODD = 1;
+ public const short VI_ASRL_PAR_EVEN = 2;
+ public const short VI_ASRL_PAR_MARK = 3;
+ public const short VI_ASRL_PAR_SPACE = 4;
+ public const short VI_ASRL_STOP_ONE = 10;
+ public const short VI_ASRL_STOP_ONE5 = 15;
+ public const short VI_ASRL_STOP_TWO = 20;
+ public const short VI_ASRL_FLOW_NONE = 0;
+ public const short VI_ASRL_FLOW_XON_XOFF = 1;
+ public const short VI_ASRL_FLOW_RTS_CTS = 2;
+ public const short VI_ASRL_FLOW_DTR_DSR = 4;
+ public const short VI_ASRL_END_NONE = 0;
+ public const short VI_ASRL_END_LAST_BIT = 1;
+ public const short VI_ASRL_END_TERMCHAR = 2;
+ public const short VI_ASRL_END_BREAK = 3;
+ public const short VI_STATE_ASSERTED = 1;
+ public const short VI_STATE_UNASSERTED = 0;
+ public const short VI_STATE_UNKNOWN = -1;
+ public const short VI_BIG_ENDIAN = 0;
+ public const short VI_LITTLE_ENDIAN = 1;
+ public const short VI_DATA_PRIV = 0;
+ public const short VI_DATA_NPRIV = 1;
+ public const short VI_PROG_PRIV = 2;
+ public const short VI_PROG_NPRIV = 3;
+ public const short VI_BLCK_PRIV = 4;
+ public const short VI_BLCK_NPRIV = 5;
+ public const short VI_D64_PRIV = 6;
+ public const short VI_D64_NPRIV = 7;
+ public const short VI_WIDTH_8 = 1;
+ public const short VI_WIDTH_16 = 2;
+ public const short VI_WIDTH_32 = 4;
+ public const short VI_GPIB_REN_DEASSERT = 0;
+ public const short VI_GPIB_REN_ASSERT = 1;
+ public const short VI_GPIB_REN_DEASSERT_GTL = 2;
+ public const short VI_GPIB_REN_ASSERT_ADDRESS = 3;
+ public const short VI_GPIB_REN_ASSERT_LLO = 4;
+ public const short VI_GPIB_REN_ASSERT_ADDRESS_LLO = 5;
+ public const short VI_GPIB_REN_ADDRESS_GTL = 6;
+ public const short VI_GPIB_ATN_DEASSERT = 0;
+ public const short VI_GPIB_ATN_ASSERT = 1;
+ public const short VI_GPIB_ATN_DEASSERT_HANDSHAKE = 2;
+ public const short VI_GPIB_ATN_ASSERT_IMMEDIATE = 3;
+ public const short VI_GPIB_HS488_DISABLED = 0;
+ public const short VI_GPIB_HS488_NIMPL = -1;
+ public const short VI_GPIB_UNADDRESSED = 0;
+ public const short VI_GPIB_TALKER = 1;
+ public const short VI_GPIB_LISTENER = 2;
+ public const short VI_VXI_CMD16 = 512;
+ public const short VI_VXI_CMD16_RESP16 = 514;
+ public const short VI_VXI_RESP16 = 2;
+ public const short VI_VXI_CMD32 = 1024;
+ public const short VI_VXI_CMD32_RESP16 = 1026;
+ public const short VI_VXI_CMD32_RESP32 = 1028;
+ public const short VI_VXI_RESP32 = 4;
+ public const short VI_ASSERT_SIGNAL = -1;
+ public const short VI_ASSERT_USE_ASSIGNED = 0;
+ public const short VI_ASSERT_IRQ1 = 1;
+ public const short VI_ASSERT_IRQ2 = 2;
+ public const short VI_ASSERT_IRQ3 = 3;
+ public const short VI_ASSERT_IRQ4 = 4;
+ public const short VI_ASSERT_IRQ5 = 5;
+ public const short VI_ASSERT_IRQ6 = 6;
+ public const short VI_ASSERT_IRQ7 = 7;
+ public const short VI_UTIL_ASSERT_SYSRESET = 1;
+ public const short VI_UTIL_ASSERT_SYSFAIL = 2;
+ public const short VI_UTIL_DEASSERT_SYSFAIL = 3;
+ public const short VI_VXI_CLASS_MEMORY = 0;
+ public const short VI_VXI_CLASS_EXTENDED = 1;
+ public const short VI_VXI_CLASS_MESSAGE = 2;
+ public const short VI_VXI_CLASS_REGISTER = 3;
+ public const short VI_VXI_CLASS_OTHER = 4;
+ #endregion
+
+ #region - Backward Compatibility Macros -----------------------------------------
+ public const int VI_ERROR_INV_SESSION = -1073807346;
+ public const int VI_INFINITE = -1;
+ public const short VI_NORMAL = 1;
+ public const short VI_FDC = 2;
+ public const short VI_HS488 = 3;
+ public const short VI_ASRL488 = 4;
+ public const short VI_ASRL_IN_BUF = 16;
+ public const short VI_ASRL_OUT_BUF = 32;
+ public const short VI_ASRL_IN_BUF_DISCARD = 64;
+ public const short VI_ASRL_OUT_BUF_DISCARD = 128;
+ #endregion
+
+ #endregion
+ }
+}
diff --git a/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32InstBase.cs b/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32InstBase.cs
new file mode 100644
index 00000000..272a8fc8
--- /dev/null
+++ b/Admin.NET/MTNet.Application/ConnectBase/Visa32/Visa32InstBase.cs
@@ -0,0 +1,813 @@
+using Microsoft.VisualBasic;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.ConnectBase
+{
+ public class Visa32InstBase
+ {
+ #region 参数配定义
+ const int BUFFER_MAX = 1000000;
+ static int m_iRm = -1;
+ private int m_session;
+ private string m_EndCode = "\n";
+ List m_infoNameList;
+ List m_infoValueList;
+ protected INST m_inst;
+ ///
+ /// 连接状态
+ ///
+ bool _connectStatus = false;
+ public bool ConnectStatus { get => _connectStatus; set => _connectStatus = value; }
+
+ ///
+ /// 设备名称
+ ///
+ string _deviceName = "Deivce1";
+ public string DeviceName { get => _deviceName; set => _deviceName = value; }
+
+ ///
+ /// 设备信息,主要是包括设备名称,串口号等
+ ///
+ string _info = "";
+ public string Info { get => _info; set => _info = value; }
+
+ ///
+ /// 是否抓去Log
+ ///
+ //private bool _IsCatchDeviceControlLog = false;
+ //public bool IsCatchDeviceControlLog
+ //{
+ // get { return _IsCatchDeviceControlLog; }
+ // set { _IsCatchDeviceControlLog = value; }
+ //}
+ public EM_STATUS Status
+ {
+ get
+ {
+ return m_inst.Status;
+ }
+ }
+ public EM_TYPE Type
+ {
+ get
+ {
+ return m_inst.Type;
+ }
+ }
+ #endregion
+
+ #region 构造函数
+ public Visa32InstBase(string strAddress)
+ {
+ //set default value
+ m_inst.address = strAddress;
+ m_inst.timeout = 5000;
+ m_inst.Status = EM_STATUS.UNKNOW;
+ m_inst.Type = EM_TYPE.UNKNOW;
+ m_infoNameList = new List();
+ m_infoValueList = new List();
+ //bool.TryParse(AppConfig.GetConfig("IsCatchDeviceControlLog"), out _IsCatchDeviceControlLog);
+ }
+
+ public Visa32InstBase(string strAddress, string deviceName)
+ {
+ //set default value
+ m_inst.address = strAddress;
+ m_inst.timeout = 5000;
+ m_inst.Status = EM_STATUS.UNKNOW;
+ m_inst.Type = EM_TYPE.UNKNOW;
+ m_infoNameList = new List();
+ m_infoValueList = new List();
+ _deviceName = deviceName;
+ // bool.TryParse(AppConfig.GetConfig("IsCatchDeviceControlLog"), out _IsCatchDeviceControlLog);
+ }
+
+ public Visa32InstBase()
+ {
+ //set default value
+ m_inst.address = "";
+ m_inst.timeout = 1000;
+ m_inst.Status = EM_STATUS.UNKNOW;
+ m_inst.Type = EM_TYPE.UNKNOW;
+ m_infoNameList = new List();
+ m_infoValueList = new List();
+ // bool.TryParse(AppConfig.GetConfig("IsCatchDeviceControlLog"), out _IsCatchDeviceControlLog);
+ }
+
+ ~Visa32InstBase()
+ {
+ if (_connectStatus)
+ {
+ //close session(instrument handler)
+ Visa32.viClose(m_session);
+ }
+ }
+ #endregion
+
+ #region Public functions
+ ///
+ /// 建立连接
+ ///
+ ///
+ public virtual int Connect()
+ {
+ int rtn = 0;
+
+ try
+ {
+ //bool.TryParse(AppConfig.GetConfig("IsCatchDeviceControlLog"), out _IsCatchDeviceControlLog);
+ _info = _deviceName + "\t" + m_inst.address + "\t";
+ //connect instrument and get instrument handler
+ if (m_iRm == -1)
+ {
+ rtn = OpenRm();
+ }
+ if (m_iRm < 0)
+ {
+ _connectStatus = false;
+ return rtn;
+ }
+
+ rtn = Visa32.viOpen(m_iRm, m_inst.address, Visa32.VI_NULL, m_inst.timeout, out m_session);
+ //Visa32.viSetAttribute(m_session, Visa32.VI_ATTR_TMO_VALUE, 30000);
+
+ if (m_inst.address.Contains("SOCKET"))
+ { Visa32.viSetAttribute(m_session, Visa32.VI_ATTR_TERMCHAR_EN, 1); }
+ if (rtn == Visa32.VI_SUCCESS)
+ {
+ //set status of instrument
+ m_inst.Status = EM_STATUS.CONNECT;
+ //set IDN of instrument
+ Thread.Sleep(500);
+ GetIDN(out m_inst.IDN);
+ _connectStatus = true;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Connet Successed");
+ }
+ else
+ {
+ //set status of instrument
+ m_inst.Status = EM_STATUS.DISCONNECT;
+ //set IDN of instrument
+ m_inst.IDN = "";
+ _connectStatus = false;
+ //DeviceControlLogger.Logger.Info($"{_info} Connect Failed");
+ //throw new DeviceException($"{_info} Connect Failed");
+ }
+ //Visa32.viSetAttribute(m_inst.m_session, Visa32.VI_ATTR_TMO_VALUE, 5000);
+ }
+ catch (Exception e)
+ {
+ _connectStatus = true;
+ rtn = Visa32.VI_ERROR_ABORT;
+ //DeviceControlLogger.Logger.Error($"{_info} Connect Failed", e);
+ //throw new DeviceException($"{_info} Connect Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 关闭连接
+ ///
+ ///
+ public virtual int Close()
+ {
+ int rtn = 0;
+ try
+ {
+ if (_connectStatus)
+ {
+ //close session(instrument handler)
+ rtn = Visa32.viClose(m_session);
+ _connectStatus = false;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} DisConnect Successed");
+ }
+ }
+ catch (Exception e)
+ {
+ //MessageBox.Show("Instrument closing fail!!!");
+ _connectStatus = false;
+ rtn = Visa32.VI_ERROR_CLOSING_FAILED;
+ //DeviceControlLogger.Logger.Error($"{_info} DisConnect Failed", e);
+ //throw new DeviceException($"{_info} DisConnect Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 发送指令
+ ///
+ /// 命令
+ ///
+ public virtual int Write(string strGPIB)
+ {
+ int rtn = 0;
+ int iCount = 0;
+ strGPIB = strGPIB + m_EndCode;
+ //transfer the GPIB command from string 2 byte[]
+ byte[] bGPIB = System.Text.Encoding.Default.GetBytes(strGPIB);
+ try
+ {
+ if (_connectStatus)
+ {
+ //write SCPI command to the instrument
+ rtn = Visa32.viWrite(m_session, bGPIB, strGPIB.Length, out iCount);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Write:{strGPIB}" + "\t" + "Successed");
+ }
+ else
+ {
+ //DeviceControlLogger.Logger.Info($"{_info} No Connect");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Write:{strGPIB }" + "\t" + "Failed" + ",Error Code" + rtn, ex);
+ //throw new DeviceException($"{_info} Write:{strGPIB} Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 发送指令
+ ///
+ /// 命令
+ /// 终结符 默认“\n”
+ ///
+ public virtual int Write(string strGPIB, string end)
+ {
+ int rtn = 0;
+ int iCount = 0;
+ strGPIB = strGPIB + end;
+ //transfer the GPIB command from string 2 byte[]
+ byte[] bGPIB = System.Text.Encoding.Default.GetBytes(strGPIB);
+ try
+ {
+ if (_connectStatus)
+ {
+ rtn = Visa32.viWrite(m_session, bGPIB, strGPIB.Length, out iCount);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Write:{strGPIB }" + "\t" + "Successed");
+ }
+ else
+ {
+ //DeviceControlLogger.Logger.Info($"{_info} No Connect");
+ }
+ //write SCPI command to the instrument
+ }
+ catch (Exception ex)
+ {
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Write:{strGPIB}" + "\t" + "Failed" + ",Error Code" + rtn, ex);
+ //throw new DeviceException($"{_info} Write:{strGPIB}" + "\t" + "Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 按照文件发送指令
+ ///
+ /// 文件地址
+ /// 命令长度
+ ///
+ public virtual int WirteFromFile(string strFilename, int iDatalen)
+ {
+ int rtn = 0;
+ int iCount = 0;
+
+ try
+ {
+ if (_connectStatus)
+ {
+ //write the specific file to the instrument
+ rtn = Visa32.viWriteFromFile(m_session, strFilename, iDatalen, ref iCount);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Write From File:{strFilename}" + "\t" + "Successed");
+ }
+ else
+ {
+ //DeviceControlLogger.Logger.Info($"{_info} No Connect");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Write From File:{strFilename}" + "\t" + "Failed" + ",Error Code:" + rtn, ex);
+ //throw new DeviceException($"{_info} Write From File:{strFilename}" + "\t" + "Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 读取返回信息
+ ///
+ ///
+ ///
+ public virtual int ReadOnly(out byte[] byteData)
+ {
+ int rtn = 0;
+ byte[] bData = new byte[BUFFER_MAX];
+ int iCount;
+ try
+ {
+ if (_connectStatus)
+ {
+ rtn = Visa32.viRead(m_session, bData, BUFFER_MAX, out iCount);
+ Array.Resize(ref bData, iCount);
+ byteData = bData;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Read Only Successed" + "\t" + "Return:" + Encoding.Default.GetString(bData));
+ }
+ else
+ {
+ byteData = new byte[1];
+ //DeviceControlLogger.Logger.Info($"{_info} No Connect");
+ }
+ }
+ catch (Exception ex)
+ {
+ byteData = new byte[1];
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Read Only Failed" + "\t" + "Error Code:" + rtn, ex);
+ //throw new DeviceException($"{_info} Read Data Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 读取返回信息
+ ///
+ ///
+ ///
+ public virtual int ReadOnly(out string strData)
+ {
+ int rtn = 0;
+ byte[] bData = new byte[BUFFER_MAX];
+ int iCount;
+ strData = "";
+ try
+ {
+ if (_connectStatus)
+ {
+ rtn = Visa32.viRead(m_session, bData, BUFFER_MAX, out iCount);
+ Array.Resize(ref bData, iCount);
+ strData = System.Text.Encoding.Default.GetString(bData);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Read Only Successed" + "\t" + "Return:" + Encoding.Default.GetString(bData));
+ }
+ else
+ {
+ //DeviceControlLogger.Logger.Info($"{_info} No Connect");
+ }
+ }
+ catch (Exception ex)
+ {
+ strData = "0";
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Read Only Failed" + "\t" + "Error Code" + rtn, ex);
+ //throw new DeviceException($"{_info} Read Data Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 读取返回信息
+ ///
+ ///
+ ///
+ public virtual int ReadOnly(out double data)
+ {
+ int rtn = 0;
+ string dataStr = "";
+ rtn += ReadOnly(out dataStr);
+ data = Convert.ToDouble(Conversion.Val(dataStr));
+ return rtn;
+ }
+
+ ///
+ /// 读取返回信息
+ ///
+ ///
+ ///
+ public virtual int ReadOnly(out int idata)
+ {
+ int rtn = 0;
+ string dataStr = "";
+ rtn += ReadOnly(out dataStr);
+ idata = Convert.ToInt32(Conversion.Val(dataStr));
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, out byte[] bData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] buffer = new byte[BUFFER_MAX];
+ List dataList = new List();
+ int count;
+ try
+ {
+ if (_connectStatus)
+ {
+ rtn = this.Write(strGPIB);
+ Thread.Sleep(waitTime);
+ if (rtn >= 0)
+ {
+ rtn = Visa32.viRead(m_session, buffer, BUFFER_MAX, out count);
+ while (rtn == 1073676294)
+ {
+ dataList.AddRange(buffer);
+ rtn = Visa32.viRead(m_session, buffer, BUFFER_MAX, out count);
+ }
+ Array.Resize(ref buffer, count);
+ dataList.AddRange(buffer);
+ }
+ bData = dataList.ToArray();
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Read Successed" + "\t" + "Return:" + Encoding.Default.GetString(bData));
+ }
+ else
+ {
+ bData = new byte[1];
+ //DeviceControlLogger.Logger.Info($"{_info} No Conncect");
+ }
+
+ }
+ catch (Exception ex)
+ {
+ bData = new byte[1];
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Read Failed" + "\t" + strGPIB + "\t" + "Error Code:" + rtn, ex);
+ //throw new DeviceException($"{_info} Read Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, out string strData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+
+ rtn = this.Read(strGPIB, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ strData = System.Text.Encoding.Default.GetString(bBuffer);
+ }
+ else
+ {
+ strData = "";
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, out int iData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+ this.Read(strGPIB, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ iData = Convert.ToInt32(Conversion.Val(System.Text.Encoding.Default.GetString(bBuffer)));
+ }
+ else
+ {
+ iData = 0;
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, out double dblData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+ this.Read(strGPIB, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ dblData = Convert.ToDouble(Conversion.Val((System.Text.Encoding.Default.GetString(bBuffer))));
+ }
+ else
+ {
+ dblData = 0;
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, string endStr, out byte[] bData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] buffer = new byte[BUFFER_MAX];
+ List dataList = new List();
+ int count;
+ try
+ {
+ if (_connectStatus)
+ {
+ rtn = this.Write(strGPIB, endStr);
+ Thread.Sleep(waitTime);
+ if (rtn >= 0)
+ {
+ rtn = Visa32.viRead(m_session, buffer, BUFFER_MAX, out count);
+ while (rtn == 1073676294)
+ {
+ dataList.AddRange(buffer);
+ rtn = Visa32.viRead(m_session, buffer, BUFFER_MAX, out count);
+ }
+ Array.Resize(ref buffer, count);
+ dataList.AddRange(buffer);
+ }
+ bData = dataList.ToArray();
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Read Successed" + "\t" + "Return:" + Encoding.Default.GetString(bData));
+ }
+ else
+ {
+ bData = new byte[1];
+ //DeviceControlLogger.Logger.Info($"{_info} No Conncect");
+ }
+
+ }
+ catch (Exception ex)
+ {
+ bData = new byte[1];
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{_info} Read Failed" + "\t" + strGPIB + "\t" + "Error Code:" + rtn, ex);
+ //throw new DeviceException($"{_info} Read Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, string endStr, out string strData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+
+ rtn = this.Read(strGPIB, endStr, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ strData = System.Text.Encoding.Default.GetString(bBuffer);
+ }
+ else
+ {
+ strData = "";
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, string endStr, out int iData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+ this.Read(strGPIB, endStr, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ iData = Convert.ToInt32(Conversion.Val(System.Text.Encoding.Default.GetString(bBuffer)));
+ }
+ else
+ {
+ iData = 0;
+ }
+ return rtn;
+ }
+
+ ///
+ /// 先发送,后查询指令
+ ///
+ ///
+ ///
+ ///
+ public virtual int Read(string strGPIB, string endStr, out double dblData, int waitTime = 50)
+ {
+ int rtn = 0;
+ byte[] bBuffer;
+ this.Read(strGPIB, endStr, out bBuffer, waitTime);
+ if (rtn == Visa32.VI_SUCCESS || rtn > 0)
+ {
+ dblData = Convert.ToDouble(Conversion.Val((System.Text.Encoding.Default.GetString(bBuffer))));
+ }
+ else
+ {
+ dblData = 0;
+ }
+ return rtn;
+ }
+ #endregion
+
+ #region Private functions
+ ///
+ /// 设置延迟时间
+ ///
+ /// 延迟时间
+ ///
+ public int SetTimeOut(int timeout)
+ {
+ int rtn = Visa32.viSetAttribute(m_session, Visa32.VI_ATTR_TMO_VALUE, timeout);
+ return rtn;
+ }
+
+ ///
+ /// 查询*IDN
+ ///
+ ///
+ ///
+ public int GetIDN(out string strIDN)
+ {
+ int rtn = 0;
+ this.Read("*IDN?", out strIDN);
+ return rtn;
+ }
+
+ private delegate int OpenRmDelegate();
+
+ ///
+ /// 打开资源
+ ///
+ ///
+ private static int OpenRmThread()
+ {
+ int rtn = -1;
+
+ if (m_iRm == -1)
+ try
+ { rtn = Visa32.viOpenDefaultRM(out m_iRm); }
+ catch
+ { rtn = -1; }
+
+ return rtn;
+ }
+
+ ///
+ /// 打开资源
+ ///
+ ///
+ private static int OpenRm()
+ {
+ OpenRmDelegate rm = OpenRmThread;
+ IAsyncResult ar = rm.BeginInvoke(null, null);
+ int timeOut = 1000;
+ while (!ar.IsCompleted)
+ {
+ System.Threading.Thread.Sleep(50);
+ timeOut -= 50;
+ if (timeOut <= 0)
+ {
+ return -1;
+ }
+ }
+ int rtn = rm.EndInvoke(ar);
+ return rtn;
+ }
+
+ ///
+ /// 关闭资源
+ ///
+ ///
+ private static int CloseRm()
+ {
+ int rtn = -1;
+ if (m_iRm != -1)
+ try
+ {
+ rtn = Visa32.viClose(m_iRm);
+ }
+ catch
+ {
+ return -1;
+ }
+ return rtn;
+ }
+
+ ///
+ /// 查询状态
+ ///
+ /// 状态
+ ///
+ public int ReadStatus(ref short status)
+ {
+ int rtn = 0;
+ try
+ {
+ if (_connectStatus)
+ {
+ //write SCPI command to the instrument
+ rtn = Visa32.viReadSTB(m_session, ref status);
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{_info} Read Status Successed!" + "\t" + "return:" + status.ToString());
+ }
+ else
+ {
+ status = 0;
+ //DeviceControlLogger.Logger.Info($"{_info} 未连接!");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = Visa32.VI_ERROR_IO;
+ //DeviceControlLogger.Logger.Error($"{m_inst.address} Read Status Failed" + ",Error Code:" + rtn, ex);
+ //throw new DeviceException($"{m_inst.address} Read Status Failed");
+ }
+ return rtn;
+ }
+
+ ///
+ /// 刷新状态信息
+ ///
+ ///
+ public virtual int RefreshInst()
+ {
+ int rtn = 0;
+ //rtn = Connect();
+ rtn = GetIDN(out m_inst.IDN);
+ if (m_inst.IDN == "")
+ {
+ m_inst.Status = EM_STATUS.DISCONNECT;
+ }
+ else
+ {
+ m_inst.Status = EM_STATUS.CONNECT;
+ }
+ return rtn;
+ }
+
+ #endregion
+
+ #region 枚举结构定义
+ public enum EM_STATUS
+ {
+ UNKNOW = 0,
+ CONNECT = 1,
+ DISCONNECT
+ };
+ public enum EM_TYPE
+ {
+ UNKNOW = 0,
+ SG,
+ SA,
+ PM,
+ NA,
+ EMU,
+ FADER,
+ SWITCH,
+ SOFTWARE,
+ OTHER
+ };
+ public struct INST
+ {
+ public string address;
+ public string IDN;
+ public int timeout;
+ public EM_STATUS Status;
+ public EM_TYPE Type;
+ public string Model;
+ };
+ #endregion
+ }
+}
diff --git a/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/EricssonBaseStationTester.cs b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/EricssonBaseStationTester.cs
new file mode 100644
index 00000000..84e4aa50
--- /dev/null
+++ b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/EricssonBaseStationTester.cs
@@ -0,0 +1,5276 @@
+using System;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+
+using System.ComponentModel;
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Linq;
+using MTNet.Application.IDAL;
+using MTNet.Application.Entity;
+using MTNet.Application.ConnectBase;
+using MTNet.Application.IDAL.Utils;
+namespace MTNet.Application.DriverLibrary.BaseStation.Ericsson
+{
+ public class EricssonBaseStationTester : ConnectInstBase, IBaseStationTester
+ {
+
+
+ ///
+ /// 连接状态
+ ///
+ public bool ConnectStatus { get; set; } = false;
+
+ bool _disposed { get; set; } = false;
+ string _cmd = "";
+
+ ///
+ /// 站点标识,可以使用基站IP
+ ///
+ //string _stationId = "/home/ruili/moshell_logfiles/CAICTNRPFCM8TR2_modump.zip";
+ //string _stationId = "181.18.3.3";
+ string _stationId ="";
+ private MoShellResult _result = new MoShellResult();
+ public MoShellResult Result
+ {
+ get { return _result; }
+ set
+ {
+ _result = value;
+ if (_result?.Status != true)
+ {
+ //var ex = new DeviceException($"{_result?.Message}");
+ ////DeviceControlLogger.Logger.Error($"Send command to ericsson base station failed.", ex);
+ //throw ex;
+ }
+ }
+ }
+
+ private List _cells = new List();
+
+ int _rtn = 0;
+
+ ///
+ /// 构造函数
+ ///
+ ///
+ ///
+ public EricssonBaseStationTester(DeviceAddrConfig addrConfig) : base(addrConfig)
+ {
+ _stationId = addrConfig.UserName;
+ }
+
+ public EricssonBaseStationTester(BaseStationTesterAddrConfig addrConfig) : base(addrConfig)
+ {
+
+ }
+
+ #region 基站函数
+
+ public override int Connect()
+ {
+ int rtn = 0;
+ try
+ {
+ if (!ConnectStatus)
+ {
+ rtn = base.Connect();
+ ConnectStatus = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(1);
+ throw new Exception($"Ericsson basestation connect error.[{rtn}]", ex);
+ }
+ return rtn;
+ }
+
+ public override int Close()
+ {
+ int rtn = 0;
+ try
+ {
+ rtn = base.Close();
+ ConnectStatus = false;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(4);
+ throw new Exception($"Ericsson basestation close error.[{rtn}]", ex);
+ }
+ return rtn;
+ }
+
+ public int Initial()
+ {
+ //GetCmdEnumInfo();
+
+ int rtn = 0;
+ MoShellResult result;
+ List moInfos;
+
+ result = ExecuteCheckCmd(_stationId);
+ if (!result?.Status == true)
+ Result = ExecuteInitCmd(_stationId);
+
+ //Result = ExecuteExtraCmd(_stationId, "parsemom /home/ruili/jarxml/MSRBS_NODE_MODEL_23.Q4_643.28133.126_a3d2.xml.gz");
+ Result = ExecuteExtraCmd(_stationId, "lt all");
+
+ //moInfos = ExtractNci(_stationId);
+ //moInfos = ExtractCellIds(_stationId);
+ //ExtractCellIdDetail(moInfos);
+
+ //Result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_OffsetFreq, false, ("NRCellCU", "5292034"), ("NRFreqRelation", "152650"), ("qOffsetFreq", "0"));
+ //Result = ExecuteSetCmd(_stationId, EricssonCmdType.TAC, true, ("nrtac", "1"));
+ //Result = ExecuteSetCmd(_stationId, EricssonCmdType.B2_Threshold2EUTRA, false, ("GNBCUCPFunction", "1"), ("Mcpc", "1"), ("McpcPCellProfile", "Default"), ("McpcPCellProfileUeCfg", "Base"), ("rsrpCandidateB2", null), ("threshold2EUtra", "-95"));
+
+ if (result?.Status == true)
+ rtn = 0;
+
+ Console.WriteLine($"Ericsson basestation initial successful.");
+
+ return rtn;
+ }
+ public string TestGet(string getdata)
+ {
+ return ExecuteExtraCmd(_stationId, getdata).ToString();
+ }
+ ///
+ /// 提取指定基站的gNBId
+ ///
+ ///
+ ///
+ public string ExtractGNBId(string stationId)
+ {
+ string gNBId = string.Empty;
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . gNBId");
+
+ string pattern = @"GNBCUCPFunction=1\s+gNBId\s+(\S+)";
+ Match match = Regex.Match(result?.Message, pattern);
+ if (match.Success)
+ gNBId = match.Groups[1].Value;
+
+ return gNBId;
+ }
+ ///
+ /// 提取指定基站的eNBId
+ ///
+ ///
+ ///
+ public string ExtracteNBId(string stationId)
+ {
+ string gNBId = string.Empty;
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . enbid");
+
+ string pattern = @"ENodeBFunction=1\s+eNBId\s+(\S+)";
+ Match match = Regex.Match(result?.Message, pattern);
+ if (match.Success)
+ gNBId = match.Groups[1].Value;
+
+ return gNBId;
+ }
+ ///
+ /// 提取cellid信息
+ ///
+ ///
+ public List ExtractCellIds(string stationId)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . cellid");
+
+ var pattern = @"^(GNBCUCPFunction[^,]+,EUtraNetwork[^,]+,ExternalENodeBFunction[^,]+,ExternalEUtranCell[^ ]+) (\w+) (\S+)";
+ var matches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);//匹配整个MO
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success && match.Groups.Count >= 4)
+ {
+ var info = new MoInfo
+ {
+ Mo = match.Groups[1].Value,
+ Attribute = match.Groups[2].Value,
+ Value = match.Groups[3].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ results.ForEach(x => Console.WriteLine(x));
+ return results;
+ }
+
+ ///
+ /// 提取cellid详细信息,包含解析Mo数据属性
+ ///
+ ///
+ public List ExtractCellIdDetail(string stationId)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . cellid");
+ var pattern = @"^(GNBCUCPFunction[^,]+,EUtraNetwork[^,]+,ExternalENodeBFunction[^,]+,ExternalEUtranCell[^ ]+) (\w+) (\S+)";
+ var allMatches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);//匹配整个MO
+
+ var mos = new List();
+
+ foreach (Match allMatch in allMatches)
+ {
+ pattern = @"^GNBCUCPFunction=(\d+),EUtraNetwork=(\d+),ExternalENodeBFunction=([\w_]+),ExternalEUtranCell=(\d+)";
+ var moMatches = Regex.Matches(allMatch.Groups[1].Value, pattern);//精确匹配MO的属性值
+ foreach (Match moMatch in moMatches)
+ {
+ int moIndex = mos.FindIndex(x => x.MoIdentifier == moMatch.Groups[0].Value);
+ if (moIndex >= 0)//当前mo已存在
+ {
+ mos[moIndex].Attributes[allMatch.Groups[2].Value] = allMatch.Groups[3].Value;
+ }
+ else//不存在 添加新mo
+ {
+ var mo = new ManagedObject
+ {
+ MoIdentifier = moMatch.Groups[0].Value,
+ MoProperties = new Dictionary(),
+ Attributes = new Dictionary()
+ };
+
+ mo.MoProperties["GNBCUCPFunction"] = moMatch.Groups[1].Value;
+ mo.MoProperties["EUtraNetwork"] = moMatch.Groups[2].Value;
+ mo.MoProperties["ExternalENodeBFunction"] = moMatch.Groups[3].Value;
+ mo.MoProperties["ExternalEUtranCell"] = moMatch.Groups[4].Value;
+
+ mo.Attributes[allMatch.Groups[2].Value] = allMatch.Groups[3].Value;
+ mos.Add(mo);
+ }
+ }
+ }
+
+ mos.ForEach(x => Console.WriteLine(x));
+ return mos;
+ }
+ public List ExtractCellIdDetail(List moInfos)
+ {
+ var mos = new List();
+
+ foreach (var info in moInfos)
+ {
+ var pattern = @"^GNBCUCPFunction=(\d+),EUtraNetwork=(\d+),ExternalENodeBFunction=([\w_]+),ExternalEUtranCell=(\d+)";
+ var moMatches = Regex.Matches(info.Mo, pattern);//精确匹配MO的属性值
+ foreach (Match moMatch in moMatches)
+ {
+ int moIndex = mos.FindIndex(x => x.MoIdentifier == moMatch.Groups[0].Value);
+ if (moIndex >= 0)//当前mo已存在
+ {
+ mos[moIndex].Attributes[info.Attribute] = info.Value;
+ }
+ else//不存在 添加新mo
+ {
+ var mo = new ManagedObject
+ {
+ MoIdentifier = moMatch.Groups[0].Value,
+ MoProperties = new Dictionary(),
+ Attributes = new Dictionary()
+ };
+
+ mo.MoProperties["GNBCUCPFunction"] = moMatch.Groups[1].Value;
+ mo.MoProperties["EUtraNetwork"] = moMatch.Groups[2].Value;
+ mo.MoProperties["ExternalENodeBFunction"] = moMatch.Groups[3].Value;
+ mo.MoProperties["ExternalEUtranCell"] = moMatch.Groups[4].Value;
+
+ mo.Attributes[info.Attribute] = info.Value;
+ mos.Add(mo);
+ }
+ }
+ }
+
+ mos.ForEach(x => Console.WriteLine(x));
+ return mos;
+ }
+
+ ///
+ /// 提取nci信息
+ ///
+ ///
+ public List ExtractNci(string stationId)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . nci");
+
+ string pattern = @"^([A-Za-z]+[\w]*)=(\d+)\s+(\w+)\s+(\d+)";
+ var matches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success && match.Groups.Count == 5)
+ {
+ if (match.Groups[3].Value != "nCI")
+ continue;
+
+ var info = new MoInfo
+ {
+ Mo = $"{match.Groups[1].Value}={match.Groups[2].Value}",
+ Attribute = match.Groups[3].Value,
+ Value = match.Groups[4].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ results.ForEach(x => Console.WriteLine(x));
+ return results;
+ }
+
+ ///
+ /// 提取NRFreqRelation信息
+ ///
+ ///
+ public List ExtractNRFreqRelation(string stationId, List cells)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . nRFreqRelationId");
+
+ string pattern = @"NRCellCU=(\d+),NRFreqRelation=(\d+)\s*nRFreqRelationId\s*(\d+)";
+ var matches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);
+ var results = new Dictionary>();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ var nrCellCU = match.Groups[1].Value;
+ var nrFreqRelation = match.Groups[2].Value;
+
+ if (!results.ContainsKey(nrCellCU))
+ {
+ results[nrCellCU] = new List();
+ }
+ results[nrCellCU].Add(nrFreqRelation);
+ }
+ }
+
+ foreach (var item in results)
+ {
+ var cell = cells.FirstOrDefault(x => x.NRCellCUId == item.Key);
+ if (cell != null)
+ {
+ cell.FreqRelationInfo =JsonConvert.SerializeObject(item.Value);
+ }
+ }
+
+ return cells;
+ }
+
+ ///
+ /// 执行MoShell初始化命令
+ ///
+ ///
+ ///
+ public MoShellResult ExecuteInitCmd(string stationId, string cmdText = "/home/zte/moshell/in/moshell/moshell", bool addHost = false)
+ {
+ object cmdObj;
+
+ if (!addHost)
+ cmdObj = new { command = MoShellCmdType.InitCmd.GetDescription(), data = new { station_id = stationId, cmd = cmdText } };
+ else
+ cmdObj = new { command = MoShellCmdType.InitCmd.GetDescription(), data = new { station_id = stationId, cmd = cmdText, rhost = new { ipaddr = AddrConfig.AddrConfig, user_id = AddrConfig.UserName, passwd = AddrConfig.Password } } };
+
+ string jsonText = JsonConvert.SerializeObject(cmdObj);
+ var result = ExecuteCommand(jsonText);
+ return result;
+ }
+
+ ///
+ /// 执行MoShell额外命令
+ ///
+ ///
+ ///
+ public MoShellResult ExecuteExtraCmd(string stationId, string cmdText)
+ {
+ var cmdObj = new { command = MoShellCmdType.ExtraCmd.GetDescription(), data = new { station_id = stationId, cmd = cmdText } };
+
+ string jsonText = JsonConvert.SerializeObject(cmdObj);
+ var result = ExecuteCommand(jsonText);
+ return result;
+ }
+
+ ///
+ /// 执行MoShell设置命令
+ ///
+ ///
+ ///
+ ///
+ public MoShellResult ExecuteSetCmd(string stationId, EricssonCmdType cmdType, bool addPoint, params (string name, string value)[] paras)
+ {
+ var cmdObj = new { command = MoShellCmdType.SetCmd.GetDescription(), data = new { station_id = stationId, cmd_name = cmdType.GetCommand(), cmd_desc = cmdType.GetDescription() } };
+
+ string jsonText = JsonConvert.SerializeObject(cmdObj);
+ JObject jsonObject = JObject.Parse(jsonText);
+ JObject dataObject = (JObject)jsonObject["data"];
+
+ if (addPoint)
+ dataObject.Add(".", null);
+
+ for (int i = 0; i < paras?.Length; i++)
+ {
+ dataObject.Add(paras[i].name, paras[i].value);
+ }
+
+ var result = ExecuteCommand(jsonObject.ToString(Formatting.None));
+ return result;
+ }
+
+ ///
+ /// 执行MoShell检查命令
+ ///
+ ///
+ ///
+ public MoShellResult ExecuteCheckCmd(string stationId)
+ {
+ var cmdObj = new { command = MoShellCmdType.CheckCmd.GetDescription(), data = new { station_id = stationId, cmd = "Station_Status" } };
+
+ string jsonText = JsonConvert.SerializeObject(cmdObj);
+ var result = ExecuteCommand(jsonText);
+ return result;
+ }
+
+ ///
+ /// 执行MoShell退出命令
+ ///
+ ///
+ ///
+ public int ExecuteQuitCmd(string stationId)
+ {
+ var cmdObj = new { command = MoShellCmdType.QuitCmd.GetDescription(), data = new { station_id = stationId, cmd = "quit" } };
+
+ string jsonText = JsonConvert.SerializeObject(cmdObj);
+ int rtn = this.Write(jsonText);
+ return rtn;
+ }
+
+ ///
+ /// 执行指令
+ ///
+ ///
+ ///
+ public MoShellResult ExecuteCommand(string cmdText)
+ {
+ Output();
+ Console.WriteLine($"{DateTime.Now:yyyy:MM:dd HH:mm:ss.fff} => Send:{cmdText}");
+ MoShellResult result = new MoShellResult();
+ StringBuilder finalResult = new StringBuilder();
+ try
+ {
+ int rtn = this.Read(cmdText, out string tempResult);
+ finalResult.Append(tempResult);
+
+ int index = 0;
+ while (!IsValidJson(finalResult.ToString()) && index < 100)//解决因一次读不全导致解析出错的问题
+ {
+ this.ReadOnly(out tempResult);
+ finalResult.Append(tempResult);
+ index++;
+ }
+
+ string finalStr = finalResult.ToString();
+ result = JsonConvert.DeserializeObject(finalStr);
+ string message = Regex.Replace(result.Message, @"(? Read:{message}");
+ }
+ catch (Exception ex)
+ {
+ //SystemLogger.Logger.Error($"Read not parameter command error.", ex);
+ throw;
+ }
+ finally
+ {
+ Output();
+ }
+ return result;
+ }
+ ///
+ /// 校验字符串是否为Json格式
+ ///
+ ///
+ ///
+ public static bool IsValidJson(string input)
+ {
+ try
+ {
+ JToken.Parse(input);
+ return true;
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ private void Output(string str = "=", int outputNum = 1, int length = 200)
+ {
+ for (int i = 0; i < outputNum; i++)
+ {
+ for (int j = 0; j < length; j++)
+ Console.Write(str);
+ //if (!(i == outputNum - 1))
+ Console.WriteLine();
+ }
+ }
+
+
+ public Task> QueryFDDLteCells()
+ {
+ return null;
+ }
+
+ public Task> QueryNrCells()
+ {
+ return null;
+ }
+
+ public async Task> GetCells()
+ {
+ var list = new List();
+ var cells = GetCells(_stationId);
+ list.AddRange(cells);
+ return list;
+ }
+
+ public List GetCells(string stationId)
+ {
+ //确定基站是4g还是5g
+ List cells=new List();
+ MoShellResult moShellResult = ExecuteExtraCmd(stationId, "st cell");
+ if (moShellResult.Message.Contains("NRCell"))//5g
+ {
+ string gNBId = ExtractGNBId(stationId);
+ cells = GetDUCells(stationId, gNBId);
+ cells = GetCUCells(stationId, cells);
+ cells = ExtractNRFreqRelation(stationId, cells);
+ _cells = cells;
+ }
+ else {
+ string eNBId = ExtracteNBId(stationId);
+ cells = GetLteCells(stationId, eNBId);
+ _cells = cells;
+ }
+ return cells;
+ }
+ ///
+ /// 获取lte小区
+ ///
+ ///
+ ///
+ ///
+ private List GetLteCells(string stationId, string gNBId)
+ {
+ var cells = new List();
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "st cell");
+
+ var pattern = @"(\d+)\s+(\d+)\s*\(\s*(.*?)\s*\)\s+(\d+)\s*\(\s*(.*?)\s*\)\s+(ENodeBFunction=1,EUtranCell\w*=\S*)";
+ var matches = Regex.Matches(result?.Message, pattern);//匹配整个MO
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success && match.Groups.Count >= 7)
+ {
+ var info = new MoInfo
+ {
+ Mo = match.Groups[6].Value.Trim(),
+ Attribute = match.Groups[3].Value.Trim(),
+ Value = match.Groups[1].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ foreach (var item in results)
+ {
+ string cmdText = $"get {item.Mo}";
+ var itemResult = ExecuteExtraCmd(stationId, cmdText);
+ GetMccMnc(itemResult?.Message, out string mcc, out string mnc);
+ //var plmnInfos = ExtractPLMNInfos(itemResult?.Message);
+ var sectors = ExtractNRSectorCarrierRef(itemResult?.Message);
+
+ var properties = new Dictionary();
+ string[] lines = itemResult?.Message.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); // 分割文本为行
+ foreach (string line in lines)
+ {
+ // 基础匹配属性名和值的结构,忽略注释行和空行
+ if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith(" >>>"))
+ {
+ string[] parts = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length == 2)
+ {
+ string key = parts[0].Trim();
+ string rawValue = parts[1].Trim();
+
+ // 处理值中可能存在的数组和特殊结构
+ string value = ProcessComplexValue(rawValue);
+ properties[key] = value;
+ }
+ }
+ }
+
+ if (!properties.Safe().Any())
+ continue;
+
+ var cell = new Cell
+ {
+ FactoryType = BaseStationTesterTypeEnum.Ericsson,
+ NodeBId = int.Parse(gNBId),
+ MoId = item.Mo,
+ mcc = mcc,
+ mnc = mnc,
+ PCI = int.Parse(GetDicValue(properties, "physicalLayerCellId")),
+ // Id = GetDicValue(properties, "nRCellDUId"),
+ //NCI = GetDicValue(properties, "nCI"),
+ //NRCellDUId = GetDicValue(properties, "nRCellDUId"),
+ //NRCellCUId = GetDicValue(properties, "nRCellCUId"),
+ CellId = int.Parse(GetDicValue(properties, "cellId")),
+ //ssbFrequency = GetDicValue(properties, "ssbFrequency"),
+ Freqband=GetDicValue(properties, "freqBand"),
+ Status = (int)(lines.FirstOrDefault(x => x.Contains("administrativeState")).Contains("UNLOCKED") ? CellStatusEnum.Unlocked : CellStatusEnum.Locked)
+ };
+ cell.Name = $"{cell.NodeBId}-{cell.CellId}";
+ cells.Add(cell);
+ }
+
+ return cells;
+ }
+ ///
+ /// 获取DU小区
+ ///
+ ///
+ ///
+ ///
+ private List GetDUCells(string stationId, string gNBId)
+ {
+ var list = new List();
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "st cell");
+
+ var pattern = @"(\d+)\s+(\d+)\s*\(\s*(.*?)\s*\)\s+(\d+)\s*\(\s*(.*?)\s*\)\s+(GNBDUFunction=1,NRCellDU=\d+)";
+ var matches = Regex.Matches(result?.Message, pattern);//匹配整个MO
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success && match.Groups.Count >= 7)
+ {
+ var info = new MoInfo
+ {
+ Mo = match.Groups[6].Value.Trim(),
+ Attribute = match.Groups[3].Value.Trim(),
+ Value = match.Groups[1].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ foreach (var item in results)
+ {
+ string cmdText = $"get {item.Mo}";
+ var itemResult = ExecuteExtraCmd(stationId, cmdText);
+ GetMccMnc(itemResult?.Message,out string mcc,out string mnc);
+ //var plmnInfos = ExtractPLMNInfos(itemResult?.Message);
+ var sectors = ExtractNRSectorCarrierRef(itemResult?.Message);
+
+ var properties = new Dictionary();
+ string[] lines = itemResult?.Message.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); // 分割文本为行
+ foreach (string line in lines)
+ {
+ // 基础匹配属性名和值的结构,忽略注释行和空行
+ if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith(" >>>"))
+ {
+ string[] parts = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length == 2)
+ {
+ string key = parts[0].Trim();
+ string rawValue = parts[1].Trim();
+
+ // 处理值中可能存在的数组和特殊结构
+ string value = ProcessComplexValue(rawValue);
+ properties[key] = value;
+ }
+ }
+ }
+
+ if (!properties.Safe().Any())
+ continue;
+
+ var cell = new Cell
+ {
+ FactoryType = BaseStationTesterTypeEnum.Ericsson,
+ NodeBId =int.Parse(gNBId),
+ MoId = item.Mo,
+ mcc=mcc,
+ mnc=mnc,
+ PCI =int.Parse(GetDicValue(properties, "nRPCI")),
+ // Id = GetDicValue(properties, "nRCellDUId"),
+ NCI = GetDicValue(properties, "nCI"),
+ NRCellDUId = GetDicValue(properties, "nRCellDUId"),
+ //NRCellCUId = GetDicValue(properties, "nRCellCUId"),
+ CellId =int.Parse(GetDicValue(properties, "cellLocalId")),
+ ssbFrequency = GetDicValue(properties, "ssbFrequency"),
+ Status =(int)(lines.FirstOrDefault(x => x.Contains("administrativeState")).Contains("UNLOCKED") ? CellStatusEnum.Unlocked : CellStatusEnum.Locked)
+ };
+ cell.Name = $"{cell.NodeBId}-{cell.CellId}";
+
+ if (cell.ssbFrequency == "0")
+ cell.ssbFrequency = GetDicValue(properties, "ssbFrequencyAutoSelected");
+
+ if (sectors.Safe().Any())
+ {
+ cell.GNBDUFunction = sectors.FirstOrDefault().GNBDUFunction;
+ cell.NRSectorCarrier = sectors.FirstOrDefault().NRSectorCarrier;
+ }
+
+ list.Add(cell);
+ }
+
+ return list;
+ }
+
+ ///
+ /// 获取CU小区
+ ///
+ ///
+ ///
+ ///
+ private List GetCUCells(string stationId, string gNBId)
+ {
+ var list = new List();
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . nRCellCUId");
+
+ var pattern = @"^(\w+=\w+).*?(\w+)\s+(\d+)";
+ var matches = Regex.Matches(result?.Message, pattern, RegexOptions.Multiline);//匹配整个MO
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ var info = new MoInfo
+ {
+ Mo = match.Groups[1].Value,
+ Attribute = match.Groups[2].Value,
+ Value = match.Groups[3].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ foreach (var item in results)
+ {
+ string cmdText = $"get {item.Mo}";
+ var itemResult = ExecuteExtraCmd(stationId, cmdText);
+ GetMccMnc(itemResult?.Message, out string mcc, out string mnc);
+ //var plmnInfos = ExtractPLMNInfos(itemResult?.Message);
+
+ var properties = new Dictionary();
+ string[] lines = itemResult?.Message.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); // 分割文本为行
+ foreach (string line in lines)
+ {
+ // 基础匹配属性名和值的结构,忽略注释行和空行
+ if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith(" >>>"))
+ {
+ string[] parts = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length == 2)
+ {
+ string key = parts[0].Trim();
+ string rawValue = parts[1].Trim();
+
+ // 处理值中可能存在的数组和特殊结构
+ string value = ProcessComplexValue(rawValue);
+ properties[key] = value;
+ }
+ }
+ }
+
+ if (!properties.Safe().Any())
+ continue;
+
+ var cell = new Cell
+ {
+ FactoryType = BaseStationTesterTypeEnum.Ericsson,
+ NodeBId =int.Parse(gNBId),
+ MoId = item.Mo,
+ mcc=mcc,
+ mnc=mnc,
+ //ZTEpLMNId = plmnInfos?.FirstOrDefault().ToString(),
+ PCI =int.Parse(GetDicValue(properties, "nRPCI")),
+ //Id = GetDicValue(properties, "nRCellCUId"),
+ CellId =int.Parse(GetDicValue(properties, "cellLocalId")) ,
+ ssbFrequency = GetDicValue(properties, "ssbFrequency"),
+ Status = (int)(lines.FirstOrDefault(x => x.Contains("cellState")).Contains("ACTIVE") ? CellStatusEnum.Unlocked : CellStatusEnum.Locked)
+ };
+ cell.Name = $"{cell.NodeBId}-{cell.CellId}";
+
+ list.Add(cell);
+ }
+
+ return list;
+ }
+ private List GetCUCells(string stationId, List cells)
+ {
+ //var list = new List();
+
+ MoShellResult result = ExecuteExtraCmd(stationId, "get . nRCellCUId");
+
+ var pattern = @"^(\w+=\w+).*?(\w+)\s+(\d+)";
+ var matches = Regex.Matches(result?.Message, pattern, RegexOptions.Multiline);//匹配整个MO
+ var results = new List();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ var info = new MoInfo
+ {
+ Mo = match.Groups[1].Value,
+ Attribute = match.Groups[2].Value,
+ Value = match.Groups[3].Value
+ };
+ results.Add(info);
+ }
+ }
+
+ foreach (var item in results)
+ {
+ string cmdText = $"get {item.Mo}";
+ var itemResult = ExecuteExtraCmd(stationId, cmdText);
+
+ var plmnInfos = ExtractPLMNInfos(itemResult?.Message);
+
+ var properties = new Dictionary();
+ string[] lines = itemResult?.Message.Split(new[] { "\r\n", "\n" }, StringSplitOptions.None); // 分割文本为行
+ foreach (string line in lines)
+ {
+ // 基础匹配属性名和值的结构,忽略注释行和空行
+ if (!string.IsNullOrWhiteSpace(line) && !line.StartsWith(" >>>"))
+ {
+ string[] parts = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
+ if (parts.Length == 2)
+ {
+ string key = parts[0].Trim();
+ string rawValue = parts[1].Trim();
+
+ // 处理值中可能存在的数组和特殊结构
+ string value = ProcessComplexValue(rawValue);
+ properties[key] = value;
+ }
+ }
+ }
+
+ if (!properties.Safe().Any())
+ continue;
+
+ string localId = GetDicValue(properties, "cellLocalId");
+ string nCI = GetDicValue(properties, "nCI");
+ if (!string.IsNullOrEmpty(localId)&&!string.IsNullOrEmpty(nCI))
+ {
+ var cell = cells.FirstOrDefault(x => x.CellId == int.Parse(localId) && x.NCI == nCI);
+ if (cell != null)
+ {
+ cell.NRCellCUId = GetDicValue(properties, "nRCellCUId");
+ }
+ }
+ //var cell = new Cell
+ //{
+ // FactoryType = AutoTest.Core.Domain.FactoryType.Ericsson,
+ // gNBId = gNBId,
+ // MoId = item.Mo,
+ // ZTEpLMNId = plmnInfos?.FirstOrDefault().ToString(),
+ // PCI = GetDicValue(properties, "nRPCI"),
+ // Id = GetDicValue(properties, "nRCellCUId"),
+ // LocalId = GetDicValue(properties, "cellLocalId"),
+ // ssbFrequency = GetDicValue(properties, "ssbFrequency"),
+ // Status = lines.FirstOrDefault(x => x.Contains("cellState")).Contains("ACTIVE") ? (int)AutoTest.Core.Domain.BSModel.CellStatus.Unlocked : (int)AutoTest.Core.Domain.BSModel.CellStatus.Locked,
+ //};
+ //cell.Name = $"{cell.gNBId}-{cell.LocalId}";
+
+ //list.Add(cell);
+ }
+
+ return cells;
+ }
+
+ private static string ProcessComplexValue(string rawValue)
+ {
+ if (rawValue.StartsWith("[") && rawValue.EndsWith("]"))
+ {
+ // 去除数组的方括号
+ return rawValue[1..^1].Trim();
+ }
+ else if (rawValue.Contains("(") && rawValue.Contains(")"))
+ {
+ return rawValue;
+ }
+ else
+ {
+ return rawValue;
+ }
+ }
+
+ private static void GetMccMnc(string input,out string mcc,out string mnc) {
+ mcc = "";
+ mnc = "";
+ string pattern = @"\>\>\> Struct\[\d+\] has \d+ members:\s*>>>\s*1\.mcc = (\d+)\s*>>>\s*2\.mnc = (\d+)";
+ var matches = Regex.Matches(input, pattern, RegexOptions.Multiline);
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ mcc = match.Groups[1].Value;
+ mnc = match.Groups[2].Value;
+ }
+ }
+ }
+ ///
+ /// 获取小区PLMN信息
+ ///
+ ///
+ ///
+ private static List ExtractPLMNInfos(string input)
+ {
+ List plmnInfos = new List();
+ string pattern = @"\>\>\> Struct\[\d+\] has 2 members:\s*>>>\s*1\.mcc = (\d+)\s*>>>\s*2\.mnc = (\d+)";
+ var matches = Regex.Matches(input, pattern, RegexOptions.Multiline);
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ int mcc = int.Parse(match.Groups[1].Value);
+ int mnc = int.Parse(match.Groups[2].Value);
+ plmnInfos.Add(new PLMNInfo { MCC = mcc, MNC = mnc });
+ }
+ }
+
+ return plmnInfos;
+ }
+
+ ///
+ /// 获取小区NRSectorCarrierRef信息
+ ///
+ ///
+ ///
+ private static List<(string GNBDUFunction, string NRSectorCarrier)> ExtractNRSectorCarrierRef(string message)
+ {
+ // >>> nRSectorCarrierRef = GNBDUFunction = 1,NRSectorCarrier = 1
+ List<(string, string)> values = new List<(string, string)>();
+ string pattern = @"nRSectorCarrierRef\s*=\s*GNBDUFunction\s*=\s*(\d+),NRSectorCarrier\s*=\s*(\d+)";
+ var matches = Regex.Matches(message, pattern, RegexOptions.Multiline);
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ values.Add((match.Groups[1].Value, match.Groups[2].Value));
+ }
+ }
+
+ return values;
+ }
+
+ private string GetDicValue(Dictionary dic, string key)
+ {
+ string value = string.Empty;
+ if (dic.ContainsKey(key))
+ value = dic[key];
+ return value;
+ }
+
+ public Task SetCellState(Cell cell, bool state)
+ {
+ int rtn = 0;
+ try
+ {
+ string cmdText = $"{(!state ? "bl" : "deb")} {cell.MoId}";
+ MoShellResult result = ExecuteExtraCmd(_stationId, cmdText);
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set cell status {state}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set cell status error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// 上行带宽
+ ///下行带宽
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task SetBandwidth(Cell cell, double BandWidth, double BandWidthUl, bool wait)
+ {
+ int rtn = 0;
+ try
+ {
+ if (!double.IsNaN(BandWidth))//修改下行
+ {
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={cell.NRSectorCarrier} bSChannelBwDL {BandWidth}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Dl_Bandwidth, false, ("NRSectorCarrier", cell.NRSectorCarrier), ("bSChannelBwDL", $"{BandWidth}"));
+ rtn += result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set dl bandwidth {BandWidth}, result:{rtn}.");
+ }
+ if (!double.IsNaN(BandWidthUl))//修改上行
+ {
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={cell.NRSectorCarrier} bSChannelBwUL {BandWidthUl}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Ul_Bandwidth, false, ("NRSectorCarrier", cell.NRSectorCarrier), ("bSChannelBwUL", $"{BandWidthUl}"));
+ rtn += result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set ul bandwidth {BandWidthUl}, result:{rtn}.");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set bandwidth error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 物理小区标识
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task SetCarrierPCI(Cell cell, string CarrierPCI, bool await)
+ {
+ int rtn = 0;
+ try
+ {
+ //var mo = cell.MoId.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)[1];
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} nRPCI {CarrierPCI}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.PhyCellId, false, ("NRCellDU", cell.NRCellDUId), ("nRPCI", CarrierPCI));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set pci {CarrierPCI}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set pci error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ public async Task SetCarrierPCI(List<(Cell, string)> cellPcis, bool wait)
+ {
+ int rtn = 0;
+
+ if (!cellPcis.Safe().Any())
+ return rtn;
+
+ foreach (var item in cellPcis)
+ {
+ rtn += await SetCarrierPCI(item.Item1, item.Item2, wait);
+ }
+
+ return rtn;
+ }
+ ///
+ /// ssb中心频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task SetCarrierFrequency(Cell cell, string Frequency, bool await)
+ {
+ int rtn = 0;
+ try
+ {
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} ssbFrequency {Frequency}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.SsbFrequency, false, ("NRCellDU", cell.NRCellDUId), ("ssbFrequency", Frequency));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set ssbFrequency {Frequency}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set ssbFrequency error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行小区中心频点//上行小区中心频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task SetCarrierFrequency(Cell cell, string earfcnDL, string earfcnUL, bool wait)
+ {
+ int rtn = 0;
+ try
+ {
+ if (!string.IsNullOrWhiteSpace(earfcnDL))//修改下行
+ {
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={cell.NRSectorCarrier} arfcnDL {earfcnDL}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.DLcenterARFCNDL, false, ("NRSectorCarrier", cell.NRSectorCarrier), ("arfcnDL", $"{earfcnDL}"));
+ rtn += result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set dl arfcn {earfcnDL}, result:{rtn}.");
+ }
+ if (!string.IsNullOrWhiteSpace(earfcnUL))//修改上行
+ {
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={cell.NRSectorCarrier} arfcnUL {earfcnUL}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ULcenterARFCNDL, false, ("NRSectorCarrier", cell.NRSectorCarrier), ("arfcnUL", $"{earfcnUL}"));
+ rtn += result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set ul arfcn {earfcnUL}, result:{rtn}.");
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set arfcn error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ public Task SetCellSelection(Cell cell, string qRxLevMin, string qRxLevMinOffsetCell)
+ {
+ return Task.FromResult(0);
+ }
+ ///
+ /// 最低接收电平
+ ///
+ ///
+ ///
+ ///
+ public Task SetCellSelection(Cell cell, double LevelValue)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 qRxLevMin -128
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} qRxLevMin {LevelValue}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.MinimumRxLevel, false, ("NRCellDU", cell.NRCellDUId), ("qRxLevMin", $"{LevelValue}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set minimum rx level {LevelValue}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set minimum rx level error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR小区重选优先级
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCellResel(Cell cell, int cellReselectionPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 cellReselectionPriority 7
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellCU={cell.NRCellCUId},NRFreqRelation={cell.NRFreqRelationList.FirstOrDefault()} cellReselectionPriority {cellReselectionPriority}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.CellReselectionPriority, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("cellReselectionPriority", $"{cellReselectionPriority}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set cell reselection pryority {cellReselectionPriority}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set cell reselection pryority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// 提取修改tInactivityTimer所需参数信息
+ ///
+ ///
+ public (string GNBCUCPFunction, string UeCC, string InactivityProfile, string InactivityProfileUeCfg) ExtractTInactivityTimerPara(string stationId)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "pr InactivityProfile");
+
+ string pattern = @"GNBCUCPFunction=(\d+)\s*[^\w]\s*UeCC=(\d+)\s*[^\w]\s*InactivityProfile=(\w+)\s*[^\w]\s*InactivityProfileUeCfg=(\w+)";
+ var matches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);
+ var results = (GNBCUCPFunction: string.Empty, UeCC: string.Empty, InactivityProfile: string.Empty, InactivityProfileUeCfg: string.Empty);
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ results.GNBCUCPFunction = match.Groups[1].Value;
+ results.UeCC = match.Groups[2].Value;
+ results.InactivityProfile = match.Groups[3].Value;
+ results.InactivityProfileUeCfg = match.Groups[4].Value;
+ }
+ }
+
+ return results;
+ }
+
+ public Task ModifyInactiveParameter(Cell cell, int inactiveTimer)
+ {
+ int rtn = 0;
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+
+ //set GNBCUCPFunction=1,UeCC=1,InactivityProfile=Default,InactivityProfileUeCfg=Base tInactivityTimer 100
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Uecc={UeCC},InactivityProfile={InactivityProfile},InactivityProfileUeCfg={InactivityProfileUeCfg} tInactivityTimer {inactiveTimer}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.UeInactivityTimer, false, ("GNBCUCPFunction", GNBCUCPFunction), ("InactivityProfile", InactivityProfile), ("InactivityProfileUeCfg", InactivityProfileUeCfg), ("tInactivityTimer", $"{inactiveTimer}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set UeInactivityTimer {inactiveTimer}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set UeInactivityTimer error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+
+ public Task ModifyIntraFReselection(Cell cell, double sIntraSearchP, bool SameFrequency)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 sNonIntraSearchP 0
+ //MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellCU={cell.NRCellCUId} sNonIntraSearchP {sIntraSearchP}");
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.S_NonIntraSearchP, false, ("NRCellCU", cell.NRCellCUId), ("sNonIntraSearchP", $"{sIntraSearchP}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set sIntraSearchP {sIntraSearchP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set sIntraSearchP error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ public Task CreateRelations(Cell FirstCell, Cell SecondCell)
+ {
+ return null;
+ }
+
+ public Task DeleteRelations(Cell FirstCell, Cell SecondCell)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetA1Threshold(Cell cell, int rsrpThresholdA1, int hysteresisA1)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetA2Threshold(Cell cell, int rsrpThresholdA2, int hysteresisA2)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetA3Threshold(Cell cell, double eventOffset, int hysteresisA3)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetA4Threshold(Cell cell, int rsrpThresholdA4, int hysteresisA4)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetA5Threshold(Cell cell, int rsrpThreshold, int A5Thrd1Rsrp, int hysteresisA5, int LNHOIF_eutraCarrierInfo)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetB1Threshold(Cell cell, int value1)
+ {
+ int rtn = 0;
+ try
+ {
+ //var list = ExtractThresholdPara(_stationId);
+ //if (list.Safe().Any())
+ //{
+ // var (GNBCUCPFunction, Mcpc, McpcPCellProfile, McpcPCellProfileUeCfg) = list.FirstOrDefault();
+
+ // //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 threshold2EUtra = -95
+ // MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateB2 threshold2EUtra={value1}");
+ // //MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.B2_Threshold2EUTRA, false, ("GNBCUCPFunction", GNBCUCPFunction), ("Mcpc", Mcpc), ("McpcPCellProfile", McpcPCellProfile), ("McpcPCellProfileUeCfg", McpcPCellProfileUeCfg), ("threshold2EUtra", $"{value1}"));
+ // rtn += result?.Status == true ? 0 : -1;
+ //}
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set B1-Threshold {value1}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set B1-Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ public Task SetB2Threshold(Cell cell, int value1, int value2)
+ {
+ int rtn = 0;
+ try
+ {
+ var list = ExtractThresholdPara(_stationId);
+ if (list.Safe().Any())
+ {
+ var item = list.FirstOrDefault();
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 threshold2EUtra = -95
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={item.GNBCUCPFunction},Mcpc={item.Mcpc},McpcPCellProfile={item.McpcPCellProfile},McpcPCellProfileUeCfg={item.McpcPCellProfileUeCfg} rsrpCandidateB2 threshold2EUtra={value1}");
+ //MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.B2_Threshold2EUTRA, false, ("GNBCUCPFunction", item.GNBCUCPFunction), ("Mcpc", item.Mcpc), ("McpcPCellProfile", item.McpcPCellProfile), ("McpcPCellProfileUeCfg", item.McpcPCellProfileUeCfg), ("threshold2EUtra", $"{value1}"));
+ rtn += result?.Status == true ? 0 : -1;
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 hysteresis = 0
+ MoShellResult result2 = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={item.GNBCUCPFunction},Mcpc={item.Mcpc},McpcPCellProfile={item.McpcPCellProfile},McpcPCellProfileUeCfg={item.McpcPCellProfileUeCfg} rsrpCandidateB2 hysteresis={value2}");
+ //MoShellResult result2 = ExecuteSetCmd(_stationId, EricssonCmdType.B2_Threshold2EUTRA, false, ("GNBCUCPFunction", item.GNBCUCPFunction), ("Mcpc", item.Mcpc), ("McpcPCellProfile", item.McpcPCellProfile), ("McpcPCellProfileUeCfg", item.McpcPCellProfileUeCfg), ("hysteresis", $"{value2}"));
+ rtn += result2?.Status == true ? 0 : -1;
+ }
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set B2-Threshold {value1},{value2}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set B2-Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// 提取修改门限所需参数信息
+ ///
+ ///
+ public List<(string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg)> ExtractThresholdPara(string stationId)
+ {
+ MoShellResult result = ExecuteExtraCmd(stationId, "pr Mcpc");
+
+ string pattern = @"GNBCUCPFunction=(\d+)\s*[^\w]\s*Mcpc=(\d+)\s*[^\w]\s*McpcPCellProfile=(\w+)\s*[^\w]\s*McpcPCellProfileUeCfg=(\w+)";
+ var matches = Regex.Matches(result.Message, pattern, RegexOptions.Multiline);
+ var results = new List<(string, string, string, string)>();
+
+ foreach (Match match in matches)
+ {
+ if (match.Success)
+ {
+ results.Add((match.Groups[1].Value, match.Groups[2].Value, match.Groups[3].Value, match.Groups[4].Value));
+ }
+ }
+
+ return results;
+ }
+
+ #region ExcelCommand
+ ///
+ /// 移动国家码
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyMcc(Cell cell, string mcc)
+ {
+ int rtn = 0;
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+ // set GNBCUCPFunction=1 mcc=460
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Mcc, false, ("GNBCUCPFunction", GNBCUCPFunction), ("mcc", mcc));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} GNBCUCPFunction {GNBCUCPFunction} set mcc {mcc}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set mcc error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 移动网络码
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyMnc(Cell cell, string mnc)
+ {
+ int rtn = 0;
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+ // set GNBCUCPFunction=1 mcc=00
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Mnc, false, ("GNBCUCPFunction", GNBCUCPFunction), ("mnc", mnc));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} GNBCUCPFunction {GNBCUCPFunction} set mcc {mnc}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} set mnc error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 跟踪区域码
+ ///
+ ///
+ ///
+ public Task ModifyTac(Cell cell, string nrtac)
+ {
+ int rtn = 0;
+ try
+ {
+ // set . nrtac 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Mnc, true, ("nrtac", nrtac));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyTac nrtac {nrtac}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyTac nrtac {nrtac} error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基站ID
+ ///
+ ///
+ ///
+ ///
+ public Task ModifygNodeBId(Cell cell, string gNBId)
+ {
+ int rtn = 0;
+
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+
+ // set GNBCUCPFunction=1 gNBId 323
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.GNodeBId, false, ("GNBCUCPFunction", GNBCUCPFunction), ("gNBId", gNBId));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygNodeBId {GNBCUCPFunction} set gNBId {gNBId}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygNodeBId set gNBId error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// gNBID长度
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifygNBIdLength(Cell cell, string gNBIdLength)
+ {
+ int rtn = 0;
+
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+ // set GNBCUCPFunction=1 gNBIdLength 22
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.GNBIdLength, false, ("GNBCUCPFunction", GNBCUCPFunction), ("gNBIdLength", gNBIdLength));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygNBIdLength {GNBCUCPFunction} set gNBIdLength {gNBIdLength}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygNBIdLength set gNBIdLength error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 小区标识
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCellId(Cell cell)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU = 1 cellLocalId 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.CellId, false, ("NRCellDU", cell.NRCellDUId), ("cellLocalId", cell.CellId.ToString()));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellId set cellLocalId {cell.LocalId}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellId set cellLocalId error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基站ID
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyeNodeBId(Cell cell, string eNBId)
+ {
+ int rtn = 0;
+
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+ // set GNBCUCPFunction=1 eNBId 1890
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.GNodeBId, false, ("GNBCUCPFunction", GNBCUCPFunction), ("eNBId", eNBId));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyeNodeBId {GNBCUCPFunction} set eNBId {eNBId}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyeNodeBId set eNBId error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上下行时隙配置
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifysubframeAssignment(Cell cell, string EUtranCellTDD, string subframeAssignment)
+ {
+ int rtn = 0;
+ try
+ {
+ // set EUtranCellTDD=MIIT-TDD-5 subframeAssignment 2
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.SubframeAssignment, false, ("EUtranCellTDD", EUtranCellTDD), ("subframeAssignment", subframeAssignment));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifysubframeAssignment subframeAssignment {subframeAssignment}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifysubframeAssignment subframeAssignment error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 特殊时隙配置
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyspecialSubframePattern(Cell cell, string EUtranCellTDD, string specialSubframePattern)
+ {
+ int rtn = 0;
+ try
+ {
+ // set EUtranCellTDD=MIIT-TDD-1 specialSubframePattern 7
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.SpecialSubframePattern, false, ("EUtranCellTDD", EUtranCellTDD), ("specialSubframePattern", specialSubframePattern));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyspecialSubframePattern specialSubframePattern {specialSubframePattern}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyspecialSubframePattern specialSubframePattern error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// LTE频段
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyfreqBand(Cell cell, string EUtranCellFDD, string freqBand)
+ {
+ int rtn = 0;
+ try
+ {
+ // set EUtranCellFDD=2 freqBand 3
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.FreqBandIndicator, false, ("EUtranCellFDD", EUtranCellFDD), ("freqBand", freqBand));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfreqBand freqBand {freqBand}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfreqBand freqBand error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SSB子载波间隔
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyssbSubcarrierSpacing(Cell cell, string ssbSubCarrierSpacing)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ssbSubCarrierSpacing 15
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.SsbSubcarrierSpacing, false, ("NRCellDU", cell.NRCellDUId), ("ssbSubCarrierSpacing", ssbSubCarrierSpacing));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbSubcarrierSpacing ssbSubCarrierSpacing {ssbSubCarrierSpacing}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbSubcarrierSpacing ssbSubCarrierSpacing error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR异频重选邻区SCS
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifysmtcScs(Cell cell, string NRNetwork, string NRFrequency, string smtcScs)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRNetwork = 1, NRFrequency = 152650 - 15 smtcScs 15
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRNetwork = {NRNetwork}, NRFrequency = {NRFrequency} smtcScs {smtcScs}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifysmtcScs smtcScs {smtcScs}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifysmtcScs smtcScs error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR小区重选偏置
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyQ_OffsetFreq(Cell cell, string qOffsetFreq)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 qOffsetFreq 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_OffsetFreq, false, ("NRCellDU", cell.NRCellDUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("qOffsetFreq", qOffsetFreq));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_OffsetFreq qOffsetFreq {qOffsetFreq}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_OffsetFreq qOffsetFreq error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR-LTE切换邻区允许测量带宽
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyallowedMeasBandwidth(Cell cell, string EUtranFreqRelation, string allowedMeasBandwidth)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,EUtranFreqRelation=1700 allowedMeasBandwidth 6
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.AllowedMeasBandwidth, false, ("NRCellCU", cell.NRCellCUId), ("EUtranFreqRelation", EUtranFreqRelation), ("allowedMeasBandwidth", allowedMeasBandwidth));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyallowedMeasBandwidth allowedMeasBandwidth {allowedMeasBandwidth}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyallowedMeasBandwidth allowedMeasBandwidth error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异频异系统重选起测门限RSRP
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyS_NonIntraSearchP(Cell cell, string sNonIntraSearchP)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 sNonIntraSearchP 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.S_NonIntraSearchP, false, ("NRCellCU", cell.NRCellCUId), ("sNonIntraSearchP", sNonIntraSearchP));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_NonIntraSearchP sNonIntraSearchP {sNonIntraSearchP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_NonIntraSearchP sNonIntraSearchP error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异频异系统重选起测门限RSRQ
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyS_NonIntraSearchQ(Cell cell, string sNonIntraSearchQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 sNonIntraSearchQ 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.S_NonIntraSearchQ, false, ("NRCellCU", cell.NRCellCUId), ("sNonIntraSearchQ", sNonIntraSearchQ));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_NonIntraSearchQ sNonIntraSearchQ {sNonIntraSearchQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_NonIntraSearchQ sNonIntraSearchQ error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异频异系统低优先级重选门限RSRP
+ ///
+ ///
+ ///
+ ///
+ public Task ModifythreshServingLowP(Cell cell, string threshServingLowP)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 threshServingLowP 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshServingLowP, false, ("NRCellCU", cell.NRCellCUId), ("threshServingLowP", threshServingLowP));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifythreshServingLowP threshServingLowP {threshServingLowP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifythreshServingLowP threshServingLowP error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异频异系统低优先级重选门限RSRQ
+ ///
+ ///
+ ///
+ ///
+ public Task ModifythreshServingLowQ(Cell cell, string threshServingLowQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 threshServingLowQ 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshServingLowQ, false, ("NRCellCU", cell.NRCellCUId), ("threshServingLowQ", threshServingLowQ));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifythreshServingLowQ threshServingLowQ {threshServingLowQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifythreshServingLowQ threshServingLowQ error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 小区重选迟滞
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyqHyst(Cell cell, string qHyst)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 qHyst 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_Hyst, false, ("NRCellCU", cell.NRCellCUId), ("qHyst", qHyst));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyqHyst qHyst {qHyst}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyqHyst qHyst error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN小区重选定时器时长
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyTreselectionEUTRA(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string tReselectionEutra)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=MIIT-FDD-1,EUtranFreqRelation=1650 tReselectionEutra 2
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.TreselectionEUTRA, false, ("EUtranCellFDD", EUtranCellFDD), ("EUtranFreqRelation", EUtranFreqRelation), ("tReselectionEutra", tReselectionEutra));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyTreselectionEUTRA tReselectionEutra {tReselectionEutra}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyTreselectionEUTRA tReselectionEutra error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN小区重选定时器时长
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytReselectionEutra(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string tReselectionEutra)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=MIIT-FDD-1,EUtranFreqRelation=1650 tReselectionEutra 2
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set EUtranCellFDD={EUtranCellFDD},EUtranFreqRelation={EUtranFreqRelation} tReselectionEutra {tReselectionEutra}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytReselectionEutra tReselectionEutra {tReselectionEutra}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytReselectionEutra tReselectionEutra error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// EUTRA邻区重选优先级
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycellReselectionPriority(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string cellReselectionPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=MIIT-FDD-1,EUtranFreqRelation=1650 cellReselectionPriority 7
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set EUtranCellFDD={EUtranCellFDD},EUtranFreqRelation={EUtranFreqRelation} cellReselectionPriority {cellReselectionPriority}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionPriority cellReselectionPriority {cellReselectionPriority}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionPriority cellReselectionPriority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// EUTRA邻区重选子优先级
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycellReselectionSubPriority(Cell cell, string EUtranCellFDD, string GUtranFreqRelation, string cellReselectionSubPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=MIIT-FDD-1,GUtranFreqRelation=423850 cellReselectionSubPriority 0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set EUtranCellFDD={EUtranCellFDD},GUtranFreqRelation={GUtranFreqRelation} cellReselectionSubPriority {cellReselectionSubPriority}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionSubPriority cellReselectionSubPriority {cellReselectionSubPriority}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionSubPriority cellReselectionSubPriority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN频点高优先级重选RSRP门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_High(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string threshXHigh)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,EUtranFreqRelation=1700 threshXHigh 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_High, false, ("EUtranCellFDD", EUtranCellFDD), ("EUtranFreqRelation", EUtranFreqRelation), ("threshXHigh", threshXHigh));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_High threshXHigh {threshXHigh}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_High threshXHigh error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN频点高优先级目标小区重选门限RSRQ
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_HighQ(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string threshXHighQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,EUtranFreqRelation=1700 threshXHighQ 2
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_HighQ, false, ("EUtranCellFDD", EUtranCellFDD), ("EUtranFreqRelation", EUtranFreqRelation), ("threshXHighQ", threshXHighQ));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_HighQ threshXHighQ {threshXHighQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_HighQ threshXHighQ error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN频点低优先级目标小区重选门限RSRP
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_Low(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string threshXLow)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,EUtranFreqRelation=1700 threshXLow 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_Low, false, ("EUtranCellFDD", EUtranCellFDD), ("EUtranFreqRelation", EUtranFreqRelation), ("threshXLow", threshXLow));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_Low threshXLow {threshXLow}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_Low threshXLow error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///E-UTRAN频点低优先级目标小区重选门限RSRQ
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_LowQ(Cell cell, string EUtranCellFDD, string EUtranFreqRelation, string threshXLowQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,EUtranFreqRelation=1700 threshXLowQ 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_LowQ, false, ("EUtranCellFDD", EUtranCellFDD), ("EUtranFreqRelation", EUtranFreqRelation), ("threshXLowQ", threshXLowQ));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_LowQ threshXLowQ {threshXLowQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_LowQ threshXLowQ error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// EUTRA邻区最小接入电平
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyQ_RxLevMin(Cell cell, string EUtranCellTDD, string EUtranFreqRelation, string qRxLevMin)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellTDD=MIIT-TDD-5,EUtranFreqRelation=40540 qRxLevMin -140
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_RxLevMin, false, ("EUtranCellTDD", EUtranCellTDD), ("EUtranFreqRelation", EUtranFreqRelation), ("qRxLevMin", qRxLevMin));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_RxLevMin qRxLevMin {qRxLevMin}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_RxLevMin qRxLevMin error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// EUTRA邻区最小接入质量
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyQ_QualMin(Cell cell, string EUtranCellTDD, string EUtranFreqRelation, string qQualMin)
+ {
+ int rtn = 0;
+ try
+ {
+ // // set EUtranCellTDD=MIIT-TDD-5,EUtranFreqRelation=40540 qQualMin 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_QualMin, false, ("EUtranCellTDD", EUtranCellTDD), ("EUtranFreqRelation", EUtranFreqRelation), ("qQualMin", qQualMin));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Q_QualMin qQualMin {qQualMin}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Q_QualMin qQualMin error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 重选NR小区定时器时长
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT_ReselectionNR_r15(Cell cell, string tReselectionNR)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellCU=5292034,NRFreqRelation=152650 tReselectionNR 2
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T_ReselectionNR_r15, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("tReselectionNR", tReselectionNR));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT_ReselectionNR_r15 tReselectionNR {tReselectionNR}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT_ReselectionNR_r15 tReselectionNR error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SSB测量时间窗
+ ///
+ ///
+ ///
+ ///
+ public Task ModifySsb_Duration_r15(Cell cell, string ssbDuration)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ssbDuration 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Ssb_Duration_r15, false, ("NRCellCU", cell.NRCellCUId), ("ssbDuration", ssbDuration));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Ssb_Duration_r15 ssbDuration {ssbDuration}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Ssb_Duration_r15 ssbDuration error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR频点重选子优先级
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCellReselectionSubPriority_r13(Cell cell, string cellReselectionSubPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 cellReselectionSubPriority 6
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.CellReselectionSubPriority_r13, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("cellReselectionSubPriority", $"{cellReselectionSubPriority}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellReselectionSubPriority_r13 {cellReselectionSubPriority}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellReselectionSubPriority_r13 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR频点高优先级重选RSRP门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_High_r15(Cell cell, string threshXHighP)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 threshXHighP 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_High_r15, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("threshXHighP", $"{threshXHighP}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ThreshX_High_r15 {threshXHighP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ThreshX_High_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR频点低优先级重选RSRP门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_Low_r15(Cell cell, string threshXLowP)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 threshXLowP 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_Low_r15, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("threshXLowP", $"{threshXLowP}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_Low_r15 {threshXLowP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_Low_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR频点高优先级重选RSRQ门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_HighQ_r15(Cell cell, string threshXHighQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 threshXHighQ 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_HighQ_r15, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("threshXHighQ", $"{threshXHighQ}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_HighQ_r15 {threshXHighQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_HighQ_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR频点低优先级重选RSRQ门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyThreshX_LowQ_r15(Cell cell, string threshXLowQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 threshXLowQ 4
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ThreshX_LowQ_r15, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", $"{cell.NRFreqRelationList.FirstOrDefault()}"), ("threshXLowQ", $"{threshXLowQ}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_LowQ_r15 {threshXLowQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyThreshX_LowQ_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 最低接收RSRQ
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyQ_QualMin_r15(Cell cell, string qQualMin)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 qQualMin -34
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Q_QualMin_r15, false, ("NRCellDU", cell.NRCellDUId), ("qQualMin", $"{qQualMin}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_QualMin_r15 {qQualMin}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyQ_QualMin_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// UE在NR SCG最大发射功率
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyP_MaxNR_r15(Cell cell, string EUtranCellFDD, string GUtranFreqRelation, string pMaxNR)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,GUtranFreqRelation=505230 pMaxNR 33
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.P_MaxNR_r15, false, ("NRCellDU", cell.NRCellDUId), ("EUtranCellFDD", $"{EUtranCellFDD}"), ("GUtranFreqRelation", $"{GUtranFreqRelation}"), ("pMaxNR", $"{pMaxNR}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP_MaxNR_r15 {pMaxNR}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP_MaxNR_r15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异系统切换A1 RSRP门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA1_Threshold(Cell cell, string EUtranCellTDD, string UeMeasControl, string ReportConfigA1Prim, string a1ThresholdRsrpPrim)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellTDD=MIIT-TDD-1,UeMeasControl=1,ReportConfigA1Prim=1 a1ThresholdRsrpPrim -65
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.A1_Threshold, false, ("EUtranCellTDD", EUtranCellTDD), ("UeMeasControl", $"{UeMeasControl}"), ("ReportConfigA1Prim", $"{ReportConfigA1Prim}"), ("a1ThresholdRsrpPrim", $"{a1ThresholdRsrpPrim}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA1_Threshold {a1ThresholdRsrpPrim}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA1_Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异系统切换A2 RSRP门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA2_Threshold(Cell cell, string EUtranCellTDD, string UeMeasControl, string ReportConfigEUtraBadCovPrim, string a2ThresholdRsrpPrim)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellTDD=MIIT-TDD-1,UeMeasControl=1,ReportConfigEUtraBadCovPrim=1 a2ThresholdRsrpPrim -88
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.A2_Threshold, false, ("EUtranCellTDD", EUtranCellTDD), ("UeMeasControl", $"{UeMeasControl}"), ("ReportConfigEUtraBadCovPrim", $"{ReportConfigEUtraBadCovPrim}"), ("a2ThresholdRsrpPrim", $"{a2ThresholdRsrpPrim}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA2_Threshold {a2ThresholdRsrpPrim}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA2_Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异系统切换A1A2幅度迟滞
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyhysteresisA1A2SearchRsrp(Cell cell, string EUtranCellFDD, string UeMeasControl, string ReportConfigSearch, string hysteresisA1A2SearchRsrp)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,UeMeasControl=1,ReportConfigSearch=1 hysteresisA1A2SearchRsrp 20
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set EUtranCellFDD={EUtranCellFDD},UeMeasControl={UeMeasControl},ReportConfigSearch={ReportConfigSearch} hysteresisA1A2SearchRsrp {hysteresisA1A2SearchRsrp}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyhysteresisA1A2SearchRsrp {hysteresisA1A2SearchRsrp}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyhysteresisA1A2SearchRsrp error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异系统切换A1A2时间迟滞
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytimeToTriggerA2Search(Cell cell, string EUtranCellFDD, string UeMeasControl, string ReportConfigSearch, string timeToTriggerA2Search)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellFDD=2,UeMeasControl=1,ReportConfigSearch=1 timeToTriggerA2Search 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set EUtranCellFDD={EUtranCellFDD},UeMeasControl={UeMeasControl},ReportConfigSearch={ReportConfigSearch} timeToTriggerA2Search {timeToTriggerA2Search}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytimeToTriggerA2Search {timeToTriggerA2Search}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytimeToTriggerA2Search error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基于覆盖的切换至E-UTRAN B2 RSRP门限1
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyB2_Threshold1(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold1)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 threshold1 = -85
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateB2 threshold1 ={threshold1}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyB2_Threshold1 {threshold1}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyB2_Threshold1 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基于覆盖的切换B2 RSRP门限2
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyB2_Threshold2EUTRA(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold2EUtra)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 threshold2EUtra = -95
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateB2 threshold2EUtra ={threshold2EUtra}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyB2_Threshold2EUTRA {threshold2EUtra}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyB2_Threshold2EUTRA error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基于覆盖的切换B1B2幅度迟滞
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyRsrpCandidateB2hysteresis(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string hysteresis)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 hysteresis = 0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateB2 hysteresis ={hysteresis}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRsrpCandidateB2hysteresis {hysteresis}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRsrpCandidateB2hysteresis error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基于覆盖的切换B1B2时间迟滞
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyRsrpCandidateB2timeToTrigger(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string timeToTrigger)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateB2 timeToTrigger = 640
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateB2 timeToTrigger ={timeToTrigger}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRsrpCandidateB2timeToTrigger {timeToTrigger}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRsrpCandidateB2timeToTrigger error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// E-UTRAN小区偏移量
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCellIndividualOffset(Cell cell, string EUtranCellTDD, string EUtranFreqRelation, string EUtranCellRelation, string cellIndividualOffsetEUtran)
+ {
+ int rtn = 0;
+ try
+ {
+ //set EUtranCellTDD=MIIT-TDD-5,EUtranFreqRelation=40540,EUtranCellRelation=TDD5-4 cellIndividualOffsetEUtran 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.CellIndividualOffset, false, ("EUtranCellTDD", EUtranCellTDD), ("EUtranFreqRelation", $"{EUtranFreqRelation}"), ("EUtranCellRelation", $"{EUtranCellRelation}"), ("cellIndividualOffsetEUtran", $"{cellIndividualOffsetEUtran}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellIndividualOffset {cellIndividualOffsetEUtran}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCellIndividualOffset error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 服务小区UE允许的最大功率
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyP_Max(Cell cell, string pMax)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 pMax 23
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.P_Max, false, ("NRCellDU", cell.NRCellDUId), ("pMax", $"{pMax}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP_Max {pMax}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP_Max error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 同频切换的A3偏置
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA3_offset(Cell cell, string NRCellRelation, string cellIndividualOffsetNR)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=CAICTNRPFCM700M1_1,NRCellRelation=318-1 cellIndividualOffsetNR 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.A3_offset, false, ("NRCellCU", cell.NRCellCUId), ("NRCellRelation", $"{NRCellRelation}"), ("cellIndividualOffsetNR", $"{cellIndividualOffsetNR}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA3_offset {cellIndividualOffsetNR}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA3_offset error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异频A2事件报告门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA2EventThreshold(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpSearchZone threshold = -70
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpSearchZone threshold= {threshold}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA2EventThreshold {threshold}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA2EventThreshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// A5事件报告的服务小区信号质量门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA5_Threshold1(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold1)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateA5 threshold1 = -85
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateA5 threshold1= {threshold1}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA5_Threshold1 {threshold1}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA5_Threshold1 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///A5事件报告的相邻小区信号质量门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyA5_Threshold2(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold2)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCandidateA5 threshold2 = -110
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCandidateA5 threshold2= {threshold2}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA5_Threshold2 {threshold2}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyA5_Threshold2 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 最大上报小区数
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyMaxReportCells(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1MaxReportCells)
+ {
+ int rtn = 0;
+ try
+ {
+ //set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1MaxReportCells 8
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.MaxReportCells, false, ("Mdt", Mdt), ("MdtCellProfile", MdtCellProfile), ("MdtCellProfileUeCfg", $"{MdtCellProfileUeCfg}"), ("m1MaxReportCells", $"{m1MaxReportCells}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyMaxReportCells {m1MaxReportCells}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyMaxReportCells error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上报参考信号index
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyReportQuantityRS_Indexes(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1ReportQuantityRsIndex)
+ {
+ int rtn = 0;
+ try
+ {
+ //set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1ReportQuantityRsIndex 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ReportQuantityRS_Indexes, false, ("Mdt", Mdt), ("MdtCellProfile", MdtCellProfile), ("MdtCellProfileUeCfg", $"{MdtCellProfileUeCfg}"), ("m1MaxReportCells", $"{m1ReportQuantityRsIndex}"));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportQuantityRS_Indexes {m1ReportQuantityRsIndex}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportQuantityRS_Indexes error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 同频小区测量Srxlev门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyS_IntraSearchP(Cell cell, string sIntraSearchP)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 sIntraSearchP 62
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.S_IntraSearchP, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", cell.NRFreqRelationList.FirstOrDefault()), ("sIntraSearchP", sIntraSearchP));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_IntraSearchP {sIntraSearchP}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_IntraSearchP error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 同频小区测量Squal门限
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyS_IntraSearchQ(Cell cell, string sIntraSearchQ)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034,NRFreqRelation=152650 sIntraSearchQ 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.S_IntraSearchQ, false, ("NRCellCU", cell.NRCellCUId), ("NRFreqRelation", cell.NRFreqRelationList.FirstOrDefault()), ("sIntraSearchQ", sIntraSearchQ));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_IntraSearchQ {sIntraSearchQ}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyS_IntraSearchQ error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SMTC周期
+ ///
+ ///
+ ///
+ ///
+ public Task ModifySmtc_periodicityAndOffset(Cell cell, string smtcPeriodicity)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=5292034 smtcPeriodicity 20
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Smtc_periodicityAndOffset, false, ("NRCellCU", cell.NRCellCUId), ("smtcPeriodicity", smtcPeriodicity));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySmtc_periodicityAndOffset {smtcPeriodicity}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySmtc_periodicityAndOffset error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SMTC持续时间
+ ///
+ ///
+ ///
+ ///
+ public Task ModifySmtc_duration(Cell cell, string smtcDuration)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellCU = 5292035 smtcDuration 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Smtc_duration, false, ("NRCellCU", cell.NRCellCUId), ("smtcDuration", smtcDuration));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySmtc_duration {smtcDuration}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySmtc_duration error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///DRX算法开关
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDrxAlgoSwitch(Cell cell, bool drxProfileEnabled)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 drxProfileEnabled false
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.DrxAlgoSwitch, false, ("NRCellDU", cell.NRCellDUId), ("drxProfileEnabled", drxProfileEnabled.ToString()));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrxAlgoSwitch {drxProfileEnabled}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrxAlgoSwitch error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 持续时间定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDrx_onDurationTimer(Cell cell, string GNBDUFunction, string UeCC, string DrxProfile, string DrxProfileUeCfg, string drxOnDurationTimer)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,UeCC=1,DrxProfile=Default,DrxProfileUeCfg=Base drxOnDurationTimer 38
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Drx_onDurationTimer, false, ("GNBDUFunction", GNBDUFunction), ("UeCC", UeCC), ("DrxProfile", DrxProfile), ("DrxProfileUeCfg", DrxProfileUeCfg), ("drxOnDurationTimer", drxOnDurationTimer));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_onDurationTimer {drxOnDurationTimer}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_onDurationTimer error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+
+ ///
+ /// 长周期
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyLongCycle(Cell cell, string GNBDUFunction, string UeCC, string DrxProfile, string DrxProfileUeCfg, string drxLongCycle)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, DrxProfile = Default, DrxProfileUeCfg = Base drxLongCycle 8
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.LongCycle, false, ("GNBDUFunction", GNBDUFunction), ("UeCC", UeCC), ("DrxProfile", DrxProfile), ("DrxProfileUeCfg", DrxProfileUeCfg), ("drxLongCycle", drxLongCycle));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyLongCycle {drxLongCycle}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyLongCycle error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// 上行行重传定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDrx_RetransmissionTimerUL(Cell cell, string GNBDUFunction, string UeCC, string DrxProfile, string DrxProfileUeCfg, string drxRetransmissionTimerUl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, DrxProfile = Default, DrxProfileUeCfg = Base drxRetransmissionTimerUl 8
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Drx_RetransmissionTimerUL, false, ("GNBDUFunction", GNBDUFunction), ("UeCC", UeCC), ("DrxProfile", DrxProfile), ("DrxProfileUeCfg", DrxProfileUeCfg), ("drxRetransmissionTimerUl", drxRetransmissionTimerUl));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_RetransmissionTimerUL {drxRetransmissionTimerUl}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_RetransmissionTimerUL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行重传定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDrx_RetransmissionTimerDL(Cell cell, string GNBDUFunction, string UeCC, string DrxProfile, string DrxProfileUeCfg, string drxRetransmissionTimerDl)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction = 1, UeCC = 1, DrxProfile = Default, DrxProfileUeCfg = Base drxRetransmissionTimerDl 8
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Drx_RetransmissionTimerDL, false, ("GNBDUFunction", GNBDUFunction), ("UeCC", UeCC), ("DrxProfile", DrxProfile), ("DrxProfileUeCfg", DrxProfileUeCfg), ("drxRetransmissionTimerDl", drxRetransmissionTimerDl));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_RetransmissionTimerDL {drxRetransmissionTimerDl}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDrx_RetransmissionTimerDL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 短周期
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyShortCycle(Cell cell, string shortDrxCycle)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //ShortCycle 短周期 set . shortDrxCycle 8
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set . shortDrxCycle {shortDrxCycle}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyShortCycle {shortDrxCycle}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyShortCycle error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 短周期定时器
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyShortCycleTimer(Cell cell, string shortDrxCycleTimer)
+ {
+ int rtn = 0;
+ try
+ {
+
+ //ShortCycleTimer 短周期定时器 set.shortDrxCycleTimer 4
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set . shortDrxCycleTimer {shortDrxCycleTimer}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyShortCycleTimer {shortDrxCycleTimer}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyShortCycleTimer error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RRC连接响应定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT300(Cell cell, string GNBDUFunction, string Rrc, string t300)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction = 1, Rrc = 1 t300 1000
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T300, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t300", t300));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT300 {t300}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT300 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RRC重建响应定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT301(Cell cell, string GNBDUFunction, string Rrc, string t301)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction = 1, Rrc = 1 t301 400
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T301, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t301", t301));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT301 {t301}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT301 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 常量 N310
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT310(Cell cell, string GNBDUFunction, string Rrc, string t310)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,Rrc=1 t310 2000
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T310, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t310", t310));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT310 {t310}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT310 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 常量 N310
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyN310(Cell cell, string GNBDUFunction, string Rrc, string n310)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction=1,Rrc=1 n310 20
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.N310, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("n310", n310));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyN310 {n310}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyN310 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RLF失步转idle定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT311(Cell cell, string GNBDUFunction, string Rrc, string t311)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction = 1, Rrc = 1 t311 3000
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T311, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t311", t311));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT311 {t311}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT311 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 常量 N311
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyN311(Cell cell, string GNBDUFunction, string Rrc, string n311)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,Rrc=1 n311 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.N311, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("n311", n311));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyN311 {n311}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyN311 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RRC连接恢复响应定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT319(Cell cell, string GNBDUFunction, string Rrc, string t319)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, Rrc = 1 t319 400
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T319, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t319", t319));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT319 {t319}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT319 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RRC连接恢复响应定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyT304(Cell cell, string GNBDUFunction, string Rrc, string t304)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, Rrc = 1 t304 400
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.T304, false, ("GNBDUFunction", GNBDUFunction), ("Rrc", Rrc), ("t304", t304));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT304 {t304}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyT304 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// UE不活动定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyUeInactivityTimer(Cell cell, string tInactivityTimer)
+ {
+ int rtn = 0;
+ try
+ {
+ var (GNBCUCPFunction, UeCC, InactivityProfile, InactivityProfileUeCfg) = ExtractTInactivityTimerPara(_stationId);
+ // set GNBCUCPFunction=1,UeCC=1,InactivityProfile=Default,InactivityProfileUeCfg=Base tInactivityTimer 100
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.UeInactivityTimer, false, ("GNBCUCPFunction", GNBCUCPFunction), ("UeCC", UeCC), ("InactivityProfile", InactivityProfile), ("InactivityProfileUeCfg", InactivityProfileUeCfg), ("tInactivityTimer", tInactivityTimer));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUeInactivityTimer {tInactivityTimer}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUeInactivityTimer error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 测量上报量类型
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyReportQuantity(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1ReportQuantityCell)
+ {
+ int rtn = 0;
+ try
+ {
+ // set Mdt = 1, MdtCellProfile = Default, MdtCellProfileUeCfg = Base m1ReportQuantityCell 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.ReportQuantity, false, ("Mdt", Mdt), ("MdtCellProfile", MdtCellProfile), ("MdtCellProfileUeCfg", MdtCellProfileUeCfg), ("m1ReportQuantityCell", m1ReportQuantityCell));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportQuantity {m1ReportQuantityCell}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportQuantity error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 帧偏置
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyFrameOffset(Cell cell, string Synchronization, string RadioEquipmentClock, string bfnOffset)
+ {
+ int rtn = 0;
+ try
+ {
+ // set Synchronization=1,RadioEquipmentClock=1 bfnOffset 0
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.FrameOffset, false, ("Synchronization", Synchronization), ("RadioEquipmentClock", RadioEquipmentClock), ("bfnOffset", bfnOffset));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyFrameOffset {bfnOffset}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyFrameOffset error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SSB周期
+ ///
+ ///
+ ///
+ ///
+ public Task ModifySsb_periodicityServingCell(Cell cell, string ssbPeriodicity)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ssbPeriodicity 20
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Ssb_periodicityServingCell, false, ("NRCellDU", cell.NRCellDUId), ("ssbPeriodicity", ssbPeriodicity));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySsb_periodicityServingCell {ssbPeriodicity}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySsb_periodicityServingCell error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行PDCP序列号长度
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyPdcp_SN_SizeDL(Cell cell, string CUCP5qiTable, string CUCP5qi, string pdcpSnSize)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 pdcpSnSize 12
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Pdcp_SN_SizeDL, false, ("CUCP5qiTable", CUCP5qiTable), ("CUCP5qi", CUCP5qi), ("pdcpSnSize", pdcpSnSize));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyPdcp_SN_SizeDL {pdcpSnSize}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyPdcp_SN_SizeDL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上行PDCP序列号长度
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyPdcp_SN_SizeUL(Cell cell, string CUCP5qiTable, string CUCP5qi, string pdcpSnSize)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 pdcpSnSize 12
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.Pdcp_SN_SizeDL, false, ("CUCP5qiTable", CUCP5qiTable), ("CUCP5qi", CUCP5qi), ("pdcpSnSize", pdcpSnSize));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyPdcp_SN_SizeUL {pdcpSnSize}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyPdcp_SN_SizeUL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RLC模式
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyRlcMode(Cell cell, string CUCP5qiTable, string CUCP5qi, string rlcMode)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 rlcMode 1
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.RlcMode, false, ("CUCP5qiTable", CUCP5qiTable), ("CUCP5qi", CUCP5qi), ("rlcMode", rlcMode));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRlcMode {rlcMode}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRlcMode error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// UE触发Polling的PDU个数门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyulPollPdu(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string ulPollPdu)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1,UeCC = 1,RadioLinkControl = 1,DrbRlc = Default,DrbRlcUeCfg = Base ulPollPdu 16
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction},UeCC = {UeCC},RadioLinkControl = {RadioLinkControl},DrbRlc ={DrbRlc},DrbRlcUeCfg = {DrbRlcUeCfg} ulPollPdu {ulPollPdu}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyulPollPdu {ulPollPdu}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyulPollPdu error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// gNodeB触发Polling的PDU个数门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifydlPollPdu(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string dlPollPdu)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,UeCC=1,RadioLinkControl=1,DrbRlc=Default,DrbRlcUeCfg=Base dlPollPdu 32
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction},UeCC = {UeCC},RadioLinkControl = {RadioLinkControl},DrbRlc ={DrbRlc},DrbRlcUeCfg = {DrbRlcUeCfg} dlPollPdu {dlPollPdu}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydlPollPdu {dlPollPdu}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydlPollPdu error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// gNodeB RLC重组定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytPollRetransmitDl(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string tPollRetransmitDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base tPollRetransmitDl 40
+
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction},UeCC = {UeCC},RadioLinkControl = {RadioLinkControl},DrbRlc ={DrbRlc},DrbRlcUeCfg = {DrbRlcUeCfg} tPollRetransmitDl {tPollRetransmitDl}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPollRetransmitDl {tPollRetransmitDl}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPollRetransmitDl error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///UE RLC重组定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytPollRetransmitUl(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string tPollRetransmitUl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base tPollRetransmitUl 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction},UeCC = {UeCC},RadioLinkControl = {RadioLinkControl},DrbRlc ={DrbRlc},DrbRlcUeCfg = {DrbRlcUeCfg} tPollRetransmitUl {tPollRetransmitUl}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPollRetransmitUl {tPollRetransmitUl}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPollRetransmitUl error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// BSR重传定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyRetxBSR_Timer(Cell cell, string GNBDUFunction, string UeCC, string Bsr, string BsrUeCfg, string reTxBsrTimer)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,UeCC=1,Bsr=1,BsrUeCfg=Base reTxBsrTimer 1280
+ MoShellResult result = ExecuteSetCmd(_stationId, EricssonCmdType.RetxBSR_Timer, false, ("GNBDUFunction", GNBDUFunction), ("UeCC", UeCC), ("Bsr", Bsr), ("BsrUeCfg", BsrUeCfg), ("reTxBsrTimer", reTxBsrTimer));
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRetxBSR_Timer {reTxBsrTimer}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyRetxBSR_Timer error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ //---------Second--------------
+ ///
+ /// 地点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytPosition(Cell cell, string NRSectorCarrier, string longitude, string latitude)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRSectorCarrier=1 longitude 119840391,set NRSectorCarrier=1 latitude 31397321
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={NRSectorCarrier} longitude {longitude},set NRSectorCarrier={NRSectorCarrier} latitude {latitude}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPosition longitude {longitude},latitude {latitude}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPosition error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR小区全局标识
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyNCGI(Cell cell, string GNBCUCPFunction, string mcc, string mnc, string nCI)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1 pLMNId mcc=460,mnc=11, set GNBCUUPFunction=1 pLMNIdList mcc=460,mnc=11 , set NRCellDU=1 nCI 5242881
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={cell.GNBDUFunction} pLMNId mcc={mcc},mnc={mnc}, set GNBCUUPFunction={cell.GNBDUFunction} pLMNIdList mcc={mcc},mnc={mnc} , set NRCellDU={cell.NRCellDUId} nCI {nCI}");
+ rtn = result?.Status == true ? 0 : -1;
+
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNCGI nCI {nCI}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNCGI error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// pointA中心频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifypointAARFCN(Cell cell, string pointAArfcnTdd, string pointAArfcnDlFdd, string pointAArfcnUlFdd)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 pointAArfcnTdd xxxx /set NRCellDU=1 pointAArfcnDlFdd 422112/set NRCellDU=1 pointAArfcnUlFdd 384112
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 pointAArfcnTdd {pointAArfcnTdd}");
+ rtn = result?.Status == true ? 0 : -1;
+ MoShellResult result1 = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 pointAArfcnDlFdd {pointAArfcnDlFdd}");
+ int rtn1 = result1?.Status == true ? 0 : -1;
+ MoShellResult result2 = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 pointAArfcnUlFdd {pointAArfcnUlFdd}");
+ int rtn2 = result2?.Status == true ? 0 : -1;
+ rtn += rtn1 + rtn2;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypointAARFCN pointAArfcnTdd {pointAArfcnTdd},pointAArfcnDlFdd {pointAArfcnDlFdd},pointAArfcnUlFdd {pointAArfcnUlFdd}, result:{rtn}.");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypointAARFCN error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 5G频段
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyfreqBandIndicatorNR(Cell cell, string bandList)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 bandList 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 bandList {bandList}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfreqBandIndicatorNR bandList {bandList}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfreqBandIndicatorNR error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 子载波间隔
+ ///
+ ///
+ ///
+ ///
+ public Task ModifySubcarrierSpacing(Cell cell, string subCarrierSpacing)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 subCarrierSpacing 15
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 subCarrierSpacing {subCarrierSpacing}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySubcarrierSpacing subCarrierSpacing {subCarrierSpacing}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifySubcarrierSpacing error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 载波带宽
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycarrierBandwidth(Cell cell, string NRSectorCarrier, string bSChannelBwUL, string bSChannelBwDL)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRSectorCarrier=1 bSChannelBwUL 30,set NRSectorCarrier=1 bSChannelBwDL 30
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRSectorCarrier={NRSectorCarrier} bSChannelBwUL {bSChannelBwUL},set NRSectorCarrier={NRSectorCarrier} bSChannelBwDL {bSChannelBwDL}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycarrierBandwidth bSChannelBwUL {bSChannelBwUL}, bSChannelBwDL {bSChannelBwDL}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycarrierBandwidth error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR异频重选邻区下行频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyInterFreqCarrierFreqInfo(Cell cell, string GNBCUCPFunction, string NRNetwork, string NRFrequency, string arfcnValueNRDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,NRNetwork=1,NRFrequency=505230-30 arfcnValueNRDl 505230
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},NRNetwork={NRNetwork},NRFrequency={NRFrequency} arfcnValueNRDl {arfcnValueNRDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyInterFreqCarrierFreqInfo NRNetwork={NRNetwork},NRFrequency={NRFrequency} arfcnValueNRDl {arfcnValueNRDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyInterFreqCarrierFreqInfo error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR异系统重选邻区下行频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycarrierFreq(Cell cell, string GNBCUCPFunction, string EUtraNetwork, string EUtranFrequency, string arfcnValueEUtranDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,EUtraNetwork=1,EUtranFrequency=1550 arfcnValueEUtranDl 1550
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycarrierFreq EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycarrierFreq error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR异系统重选邻区优先级
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycellReselectionPriority(Cell cell, string EUtranFreqRelation, string cellReselectionPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellCU=BJ_HYBL52_RC66_D11,EUtranFreqRelation=1550 cellReselectionPriority 6
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellCU={cell.NRCellCUId},EUtranFreqRelation={EUtranFreqRelation} cellReselectionPriority {cellReselectionPriority}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionPriority ,EUtranFreqRelation={EUtranFreqRelation} cellReselectionPriority {cellReselectionPriority}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionPriority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR网内切换邻区ssb频点
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyssbFrequency(Cell cell, string ssbFrequency)
+ {
+ int rtn = 0;
+ try
+ {
+ //ssbFrequency set NRCellDU=1 ssbFrequency 423150
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU=1 ssbFrequency {ssbFrequency}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbFrequency ssbFrequency {ssbFrequency}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbFrequency error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR网内切换邻区SCS
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyssbSubcarrierSpacing(Cell cell, string NRNetwork, string NRFrequency, string smtcScs)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRNetwork=1,NRFrequency=504990-30 smtcScs 30
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRNetwork = {NRNetwork}, NRFrequency = {NRFrequency} smtcScs {smtcScs}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbSubcarrierSpacing NRNetwork = {NRNetwork}, NRFrequency = {NRFrequency} smtcScs {smtcScs}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyssbSubcarrierSpacing error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR-LTE切换邻区频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyNRLTEcarrierFreq(Cell cell, string GNBCUCPFunction, string EUtraNetwork, string EUtranFrequency, string arfcnValueEUtranDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,EUtraNetwork=1,EUtranFrequency=1550 arfcnValueEUtranDl 1550
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNRLTEcarrierFreq GNBCUCPFunction={GNBCUCPFunction},EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNRLTEcarrierFreq error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR服务小区重选优先级
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyNRServercellReselectionPriority(Cell cell, string cellReselectionPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellCU=CAICTNRPFCM4_1,NRFreqRelation=511230 cellReselectionPriority 7
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellCU={cell.NRCellCUId},NRFreqRelation={cell.NRFreqRelationList.FirstOrDefault()} cellReselectionPriority {cellReselectionPriority}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNRServercellReselectionPriority NRFreqRelation={cell.NRFreqRelationList.FirstOrDefault()} cellReselectionPriority {cellReselectionPriority}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyNRServercellReselectionPriority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// EUTRA邻频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCarrierFreqEUTRA(Cell cell, string GNBCUCPFunction, string EUtraNetwork, string EUtranFrequency, string arfcnValueEUtranDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,EUtraNetwork=1,EUtranFrequency=1550 arfcnValueEUtranDl 1550
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCarrierFreqEUTRA EUtraNetwork={EUtraNetwork},EUtranFrequency={EUtranFrequency} arfcnValueEUtranDl {arfcnValueEUtranDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCarrierFreqEUTRA error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR邻频点
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCarrierFreqNRr15(Cell cell, string GNBCUCPFunction, string NRNetwork, string NRFrequency, string arfcnValueNRDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,NRNetwork=1,NRFrequency=505230-30 arfcnValueNRDl 505230
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},NRNetwork={NRNetwork},NRFrequency={NRFrequency} arfcnValueNRDl {arfcnValueNRDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCarrierFreqNRr15 NRNetwork={NRNetwork},NRFrequency={NRFrequency} arfcnValueNRDl {arfcnValueNRDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCarrierFreqNRr15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SSB测量周期
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyperiodicityAndOffsetr15(Cell cell, string ssbPeriodicity, string ssbOffset)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ssbPeriodicity 20,set NRCellDU=1 ssbOffset 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} ssbPeriodicity {ssbPeriodicity},set NRCellDU={cell.NRCellDUId} ssbOffset {ssbOffset}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffsetr15 ssbPeriodicity {ssbPeriodicity}, ssbOffset {ssbOffset}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffsetr15 error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 基于覆盖的切换至E-UTRAN盲A2 RSRP门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCoverA2Threshold(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold)
+ {
+ int rtn = 0;
+ try
+ {
+ // a2-Threshold set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpCritical threshold=-156
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpCritical threshold={threshold}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCoverA2Threshold threshold={threshold}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCoverA2Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 异系统切换NR A2 RSRP门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDiffSysA2Threshold(Cell cell, string GNBCUCPFunction, string Mcpc, string McpcPCellProfile, string McpcPCellProfileUeCfg, string threshold)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBCUCPFunction=1,Mcpc=1,McpcPCellProfile=Default,McpcPCellProfileUeCfg=Base rsrpSearchZone threshold=-70
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBCUCPFunction={GNBCUCPFunction},Mcpc={Mcpc},McpcPCellProfile={McpcPCellProfile},McpcPCellProfileUeCfg={McpcPCellProfileUeCfg} rsrpSearchZone threshold={threshold}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDiffSysA2Threshold threshold={threshold}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDiffSysA2Threshold error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 前导初始接收目标功率
+ ///
+ ///
+ ///
+ ///
+ public Task ModifypreambleReceivedTargetPower(Cell cell, string rachPreambleRecTargetPower)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 rachPreambleRecTargetPower -110
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} rachPreambleRecTargetPower {rachPreambleRecTargetPower}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypreambleReceivedTargetPower rachPreambleRecTargetPower {rachPreambleRecTargetPower}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypreambleReceivedTargetPower error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// preamble最大发送次数
+ ///
+ ///
+ ///
+ ///
+ public Task ModifypreambleTransMax(Cell cell, string rachPreambleTransMax)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 rachPreambleTransMax 10
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} rachPreambleTransMax {rachPreambleTransMax}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypreambleTransMax rachPreambleTransMax {rachPreambleTransMax}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypreambleTransMax error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 路径损耗因子
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifyalpha(Cell cell, string SctpProfile, string alphaIndex)
+ {
+ int rtn = 0;
+ try
+ {
+ // set SctpProfile=1 alphaIndex 3 ?
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set SctpProfile={SctpProfile} alphaIndex {alphaIndex}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyalpha alphaIndex {alphaIndex}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyalpha error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// PUCCH标称PO值
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyP0nominal(Cell cell, string pZeroNomPucch)
+ {
+ int rtn = 0;
+ try
+ {
+ //P0-nominal set NRCellDU=1 pZeroNomPucch -114
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} pZeroNomPucch {pZeroNomPucch}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP0nominal pZeroNomPucch {pZeroNomPucch}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyP0nominal error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 测量报告间隔
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyReportInterval(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1ReportInterval)
+ {
+ int rtn = 0;
+ try
+ {
+ // set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1ReportInterval 7
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set Mdt={Mdt},MdtCellProfile={MdtCellProfile},MdtCellProfileUeCfg={MdtCellProfileUeCfg} m1ReportInterval {m1ReportInterval}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportInterval m1ReportInterval {m1ReportInterval}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyReportInterval error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 测量结果报告次数
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyreportAmount(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1ReportAmount)
+ {
+ int rtn = 0;
+ try
+ {
+ //set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1ReportAmount 4
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set Mdt={Mdt},MdtCellProfile={MdtCellProfile},MdtCellProfileUeCfg={MdtCellProfileUeCfg} m1ReportAmount {m1ReportAmount}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyreportAmount m1ReportAmount {m1ReportAmount}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyreportAmount error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// RS测量上报资源最大个数
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyMaxNrofRSIndexesToReport(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1MaxNoOfRsIndexToReport)
+ {
+ int rtn = 0;
+ try
+ {
+ // set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1MaxNoOfRsIndexToReport 8
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set Mdt={Mdt},MdtCellProfile={MdtCellProfile},MdtCellProfileUeCfg={MdtCellProfileUeCfg} m1MaxNoOfRsIndexToReport {m1MaxNoOfRsIndexToReport}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyMaxNrofRSIndexesToReport m1MaxNoOfRsIndexToReport {m1MaxNoOfRsIndexToReport}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyMaxNrofRSIndexesToReport error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 包含beam测量指示
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyincludeBeamMeasurements(Cell cell, string Mdt, string MdtCellProfile, string MdtCellProfileUeCfg, string m1IncludeBeamMeasurement)
+ {
+ int rtn = 0;
+ try
+ {
+ //set Mdt=1,MdtCellProfile=Default,MdtCellProfileUeCfg=Base m1IncludeBeamMeasurement true
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set Mdt={Mdt},MdtCellProfile={MdtCellProfile},MdtCellProfileUeCfg={MdtCellProfileUeCfg} m1IncludeBeamMeasurement {m1IncludeBeamMeasurement}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyincludeBeamMeasurements m1IncludeBeamMeasurement {m1IncludeBeamMeasurement}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyincludeBeamMeasurements error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// 小区级RSRP滤波系数
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyfilterCoefficient(Cell cell, string UeMC, string UeMCCellProfile, string filterCoefficientNrRsrpHigh, string filterCoefficientNrRsrpLow, string filterCoefficientNrRsrqHigh, string filterCoefficientNrRsrqLow)
+ {
+ int rtn = 0;
+ try
+ {
+ //filterCoefficientRSRP/filterCoefficientRSRQ/filterCoefficientRS-SINR 小区级RSRP滤波系数 set UeMC=1,UeMCCellProfile=Default filterCoefficientNrRsrpHigh 4,set UeMC=1,UeMCCellProfile=Default filterCoefficientNrRsrpLow 4,set UeMC=1,UeMCCellProfile=Default filterCoefficientNrRsrqHigh 11,set UeMC=1,UeMCCellProfile=Default filterCoefficientNrRsrqLow 11
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set UeMC={UeMC},UeMCCellProfile={UeMCCellProfile} filterCoefficientNrRsrpHigh {filterCoefficientNrRsrpHigh},set UeMC={UeMC},UeMCCellProfile={UeMCCellProfile} filterCoefficientNrRsrpLow {filterCoefficientNrRsrpLow},set UeMC={UeMC},UeMCCellProfile={UeMCCellProfile} filterCoefficientNrRsrqHigh {filterCoefficientNrRsrqHigh},set UeMC={UeMC},UeMCCellProfile={UeMCCellProfile} filterCoefficientNrRsrqLow {filterCoefficientNrRsrqLow}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfilterCoefficient {filterCoefficientNrRsrpHigh},{filterCoefficientNrRsrpLow},{filterCoefficientNrRsrqHigh},{filterCoefficientNrRsrqLow} ");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyfilterCoefficient error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// NR服务小区重选子优先级
+ ///
+ ///
+ ///
+ ///
+ public Task ModifycellReselectionSubPriority(Cell cell, string cellReselectionSubPriority)
+ {
+ int rtn = 0;
+ try
+ {
+ // NR服务小区重选子优先级 set NRCellCU=CAICTNRPFCM4_1,NRFreqRelation=511230 cellReselectionSubPriority 7
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellCU={cell.NRCellCUId},NRFreqRelation={cell.NRFreqRelationList.FirstOrDefault()} cellReselectionSubPriority {cellReselectionSubPriority}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionSubPriority cellReselectionSubPriority {cellReselectionSubPriority}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifycellReselectionSubPriority error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// MAC实体预期用于HARQ重传的UL分配之前的最小持续时间
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifydrxHARQRTTTimerUL(Cell cell, string GNBDUFunction, string UeCC, string Harq, string HarqUeCfg, string ulHarqMode)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,UeCC=1,Harq=1,HarqUeCfg=Base ulHarqMode 0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction={GNBDUFunction},UeCC={UeCC},Harq={Harq},HarqUeCfg={HarqUeCfg} ulHarqMode {ulHarqMode}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydrxHARQRTTTimerUL ulHarqMode {ulHarqMode}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydrxHARQRTTTimerUL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// MAC实体预期预期DL HARQ重传授权之前的最小持续时间
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifydrxHARQRTTTimerDL(Cell cell, string GNBDUFunction, string UeCC, string Harq, string HarqUeCfg, string dlHarqMode)
+ {
+ int rtn = 0;
+ try
+ {
+ //drx-HARQ-RTT-TimerDL set GNBDUFunction=1,UeCC=1,Harq=1,HarqUeCfg=Base dlHarqMode 0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction={GNBDUFunction},UeCC={UeCC},Harq={Harq},HarqUeCfg={HarqUeCfg} dlHarqMode {dlHarqMode}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydrxHARQRTTTimerUL dlHarqMode {dlHarqMode}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydrxHARQRTTTimerUL error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 支持频段
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyFrequencyBand(Cell cell, string bandListManual, string NRFrequency)
+ {
+ int rtn = 0;
+ try
+ {
+ //set NRCellDU=1 bandListManual 41, set NRFrequency=5 bandListManual 41
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} bandListManual {bandListManual}, set NRFrequency={NRFrequency} bandListManual {bandListManual}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyFrequencyBand NRFrequency={NRFrequency}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyFrequencyBand error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 时隙配比
+ ///
+ ///
+ ///
+ ///
+ public Task ModifydlULTransmissionPeriodicity(Cell cell, string tddUlDlPattern)
+ {
+ int rtn = 0;
+ try
+ {
+ // NRCellDU = 1 tddUlDlPattern 3 (TDD_ULDL_PATTERN_03)
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU = 1 tddUlDlPattern {tddUlDlPattern} (TDD_ULDL_PATTERN_03)");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydlULTransmissionPeriodicity tddUlDlPattern={tddUlDlPattern}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydlULTransmissionPeriodicity error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 时隙结构
+ ///
+ ///
+ ///
+ ///
+ public Task ModifynrofDownlinkSymbols(Cell cell, string tddSpecialSlotPattern)
+ {
+ int rtn = 0;
+ try
+ {
+ // NRCellDU = 1 tddSpecialSlotPattern 2 (TDD_SPECIAL_SLOT_PATTERN_02)
+ MoShellResult result = ExecuteExtraCmd(_stationId, $" set NRCellDU = 1 tddSpecialSlotPattern {tddSpecialSlotPattern} (TDD_SPECIAL_SLOT_PATTERN_02)");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifynrofDownlinkSymbols tddSpecialSlotPattern={tddSpecialSlotPattern}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifynrofDownlinkSymbols error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SSB发送图样
+ ///
+ ///
+ ///
+ ///
+ public Task ModifymediumBitmap(Cell cell, string ssbOffset)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ssbOffset 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $" set NRCellDU={cell.NRCellDUId} ssbOffset {ssbOffset}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifymediumBitmap ssbOffset={ssbOffset}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifymediumBitmap error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行调制方式
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifydmcsTable(Cell cell, string GNBDUFunction, string UeCC, string LinkAdaptation, string LinkAdaptationUeCfg, string dlMcsTable)
+ {
+ int rtn = 0;
+ try
+ {
+ // mcs-Table 下行调制方式 set GNBDUFunction=1,UeCC=1,LinkAdaptation=1,LinkAdaptationUeCfg=Base dlMcsTable 1/0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction={GNBDUFunction},UeCC={UeCC},LinkAdaptation={LinkAdaptation},LinkAdaptationUeCfg={LinkAdaptationUeCfg} dlMcsTable {dlMcsTable}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydmcsTable dlMcsTable {dlMcsTable}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifydmcsTable error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行MU-MIMO功能开关
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDlMuMimoSwitch(Cell cell, string featureState)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CXC4012590 featureState 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set FeatureState=CXC4012590 featureState {featureState}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDlMuMimoSwitch featureState {featureState}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDlMuMimoSwitch error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// DL 256QAM开关
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyDl256QAMSwitch(Cell cell, string dl256QamEnabled)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 dl256QamEnabled true
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} dl256QamEnabled {dl256QamEnabled}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDl256QAMSwitch dl256QamEnabled {dl256QamEnabled}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyDl256QAMSwitch error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上行调制方式
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyumcsTable(Cell cell, string GNBDUFunction, string UeCC, string LinkAdaptation, string LinkAdaptationUeCfg, string ulMcsTable)
+ {
+ int rtn = 0;
+ try
+ {
+ // mcs-Table 下行调制方式 set GNBDUFunction=1,UeCC=1,LinkAdaptation=1,LinkAdaptationUeCfg=Base ulMcsTable 1/0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction={GNBDUFunction},UeCC={UeCC},LinkAdaptation={LinkAdaptation},LinkAdaptationUeCfg={LinkAdaptationUeCfg} ulMcsTable {ulMcsTable}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyumcsTable ulMcsTable {ulMcsTable}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyumcsTable error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上行MU-MIMO功能开关
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyUlMuMimoSwitch(Cell cell, string featureState)
+ {
+ int rtn = 0;
+ try
+ {
+ // set FeatureState=CXC4012330 featureState 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set FeatureState=CXC4012330 featureState {featureState}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUlMuMimoSwitch featureState {featureState}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUlMuMimoSwitch error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// UL 256QAM开关
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyUl256QAMSwitch(Cell cell, string ul256QamEnabled)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 ul256QamEnabled true
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} ul256QamEnabled {ul256QamEnabled}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUl256QAMSwitch ul256QamEnabled {ul256QamEnabled}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyUl256QAMSwitch error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 信道测量CSI端口数量
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyCsinrofPorts(Cell cell, string csiRsControl16Ports)
+ {
+ int rtn = 0;
+ try
+ {
+ // nrofPorts set NRCellDU=1 csiRsConfig16P csiRsControl16Ports=1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} csiRsConfig16P csiRsControl16Ports {csiRsControl16Ports}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCsinrofPorts csiRsControl16Ports {csiRsControl16Ports}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyCsinrofPorts error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 信道测量CSI周期
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyperiodicityAndOffset(Cell cell, string csiRsPeriodicity)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 csiRsPeriodicity 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} csiRsPeriodicity {csiRsPeriodicity}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffset csiRsPeriodicity {csiRsPeriodicity}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffset error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 时频跟踪TRS周期
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytrsPeriodicity(Cell cell, string trsPeriodicity)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU = 1 trsPeriodicity 20
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} trsPeriodicity {trsPeriodicity}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytrsPeriodicity trsPeriodicity {trsPeriodicity}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytrsPeriodicity error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 梳齿频分倍数
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytransmissionComb(Cell cell, string srsSymbolCombSelectionMode)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 srsSymbolCombSelectionMode 0
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} srsSymbolCombSelectionMode {srsSymbolCombSelectionMode}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytransmissionComb srsSymbolCombSelectionMode {srsSymbolCombSelectionMode}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytransmissionComb error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 组或序列跳频配置
+ ///
+ ///
+ ///
+ ///
+ public Task ModifygroupOrSequenceHopping(Cell cell, string srsHoppingBandwidth)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU=1 srsHoppingBandwidth 0
+
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} srsHoppingBandwidth {srsHoppingBandwidth}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygroupOrSequenceHopping srsHoppingBandwidth {srsHoppingBandwidth}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifygroupOrSequenceHopping error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// SRS周期和偏移
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyperiodicityAndOffset_P(Cell cell, string srsPeriodicity)
+ {
+ int rtn = 0;
+ try
+ {
+ // set NRCellDU = 1 srsPeriodicity 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set NRCellDU={cell.NRCellDUId} srsPeriodicity {srsPeriodicity}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffset_P srsPeriodicity {srsPeriodicity}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyperiodicityAndOffset_P error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 上行PDCP丢弃定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytPdcpDiscard(Cell cell, string CUCP5qiTable, string CUCP5qi, string tPdcpDiscard)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 tPdcpDiscard 250
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set CUCP5qiTable={CUCP5qiTable},CUCP5qi={CUCP5qi} tPdcpDiscard {tPdcpDiscard}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard tPdcpDiscard {tPdcpDiscard}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// gNodeB PDCP重排序定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytReorderingUl(Cell cell, string CUCP5qiTable, string CUCP5qi, string tReorderingUl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 tReorderingUl 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set CUCP5qiTable={CUCP5qiTable},CUCP5qi={CUCP5qi} tReorderingUl {tReorderingUl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard tReorderingUl {tReorderingUl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+ ///
+ /// UE PDCP重排序定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifytReorderingDl(Cell cell, string CUCP5qiTable, string CUCP5qi, string tReorderingDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CUCP5qiTable=1,CUCP5qi=1 tReorderingDl 200
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set CUCP5qiTable={CUCP5qiTable},CUCP5qi={CUCP5qi} tReorderingDl {tReorderingDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard tReorderingDl {tReorderingDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifytPdcpDiscard error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// PDCP头压缩
+ ///
+ ///
+ ///
+ ///
+ public Task ModifyheaderCompression(Cell cell, string featureState)
+ {
+ int rtn = 0;
+ try
+ {
+ // set CXC4012592 featureState 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set CXC4012592 featureState {featureState}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyheaderCompression featureState {featureState}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyheaderCompression error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// pollByte UE AM模式触发Polling 的字节数门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifypollByteUEAM(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string ulMaxRetxThreshold)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base ulMaxRetxThreshold 32 ?
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} ulMaxRetxThreshold {ulMaxRetxThreshold}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypollByteUEAM ulMaxRetxThreshold {ulMaxRetxThreshold}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypollByteUEAM error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///gNodeB AM模式触发Polling的字节数门限
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task ModifypollBytegNodeBAM(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string dlMaxRetxThreshold)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base dlMaxRetxThreshold 16
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} dlMaxRetxThreshold {dlMaxRetxThreshold}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypollByteUEAM dlMaxRetxThreshold {dlMaxRetxThreshold}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifypollByteUEAM error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///UE Polling PDU重传定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifyt_PollRetransmitUEPolling(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string tPollRetransmitUl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base tPollRetransmitUl 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} tPollRetransmitUl {tPollRetransmitUl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_PollRetransmitUEPolling tPollRetransmitUl {tPollRetransmitUl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_PollRetransmitUEPolling error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// gNodeB Polling PDU重传定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifyt_PollRetransmitgNodeBPolling(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string tPollRetransmitDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,UeCC=1,RadioLinkControl=1,DrbRlc=Default,DrbRlcUeCfg=Base tPollRetransmitDl 40
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} tPollRetransmitDl {tPollRetransmitDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_PollRetransmitgNodeBPolling tPollRetransmitDl {tPollRetransmitDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_PollRetransmitgNodeBPolling error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ ///UE禁止发送状态报告定时器//gNodeB AM模式禁止发送状态报告定时器
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifyt_StatusProhibit(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string tStatusProhibitDl)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction = 1, UeCC = 1, RadioLinkControl = 1, DrbRlc = Default, DrbRlcUeCfg = Base tStatusProhibitDl 10
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} tStatusProhibitDl {tStatusProhibitDl}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_StatusProhibit tStatusProhibitDl {tStatusProhibitDl}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyt_StatusProhibit error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 下行RLC序列号长度 上行RLC序列号长度
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifytsn_FieldLength(Cell cell, string GNBDUFunction, string UeCC, string RadioLinkControl, string DrbRlc, string DrbRlcUeCfg, string rlcSNLength)
+ {
+ int rtn = 0;
+ try
+ {
+ //set GNBDUFunction=1,UeCC=1,RadioLinkControl=1,DrbRlc=Default,DrbRlcUeCfg=Base rlcSNLength 6
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction = {GNBDUFunction}, UeCC = {UeCC}, RadioLinkControl = {RadioLinkControl}, DrbRlc = {DrbRlc}, DrbRlcUeCfg = {DrbRlcUeCfg} rlcSNLength {rlcSNLength}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifytsn_FieldLength rlcSNLength {rlcSNLength}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifytsn_FieldLength error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// PF中PO个数
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public Task Modifyns(Cell cell, string GNBDUFunction, string Paging, string nS)
+ {
+ int rtn = 0;
+ try
+ {
+ // set GNBDUFunction=1,Paging=1 nS 1
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"set GNBDUFunction={GNBDUFunction},Paging={Paging} nS {nS}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyns nS {nS}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} Modifyns error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+ ///
+ /// 初始BWP
+ ///
+ ///
+ ///
+ public Task ModifyBWP(Cell cell, string startRB)
+ {
+ int rtn = 0;
+ try
+ {
+ // get NRCellDU=1 bWPRef ,set BWP=DL$ startRB 48,set BWP=UL$ startRB 48
+
+ MoShellResult result = ExecuteExtraCmd(_stationId, $"get NRCellDU={cell.NRCellDUId} bWPRef ,set BWP=DL$ startRB {startRB},set BWP=UL$ startRB {startRB}");
+ rtn = result?.Status == true ? 0 : -1;
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyBWP startRB {startRB}");
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyBWP error.", ex);
+ }
+ return Task.FromResult(rtn);
+ }
+
+
+
+
+
+
+
+ #endregion
+
+
+ ///
+ /// 获取基站异常代码
+ ///
+ ///
+ ///
+ public int GetErrorCode(int errorCode)
+ {
+ int.TryParse(ErrorCodeHelper.GetDeviceErrorCode(DeviceTypeEnum.BaseStationTester, errorCode), out int code);
+ return code;
+ }
+
+ #endregion
+
+ #region 接口实现
+
+
+
+
+
+ public int QuerySiteState()
+ {
+ return _rtn;
+ }
+
+ public void Dispose()
+ {
+ if (_disposed)
+ return;
+
+ _disposed = true;
+ base.Close();
+ }
+
+
+
+ public Task SetCarrierFrequencyAndPCI(Cell cell, string earfcnDL, string earfcnUL, string CarrierPCI, List cells, bool wait)
+ {
+ throw new NotImplementedException();
+ }
+
+ public Task SetCarrierFrequencyAndPCI(Cell cell, string earfcnDL, string earfcnUL, string CarrierPCI, bool wait)
+ {
+ throw new NotImplementedException();
+ }
+
+ public int BeforTest()
+ {
+ throw new NotImplementedException();
+ }
+
+ public int AfterTest()
+ {
+ return 0;
+ }
+
+ #endregion
+ }
+}
diff --git a/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/MoShellResult.cs b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/MoShellResult.cs
new file mode 100644
index 00000000..d76a0082
--- /dev/null
+++ b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Ericsson/MoShellResult.cs
@@ -0,0 +1,299 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MTNet.Application.DriverLibrary.BaseStation
+{
+
+ ///
+ /// 爱立信接口返回的结果对象
+ ///
+ public class MoShellResult
+ {
+ [JsonProperty("msg")]
+ public string Message { get; set; } = string.Empty;
+
+ [JsonProperty("status")]
+ public bool Status { get; set; } = false;
+
+ public override string ToString()
+ {
+ return $"status:{Status}, msg:{Message}";
+ }
+ }
+
+ public class MoInfo
+ {
+ public string Mo { get; set; }
+ public string Attribute { get; set; }
+ public string Value { get; set; }
+
+ public override string ToString()
+ {
+ return $"Mo:{Mo}, Attribute:{Attribute}, Value:{Value}";
+ }
+ }
+
+ public class ManagedObject
+ {
+ public string MoIdentifier { get; set; }
+ public Dictionary MoProperties { get; set; } // 存储MO的属性及其值
+ public Dictionary Attributes { get; set; }
+
+ public override string ToString()
+ {
+ return $"{MoIdentifier},{string.Join(",", Attributes.Select(kvp => $"{kvp.Key}:{kvp.Value}"))?[0..^1]}";
+ }
+ }
+
+ public class PLMNInfo
+ {
+ public int MCC { get; set; }
+ public int MNC { get; set; }
+
+ public override string ToString()
+ {
+ return $"{MCC}/{MNC}";
+ }
+ }
+
+ ///
+ /// MoShell指令类型
+ ///
+ public enum MoShellCmdType
+ {
+ [Description("InitCmd")]
+ InitCmd,
+ [Description("ExtraCmd")]
+ ExtraCmd,
+ [Description("SetCmd")]
+ SetCmd,
+ [Description("CheckCmd")]
+ CheckCmd,
+ [Description("QuitCmd")]
+ QuitCmd
+ }
+
+ ///
+ /// MoShell爱立信操作指令
+ ///
+ public enum EricssonCmdType
+ {
+ [Description("移动国家码"), Command("Mcc")]
+ Mcc,
+ [Description("移动网络码"), Command("Mnc")]
+ Mnc,
+ [Description("跟踪区域码"), Command("TAC")]
+ TAC,
+ [Description("基站ID"), Command("gNodeBId")]
+ GNodeBId,
+ [Description("gNBID长度"), Command("gNBIdLength")]
+ GNBIdLength,
+ [Description("小区标识"), Command("CellId")]
+ CellId,
+ [Description("物理小区标识"), Command("PhyCellId")]
+ PhyCellId,
+ [Description("本地小区ID"), Command("LocalCellId")]
+ LocalCellId,
+ [Description("基站ID"), Command("eNodeBId")]
+ ENodeBId,
+ [Description("ssb中心频点"), Command("ssbFrequency")]
+ SsbFrequency,
+ [Description("下行小区中心频点"), Command("DLcenterARFCNDL")]
+ DLcenterARFCNDL,
+ [Description("上行小区中心频点"), Command("ULcenterARFCNDL")]
+ ULcenterARFCNDL,
+ [Description("上下行时隙配置"), Command("subframeAssignment")]
+ SubframeAssignment,
+ [Description("特殊时隙配置"), Command("specialSubframePattern")]
+ SpecialSubframePattern,
+ [Description("LTE频段"), Command("freqBandIndicator")]
+ FreqBandIndicator,
+ [Description("SSB子载波间隔"), Command("ssbSubcarrierSpacing")]
+ SsbSubcarrierSpacing,
+ [Description("上行带宽"), Command("ul-Bandwidth")]
+ Ul_Bandwidth,
+ [Description("下行带宽"), Command("dl-Bandwidth")]
+ Dl_Bandwidth,
+ [Description("最低接收电平"), Command("MinimumRxLevel")]
+ MinimumRxLevel,
+ //[Description("NR异频重选邻区SCS"), Command("ssbSubcarrierSpacing")]
+ //SsbSubcarrierSpacing,
+ [Description("NR小区重选偏置"), Command("q-OffsetFreq")]
+ Q_OffsetFreq,
+ [Description("NR小区重选优先级"), Command("cellReselectionPriority")]
+ CellReselectionPriority,
+ [Description("NR-LTE切换邻区允许测量带宽"), Command("allowedMeasBandwidth")]
+ AllowedMeasBandwidth,
+ [Description("异频异系统重选起测门限RSRP"), Command("s-NonIntraSearchP")]
+ S_NonIntraSearchP,
+ [Description("异频异系统重选起测门限RSRQ"), Command("s-NonIntraSearchQ")]
+ S_NonIntraSearchQ,
+ [Description("异频异系统低优先级重选门限RSRP"), Command("threshServingLowP")]
+ ThreshServingLowP,
+ [Description("异频异系统低优先级重选门限RSRQ"), Command("threshServingLowQ")]
+ ThreshServingLowQ,
+ [Description("小区重选迟滞"), Command("q-Hyst")]
+ Q_Hyst,
+ [Description("E-UTRAN小区重选定时器时长"), Command("TreselectionEUTRA")]
+ TreselectionEUTRA,
+ //[Description("EUTRA邻区重选优先级"), Command("cellReselectionPriority")]
+ //CellReselectionPriority,
+ [Description("EUTRA邻区重选子优先级"), Command("cellReselectionSubPriority")]
+ CellReselectionSubPriority,
+ [Description("E-UTRAN频点高优先级重选RSRP门限"), Command("threshX-High")]
+ ThreshX_High,
+ [Description("E-UTRAN频点高优先级目标小区重选门限RSRQ"), Command("threshX-HighQ")]
+ ThreshX_HighQ,
+ [Description("E-UTRAN频点低优先级目标小区重选门限RSRP"), Command("threshX-Low")]
+ ThreshX_Low,
+ [Description("E-UTRAN频点低优先级目标小区重选门限RSRQ"), Command("threshX-LowQ")]
+ ThreshX_LowQ,
+ [Description("EUTRA邻区最小接入电平"), Command("q-RxLevMin")]
+ Q_RxLevMin,
+ [Description("EUTRA邻区最小接入质量"), Command("q-QualMin")]
+ Q_QualMin,
+ [Description("重选NR小区定时器时长"), Command("t-ReselectionNR-r15")]
+ T_ReselectionNR_r15,
+ [Description("SSB测量时间窗"), Command("ssb-Duration-r15")]
+ Ssb_Duration_r15,
+ [Description("SSB子载波间隔"), Command("subcarrierSpacingSSB")]
+ SubcarrierSpacingSSB,
+ //[Description("NR频点重选优先级"), Command("cellReselectionPriority")]
+ //CellReselectionPriority,
+ [Description("NR频点重选子优先级"), Command("cellReselectionSubPriority-r13")]
+ CellReselectionSubPriority_r13,
+ [Description("NR频点高优先级重选RSRP门限"), Command("threshX-High-r15")]
+ ThreshX_High_r15,
+ [Description("NR频点低优先级重选RSRP门限"), Command("threshX-Low-r15")]
+ ThreshX_Low_r15,
+ [Description("NR频点低优先级重选RSRQ门限"), Command("threshX-HighQ-r15")]
+ ThreshX_HighQ_r15,
+ [Description("NR频点低优先级重选RSRQ门限"), Command("threshX-LowQ-r15")]
+ ThreshX_LowQ_r15,
+ [Description("最低接收电平"), Command("q-RxLevMin-r15")]
+ Q_RxLevMin_r15,
+ [Description("最低接收RSRQ"), Command("q-QualMin-r15")]
+ Q_QualMin_r15,
+ [Description("UE在NR SCG最大发射功率"), Command("p-MaxNR-r15")]
+ P_MaxNR_r15,
+ [Description("异系统切换A1 RSRP门限"), Command("a1-Threshold")]
+ A1_Threshold,
+ [Description("异系统切换A2 RSRP门限"), Command("a2-Threshold")]
+ A2_Threshold,
+ [Description("异系统切换A1A2幅度迟滞"), Command("hysteresis")]
+ Hysteresis,
+ [Description("异系统切换A1A2时间迟滞"), Command("timeToTrigger")]
+ TimeToTrigger,
+ [Description("基于覆盖的切换至E-UTRAN B2 RSRP门限1"), Command("b2-Threshold1")]
+ B2_Threshold1,
+ [Description("基于覆盖的切换B2 RSRP门限2"), Command("b2-Threshold2EUTRA")]
+ B2_Threshold2EUTRA,
+ //[Description("基于覆盖的切换B1B2幅度迟滞"), Command("hysteresis")]
+ //Hysteresis,
+ //[Description("基于覆盖的切换B1B2时间迟滞"), Command("timeToTrigger")]
+ //TimeToTrigger,
+ [Description("E-UTRAN小区偏移量"), Command("cellIndividualOffset")]
+ CellIndividualOffset,
+ [Description("服务小区UE允许的最大功率"), Command("p-Max")]
+ P_Max,
+ [Description("同频切换的A3偏置"), Command("a3-offset")]
+ A3_offset,
+ //[Description("异频A1事件报告门限"), Command("a1-Threshold")]
+ //A1_Threshold,
+ //[Description("异频A2事件报告门限"), Command("a2-Threshold")]
+ //A2_Threshold,
+ [Description("A5事件报告的服务小区信号质量门限"), Command("a5-Threshold1")]
+ A5_Threshold1,
+ [Description("A5事件报告的相邻小区信号质量门限"), Command("a5-Threshold2")]
+ A5_Threshold2,
+ [Description("最大上报小区数"), Command("maxReportCells")]
+ MaxReportCells,
+ [Description("上报参考信号index"), Command("reportQuantityRS-Indexes")]
+ ReportQuantityRS_Indexes,
+ //[Description("小区重选迟滞"), Command("q-Hyst")]
+ //Q_Hyst,
+ //[Description("NR服务小区重选优先级"), Command("cellReselectionPriority")]
+ //CellReselectionPriority,
+ //[Description("异频异系统重选起测门限RSRP"), Command("s-NonIntraSearchP")]
+ //S_NonIntraSearchP,
+ //[Description("异频异系统重选起测门限RSRQ"), Command("s-NonIntraSearchQ")]
+ //S_NonIntraSearchQ,
+ //[Description("异频异系统低优先级重选门限RSRP"), Command("threshServingLowP")]
+ //ThreshServingLowP,
+ //[Description("异频异系统低优先级重选门限RSRQ"), Command("threshServingLowQ")]
+ //ThreshServingLowQ,
+ //[Description("最低接收电平门限"), Command("q-RxLevMin")]
+ //Q_RxLevMin,
+ //[Description("最低信号质量门限"), Command("q-QualMin")]
+ //Q_QualMin,
+ [Description("同频小区测量Srxlev门限"), Command("s-IntraSearchP")]
+ S_IntraSearchP,
+ [Description("同频小区测量Squal门限"), Command("s-IntraSearchQ")]
+ S_IntraSearchQ,
+ [Description("NR小区重选定时器"), Command("t-ReselectionNR")]
+ T_ReselectionNR,
+ [Description("SMTC周期"), Command("smtc: periodicityAndOffset")]
+ Smtc_periodicityAndOffset,
+ [Description("SMTC持续时间"), Command("smtc: duration")]
+ Smtc_duration,
+ [Description("高优先级载频或异系统小区Srxlev门限"), Command("threshX-HighP")]
+ ThreshX_HighP,
+ [Description("低优先级载频或异系统小区Srxlev门限"), Command("threshX-LowP")]
+ ThreshX_LowP,
+ [Description("DRX算法开关"), Command("DrxAlgoSwitch")]
+ DrxAlgoSwitch,
+ [Description("持续时间定时器"), Command("drx-onDurationTimer")]
+ Drx_onDurationTimer,
+ [Description("长周期"), Command("LongCycle")]
+ LongCycle,
+ [Description("上行行重传定时器"), Command("drx-RetransmissionTimerUL")]
+ Drx_RetransmissionTimerUL,
+ [Description("下行重传定时器"), Command("drx-RetransmissionTimerDL")]
+ Drx_RetransmissionTimerDL,
+ [Description("短周期"), Command("ShortCycle")]
+ ShortCycle,
+ [Description("短周期定时器"), Command("ShortCycleTimer")]
+ ShortCycleTimer,
+ [Description("RRC连接响应定时器"), Command("t300")]
+ T300,
+ [Description("RRC重建响应定时器"), Command("t301")]
+ T301,
+ [Description("定时器 T310"), Command("T310")]
+ T310,
+ [Description("常量 N310"), Command("N310")]
+ N310,
+ [Description("RLF失步转idle定时器"), Command("t311")]
+ T311,
+ [Description("常量 N311"), Command("N311")]
+ N311,
+ [Description("RRC连接恢复响应定时器"), Command("t319")]
+ T319,
+ [Description("定时器 T304"), Command("T304")]
+ T304,
+ [Description("UE不活动定时器"), Command("UeInactivityTimer")]
+ UeInactivityTimer,
+ [Description("测量上报量类型"), Command("reportQuantity")]
+ ReportQuantity,
+ [Description("帧偏置"), Command("FrameOffset")]
+ FrameOffset,
+ [Description("SSB周期"), Command("ssb-periodicityServingCell")]
+ Ssb_periodicityServingCell,
+ [Description("下行PDCP序列号长度"), Command("pdcp-SN-SizeDL")]
+ Pdcp_SN_SizeDL,
+ [Description("上行PDCP序列号长度"), Command("pdcp-SN-SizeUL")]
+ Pdcp_SN_SizeUL,
+ [Description("RLC模式"), Command("RlcMode")]
+ RlcMode,
+ [Description("UE触发Polling的PDU个数门限"), Command("pollPDU")]
+ PollPDU,
+ [Description("gNodeB RLC重组定时器"), Command("t-Reassembly")]
+ T_Reassembly,
+ [Description("BSR重传定时器"), Command("retxBSR-Timer")]
+ RetxBSR_Timer,
+ }
+}
diff --git a/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Huawei/HuaweiBaseStationTester.cs b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Huawei/HuaweiBaseStationTester.cs
new file mode 100644
index 00000000..6f0932c8
--- /dev/null
+++ b/Admin.NET/MTNet.Application/DriverLibrary/BaseStation/Huawei/HuaweiBaseStationTester.cs
@@ -0,0 +1,12786 @@
+
+using MTNet.Application.ConnectBase;
+using MTNet.Application.Entity;
+using MTNet.Application.IDAL;
+using MTNet.Application.IDAL.Utils;
+using Newtonsoft.Json;
+using Org.BouncyCastle.Asn1.X500;
+using Org.BouncyCastle.Bcpg;
+using Org.BouncyCastle.Ocsp;
+using Org.BouncyCastle.Utilities;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Net.Sockets;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Threading.Tasks;
+
+
+namespace MTNet.Application.DriverLibrary.BaseStation.Huawei
+{
+ public class HuaweiBaseStationTester : ConnectInstBase, IHuaweiBaseStationTester
+ {
+
+ int _rtn = 0;
+ string _cmd = "";
+ private List CellList = new List();
+ DeviceAddrConfig _addrConfig = new DeviceAddrConfig();
+ ///
+ /// 构造函数
+ ///
+ ///
+ ///
+ public HuaweiBaseStationTester(DeviceAddrConfig addrConfig) : base(addrConfig)
+ {
+ System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
+ _addrConfig = addrConfig;
+ }
+ public int RTN
+ {
+ get { return _rtn; }
+ private set
+ {
+ _rtn = value;
+ if (_rtn < 0)
+ {
+ //DeviceControlLogger.Logger.Error("Send command error.", new Exception($"Send command to Huawei base station failed!Error Command:{_cmd}"));
+ }
+ }
+ }
+
+ #region 实现接口
+ ///
+ /// 连接状态
+ ///
+ public bool ConnectStatus { get; set; } = false;
+ public override int Connect()
+ {
+ int rtn = 0;
+ try
+ {
+ if (!ConnectStatus)
+ {
+ rtn = base.Connect();
+ ConnectStatus = true;
+ }
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(1);
+ throw new Exception($"Huawei basestation connect error.[{rtn}]", ex);
+ }
+ return rtn;
+ }
+
+ public override int Close()
+ {
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"Huawei BaseStation DisConnect Success!");
+ return _rtn;
+ }
+ public int Initial()
+ {
+ int rtn = 0;
+
+ try
+ {
+ string response = SendRead("LGI:OP=" + AddrConfig.UserName + ",PWD=" + AddrConfig.Password + ";\r\n");
+ }
+ catch (Exception ex)
+ {
+ //SystemLogger.Logger.Error($"Read not parameter command error.", ex);
+ throw;
+ }
+
+ return rtn;
+ }
+ //public int Initial(TestSettings settings)
+ //{
+ // _testSettings = settings;
+
+ // //if (Common.IsCatchDeviceControlLog)
+ // //DeviceControlLogger.Logger.Info($"Huawei BaseStation Initial Success!");
+
+ // return _rtn;
+ //}
+
+ //public int Initial(BaseStationTesterSettings bsSettings)
+ //{
+ // _bsParameters = bsSettings as BSParameters;
+ // return _rtn;
+ //}
+
+
+ public void Dispose()
+ {
+ Close();
+ }
+
+ public int QuerySiteState()
+ {
+ //if (Common.IsCatchDeviceControlLog)
+ //DeviceControlLogger.Logger.Info($"Huawei BaseStation AfterTest Success!");
+ return _rtn;
+ }
+
+ // NR-NR
+ // 同站同频:邻区
+ // 同站异频:频点,邻区
+ // 异站异频:频点,外部邻区,邻区
+ // 异站同频:外部邻区,邻区
+
+ //NR-LTE
+ //异站异频:频点,外部邻区,邻区
+
+ //LTE-NR
+ //异站异频:频点,外部邻区,邻区
+
+ //LTE-LTE
+ //同站同频:邻区
+ //同站异频:频点,邻区
+ //异站异频:频点,外部邻区,邻区
+ //异站同频:外部邻区,邻区
+ ///
+ /// 添加邻区
+ ///
+ ///
+ ///
+ ///
+ public Task CreateRelations(Cell FirstCell, Cell SecondCell)
+ {
+ FirstCell = CellList.FirstOrDefault(x => x.Name == FirstCell.Name);
+ SecondCell = CellList.FirstOrDefault(x => x.Name == SecondCell.Name);
+ if (FirstCell == null || SecondCell == null)
+ return Task.CompletedTask;
+ try
+ {
+ //登录
+ //var _client = ConnectAndLogin();
+ //NR-NR
+ if (FirstCell.NetworkType == SecondCell.NetworkType && FirstCell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //NR-NR同站
+ if (FirstCell.NodeBId == SecondCell.NodeBId)
+ {
+ //网元一样 直接注册一个就可以
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+
+ string mcc = "";//
+ string mnc = "";//
+ ////查询 运营商信息
+ var operatordata = SendRead("LST GNBOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[10][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[9][3].ToString();
+ }
+ }
+ var ssbfreqpos = "";
+ if (FirstCell.ssbFrequency == SecondCell.ssbFrequency)//NR-NR同站同频
+ {
+ //不需要添加频点
+ }
+ else
+ { //NR-NR同站异频
+ //查询频域位置和跟踪区域标识
+ var ssbfreqposdata = SendRead("LST GNBOPERATOR:;\r\n");
+ string pattern = @"SSB频域位置\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ssbfreqposdata, pattern);
+ if (match.Success)
+ {
+ ssbfreqpos = match.Groups[1].Value;
+ }
+ //添加频点关系
+ _ = SendRead("ADD NRCELLFREQRELATION:NRCELLID=" + FirstCell.CellId + ",SSBFREQPOS=" + ssbfreqpos + ",FREQUENCYBAND=" + SecondCell.Freqband + ";\r\n");
+ }
+
+ var commond = $"ADD NRCELLRELATION:NRCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",GNBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n";
+ var relation = SendRead(commond);
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+ //NR-NR异站
+ else
+ {
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+
+ if (FirstCell.ssbFrequency == SecondCell.ssbFrequency)//NR-NR异站同频
+ {
+ string mcc = "";//460
+ string mnc = "";//07
+ string track = "";//1
+ string ssbfreqpos = "";//1916
+ ////查询 运营商信息
+ var operatordata = SendRead("LST GNBOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[10][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[9][3].ToString();
+ }
+ }
+ //查询频域位置和跟踪区域标识
+ var ssbfreqposdata = SendRead("LST GNBOPERATOR:;\r\n");
+ string pattern = @"SSB频域位置\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ssbfreqposdata, pattern);
+ if (match.Success)
+ {
+ ssbfreqpos = match.Groups[1].Value;
+ }
+ var tacflag = "";
+ string patterntac = @"跟踪区域标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match1 = Regex.Match(ssbfreqposdata, patterntac);
+ if (match1.Success)
+ {
+ tacflag = match1.Groups[1].Value;
+ }
+ //根据跟踪区域标识查询跟踪区域码
+ var tarckdata = SendRead($"LST GNBTRACKINGAREA:TRACKINGAREAID={tacflag};\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ track = tarckinfo[8][2].ToString();
+ }
+ else
+ {
+ track = tarckinfo[9][1].ToString();
+ }
+ }
+
+ var CGPOMU1 = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT1 = GetMatchCollections(CGPOMU1);
+ if (CGPOMUT1[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT1[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加外部邻区
+ _ = SendRead("ADD NREXTERNALNCELL:MCC=" + mcc + ",MNC=" + mnc + ",GNBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ",PHYSICALCELLID=" + SecondCell.PCI + ",TAC=" + track + ",SSBFREQPOS=" + ssbfreqpos + ";\r\n");
+ //添加邻区关系
+ var relation = SendRead("ADD NRCELLRELATION:NRCELLID=" + FirstCell.CellId + ",MCC=" + mcc + ",MNC=" + mnc + ",GNBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ";\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+ else
+ { //NR-NR异站异频
+ string mcc = "";//460
+ string mnc = "";//07
+ string track = "";//1
+ string ssbfreqpos = "";//1916
+ ////查询 运营商信息
+ var operatordata = SendRead("LST GNBOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[10][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[9][3].ToString();
+ }
+ }
+ //查询频域位置和跟踪区域标识
+ var ssbfreqposdata = SendRead("LST GNBOPERATOR:;\r\n");
+ string pattern = @"SSB频域位置\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ssbfreqposdata, pattern);
+ if (match.Success)
+ {
+ ssbfreqpos = match.Groups[1].Value;
+ }
+ var tacflag = "";
+ string patterntac = @"跟踪区域标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match1 = Regex.Match(ssbfreqposdata, patterntac);
+ if (match1.Success)
+ {
+ tacflag = match1.Groups[1].Value;
+ }
+ //根据跟踪区域标识查询跟踪区域码
+ var tarckdata = SendRead($"LST GNBTRACKINGAREA:TRACKINGAREAID={tacflag};\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ track = tarckinfo[8][2].ToString();
+ }
+ else
+ {
+ track = tarckinfo[9][1].ToString();
+ }
+ }
+
+ var CGPOMU1 = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT1 = GetMatchCollections(CGPOMU1);
+ if (CGPOMUT1[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT1[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加频点关系
+ _ = SendRead("ADD NRCELLFREQRELATION:NRCELLID=" + FirstCell.CellId + ",SSBFREQPOS=" + ssbfreqpos + ",FREQUENCYBAND=" + SecondCell.Freqband + ";\r\n");
+ //添加外部邻区
+ _ = SendRead("ADD NREXTERNALNCELL:MCC=" + mcc + ",MNC=" + mnc + ",GNBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ",PHYSICALCELLID=" + SecondCell.PCI + ",TAC=" + track + ",SSBFREQPOS=" + ssbfreqpos + ";\r\n");
+ //添加邻区关系
+ var relation = SendRead("ADD NRCELLRELATION:NRCELLID=" + FirstCell.CellId + ",MCC=" + mcc + ",MNC=" + mnc + ",GNBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ";\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+
+ }
+
+ }
+ }
+ //LTE-LTE
+ else if (FirstCell.NetworkType == SecondCell.NetworkType && FirstCell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ //LTE-LTE同站
+ if (FirstCell.NodeBId == SecondCell.NodeBId)
+ {
+ //同站注册一个网元
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //LTE-LTE同站同频
+ if (FirstCell.ssbFrequency == SecondCell.ssbFrequency)
+ {
+ ////查询 运营商信息
+ string mcc = "";//460
+ string mnc = "";//01
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ //添加邻区关系
+ var relation = SendRead($"ADD EUTRANINTRAFREQNCELL:LOCALCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+ //LTE-LTE同站异频
+ else
+ {
+ ////查询 运营商信息
+ string mcc = "";//460
+ string mnc = "";//01
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ //先添加频点关系
+ int resdic = keyValueBandwidthPairs[SecondCell.DlBandwidth];
+ string compd = $"ADD EUTRANINTERNFREQ:LOCALCELLID={FirstCell.CellId},DLEARFCN={SecondCell.ssbFrequency},ULEARFCNCFGIND=NOT_CFG,CELLRESELPRIORITYCFGIND=NOT_CFG,SPEEDDEPENDSPCFGIND=NOT_CFG,MEASBANDWIDTH=MBW{resdic},PMAXCFGIND=NOT_CFG,QQUALMINCFGIND=NOT_CFG,INTERFREQCIOADJLIMITCFGIND=NOT_CFG;\r\n";
+ _ = SendRead(compd);
+ //添加邻区关系
+ var relation = SendRead($"ADD EUTRANINTERFREQNCELL:LOCALCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+
+ }
+ //LTE-LTE异站
+ else
+ {
+ //LTE-LTE异站异频
+ if (FirstCell.ssbFrequency != SecondCell.ssbFrequency)
+ {
+ //异站先注册SecondCell 查询需要信息
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ ////查询 运营商信息
+ string mcc = "460";
+ string mnc = "07";
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ var track = "";
+ //查询跟踪区域码
+ var tarckdata = SendRead("LST CNOPERATORTA:;\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ else
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ var CGPOMUser = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUTser = GetMatchCollections(CGPOMUser);
+ if (CGPOMUTser[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUTser[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加频点
+ int resdic = keyValueBandwidthPairs[SecondCell.DlBandwidth];
+ string compd = $"ADD EUTRANINTERNFREQ:LOCALCELLID={FirstCell.CellId},DLEARFCN={SecondCell.ssbFrequency},ULEARFCNCFGIND=NOT_CFG,CELLRESELPRIORITYCFGIND=NOT_CFG,SPEEDDEPENDSPCFGIND=NOT_CFG,MEASBANDWIDTH=MBW{resdic},PMAXCFGIND=NOT_CFG,QQUALMINCFGIND=NOT_CFG,INTERFREQCIOADJLIMITCFGIND=NOT_CFG;\r\n";
+ _ = SendRead(compd);
+ //添加外部
+ var comwb = $"ADD EUTRANEXTERNALCELL:MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId},DLEARFCN={SecondCell.ssbFrequency},ULEARFCNCFGIND=NOT_CFG,PHYCELLID={SecondCell.PCI},TAC={track};\r\n";
+ _ = SendRead(comwb);
+ //添加邻区
+ var com = $"ADD EUTRANINTERFREQNCELL:LOCALCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n";
+ var relation = SendRead(com);
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+
+
+ }
+ //LTE-LTE异站同频
+ else
+ {
+
+ //异站先注册SecondCell 查询需要信息
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ ////查询 运营商信息
+ string mcc = "";
+ string mnc = "";
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ var track = "";
+ //查询跟踪区域码
+ var tarckdata = SendRead("LST CNOPERATORTA:;\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ else
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ var CGPOMUser = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUTser = GetMatchCollections(CGPOMUser);
+ if (CGPOMUTser[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUTser[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加外部
+ var comwb = $"ADD EUTRANEXTERNALCELL:MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId},DLEARFCN={SecondCell.ssbFrequency},ULEARFCNCFGIND=NOT_CFG,PHYCELLID={SecondCell.PCI},TAC={track};\r\n";
+ _ = SendRead(comwb);
+
+ var relation = SendRead($"ADD EUTRANINTRAFREQNCELL:LOCALCELLID={FirstCell},MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+
+ }
+ }
+
+
+ }
+
+ }
+ //LTE-NR
+ else if (FirstCell.NetworkType != SecondCell.NetworkType && FirstCell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ //异站先注册SecondCell 查询需要信息
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ var mcc = "";
+ var mnc = "";
+ var tac = "";
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ //查询跟踪区域码
+ var tarckdata = SendRead("LST CNOPERATORTA:;\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ tac = tarckinfo[9][2].ToString();
+ }
+ else
+ {
+ tac = tarckinfo[9][2].ToString();
+ }
+ }
+ //切服务网元
+ var CGPOMUser = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUTser = GetMatchCollections(CGPOMUser);
+ if (CGPOMUTser[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUTser[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加频点
+ _ = SendRead($"ADD NRNFREQ:LOCALCELLID={FirstCell.CellId},DLARFCN={SecondCell.ssbFrequency},ULARFCNCONFIGIND=NOT_CFG;\r\n");
+ //添加外部
+ _ = SendRead($"ADD NREXTERNALCELL:MCC=\"{mcc}\",MNC=\"{mnc}\",GNODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId},DLARFCN={SecondCell.ssbFrequency},ULARFCNCONFIGIND=NOT_CFG,PHYCELLID={SecondCell.PCI},TAC={tac};\r\n");
+ //添加邻区
+ var relation = SendRead($"ADD NRNRELATIONSHIP:LOCALCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",GNODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+ //NR-LTE
+ else if (FirstCell.NetworkType != SecondCell.NetworkType && FirstCell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //异站先注册SecondCell 查询需要信息
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ ////查询 运营商信息
+ string mcc = "";
+ string mnc = "";
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ var track = "";
+ //查询跟踪区域码
+ var tarckdata = SendRead("LST CNOPERATORTA:;\r\n");
+ var tarckinfo = GetMatchCollections(tarckdata);
+ if (tarckinfo[tarckinfo.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (tarckinfo[tarckinfo.Count - 6][2].ToString() == "1)")
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ else
+ {
+ track = tarckinfo[9][2].ToString();
+ }
+ }
+ //切服务网元
+ var CGPOMUser = SendRead("REG NE:NAME=\"" + FirstCell.NetworkElementName + "\";\r\n");
+ var CGPOMUTser = GetMatchCollections(CGPOMUser);
+ if (CGPOMUTser[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUTser[3][3]}.");
+ return Task.FromResult(-1);
+ }
+ //添加频点
+ int resdic = keyValueBandwidthPairs[SecondCell.DlBandwidth];
+ _ = SendRead($"ADD NRCELLEUTRANNFREQ:NRCELLID={FirstCell.CellId},DLEARFCN={SecondCell.ssbFrequency},MEASUREMENTBANDWIDTH=MBW{resdic};\r\n");
+ //添加外部
+ _ = SendRead($"ADD GNBEUTRAEXTERNALCELL:MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId},DLEARFCN={SecondCell.ssbFrequency},PHYSICALCELLID={SecondCell.PCI},TAC={track};\r\n");
+ //添加邻区
+ var relation = SendRead($"ADD NRCELLEUTRANRELATION:NRCELLID={FirstCell.CellId},MCC=\"{mcc}\",MNC=\"{mnc}\",ENODEBID={SecondCell.NodeBId},CELLID={SecondCell.CellId};\r\n");
+ if (relation.Contains("执行成功"))
+ {
+ return Task.CompletedTask;
+ }
+ else
+ {
+ var res = GetMatchCollections(relation);
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:failed result:{res[3][3].ToString()}.");
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+
+ //DeviceControlLogger.Logger.Error($"FirstCell:{FirstCell.Name},SecondCell:{SecondCell.Name} CreateRelations Exception:{ex.Message}.");
+ return Task.FromResult(-1);
+ }
+ return Task.CompletedTask;
+ }
+ public async Task DeleteRelations(Cell FirstCell, Cell SecondCell)
+ {
+ var rtn = 0;
+ FirstCell = CellList.FirstOrDefault(x => x.Name == FirstCell.Name);
+ SecondCell = CellList.FirstOrDefault(x => x.Name == SecondCell.Name);
+ try
+ {
+ if (FirstCell == null || SecondCell == null)
+ {
+ //DeviceControlLogger.Logger.Info($"DeleteRelations FirstCell or SecondCell null.");
+ return 0;
+ }
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + SecondCell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"CreateRelations GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ string mcc = "";
+ string mnc = "";
+ var command = "";
+ if (FirstCell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var operatordata = SendRead("LST GNBOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[10][2].ToString();
+ }
+ else
+ {
+ mcc = mat[9][2].ToString();
+ mnc = mat[9][3].ToString();
+ }
+ }
+ command = "RMV NRCELLRELATION:NRCELLID=" + FirstCell.CellId + ",MCC=" + mcc + ",MNC=" + mnc + ",GNBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ";\r\n";
+ }
+ if (FirstCell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var operatordata = SendRead("LST CNOPERATOR:;\r\n");
+ var mat = GetMatchCollections(operatordata);
+ if (mat[mat.Count - 6][0].ToString() != "没有查到相应的结果")
+ {
+ if (mat[mat.Count - 6][2].ToString() == "1)")
+ {
+ mcc = mat[10][2].ToString();
+ mnc = mat[11][2].ToString();
+
+ }
+ else
+ {
+ mcc = mat[9][3].ToString();
+ mnc = mat[9][4].ToString();
+ }
+ }
+ command = "RMV NRNRELATIONSHIP:LOCALCELLID=" + FirstCell.CellId + ",MCC=" + mcc + ",MNC=" + mnc + ",GNODEBID=" + SecondCell.NodeBId + ",CELLID=" + SecondCell.CellId + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"DeleteRelations failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"DeleteRelations Exception:{ex.Message}.");
+ return -1;
+ }
+ }
+
+ public async Task> GetCells()
+ {
+ List HuaweiCells = new List();
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var list = SendRead("LST NEBYOMC:;\r\n");//查询网元信息//LST NE:;
+ var nelist = GetMatchCollections(list);
+ for (int i = 10; i < nelist.Count - 5; i++)
+ {
+ try
+ {
+ //使用 IP 地址注册网元
+ //var CGPOMU=SendRead("REG NE:IP=\"" + nelist[i][2].ToString() + "\";\r\n");
+ //使用名称注册网元
+ var CGPOMU = SendRead("REG NE:NAME=\"" + nelist[i][1].ToString() + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"GetCells GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+ continue;
+ }
+ //NRDU小区
+ if (nelist[i][0].ToString() == "BTS59005GNE")
+ {
+ //查询GNB
+ var gnbdata = GetMatchCollections(SendRead("LST GNODEBFUNCTION:;\r\n"))[9][2].ToString();
+ //查询NR DU小区静态参数 LST NRDUCELL:;
+ var datacell = SendRead("LST NRDUCELL:;\r\n");
+ //var mat = GetMatchCollections(SendRead("LST NRDUCELL:;\r\n"));
+ var GNBOPERATOR = SendRead("LST GNBOPERATOR:OPERATORID=0;\r\n");
+ string mccpattern = @"移动国家码\s*=\s*([^\s]+)";
+ string mncpattern = @"移动网络码\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match matchmcc = Regex.Match(GNBOPERATOR, mccpattern);
+ Match matchmnc = Regex.Match(GNBOPERATOR, mncpattern);
+ var mcc = matchmcc.Groups[1].Value;
+ var mnc = matchmnc.Groups[1].Value;
+ if (!datacell.Contains("没有查到相应的结果"))
+ {
+ var spdatacell = datacell.Split("--- END\r\n\r\n");
+ if (spdatacell.Length == 2 && spdatacell[0].Contains("(结果个数 = 1)"))
+ {//有且仅有一条数据 //一条数据返回数据格式跟多条数据格式不统一 单独处理
+ var mat1 = GetMatchCollections(datacell);
+ var cell = new Cell();
+ cell.NetworkType = NetworkTypeEnum.NR;
+ cell.NetworkElementName = nelist[i][1].ToString();
+ cell.Name = gnbdata + "-" + mat1[7][3].ToString();
+ //cell.Name = mat[8][3].ToString();
+ //cell.Nokia_cellName = mat1[8][3].ToString();
+ if (mat1[9][2].ToString().Contains("TDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.TDDLTE;
+ }
+ else if (mat1[9][2].ToString().Contains("FDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.FDDLTE;
+ }
+ else if (mat1[9][2].ToString().Contains("SUL"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.SUL;
+ }
+ else if (mat1[9][2].ToString().Contains("SDL"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.SDL;
+ }
+ else
+ {
+ cell.MobileStandard = CellMobileStandardEnum.NR;
+ }
+ cell.PCI =int.Parse(mat1[11][2].ToString());
+ cell.CellId =int.Parse(mat1[7][3].ToString()) ;
+ cell.MoId = mat1[10][2].ToString();
+ cell.ssbFrequency =mat1[14][2].ToString();
+ cell.NodeBId =int.Parse(gnbdata);
+ cell.Freqband = mat1[12][2].ToString();
+ cell.Status = (int)(mat1[26][2].ToString() == "解闭塞" ? CellStatusEnum.Unlocked : CellStatusEnum.Locked);
+ cell.FactoryType = BaseStationTesterTypeEnum.Huawei;
+ cell.mcc = mcc;
+ cell.mnc = mnc;
+ HuaweiCells.Add(cell);
+ }
+ else
+ {
+ //多条可能分页可能不分页
+ for (int m = 0; m < spdatacell.Length - 1; m++)
+ {
+ var mat1 = GetMatchCollections(spdatacell[m]);
+ var matches = Regex.Matches(spdatacell[m], @"\(结果个数 = (\d+)\)");
+ var items = 0;
+ foreach (Match match in matches)
+ {
+ items = int.Parse(match.Groups[1].Value);
+ Console.WriteLine($"第{m}页,{items}条数据\r\n\r\n");
+ }
+ for (int n = 9; n < 9 + items; n++)
+ {
+ var cell = new Cell();
+ cell.NetworkType = NetworkTypeEnum.NR;
+ cell.NetworkElementName = nelist[i][1].ToString();
+ cell.Name = gnbdata + "-" + mat1[n][0].ToString();
+ //cell.Name = mat[j][1].ToString();
+ //cell.Nokia_cellName = mat1[n][1].ToString();
+ if (mat1[n][2].ToString().Contains("TDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.TDDLTE;
+ }
+ else if (mat1[n][2].ToString().Contains("FDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.FDDLTE;
+ }
+ else if (mat1[n][2].ToString().Contains("SUL"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.SUL;
+ }
+ else if (mat1[n][2].ToString().Contains("SDL"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.SDL;
+ }
+ else
+ {
+ cell.MobileStandard = CellMobileStandardEnum.NR;
+ }
+ cell.PCI =int.Parse(mat1[n][4].ToString()) ;
+ cell.CellId =int.Parse(mat1[n][0].ToString()) ;
+ cell.MoId = mat1[n][3].ToString();
+ cell.ssbFrequency =mat1[n][7].ToString();
+ cell.NodeBId = int.Parse(gnbdata);
+ cell.Freqband = mat1[n][5].ToString();
+ cell.Status = (int)(mat1[n][19].ToString() == "解闭塞" ? CellStatusEnum.Unlocked : CellStatusEnum.Locked);
+ cell.FactoryType = BaseStationTesterTypeEnum.Huawei;
+ cell.mcc = mcc;
+ cell.mnc = mnc;
+ //cell.HBTEInitialValues
+ //cell.AttenuatorMapping
+ HuaweiCells.Add(cell);
+ }
+ }
+ }
+
+ }
+ }
+ //LTE小区
+ else if (nelist[i][0].ToString() == "eNodeBNE")
+ {
+ //查询eNB
+ var enbdata = GetMatchCollections(SendRead("LST ENODEBFUNCTION:;\r\n"))[9][2].ToString();
+ //查询NR DU小区静态参数 LST NRDUCELL:;
+ var datacell = SendRead("LST CELL:;\r\n");
+ var CNOPERATORID = SendRead("LST CNOPERATOR:CNOPERATORID = 0;\r\n");
+ string mccpattern = @"移动国家码\s*=\s*([^\s]+)";
+ string mncpattern = @"移动网络码\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match matchmcc = Regex.Match(CNOPERATORID, mccpattern);
+ Match matchmnc = Regex.Match(CNOPERATORID, mncpattern);
+ var mcc = matchmcc.Groups[1].Value;
+ var mnc = matchmnc.Groups[1].Value;
+ // var mat = GetMatchCollections(datacell);
+ if (!datacell.Contains("没有查到相应的结果"))
+ {
+ var spdatacell = datacell.Split("--- END\r\n\r\n");
+ if (spdatacell.Length == 2 && spdatacell[0].Contains("(结果个数 = 1)"))
+ {//有且仅有一条数据
+ var mat1 = GetMatchCollections(datacell);
+ var cell = new Cell();
+ cell.NetworkType = NetworkTypeEnum.LTE;
+ //一条数据返回数据格式跟多条数据格式不统一 单独处理
+
+ //放网元名
+ cell.NetworkElementName = nelist[i][1].ToString();
+ cell.Name = enbdata + "-" + mat1[7][2].ToString();
+ //cell.Name = mat[8][2].ToString();
+ //cell.Nokia_cellName = mat1[8][2].ToString();
+ if (mat1[26][2].ToString().Contains("TDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.TDDLTE;
+ }
+ else if (mat1[26][2].ToString().Contains("FDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.FDDLTE;
+ }
+ else
+ {
+ cell.MobileStandard = CellMobileStandardEnum.LTE;
+
+ }
+ cell.PCI =int.Parse(mat1[21][2].ToString());
+ cell.CellId =int.Parse(mat1[7][2].ToString());
+ cell.MoId = mat1[20][2].ToString();
+ cell.ssbFrequency =mat1[17][2].ToString();
+ cell.NodeBId =int.Parse(enbdata);
+ cell.DlBandwidth = mat1[19][2].ToString();
+ cell.Freqband = mat1[14][2].ToString();//
+ cell.Status = (int)(mat1[24][2].ToString() == "解闭塞" ? CellStatusEnum.Unlocked : CellStatusEnum.Locked);
+ cell.FactoryType = BaseStationTesterTypeEnum.Huawei;
+ cell.mcc = mcc;
+ cell.mnc = mnc;
+ //cell.HBTEInitialValues
+ //cell.AttenuatorMapping
+ HuaweiCells.Add(cell);
+ }
+ else
+ {//多条可能分页可能不分页
+ for (int m = 0; m < spdatacell.Length - 1; m++)
+ {
+ var mat1 = GetMatchCollections(spdatacell[m]);
+ var matches = Regex.Matches(spdatacell[m], @"\(结果个数 = (\d+)\)");
+ var items = 0;
+ foreach (Match match in matches)
+ {
+ items = int.Parse(match.Groups[1].Value);
+ Console.WriteLine($"第{m}页,{items}条数据\r\n\r\n");
+ }
+ for (int n = 9; n < 9 + items; n++)
+ {
+ var cell = new Cell();
+ cell.NetworkType = NetworkTypeEnum.LTE;
+ //放网元名 修改时候需要注册连接
+ cell.NetworkElementName = nelist[i][1].ToString();
+ cell.Name = enbdata + "-" + mat1[n][0].ToString();
+ //cell.Name = mat[j][1].ToString();
+ //cell.Nokia_cellName = mat1[n][1].ToString();
+ if (mat1[n][19].ToString().Contains("TDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.TDDLTE;
+ }
+ else if (mat1[n][19].ToString().Contains("FDD"))
+ {
+ cell.MobileStandard = CellMobileStandardEnum.FDDLTE;
+ }
+ else
+ {
+ cell.MobileStandard = CellMobileStandardEnum.LTE;
+ }
+ cell.PCI =int.Parse(mat1[n][14].ToString());
+ cell.CellId =int.Parse(mat1[n][0].ToString()) ;
+ cell.MoId = mat1[n][13].ToString();
+ cell.ssbFrequency =mat1[n][10].ToString() ;
+ cell.NodeBId =int.Parse(enbdata);
+ cell.DlBandwidth = mat1[n][12].ToString();//添加邻区频点测量带宽用
+ cell.Freqband = mat1[n][7].ToString();//添加邻区频点测量带宽用
+ cell.Status = (int)(mat1[n][17].ToString() == "解闭塞" ? CellStatusEnum.Unlocked : CellStatusEnum.Locked);
+ cell.FactoryType = BaseStationTesterTypeEnum.Huawei;
+ cell.mcc = mcc;
+ cell.mnc = mnc;
+ //cell.HBTEInitialValues
+ //cell.AttenuatorMapping
+ HuaweiCells.Add(cell);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ //2g/3g
+ }
+ }
+ catch (Exception e)
+ {
+ Console.WriteLine("异常网元:" + nelist[i][1].ToString() + e.Message);
+ }
+ }
+ CellList = HuaweiCells;
+ return HuaweiCells;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Error($"GetCells getBtsInformation failed result:{ex.Message}.");
+ return null;
+ }
+ }
+ //ZTE
+
+ public Task ModifyCellResel(Cell cell, int cellReselectionPriority)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"ModifyCellResel GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELLRESELCONFIG:NRCELLID=" + cell.CellId + ",CELLRESELPRIORITY=" + cellReselectionPriority + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELLRESEL:LOCALCELLID=" + cell.CellId + ",CELLRESELPRIORITY=" + cellReselectionPriority + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"ModifyCellResel failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return Task.FromResult(rtn);
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(10);
+ //DeviceControlLogger.Logger.Info($"ModifyCellResel Exception:{ex.Message}.");
+ return Task.FromResult(rtn);
+ }
+
+ }
+ //ZTE
+ public Task ModifyExternalNRCellCU(Cell cell, Cell relationCell, string nRPCI)
+ {
+ return Task.FromResult(0);
+ }
+
+ public async Task ModifyInactiveParameter(Cell cell, int inactiveTimer)
+ {
+ string QCI = "";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"ModifyInactiveParameter GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+ }
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var qcilist = SendRead($"LST NRDUCELLQCIBEARER:NRDUCELLID={cell.CellId};\r\n");
+ string pattern = @"\(结果个数 = (\d+)\)";
+ MatchCollection matches = Regex.Matches(qcilist, pattern);
+ var info = GetMatchCollections(qcilist);
+ int num = 0;
+ for (int j = 0; j < matches.Count; j++)
+ {
+ if (j == 0)
+ {
+ num = num + 9;
+ }
+ else
+ {
+ num = num + 9 + 7;
+ }
+ string resultNumber = matches[j].Groups[1].Value;
+ for (int i = 0; i < int.Parse(resultNumber); i++)
+ {
+ var com = "MOD NRDUCELLQCIBEARER:NRDUCELLID=" + cell.CellId + ",QCI=" + info[num + i][1] + ",UEINACTIVITYTIMER=" + inactiveTimer + ";\r\n";
+ SendRead(com);
+ }
+ num = num + int.Parse(resultNumber);
+ }
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var qcilist = SendRead($"LST QCIPARA:;\r\n");
+ string pattern = @"\(结果个数 = (\d+)\)";
+ // 执行匹配
+ MatchCollection matches = Regex.Matches(qcilist, pattern);
+ var info = GetMatchCollections(qcilist);
+ int num = 0;
+ for (int j = 0; j < matches.Count; j++)
+ {
+ if (j == 0)
+ {
+ num = num + 9;
+ }
+ else
+ {
+ num = num + 9 + 7;
+ }
+ string resultNumber = matches[j].Groups[1].Value;
+ for (int i = 0; i < int.Parse(resultNumber); i++)
+ {
+ var com = "MOD QCIPARA:QCI=" + info[num + i][0] + ",UEINACTIVITYTIMERDYNDRXQCI=" + inactiveTimer + ";\r\n";
+ SendRead(com);
+ }
+ num = num + int.Parse(resultNumber);
+ }
+ }
+
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Error($"ModifyInactiveParameter failed result:{ex.Message}.");
+ return rtn;
+ }
+
+ return 0;
+ }
+
+ public async Task ModifyIntraFReselection(Cell cell, double sIntraSearchP, bool SameFrequency)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"ModifyIntraFReselection GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+ return -1;
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELLRESELCONFIG:NRCELLID=" + cell.CellId + ",NONINTRAFREQMEASRSRPTHLD=" + sIntraSearchP + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELLRESEL:LOCALCELLID=" + cell.CellId + ",SNONINTRASEARCHCFGIND=CFG,SNONINTRASEARCH=" + sIntraSearchP + ";\r\n";
+ }
+ var res = SendRead(command);
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(12);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} ModifyIntraFReselection Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+
+ public async Task SetA1Threshold(Cell cell, int rsrpThresholdA1, int hysteresisA1)
+ {
+ // 测量参数组标识
+ var INTRAFREQHOMEASGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetA1Threshold failed result:{CGPOMUT[3][3].ToString()}.");
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var ret = SendRead("LST NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异系统切换测量参数组标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ //INTERRATHOA1RSRPTHLD=-111(-156到-31),INTERRATHOA1A2HYST=2(0到30);
+ command = "MOD NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ",INTERRATHOMEASGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTERRATHOA1RSRPTHLD=" + rsrpThresholdA1 + ",INTERRATHOA1A2HYST=" + hysteresisA1 + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var ret = SendRead("LST INTERRATHOCOMMGROUP:LOCALCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异系统切换公共参数组ID\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ //INTERRATHOA1RSRPTHLD=-111(-156到-31),INTERRATHOA1A2HYST=2(0到30);
+ command = "MOD INTERRATHOCOMMGROUP:LOCALCELLID=" + cell.CellId + ",INTERRATHOCOMMGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTERRATHOA1A2HYST=" + hysteresisA1 + ",INTERRATHOA1THDRSRP=" + rsrpThresholdA1 + ";\r\n";
+ }
+ var res = SendRead(command);
+
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetA1Threshold {cell.Name} Exception:{ex.Message}.");
+ }
+
+
+
+
+
+ }
+
+ public async Task SetA2Threshold(Cell cell, int rsrpThresholdA2, int hysteresisA2)
+ {
+ // 测量参数组标识
+ var INTRAFREQHOMEASGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetA2Threshold failed result:{CGPOMUT[3][3].ToString()}.");
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var ret = SendRead("LST NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异系统切换测量参数组标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ //默认值INTERRATHOA2RSRPTHLD=-115(-156到-31),INTERRATHOA1A2HYST=2(0到30);
+ command = "MOD NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ",INTERRATHOMEASGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTERRATHOA2RSRPTHLD=" + rsrpThresholdA2 + ",INTERRATHOA1A2HYST=" + hysteresisA2 + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var ret = SendRead("LST INTERRATHOCOMMGROUP:LOCALCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异系统切换公共参数组ID\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ //INTERRATHOA1RSRPTHLD=-115(-140到-43),INTERRATHOA1A2HYST=2(0到30);
+ command = "MOD INTERRATHOCOMMGROUP:LOCALCELLID=" + cell.CellId + ",INTERRATHOCOMMGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTERRATHOA1A2HYST=" + hysteresisA2 + ",INTERRATHOA2THDRSRP=" + rsrpThresholdA2 + ";";
+ }
+ var res = SendRead(command);
+
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetA2Threshold {cell.Name} Exception:{ex.Message}.");
+ }
+
+ }
+
+ //同频切换的A3偏置 //同频切换的A3幅度迟滞
+ public async Task SetA3Threshold(Cell cell, double eventOffset, int hysteresisA3)
+ {
+ var rtn = 0;
+ // 测量参数组标识
+ var INTRAFREQHOMEASGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetA3Threshold failed result:{CGPOMUT[3][3].ToString()}.");
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var ret = SendRead("LST NRCELLINTRAFHOMEAGRP:NRCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"同频切换测量参数组标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ command = "MOD NRCELLINTRAFHOMEAGRP:NRCELLID=" + cell.CellId + ",INTRAFREQHOMEASGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTRAFREQHOA3OFFSET=" + eventOffset + ",INTRAFREQHOA3HYST=" + hysteresisA3 + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var ret = SendRead("LST INTRAFREQHOGROUP:LOCALCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"同频切换参数组ID\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ command = "MOD INTRAFREQHOGROUP:LOCALCELLID=" + cell.CellId + ",INTRAFREQHOGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTRAFREQHOA3HYST=" + hysteresisA3 + ",INTRAFREQHOA3OFFSET=" + eventOffset + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetA3Threshold failed result:{reslist[reslist.Count - 7][3]}.");
+
+ }
+
+
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetA3Threshold {cell.Name} Exception:{ex.Message}.");
+ }
+
+ }
+
+ //华为不支持基于覆盖的A4事件,可使用A5替代,即将A5的门限1设置非常高的值也就等效变成了A4
+ public Task SetA4Threshold(Cell cell, int rsrpThresholdA4, int hysteresisA4)
+ {
+ return Task.CompletedTask;
+ }
+
+ public async Task SetA5Threshold(Cell cell, int rsrpThreshold, int A5Thrd1Rsrp, int hysteresisA5, int LNHOIF_eutraCarrierInfo)
+ {
+ // 测量参数组标识
+ var INTRAFREQHOMEASGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetA5Threshold failed result:{CGPOMUT[3][3]}.");
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ var ret = SendRead("LST NRCELLINTERFHOMEAGRP:NRCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异频切换测量参数组标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ command = "MOD NRCELLINTERFHOMEAGRP:NRCELLID=" + cell.CellId + ",INTERFREQHOMEASGROUPID=" + INTRAFREQHOMEASGROUPID + ",INTERFREQA4A5HYST=" + hysteresisA5 + ",COVINTERFREQA5RSRPTHLD1=" + rsrpThreshold + ",COVINTERFREQA5RSRPTHLD2=" + A5Thrd1Rsrp + ";\r\n";
+
+ }
+ //COVINTERFREQA5RSRPTHLD1 -156~-31(-106) COVINTERFREQA5RSRPTHLD2 -156~-31(-110) INTERFREQA4A5HYST 2
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var ret = SendRead("LST INTERFREQHOGROUP:LOCALCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异频切换参数组ID\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ command = "MOD INTERFREQHOGROUP:LOCALCELLID=" + cell.CellId + ",INTERFREQHOGROUPID=" + INTRAFREQHOMEASGROUPID + ",InterFreqHoA4ThdRsrp=" + rsrpThreshold + ",InterFreqHoA5Thd1Rsrp=" + A5Thrd1Rsrp + ";INTERFREQHOA4HYST=" + hysteresisA5 + "\r\n";
+
+ }
+ //INTERFREQHOA1THDRSRP -140~-43(-105) INTERFREQHOA2THDRSRP-140~-43( -109) INTERFREQHOA4HYST 2
+ }
+ var res = SendRead(command);
+
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetA5Threshold {cell.Name} Exception:{ex.Message}.");
+ }
+ }
+
+ public async Task SetB1Threshold(Cell cell, int value1)
+ {
+ // 测量参数组标识
+ var NRHOPARAMGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetB1Threshold GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ var ret = SendRead("LST INTERRATHONRPARAMGRP:LOCALCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"E-UTRAN切换至NR的切换参数组ID\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ NRHOPARAMGROUPID = match.Groups[1].Value;
+ }
+ //-105
+ command = "MOD INTERRATHONRPARAMGRP:LOCALCELLID=" + cell.CellId + ",NRHOPARAMGROUPID=" + NRHOPARAMGROUPID + ",COVBASEDNRB1RSRPTHLD=" + value1 + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetB1Threshold failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($" SetB1Threshold Exception:{ex.Message}.");
+ return rtn;
+ }
+ return 0;
+ }
+
+ public async Task SetB2Threshold(Cell cell, int value1, int value2)
+ {
+ // 测量参数组标识
+ var INTRAFREQHOMEASGROUPID = "0";
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetB2Threshold GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ var command = "";
+ var command2 = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {//-115
+ var ret = SendRead("LST NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ";\r\n");
+ string pattern = @"异系统切换测量参数组标识\s*=\s*([^\s]+)";
+ // 使用Regex.Match来查找匹配项
+ Match match = Regex.Match(ret, pattern);
+ if (match.Success)
+ {
+ INTRAFREQHOMEASGROUPID = match.Groups[1].Value;
+ }
+ command = "MOD NRCELLINTERRHOMEAGRP:NRCELLID=" + cell.CellId + ",INTERRATHOMEASGROUPID=" + INTRAFREQHOMEASGROUPID + ",COVHOTOEUTRANB2RSRPTHLD1=" + value1 + ";\r\n";
+ //-111
+ command2 = "MOD NRCELLHOEUTRANMEAGRP:NRCELLID=" + cell.CellId + ",INTERRHOTOEUTRANMEASGRPID=" + INTRAFREQHOMEASGROUPID + ",COVBASEDHOB1RSRPTHLD=" + value2 + ";\r\n";
+ }
+ var res = SendRead(command + command2);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetB2Threshold failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($" SetB2Threshold Exception:{ex.Message}.");
+ return rtn;
+ }
+ return 0;
+ }
+
+ public async Task SetBandwidth(Cell cell, double BandWidth, double BandWidthUl, bool wait)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierPCI GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改带宽时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",ULBANDWIDTH=CELL_BW_" + BandWidth + "M,DLBANDWIDTH=CELL_BW_" + BandWidthUl + "M;\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",ULBANDWIDTH=CELL_BW_" + BandWidth + "M,DLBANDWIDTH=CELL_BW_" + BandWidthUl + "M;\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",ULBANDWIDTH=CELL_BW_" + BandWidth + "M,DLBANDWIDTH=CELL_BW_" + BandWidthUl + "M;\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SUL";
+ command += duplexmode + ",ULBANDWIDTH=CELL_BW_" + BandWidth + "M;\r\n";
+ }
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",ULBANDWIDTH=CELL_BW_N" + (int)(BandWidth * 5) + ",DLBANDWIDTH=CELL_BW_N" + (int)(BandWidthUl * 5) + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetBandwidth failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(7);
+ //DeviceControlLogger.Logger.Info($" SetBandwidth Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task SetCarrierFrequency(Cell cell, string Frequency, bool wait)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierFrequency GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ var command = "";
+
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改频点时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",DLNARFCN=" + Frequency + ",ULNARFCN=" + Frequency + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",DLNARFCN=" + Frequency + ",ULNARFCN=" + Frequency + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",DLNARFCN=" + Frequency + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SUL";
+ command += duplexmode + ",ULNARFCN=" + Frequency + ";\r\n";
+ }
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",DLEARFCN=" + Frequency + ",ULEARFCNCFGIND=CFG,ULEARFCN=" + Frequency + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierPCI failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(8);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} SetCarrierFrequency Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+
+ public async Task SetCarrierFrequency(Cell cell, string earfcnDL, string earfcnUL, bool wait)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return -1;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierFrequency GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return -1;
+ }
+ var command = "";
+
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改频点时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ",ULNARFCN=" + earfcnUL + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ",ULNARFCN=" + earfcnUL + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SUL";
+ command += duplexmode + ",ULNARFCN=" + earfcnUL + ";\r\n";
+ }
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ if (earfcnUL == "-1")
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",DLEARFCN=" + earfcnDL + ";\r\n";
+ }
+ else
+ {
+
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",DLEARFCN=" + earfcnDL + ",ULEARFCNCFGIND=CFG,ULEARFCN=" + earfcnUL + ";\r\n";
+ }
+
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierFrequency failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(6);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} SetCarrierFrequency Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+
+ public async Task SetCarrierPCI(Cell cell, string CarrierPCI, bool wait)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ int rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierPCI GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return 0;
+ }
+ var command = "";
+
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改pci时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ return 0;//SUL模式不能修改pci
+ }
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",PHYCELLID=" + CarrierPCI + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierPCI failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(6);
+ //DeviceControlLogger.Logger.Info($"{cell.Name} SetCarrierPCI Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+ public Task SetCarrierPCI(List<(Cell, string)> cellPcis, bool wait)
+ {
+ int rtn = 0;
+ try
+ {
+ for (int i = 0; i < cellPcis.Count; i++)
+ {
+ SetCarrierPCI(cellPcis[i].Item1, cellPcis[i].Item2, true);
+ }
+ return Task.FromResult(rtn);
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(6);
+ //DeviceControlLogger.Logger.Info($"SetCarrierPCI cellPcis Exception:{ex.Message}.");
+ return Task.FromResult(rtn);
+ }
+ }
+ //ZTE
+ public Task SetCellSelection(Cell cell, string qRxLevMin, string qRxLevMinOffsetCell)
+ {
+ return Task.FromResult(0);
+ }
+
+ public Task SetCellSelection(Cell cell, double LevelValue)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCellSelection GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELLRESELCONFIG:NRCELLID=" + cell.CellId + ",MINIMUMRXLEVEL=" + LevelValue + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELLRESEL:LOCALCELLID=" + cell.CellId + ",QRXLEVMIN=" + LevelValue + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCellSelection failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return Task.FromResult(rtn);
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetCellSelection Exception:{ex.Message}.");
+ return Task.FromResult(-1);
+ }
+ }
+
+ public async Task SetCellState(Cell cell, bool state)
+ {
+ var rtn = 0;
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ if (cell == null)
+ return 0;
+ try
+ {
+ if (cell.FactoryType == BaseStationTesterTypeEnum.Huawei)
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCellState GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+ return 0;
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ if (state)
+ {
+ command = "BLK NRDUCELL:NRDUCELLID=" + cell.CellId + ",CELLADMINSTATE=CELL_HIGH_BLOCK;\r\n";
+ }
+ else
+ {
+ command = "UBL NRDUCELL:NRDUCELLID=" + cell.CellId + ";\r\n";
+ }
+
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ if (state)
+ {
+ command = "BLK CELL:LOCALCELLID=" + cell.CellId + ",CELLADMINSTATE=CELL_HIGH_BLOCK;\r\n";
+ }
+ else
+ {
+ command = "UBL CELL:LOCALCELLID=" + cell.CellId + ";\r\n";
+ }
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCellState failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ rtn = GetErrorCode(15);
+ //DeviceControlLogger.Logger.Info($"SetCellState {cell.Name} Exception:{ex.Message}.");
+ return rtn;
+ }
+ }
+ public int SetCoFrequencyMeasurementStartUpThreshold(string cellName, double value)
+ {
+ var cell = CellList.Where(x => x.Name == cellName).FirstOrDefault();
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCoFrequencyMeasurementStartUpThreshold GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELLRESELCONFIG:NRCELLID=" + cell.CellId + ",INTRAFREQMEASSTARTTHLD=" + value + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELLRESEL:LOCALCELLID=" + cell.CellId + ",SINTRASEARCHQ=" + value + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetCoFrequencyMeasurementStartUpThreshold failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetCellSelection Exception:{ex.Message}.");
+ return -1;
+ }
+ }
+ public int SetMinAccessLevel(string cellName, double level)
+ {
+ Cell cell = new Cell();
+ cell = CellList.FirstOrDefault(x => x.Name == cellName);
+ var rtn = 0;
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCellSelection GetCGPOMU failed result:{CGPOMUT[3][3].ToString()}.");
+
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELLRESELCONFIG:NRCELLID=" + cell.CellId + ",MINIMUMRXLEVEL=" + level + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELLRESEL:LOCALCELLID=" + cell.CellId + ",QRXLEVMIN=" + level + ";\r\n";
+ }
+ var res = SendRead(command);
+ var reslist = GetMatchCollections(res);
+ if (!res.Contains("执行成功"))
+ {
+ //DeviceControlLogger.Logger.Error($"SetMinAccessLevel failed result:{reslist[reslist.Count - 7][3]}.");
+ rtn = -1;
+ }
+ return rtn;
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"SetCellSelection Exception:{ex.Message}.");
+ return -1;
+ }
+ }
+ public int SetNeighborhoodRelations(string cellName1, string cellName2)
+ {
+ return _rtn;
+ }
+ public int SetReselectPriority(string cellName, int priority)
+ {
+ return _rtn;
+ }
+ #endregion
+ #region other
+
+ ///
+ /// 获取终端异常代码
+ ///
+ ///
+ ///
+ public int GetErrorCode(int errorCode)
+ {
+ int.TryParse(ErrorCodeHelper.GetDeviceErrorCode(DeviceTypeEnum.BaseStationTester, errorCode), out int code);
+ return code;
+ }
+
+ public HuaweiBaseStationTester ConnectAndLogin()
+ {
+ return this;
+ }
+
+ public string SendRead(string command)
+ {
+ //Console.WriteLine(command);
+ StringBuilder finalResult = new StringBuilder();
+ int rtn = Read(command, out byte[] tempResult);
+ byte[] finalData = Algorithms.Decode(tempResult);
+ Encoding encoding = Encoding.GetEncoding("GBK");
+ string response = encoding.GetString(finalData, 0, finalData.Length);
+ finalResult.Append(response);
+ int index = 0;
+ while ((!finalResult.ToString().EndsWith("--- END\r\n\r\n")) && index < 100)//解决因一次读不全导致解析出错的问题
+ {
+ this.ReadOnly(out tempResult);
+ finalResult.Append(encoding.GetString(Algorithms.Decode(tempResult), 0, Algorithms.Decode(tempResult).Length));
+ index++;
+ }
+ return finalResult.ToString();
+ }
+
+ public List GetMatchCollections(string data)
+ {
+ List matchCollections = new List();
+ var strdata = data.Split("\r\n");
+ string pattern = @"\S+"; // 非空白字符匹配一次或多次
+ for (int i = 0; i < strdata.Length; i++)
+ {
+ MatchCollection matchgnb = Regex.Matches(strdata[i], pattern);
+ if (matchgnb != null)
+ {
+ matchCollections.Add(matchgnb);
+ }
+ }
+ return matchCollections;
+ }
+
+
+
+ public static Dictionary keyValuePairs = new Dictionary() {
+ { "630000,630000","7783" } ,
+ { "630004,630004","7783"} ,
+ { "636668,636668","7853" } ,
+ { "643332,643332", "7950" } ,
+ { "180000,189000", "2361"} ,
+ { "636666,636666", "7853" } ,
+ { "389000,427000", "5336" } ,
+ { "2052499,2052499", "22377" } ,
+ { "143600,151600", "1916" } ,
+ { "723340,723340", "8768" } ,
+ { "513000,513000", "6312" } ,
+ { "520002,520002", "6399"} ,
+ { "506004,506004", "6324" }
+ };
+ public static Dictionary keyValueBandwidthPairs = new Dictionary() {
+ {"1.4M",6 },{"3M",15 },{"5M",25 },{"10M",50 },{"15M",75 },{"20M",100 }
+
+ };
+ public async Task SetCarrierFrequencyAndPCI(Cell cell, string earfcnDL, string earfcnUL, string CarrierPCI, List cells, bool wait)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ int respci = 0, resFreq = 0;
+ if (!string.IsNullOrEmpty(CarrierPCI))
+ {
+ respci = SetCarrierPCIAndNeigh(cell, CarrierPCI, cells);
+ }
+ if (!string.IsNullOrEmpty(earfcnUL) && !string.IsNullOrEmpty(earfcnDL))
+ {
+ resFreq = SetCarrierFreqAndNeigh(cell, earfcnDL, earfcnUL, cells);
+ }
+ return respci + resFreq;
+ }
+ public int SetCarrierPCIAndNeigh(Cell cell, string CarrierPCI, List cells)
+ {
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ // Logger.WriteLog($"ModifyCarrierPCI GetCGPOMU failed result:{CGPOMUT[3][3]}.", IsRecordlog);
+ return -1;
+ }
+ var command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改pci时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",PHYSICALCELLID=" + CarrierPCI + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ return 0;//SUL模式不能修改pci
+ }
+ _ = SendRead(command);
+ foreach (var item in cells)
+ {
+ _ = SendRead("REG NE:NAME=\"" + item.NetworkElementName + "\";\r\n");
+ if (item.NetworkType == NetworkTypeEnum.NR)//NR-NR
+ {
+ _ = SendRead($"MOD NREXTERNALNCELL:MCC=\"{cell.mnc}\",MNC=\"{cell.mnc}\",GNBID={cell.NodeBId},CELLID={cell.CellId},PHYSICALCELLID={CarrierPCI};\r\n");
+ }
+ if (item.NetworkType == NetworkTypeEnum.LTE)//LTE-NR
+ {
+ _ = SendRead($"MOD NREXTERNALCELL:MCC=\"{cell.mnc}\",MNC=\"{cell.mnc}\",GNODEBID={cell.NodeBId},CELLID={cell.CellId},PHYCELLID={CarrierPCI};\r\n");
+ }
+ }
+ return 0;
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",PHYCELLID=" + CarrierPCI + ";\r\n";
+ _ = SendRead(command);
+ foreach (var item in cells)
+ {
+ _ = SendRead("REG NE:NAME=\"" + item.NetworkElementName + "\";\r\n");
+ if (item.NetworkType == NetworkTypeEnum.NR)//LTE-LTE
+ {
+ _ = SendRead($"MOD EUTRANEXTERNALCELL:MCC=\"{cell.mcc}\",MNC=\"{cell.mnc}\",ENODEBID={cell.NodeBId},CELLID={cell.CellId},PHYCELLID={CarrierPCI};\r\n");
+ }
+ if (item.NetworkType == NetworkTypeEnum.LTE) //NR - LTE
+ {
+ _ = SendRead($"MOD GNBEUTRAEXTERNALCELL:MCC=\"1\",MNC=\"2\",ENODEBID=3,CELLID=4,PHYSICALCELLID=5;\r\n");
+ }
+ }
+ return 0;
+ }
+ else
+ {
+ //其他2/3g
+ return 0;
+ }
+ }
+ catch (Exception ex)
+ {
+ // Logger.WriteLog($"{cell.Name} ModifyCarrierPCI Exception:{ex.Message}.", IsRecordlog);
+ return -1;
+ }
+ }
+ public int SetCarrierFreqAndNeigh(Cell cell, string earfcnDL, string earfcnUL, List| cells)
+ {
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ //DeviceControlLogger.Logger.Error($"SetCarrierFrequency GetCGPOMU failed result:{CGPOMUT[3][3]}.");
+ return -1;
+ }
+ var command = "";
+ var ssbfreqpos = keyValuePairs[$"{earfcnUL},{earfcnDL}"];
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ //BTS59005GNE 类型修改频点时必须传入duplexmode
+ command = "MOD NRDUCELL:NRDUCELLID=" + cell.CellId;
+ var duplexmode = "";
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_FDD";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ",ULNARFCN=" + earfcnUL + ",SSBFREQPOS=" + ssbfreqpos + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.TDDLTE)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_TDD";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ",ULNARFCN=" + earfcnUL + ",SSBFREQPOS=" + ssbfreqpos + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SDL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SDL";
+ command += duplexmode + ",DLNARFCN=" + earfcnDL + ";\r\n";
+ }
+ if (cell.MobileStandard == CellMobileStandardEnum.SUL)
+ {
+ duplexmode = ",DUPLEXMODE=CELL_SUL";
+ command += duplexmode + ",ULNARFCN=" + earfcnUL + ";\r\n";
+ }
+ _ = SendRead(command);
+ foreach (var item in cells)
+ {
+ _ = SendRead("REG NE:NAME=\"" + item.NetworkElementName + "\";\r\n");
+ if (item.NetworkType == NetworkTypeEnum.NR)//NR-NR
+ {
+ _ = SendRead($"ADD NRCELLFREQRELATION:NRCELLID={item.CellId},SSBFREQPOS={ssbfreqpos},FREQUENCYBAND={cell.Freqband};\r\n");
+ _ = SendRead($"MOD NREXTERNALNCELL:MCC=\"{cell.mcc}\",MNC=\"{cell.mnc}\",GNBID={cell.NodeBId},CELLID={cell.CellId},SSBFREQPOS={ssbfreqpos};\r\n");
+ }
+ if (item.NetworkType == NetworkTypeEnum.LTE)//LTE-NR
+ {
+ _ = SendRead($"ADD NRNFREQ:LOCALCELLID={item.CellId},DLARFCN={earfcnDL},ULARFCNCONFIGIND=NOT_CFG;\r\n");
+ _ = SendRead($"MOD NREXTERNALCELL:MCC=\"{cell.mcc}\",MNC=\"{cell.mnc}\",GNODEBID={cell.NodeBId},CELLID={cell.CellId},DLARFCN={earfcnDL};\r\n");
+ }
+ }
+ return 0;
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",DLEARFCN=" + earfcnDL + ";\r\n";
+ _ = SendRead(command);
+ foreach (var item in cells)
+ {
+ _ = SendRead("REG NE:NAME=\"" + item.NetworkElementName + "\";\r\n");
+ if (item.NetworkType == NetworkTypeEnum.NR)//NR-LTE
+ {
+ int res = keyValueBandwidthPairs[cell.DlBandwidth];
+ _ = SendRead($"ADD NRCELLEUTRANNFREQ:NRCELLID={item.CellId},DLEARFCN={earfcnDL},MEASUREMENTBANDWIDTH=MBW{res};\r\n");
+ _ = SendRead($"MOD GNBEUTRAEXTERNALCELL:MCC=\"{cell.mcc}\",MNC=\"{cell.mnc}\",ENODEBID={cell.NodeBId},CELLID={cell.CellId},DLEARFCN={earfcnDL};\r\n");
+ }
+ if (item.NetworkType == NetworkTypeEnum.LTE)//LTE-LTE
+ {
+ int res = keyValueBandwidthPairs[cell.DlBandwidth];
+ _ = SendRead($"ADD EUTRANINTERNFREQ:LOCALCELLID={item.CellId},DLEARFCN={earfcnDL},ULEARFCNCFGIND=NOT_CFG,CELLRESELPRIORITYCFGIND=NOT_CFG,SPEEDDEPENDSPCFGIND=NOT_CFG,MEASBANDWIDTH={res},PMAXCFGIND=NOT_CFG,QQUALMINCFGIND=NOT_CFG,INTERFREQCIOADJLIMITCFGIND=NOT_CFG;\r\n");
+ _ = SendRead($"MOD EUTRANEXTERNALCELL:MCC=\"{cell.mcc}\",MNC=\"{cell.mnc}\",ENODEBID={cell.NodeBId},CELLID={cell.CellId},DLEARFCN={earfcnDL};\r\n");
+ }
+ }
+ return 0;
+ }
+ else
+ {
+ //其他2 3g
+ return 0;
+ }
+ }
+ catch (Exception ex)
+ {
+ //DeviceControlLogger.Logger.Info($"{cell.Name} SetCarrierFrequency Exception:{ex.Message}.");
+ return -1;
+ }
+ }
+ #endregion
+
+ #region 其他方法
+ ///
+ /// 双工方式
+ ///
+ ///
+ ///
+ ///
+ ///
+ public async Task ModifyDuplexMode(Cell cell, string mode)
+ {
+ cell = CellList.FirstOrDefault(x => x.Name == cell.Name);
+ try
+ {
+ //var _client = ConnectAndLogin();
+ var CGPOMU = SendRead("REG NE:NAME=\"" + cell.NetworkElementName + "\";\r\n");
+ var CGPOMUT = GetMatchCollections(CGPOMU);
+ if (CGPOMUT[3][2].ToString() != "0")
+ {
+ // Logger.WriteLog($"ModifyDuplexMode GetCGPOMU failed result:{CGPOMUT[3][3]}.", IsRecordlog);
+ return -1;
+ }
+ string command = "";
+ if (cell.NetworkType == NetworkTypeEnum.NR)
+ {
+ command = "MOD NRCELL:NRCELLID=" + cell.CellId + ",DUPLEXMODE=" + mode + ";\r\n";
+ }
+ else if (cell.NetworkType == NetworkTypeEnum.LTE)
+ {
+ if (cell.MobileStandard == CellMobileStandardEnum.FDDLTE)
+ {
+ command = "MOD CELL:LOCALCELLID=" + cell.CellId + ",FDDTDDIND=" + mode + ";\r\n";
+ }//tdd需要同时配置subframeAssignment和specialSubframePattern参数
+ }
+ var res = SendRead(command);
+ var resinfo = GetMatchCollections(res);
+ if (!res.Contains("RETCODE = 0"))
+ {
+ // Logger.WriteLog($"ModifyDuplexMode execute failed result:{res}.", IsRecordlog);
+ return -1;
+ }
+ else
+ {
+ return 0;
+ }
+
+ }
+ catch (Exception ex)
+ {
+ // Logger.WriteLog($"ModifyDuplexMode failed result:{ex}.", IsRecordlog);
+ return -1;
+ }
+ }
+ /// | | | | | | | | | | | | | | | | | | | | | | | | |