示例#1
0
 public SnmpTypeObject GetDataUsingDataContract(SnmpTypeObject snmpObject)
 {
     if (snmpObject == null)
     {
         throw new ArgumentNullException("snmp");
     }
     if (snmpObject.Value != null)
     {
         snmpObject.Value += "Suffix";
     }
     return(snmpObject);
 }
示例#2
0
        public byte[]  WriteFromObject(SnmpTypeObject obj)
        {
            //Create User object.
            SnmpTypeObject objectSnmp = obj;

            //Create a stream to serialize the object to.
            MemoryStream ms = new MemoryStream();

            // Serializer the User object to the stream.
            DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(SnmpTypeObject));

            ser.WriteObject(ms, objectSnmp);
            byte[] json = ms.ToArray();
            ms.Close();
            return(json);
        }
示例#3
0
        public SnmpTypeObject Get(SnmpTypeObject snmpObject)
        {
            Console.WriteLine("Weszlo do geta restowego");
            if (_snmp == null)
            {
                string host      = "127.0.0.1";
                string community = "public";
                _snmp = new SimpleSnmp(host, community);
            }

            string[] value = get(snmpObject.Oid);
            // NIE WIEM CO MA BYC ZWRACANE CZY TYLKO VALUE CZY CALA TABLICA
            snmpObject.Oid   = value[0];
            snmpObject.Type  = value[1];
            snmpObject.Value = value[2];
            return(snmpObject);
        }