public SnmpTypeObject GetDataUsingDataContract(SnmpTypeObject snmpObject) { if (snmpObject == null) { throw new ArgumentNullException("snmp"); } if (snmpObject.Value != null) { snmpObject.Value += "Suffix"; } return(snmpObject); }
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); }
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); }