예제 #1
0
        public static IKeyed GetDevice(PepperDash.Essentials.Core.Config.DeviceConfig dc)
        {
            // ? why is this static JTA 2018-06-13?

            var key        = dc.Key;
            var name       = dc.Name;
            var type       = dc.Type;
            var properties = dc.Properties;
            var propAnon   = new { };

            JsonConvert.DeserializeAnonymousType(dc.Properties.ToString(), propAnon);

            var typeName  = dc.Type.ToLower();
            var groupName = dc.Group.ToLower();

            Debug.Console(0, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString());
            if (typeName == "essentialdm")
            {
                return(new EssentialDM(key, name, properties));
            }
            else if (typeName == "essentialcomm")
            {
                Debug.Console(0, "Launch Essential Comm");
                return(new EssentialComm(key, name, properties));
            }
            return(null);
        }
예제 #2
0
        public static bool UpdateRoomConfig(DeviceConfig config)
        {
            bool success = false;

            var deviceConfig = ConfigReader.ConfigObject.Rooms.FirstOrDefault(d => d.Key.Equals(config.Key));

            if (deviceConfig != null)
            {
                deviceConfig = config;

                Debug.Console(1, "Updated config of device: '{0}'", config.Key);

                success = true;
            }

            ResetTimer();

            return(success);
        }
 /// <summary>
 /// Returns the value of properties.hasControls, or false if not defined
 /// </summary>
 public static bool GetHasControls(DeviceConfig deviceConfig)
 {
     return(deviceConfig.Properties.Value <bool>("hasControls"));
 }
 /// <summary>
 /// Returns the value of properties.hasAudio, or false if not defined
 /// </summary>
 public static bool GetHasAudio(DeviceConfig deviceConfig)
 {
     return(deviceConfig.Properties.Value <bool>("hasAudio"));
 }