/// <summary> /// Uses DAT SNMP set /// </summary> /// <param name="sov">The sov.</param> /// <param name="exeTime">The executable time.</param> /// <returns></returns> private string SnmpSet(SnmpOidValue sov, out int exeTime) { string result = string.Empty; exeTime = 0; int startCnt = 0; try { startCnt = Environment.TickCount; result = SNMP.Set(sov).ToString(); exeTime = Environment.TickCount - startCnt; } catch (Exception ex) { GetLastError = ex.JoinAllErrorMessages(); } return(result); }
/// <summary> /// /// </summary> /// <param name="exeTime"></param> /// <param name="pOID"></param> /// <returns></returns> public string GetNextSnmp(out int exeTime, string pOID, ref string nextString) { string result = string.Empty; exeTime = 0; GetLastError = string.Empty; int startCnt = Environment.TickCount; try { SnmpOidValue oidData = SNMP.GetNext(pOID); exeTime = Environment.TickCount - startCnt; nextString = oidData.Oid; result = oidData.Value.ToString(); if (nextString[0] == '.') { nextString = nextString.Substring(1); } } catch (SnmpException se) { SetLextmError(se); } catch (Exception ex) { GetLastError = "ERROR: " + ex.JoinAllErrorMessages(); } finally { if (exeTime == 0 && startCnt != 0) { exeTime = Environment.TickCount - startCnt; } if (result.Contains("NoSuch")) { GetLastError = "ERROR: " + result; } } return(result); }
/// <summary> /// Creates the DAT SnmpOidValue using type int for use in the DAT SNMP Set /// Sets the SnmpOidValue OID with the desired reboot style. /// </summary> /// <param name="oid">The oid.</param> /// <param name="exeTime">The executable time.</param> /// <returns></returns> public string RebootDevice(string oid, out int exeTime) { SnmpOidValue sov = new SnmpOidValue(oid, RebootStyle); return(SnmpSet(sov, out exeTime)); }
/// <summary> ///Creates the DAT SnmpOidValue using type string for use in the DAT SNMP Set /// </summary> /// <param name="oid">The OID.</param> /// <param name="value">The value.</param> /// <param name="exeTime">The executable time.</param> /// <returns></returns> public string SetDeviceValue(string oid, string value, out int exeTime) { SnmpOidValue sov = new SnmpOidValue(oid, value); return(SnmpSet(sov, out exeTime)); }