protected override async Task HandleAsync(PulseReport request, IList <OutgoingMessage> outgoingMessages, CancellationToken cToken) { var node = await _findNodeQuery.ByRfIdAsync(request.FromRfAddress, NodeInclude.AggregatedData | NodeInclude.Ports); if (node == null) { throw new NodeNotFoundException(request.FromRfAddress); } _touchNode.Touch(node, request.Rssi); var port = node.Ports.OfType <PulseSensor>().SingleOrDefault(_ => _.PortNumber == request.PortNumber); if (port == null) { node.Ports.Add(port = new PulseSensor() { Node = node, PortNumber = request.PortNumber, PulseCount = 0, }); } port.PulseCount += request.NewPulse; port.History = new List <PulseHistory> { new PulseHistory { Timestamp = _timeProvider.UtcNow, Rssi = request.Rssi, NewPulses = request.NewPulse, Total = port.PulseCount, } }; }
public SensorTests() { tSensor = new TemperatureSensor(); pSensor = new PulseSensor(); aSensor = new ActivitySensor(); }