Beispiel #1
0
        public SignalUnit(ConfigurationUnit confConfigurationUnit)
        {
            if (confConfigurationUnit.Type == ConfigurationUnitType.Signal)
            {
                foreach (KeyValuePair <string, string> param in confConfigurationUnit.Parameters)
                {
                    string value = param.Value;
                    switch (param.Key.ToUpper())
                    {
                    case "ИДЕНТИФИКАТОР":
                        Uid = Convert.ToInt32(value);
                        break;

                    case "ИМЯ":
                        Name = value;
                        break;

                    case "ИМЯСЕРВЕР":
                        ServerName = value;
                        break;

                    case "ТИП":
                        SignalType type = getSignalsTypes(value);
                        Type = type;
                        break;

                    case "ИДЕНТИФИКАТОРБЛОКАДАННЫХ":
                        DataBlockUid = Convert.ToInt32(value);
                        break;

                    case "БАЙТ":
                        Byte = Convert.ToInt32(value);
                        break;

                    case "БИТ":
                        Bit = Convert.ToInt32(value);
                        break;

                    case "ЗНАЧЕНИЕВИРТУАЛЬНОГОСИГНАЛА":
                        VirtualValue = Convert.ToDouble(value.Replace(".", ","));
                        break;

                    case "СОСТАВНОЙСИГНАЛ":
                        CompoundSignalType tmpType = getCompoundSignalsTypes(value);
                        CompoundSignal = tmpType;
                        break;

                    case "ЗАПИСЬКЛИЕНТАМИ":
                        int tmpValue = Convert.ToInt32(value);
                        UserWrite = tmpValue > 0;
                        break;

                    case "МИНИМАЛЬНЫЙУРОВЕНЬАНАЛОГОВОГОСИГНАЛА":
                        MinAnalogLevel = Convert.ToInt32(value);
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        private CompoundSignalType getCompoundSignalsTypes(string type)
        {
            CompoundSignalType res = CompoundSignalType.SIMPLE_SIGNAL;

            switch (type)
            {
            case "REAL_SIGNAL":
                res = CompoundSignalType.SIMPLE_SIGNAL;
                break;

            case "VIRTUAL_SIGNAL":
                res = CompoundSignalType.VIRTUAL_SIGNAL;
                break;

            default:
                res = CompoundSignalType.SIMPLE_SIGNAL;
                break;
            }

            return(res);
        }