public Light(JObject jObject, HueConnection context, string id) : this(context, id) { if (jObject["state"] != null) { var lightState = HueObjectFactory.CreateHueObject(jObject["state"].ToString(), HueObjectType.LightState) as State; if (lightState != null) { State = lightState; } } Type = (string)jObject["type"]; LightType = EnumHelper.GetEnumWithDescription <LightType>(Type); SupportsColorModeAttribute supportsColorModeAttribute = LightType.GetEnumAttribute <SupportsColorModeAttribute>(); if (supportsColorModeAttribute != null) { SupportedColorModes = supportsColorModeAttribute.Modes; } else { SupportedColorModes = new List <ColorMode>(); } Name = (string)jObject["name"]; ModelID = (string)jObject["modelid"]; SoftwareVersion = (string)jObject["swversion"]; }
public Bridge(JObject jObject, HueConnection hueConnection) : base(hueConnection, (string)jObject["id"]) { InternalIPAddress = (string)jObject["internalipaddress"]; MACAddress = (string)jObject["macaddress"]; _groups = new HueObjectCollectionBase <Group>(); _lights = new HueObjectCollectionBase <Light>(); }
public Schedule(JObject jObject, HueConnection connection, string id) : base(connection, id) { Name = (string)jObject["name"]; Description = (string)jObject["description"]; if (jObject["command"] != null) { var command = HueObjectFactory.CreateHueObject(jObject["command"].ToString(), HueObjectType.Command) as Command; if (command != null) { Command = command; } } Time = (DateTime?)jObject["time"]; }
public Group(JObject jObject, HueConnection context, string id) : base(context, id) { Name = (string)jObject["name"]; if (jObject["action"] != null) { var lightState = HueObjectFactory.CreateHueObject(jObject["action"].ToString(), HueObjectType.LightState) as State; if (lightState != null) { State = lightState; } } Lights = new HueObjectCollectionBase <Light>(); if (jObject["lights"] != null) { LightsIDs = jObject["lights"].ToObject <List <string> >(); } }
public Light(HueConnection context, string id) : base(context, id) { }
public async Task <HueObjectBase> GetBridgesAsync(HueConnection connection) { // ToDo Implement UPnP code here return(await GetBridgesFromPortalAPIAsync(connection)); }
private async Task <HueObjectBase> GetBridgesFromPortalAPIAsync(HueConnection connection) { string returnString = await connection.GetAsync(Resources.BridgeUPNPURI); return(HueObjectFactory.CreateHueObject(returnString, connection, HueObjectType.Bridge) as HueObjectCollectionBase <Bridge> ?? (HueObjectBase) new Error(-1, "", "No Hue Bridge Found")); }