Example #1
0
        public Sensor(Dictionary <string, string> deviceParams, ThingsOfFoi thingsOfFoi) : base(deviceParams, thingsOfFoi)
        {
            DeviceType = DeviceType.Sensor;
            RandomGeneratorFacade randomGeneratorFacade = new RandomGeneratorFacade();

            do
            {
                UniqueIdentifier = randomGeneratorFacade.GiveRandomNumber(1, 1000);
            } while (DoesUniqueIdentifierExists(UniqueIdentifier, thingsOfFoi.Sensors));
        }
Example #2
0
        protected Device(Dictionary <string, string> deviceParams, ThingsOfFoi thingsOfFoi)
        {
            Name      = deviceParams["naziv"];
            Type      = Converter.StringToInt(deviceParams["tip"]);
            Kind      = Converter.StringToInt(deviceParams["vrsta"]);
            Min       = Converter.StringToFloat(deviceParams["min vrijednost"]);
            Max       = Converter.StringToFloat(deviceParams["max vrijednost"]);
            Comentary = deviceParams["komentar"];

            DeviceParams = deviceParams;
            ThingsOfFoi  = thingsOfFoi;
        }
        public Device CreateDevice(Dictionary <string, string> deviceParams, DeviceType deviceType, ThingsOfFoi thingsOfFoi)
        {
            switch (deviceType)
            {
            case DeviceType.Actuator:
                return(new Actuator(deviceParams, thingsOfFoi));

            case DeviceType.Sensor:
                return(new Sensor(deviceParams, thingsOfFoi));

            default: return(null);
            }
        }