private bool Exists(NodeStatus node) { foreach (NodeStatus n in nodes) { if (n.Serial.Equals(node.Serial)) { return(true); } } return(false); }
private void Update(NodeStatus node) { foreach (NodeStatus n in nodes) { if (n.Serial.Equals(node.Serial)) { n.Update(node); return; } } }
public void Update(NodeStatus node) { Battery = node.Battery; DeltaBattery = Battery - InitialBattery; Rssi = node.Rssi; Firmware = node.Firmware; LastHealth = node.LastHealth; FixTime = node.FixTime; SolarVoltage = node.SolarVoltage; TotalSolarCurrent = node.TotalSolarCurrent; Temperature = node.Temperature; Latitude = node.Latitude; Longitude = node.Longitude; }
private void ParseNodeHealth(string data) { if (data.Contains("node_health") == false) { return; } NodeStatus node = new NodeStatus(JsonConvert.DeserializeObject(data)); if (this.Exists(node)) { this.Update(node); } else { this.Create(node); } }
private void Create(NodeStatus node) { nodes.Add(node); }