Ejemplo n.º 1
0
        /// <summary>
        /// Constructs for a single OID.
        /// </summary>
        /// <param name="deviceAddress">The device's IP address.</param>
        /// <param name="meaning">The meaning of the OID.</param>
        /// <param name="oid">The OID.</param>
        public CachableOid(IpAddress deviceAddress, CachableValueMeanings meaning, Oid oid)
        {
            this.oids = new List <Oid>
            {
                oid
            };

            this.Address = deviceAddress ?? throw new ArgumentNullException(nameof(deviceAddress), "IP address of the cachable OID is null");
            this.Meaning = meaning;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs from an enumeration of OIDs.
        /// </summary>
        /// <param name="deviceAddress">The device's IP address.</param>
        /// <param name="meaning">The meaning of the OID.</param>
        /// <param name="oids">The enumeration of OIDs to add.</param>
        public CachableOid(IpAddress deviceAddress, CachableValueMeanings meaning, IEnumerable <Oid> oids)
        {
            if (oids is null)
            {
                throw new ArgumentNullException(nameof(oids), "Enumeration of OIDs is null");
            }

            this.oids = oids as IList <Oid> ?? oids.ToList();
            if (this.oids.Count == 0)
            {
                throw new ArgumentException("Enumeration of OIDs does not contain any element", nameof(oids));
            }

            this.Address = deviceAddress ?? throw new ArgumentNullException(nameof(deviceAddress), "IP address of the cachable OID is null");
            this.Meaning = meaning;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds the given <see paramref="oid" /> as OID for the given value meaning.
 /// </summary>
 /// <param name="meaning">The value meaning that is requested by the given OID.</param>
 /// <param name="oids">The OID that can be used to request the given value.</param>
 protected void RecordCachableOids(CachableValueMeanings meaning, IEnumerable <Oid> oids)
 {
     // intentionally add or silently replace an existing value
     this.cachableOidLookup[meaning] = new CachableOid(this.DeviceAddress, meaning, oids);
 }
Ejemplo n.º 4
0
 /// <inheritdoc />
 public ICachableOid this[CachableValueMeanings key] => this.cachableOidLookup[key];