示例#1
0
        private bool GetRadioByRadioID(int radioID, out Radio radio)
        {
            bool radioFound = radios.TryGetValue(radioID, out radio);

            if (!radioFound)
            {
                logger.Warn($"Can't find radio settings for radioID {radioID}");
            }

            return(radioFound);
        }
示例#2
0
        public static Model.Db.Radio Map(Radio radio)
        {
            Model.Db.Radio radioSettings = new Model.Db.Radio
            {
                Name            = radio.Name,
                RadioId         = radio.RadioId,
                GpsMode         = radio.GpsMode.ToString(),
                RequestInterval = radio.RequestInterval ?? 0
            };

            return(radioSettings);
        }
示例#3
0
        public static Radio Map(Model.Db.Radio radioSettings)
        {
            if (!Enum.TryParse(radioSettings.GpsMode, true, out GpsModeEnum gpsMode))
            {
                gpsMode = GpsModeEnum.None;
                logger.Warn($"Could not parse GpsEnum value '{radioSettings.GpsMode}', defaulted to {gpsMode.ToString()}");
            }

            Radio radio = new Radio
            {
                Name            = radioSettings.Name,
                RadioId         = radioSettings.RadioId,
                GpsMode         = gpsMode,
                RequestInterval = radioSettings.RequestInterval
            };

            return(radio);
        }