示例#1
0
        private void AddOidData(OidEnt oidInfo, DeviceOidEnt dOid, ListOidEnt tmpOidList)
        {
            if (string.IsNullOrEmpty(oidInfo.OidIndex))
            {
                oidInfo.OidIndex      = dOid.OidString;
                oidInfo.OidIndexValue = dOid.OidValue;
                oidInfo.Usage         = USAGES.eHpDeviceMib;
            }
            else
            {
                // same family but a different index, so making a copy and setting same OID with different index
                OidEnt oid = new OidEnt(oidInfo);
                oid.OidIndex      = dOid.OidString;
                oid.OidIndexValue = dOid.OidValue;
                oidInfo.Usage     = USAGES.eHpDeviceMib;
                oid.Usage         = USAGES.eHpDeviceMib;

                tmpOidList.Add(oid);
            }
        }
示例#2
0
        public void GetDeviceOidListings()
        {
            string sValue   = string.Empty;
            int    exeTime  = 0;
            bool   isFamily = true;
            int    count    = 0;
            string rtnOID   = StartOid;
            string OID      = StartOid;

            RDLSnmpGns rDLSnmpGns = new RDLSnmpGns(IPAddress);

            ListDeviceOids.Clear();
            GetLastError = string.Empty;

            while (isFamily && !IsError)
            {
                DeviceOidEnt oidInfo = new DeviceOidEnt();
                count++;
                int execTm = 0;
                sValue       = rDLSnmpGns.GetNextSnmp(out execTm, OID, ref rtnOID);
                exeTime     += execTm;
                GetLastError = rDLSnmpGns.GetLastError;
                if (!IsError)
                {
                    isFamily = CheckForFamily(StartOid, rtnOID);
                    if (IsError && count > 1)
                    {
                        GetLastError = string.Empty;
                    }
                }

                oidInfo.OidString = rtnOID;
                oidInfo.OidValue  = sValue.Replace(',', ';');
                ListDeviceOids.Add(oidInfo);

                OID = rtnOID;
            }
        }