public IList <Device> GenerateDevices(List <string[]> deviceList) { var devices = new List <Device>(); foreach (var deviceToken in deviceList) { var name = deviceToken[0]; var isServiceElevator = bool.Parse(deviceToken[1]); var isBlocked = bool.Parse(deviceToken[2]); var hasFaultyAc = bool.Parse(deviceToken[3]); var isBusy = bool.Parse(deviceToken[4]); var isJerky = bool.Parse(deviceToken[5]); var isOnAuxPower = bool.Parse(deviceToken[6]); var isDSCMalfunctioning = bool.Parse(deviceToken[7]); var behaviour = new DeviceBehaviour() { IsService = isServiceElevator, HasFaultyACUnit = hasFaultyAc, IsBusy = isBusy, IsBlocked = isBlocked, IsDSCMalfunctioning = isDSCMalfunctioning, IsJerky = isJerky, IsOnAuxPower = isOnAuxPower }; var device = new Device(name, behaviour, this.transport); devices.Add(device); } return(devices); }
public Device( string deviceId, DeviceBehaviour deviceBehaviour, EventHubTransport transport) { this.deviceId = deviceId; this.transport = transport; this.deviceBehaviour = deviceBehaviour; int peakFrequencyInTicks = Convert.ToInt32(Math.Ceiling((double)PEAK_FREQUENCY_IN_SECONDS / REPORT_FREQUENCY_IN_SECONDS)); this.dscGenerator = new SampleDataGenerator(0, 0.6); this.temperatureGenerator = new SampleDataGenerator(22, 24, 30, peakFrequencyInTicks); this.humidityGenerator = new SampleDataGenerator(20, 50); this.vibrationGenerator = new SampleDataGenerator(0, 10); this.loadGenerator = !this.deviceBehaviour.IsService ? new SampleDataGenerator(200, 800) : new SampleDataGenerator(300, 1200); }