Example #1
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            Scooter scooter = new Scooter("1", true, 15, 50, 1, 3);
            Http    http    = new Http();

            while (!stoppingToken.IsCancellationRequested)
            {
                scooter.GetJson();
                http.Send("0");
                _logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
                await Task.Delay(10000, stoppingToken);
            }
        }
Example #2
0
        public void AmqpSender()
        {
            var payload = scooter.GetJson();
            var payloadSensorBattery    = batterySensor.GetJson();
            var payloadBrightnessSensor = brightnessSensor.GetJson();
            var payloadGpsSensor        = gpsSensor.GetJson();
            var payloadSpeedSensor      = speedSensor.GetJson();

            protocol.Send("queue_scooter", payload);
            protocol.Send("queue_sensor", payloadSpeedSensor);
            protocol.Send("queue_sensor", payloadGpsSensor);
            protocol.Send("queue_sensor", payloadBrightnessSensor);
            protocol.Send("queue_sensor", payloadSensorBattery);
        }