public System.Collections.Generic.Dictionary <int, System.Collections.Generic.List <int> > TurnOffDeviceOutlets() { this.devMap.Clear(); foreach (DevSnmpConfig current in this.devsnmpconfigs) { this.cfg = DevAccessCfg.GetInstance(); this.snmpCfg = current; this.sc = this.cfg.getSnmpConfig(this.snmpCfg); this.mc = this.cfg.getDeviceModelConfig(this.snmpCfg.modelName, this.snmpCfg.fmwareVer); if (this.mc.switchable == 2) { this.se = new DefaultSnmpExecutor(new SnmpConfiger(this.sc, this.mc)); bool flag = this.se.TurnOffOutlets(); if (flag) { for (int i = 1; i <= this.mc.portNum; i++) { current.groupOutlets.Add(i); } this.devMap.Add(current.devID, current.groupOutlets); } } } return(this.devMap); }
public AbstractSnmpSession(SnmpConfig config) { if (config == null) { throw new System.ArgumentNullException("SnmpConfig is null"); } this.config = config; }
public DevAccessAPI(DevSnmpConfig snmpSettings) { this.cfg = DevAccessCfg.GetInstance(); this.snmpCfg = snmpSettings; this.sc = this.cfg.getSnmpConfig(this.snmpCfg); this.mc = this.cfg.getDeviceModelConfig(this.snmpCfg.modelName, this.snmpCfg.fmwareVer); this.se = new DefaultSnmpExecutor(new SnmpConfiger(this.sc, this.mc)); }
public static SnmpSession CreateSession(SnmpConfig config) { if (config is SnmpV3Config) { return(new SnmpV3Session((SnmpV3Config)config)); } if (config is SnmpV2Config) { return(new SnmpV2Session((SnmpV2Config)config)); } return(new SnmpV1Session((SnmpV1Config)config)); }
public SnmpConfiger(SnmpConfig snmpConfig, DevModelConfig modelCfg) { this.snmpConfig = snmpConfig; this.modelConfig = modelCfg; this.portnumber = modelCfg.portNum; this.deviceModel = modelCfg.modelName; this.switchable = modelCfg.switchable; this.sensornumber = modelCfg.sensorNum; this.banknumber = modelCfg.bankNum; this.linenumber = modelCfg.lineNum; this.perportreading = modelCfg.perportreading; this.perbankreading = modelCfg.perbankReading; this.perdoorreading = modelCfg.doorReading; }
public SnmpConfiger(SnmpConfig snmpConfig, DevModelConfig modelCfg, string devMac, int devID, DevRealConfig realCfg) { this.snmpConfig = snmpConfig; this.modelConfig = modelCfg; this.deviceModel = modelCfg.modelName; this.switchable = modelCfg.switchable; this.realConfig = realCfg; this.portnumber = realCfg.portNum; this.banknumber = realCfg.bankNum; this.linenumber = realCfg.lineNum; this.sensornumber = realCfg.sensorNum; this.perdoorreading = realCfg.contactNum; this.perportreading = modelCfg.perportreading; this.perbankreading = modelCfg.perbankReading; this.deviceMac = devMac; this.deviceID = devID; }
public SnmpConfig getSnmpConfig(DevSnmpConfig snmpCfg) { SnmpConfig snmpConfig = null; switch (snmpCfg.snmpVer) { case 0: snmpConfig = new SnmpV1Config(snmpCfg.devIP); ((SnmpV1Config)snmpConfig).Community = snmpCfg.userName; ((SnmpV1Config)snmpConfig).Retry = snmpCfg.retry; ((SnmpV1Config)snmpConfig).Port = snmpCfg.devPort; ((SnmpV1Config)snmpConfig).Timeout = snmpCfg.timeout; break; case 1: snmpConfig = new SnmpV2Config(snmpCfg.devIP); ((SnmpV2Config)snmpConfig).Community = snmpCfg.userName; ((SnmpV2Config)snmpConfig).Retry = snmpCfg.retry; ((SnmpV2Config)snmpConfig).Port = snmpCfg.devPort; ((SnmpV2Config)snmpConfig).Timeout = snmpCfg.timeout; break; case 3: snmpConfig = new SnmpV3Config(snmpCfg.devIP); snmpConfig.Retry = snmpCfg.retry; snmpConfig.Timeout = snmpCfg.timeout; snmpConfig.Port = snmpCfg.devPort; ((SnmpV3Config)snmpConfig).Authentication = (Authentication)System.Enum.Parse(typeof(Authentication), snmpCfg.authType); ((SnmpV3Config)snmpConfig).AuthSecret = snmpCfg.authPSW; ((SnmpV3Config)snmpConfig).Privacy = (Privacy)System.Enum.Parse(typeof(Privacy), snmpCfg.privType); ((SnmpV3Config)snmpConfig).PrivacySecret = snmpCfg.privPSW; ((SnmpV3Config)snmpConfig).UserName = snmpCfg.userName; break; } return(snmpConfig); }
public DevDiscoverAPI(DevSnmpConfig snmpSettings) { this.cfg = DevAccessCfg.GetInstance(); this.snmpCfg = snmpSettings; this.sc = this.cfg.getSnmpConfig(this.snmpCfg); }
public SnmpConfiger(SnmpConfig snmpConfig) : this(snmpConfig, 1) { }
public SnmpConfiger(SnmpConfig snmpConfig, int portNums) { this.snmpConfig = snmpConfig; this.portnumber = portNums; }