/// <summary> /// Displaies the service. /// </summary> /// <param name="name">Name.</param> /// <param name="type">Type.</param> public void DisplayService(string name, HMServiceType type) { // Update GUI Title.Text = name; // Take action based on type switch (type) { case HMServiceType.GarageDoorOpener: SubTitle.Text = "Garage Door Opener"; break; case HMServiceType.LightBulb: SubTitle.Text = "Light Bulb"; break; case HMServiceType.LockManagement: case HMServiceType.LockMechanism: SubTitle.Text = "Lock"; break; case HMServiceType.None: SubTitle.Text = "None"; break; case HMServiceType.Switch: SubTitle.Text = "Switch"; break; case HMServiceType.Thermostat: SubTitle.Text = "Thermostat"; break; } }
/// <summary> /// Displaies the service. /// </summary> /// <param name="name">Name.</param> /// <param name="type">Type.</param> public void DisplayService(string name, HMServiceType type) { // Update GUI Title.Text = name; // Take action based on type switch (type) { case HMServiceType.GarageDoorOpener: SubTitle.Text = "Garage Door Opener"; break; case HMServiceType.LightBulb: SubTitle.Text = "Light Bulb"; break; case HMServiceType.LockManagement: case HMServiceType.LockMechanism: SubTitle.Text = "Lock"; break; case HMServiceType.None: SubTitle.Text = "None"; break; case HMServiceType.Switch: SubTitle.Text = "Switch"; break; case HMServiceType.Thermostat: SubTitle.Text = "Thermostat"; break; } }
public HMService[] GetServices(HMServiceType serviceTypes) { var arr = new List<NSString> (); if ((serviceTypes & HMServiceType.LightBulb) == HMServiceType.LightBulb) arr.Add (HMServiceTypeInternal.LightBulb); if ((serviceTypes & HMServiceType.Switch) == HMServiceType.Switch) arr.Add (HMServiceTypeInternal.Switch); if ((serviceTypes & HMServiceType.Thermostat) == HMServiceType.Thermostat) arr.Add (HMServiceTypeInternal.Thermostat); if ((serviceTypes & HMServiceType.GarageDoorOpener) == HMServiceType.GarageDoorOpener) arr.Add (HMServiceTypeInternal.GarageDoorOpener); if ((serviceTypes & HMServiceType.AccessoryInformation) == HMServiceType.AccessoryInformation) arr.Add (HMServiceTypeInternal.AccessoryInformation); if ((serviceTypes & HMServiceType.Fan) == HMServiceType.Fan) arr.Add (HMServiceTypeInternal.Fan); if ((serviceTypes & HMServiceType.Outlet) == HMServiceType.Outlet) arr.Add (HMServiceTypeInternal.Outlet); if ((serviceTypes & HMServiceType.LockMechanism) == HMServiceType.LockMechanism) arr.Add (HMServiceTypeInternal.LockMechanism); if ((serviceTypes & HMServiceType.LockManagement) == HMServiceType.LockManagement) arr.Add (HMServiceTypeInternal.LockManagement); // iOS 9 if ((serviceTypes & HMServiceType.AirQualitySensor) == HMServiceType.AirQualitySensor) arr.Add (HMServiceTypeInternal.AirQualitySensor); if ((serviceTypes & HMServiceType.SecuritySystem) == HMServiceType.SecuritySystem) arr.Add (HMServiceTypeInternal.SecuritySystem); if ((serviceTypes & HMServiceType.CarbonMonoxideSensor) == HMServiceType.CarbonMonoxideSensor) arr.Add (HMServiceTypeInternal.CarbonMonoxideSensor); if ((serviceTypes & HMServiceType.ContactSensor) == HMServiceType.ContactSensor) arr.Add (HMServiceTypeInternal.ContactSensor); if ((serviceTypes & HMServiceType.Door) == HMServiceType.Door) arr.Add (HMServiceTypeInternal.Door); if ((serviceTypes & HMServiceType.HumiditySensor) == HMServiceType.HumiditySensor) arr.Add (HMServiceTypeInternal.HumiditySensor); if ((serviceTypes & HMServiceType.LeakSensor) == HMServiceType.LeakSensor) arr.Add (HMServiceTypeInternal.LeakSensor); if ((serviceTypes & HMServiceType.LightSensor) == HMServiceType.LightSensor) arr.Add (HMServiceTypeInternal.LightSensor); if ((serviceTypes & HMServiceType.MotionSensor) == HMServiceType.MotionSensor) arr.Add (HMServiceTypeInternal.MotionSensor); if ((serviceTypes & HMServiceType.OccupancySensor) == HMServiceType.OccupancySensor) arr.Add (HMServiceTypeInternal.OccupancySensor); if ((serviceTypes & HMServiceType.StatefulProgrammableSwitch) == HMServiceType.StatefulProgrammableSwitch) arr.Add (HMServiceTypeInternal.StatefulProgrammableSwitch); if ((serviceTypes & HMServiceType.StatelessProgrammableSwitch) == HMServiceType.StatelessProgrammableSwitch) arr.Add (HMServiceTypeInternal.StatelessProgrammableSwitch); if ((serviceTypes & HMServiceType.SmokeSensor) == HMServiceType.SmokeSensor) arr.Add (HMServiceTypeInternal.SmokeSensor); if ((serviceTypes & HMServiceType.TemperatureSensor) == HMServiceType.TemperatureSensor) arr.Add (HMServiceTypeInternal.TemperatureSensor); if ((serviceTypes & HMServiceType.Window) == HMServiceType.Window) arr.Add (HMServiceTypeInternal.Window); if ((serviceTypes & HMServiceType.WindowCovering) == HMServiceType.WindowCovering) arr.Add (HMServiceTypeInternal.WindowCovering); return _ServicesWithTypes (arr.ToArray ()); }
// Handles selection of one of the associated service types in the list. void DidSelectAssociatedServiceTypeAtIndexPath(NSIndexPath indexPath) { HMServiceType[] serviceTypes = CharacteristicsTableViewDataSource.ValidAssociatedServiceTypes; HMServiceType newServiceType = HMServiceType.None; if (indexPath.Row < serviceTypes.Length) { newServiceType = serviceTypes [indexPath.Row]; } NSString typeName = HMServiceKeys.Convert(newServiceType); Service.UpdateAssociatedServiceType(typeName, error => { if (error != null) { DisplayError(error); return; } DidUpdateAssociatedServiceType(); }); }
public Task UpdateNameAsync(HMServiceType serviceType) { return(UpdateNameAsync(GetName(serviceType))); }
public void UpdateAssociatedServiceType(HMServiceType serviceType, Action <NSError> completion) { UpdateAssociatedServiceType(GetName(serviceType), completion); }
NSString GetName(HMServiceType serviceType) { switch (serviceType) { case HMServiceType.LightBulb: return(HMServiceTypeInternal.LightBulb); case HMServiceType.Switch: return(HMServiceTypeInternal.Switch); case HMServiceType.Thermostat: return(HMServiceTypeInternal.Thermostat); case HMServiceType.GarageDoorOpener: return(HMServiceTypeInternal.GarageDoorOpener); case HMServiceType.AccessoryInformation: return(HMServiceTypeInternal.AccessoryInformation); case HMServiceType.Fan: return(HMServiceTypeInternal.Fan); case HMServiceType.Outlet: return(HMServiceTypeInternal.Outlet); case HMServiceType.LockMechanism: return(HMServiceTypeInternal.LockMechanism); case HMServiceType.LockManagement: return(HMServiceTypeInternal.LockManagement); // iOS 9 case HMServiceType.AirQualitySensor: return(HMServiceTypeInternal.AirQualitySensor); case HMServiceType.Battery: return(HMServiceTypeInternal.Battery); case HMServiceType.CarbonDioxideSensor: return(HMServiceTypeInternal.CarbonDioxideSensor); case HMServiceType.CarbonMonoxideSensor: return(HMServiceTypeInternal.CarbonMonoxideSensor); case HMServiceType.ContactSensor: return(HMServiceTypeInternal.ContactSensor); case HMServiceType.Door: return(HMServiceTypeInternal.Door); case HMServiceType.HumiditySensor: return(HMServiceTypeInternal.HumiditySensor); case HMServiceType.LeakSensor: return(HMServiceTypeInternal.LeakSensor); case HMServiceType.LightSensor: return(HMServiceTypeInternal.LightSensor); case HMServiceType.MotionSensor: return(HMServiceTypeInternal.MotionSensor); case HMServiceType.OccupancySensor: return(HMServiceTypeInternal.OccupancySensor); case HMServiceType.SecuritySystem: return(HMServiceTypeInternal.SecuritySystem); case HMServiceType.StatefulProgrammableSwitch: return(HMServiceTypeInternal.StatefulProgrammableSwitch); case HMServiceType.StatelessProgrammableSwitch: return(HMServiceTypeInternal.StatelessProgrammableSwitch); case HMServiceType.SmokeSensor: return(HMServiceTypeInternal.SmokeSensor); case HMServiceType.TemperatureSensor: return(HMServiceTypeInternal.TemperatureSensor); case HMServiceType.Window: return(HMServiceTypeInternal.Window); case HMServiceType.WindowCovering: return(HMServiceTypeInternal.WindowCovering); default: return(null); } }
NSString GetName(HMServiceType serviceType) { switch (serviceType) { case HMServiceType.LightBulb: return HMServiceTypeInternal.LightBulb; case HMServiceType.Switch: return HMServiceTypeInternal.Switch; case HMServiceType.Thermostat: return HMServiceTypeInternal.Thermostat; case HMServiceType.GarageDoorOpener: return HMServiceTypeInternal.GarageDoorOpener; case HMServiceType.AccessoryInformation: return HMServiceTypeInternal.AccessoryInformation; case HMServiceType.Fan: return HMServiceTypeInternal.Fan; case HMServiceType.Outlet: return HMServiceTypeInternal.Outlet; case HMServiceType.LockMechanism: return HMServiceTypeInternal.LockMechanism; case HMServiceType.LockManagement: return HMServiceTypeInternal.LockManagement; // iOS 9 case HMServiceType.AirQualitySensor: return HMServiceTypeInternal.AirQualitySensor; case HMServiceType.Battery: return HMServiceTypeInternal.Battery; case HMServiceType.CarbonDioxideSensor: return HMServiceTypeInternal.CarbonDioxideSensor; case HMServiceType.CarbonMonoxideSensor: return HMServiceTypeInternal.CarbonMonoxideSensor; case HMServiceType.ContactSensor: return HMServiceTypeInternal.ContactSensor; case HMServiceType.Door: return HMServiceTypeInternal.Door; case HMServiceType.HumiditySensor: return HMServiceTypeInternal.HumiditySensor; case HMServiceType.LeakSensor: return HMServiceTypeInternal.LeakSensor; case HMServiceType.LightSensor: return HMServiceTypeInternal.LightSensor; case HMServiceType.MotionSensor: return HMServiceTypeInternal.MotionSensor; case HMServiceType.OccupancySensor: return HMServiceTypeInternal.OccupancySensor; case HMServiceType.SecuritySystem: return HMServiceTypeInternal.SecuritySystem; case HMServiceType.StatefulProgrammableSwitch: return HMServiceTypeInternal.StatefulProgrammableSwitch; case HMServiceType.StatelessProgrammableSwitch: return HMServiceTypeInternal.StatelessProgrammableSwitch; case HMServiceType.SmokeSensor: return HMServiceTypeInternal.SmokeSensor; case HMServiceType.TemperatureSensor: return HMServiceTypeInternal.TemperatureSensor; case HMServiceType.Window: return HMServiceTypeInternal.Window; case HMServiceType.WindowCovering: return HMServiceTypeInternal.WindowCovering; default: return null; } }
public HMService [] GetServices(HMServiceType serviceTypes) { var arr = new List <NSString> (); if ((serviceTypes & HMServiceType.LightBulb) == HMServiceType.LightBulb) { arr.Add(HMServiceTypeInternal.LightBulb); } if ((serviceTypes & HMServiceType.Switch) == HMServiceType.Switch) { arr.Add(HMServiceTypeInternal.Switch); } if ((serviceTypes & HMServiceType.Thermostat) == HMServiceType.Thermostat) { arr.Add(HMServiceTypeInternal.Thermostat); } if ((serviceTypes & HMServiceType.GarageDoorOpener) == HMServiceType.GarageDoorOpener) { arr.Add(HMServiceTypeInternal.GarageDoorOpener); } if ((serviceTypes & HMServiceType.AccessoryInformation) == HMServiceType.AccessoryInformation) { arr.Add(HMServiceTypeInternal.AccessoryInformation); } if ((serviceTypes & HMServiceType.Fan) == HMServiceType.Fan) { arr.Add(HMServiceTypeInternal.Fan); } if ((serviceTypes & HMServiceType.Outlet) == HMServiceType.Outlet) { arr.Add(HMServiceTypeInternal.Outlet); } if ((serviceTypes & HMServiceType.LockMechanism) == HMServiceType.LockMechanism) { arr.Add(HMServiceTypeInternal.LockMechanism); } if ((serviceTypes & HMServiceType.LockManagement) == HMServiceType.LockManagement) { arr.Add(HMServiceTypeInternal.LockManagement); } // iOS 9 if ((serviceTypes & HMServiceType.AirQualitySensor) == HMServiceType.AirQualitySensor) { arr.Add(HMServiceTypeInternal.AirQualitySensor); } if ((serviceTypes & HMServiceType.SecuritySystem) == HMServiceType.SecuritySystem) { arr.Add(HMServiceTypeInternal.SecuritySystem); } if ((serviceTypes & HMServiceType.CarbonMonoxideSensor) == HMServiceType.CarbonMonoxideSensor) { arr.Add(HMServiceTypeInternal.CarbonMonoxideSensor); } if ((serviceTypes & HMServiceType.ContactSensor) == HMServiceType.ContactSensor) { arr.Add(HMServiceTypeInternal.ContactSensor); } if ((serviceTypes & HMServiceType.Door) == HMServiceType.Door) { arr.Add(HMServiceTypeInternal.Door); } if ((serviceTypes & HMServiceType.HumiditySensor) == HMServiceType.HumiditySensor) { arr.Add(HMServiceTypeInternal.HumiditySensor); } if ((serviceTypes & HMServiceType.LeakSensor) == HMServiceType.LeakSensor) { arr.Add(HMServiceTypeInternal.LeakSensor); } if ((serviceTypes & HMServiceType.LightSensor) == HMServiceType.LightSensor) { arr.Add(HMServiceTypeInternal.LightSensor); } if ((serviceTypes & HMServiceType.MotionSensor) == HMServiceType.MotionSensor) { arr.Add(HMServiceTypeInternal.MotionSensor); } if ((serviceTypes & HMServiceType.OccupancySensor) == HMServiceType.OccupancySensor) { arr.Add(HMServiceTypeInternal.OccupancySensor); } if ((serviceTypes & HMServiceType.StatefulProgrammableSwitch) == HMServiceType.StatefulProgrammableSwitch) { arr.Add(HMServiceTypeInternal.StatefulProgrammableSwitch); } if ((serviceTypes & HMServiceType.StatelessProgrammableSwitch) == HMServiceType.StatelessProgrammableSwitch) { arr.Add(HMServiceTypeInternal.StatelessProgrammableSwitch); } if ((serviceTypes & HMServiceType.SmokeSensor) == HMServiceType.SmokeSensor) { arr.Add(HMServiceTypeInternal.SmokeSensor); } if ((serviceTypes & HMServiceType.TemperatureSensor) == HMServiceType.TemperatureSensor) { arr.Add(HMServiceTypeInternal.TemperatureSensor); } if ((serviceTypes & HMServiceType.Window) == HMServiceType.Window) { arr.Add(HMServiceTypeInternal.Window); } if ((serviceTypes & HMServiceType.WindowCovering) == HMServiceType.WindowCovering) { arr.Add(HMServiceTypeInternal.WindowCovering); } return(_ServicesWithTypes(arr.ToArray())); }
public void UpdateAssociatedServiceType(HMServiceType serviceType, Action<NSError> completion) { UpdateAssociatedServiceType (GetName (serviceType), completion); }
public Task UpdateNameAsync(HMServiceType serviceType) { return(UpdateNameAsync(serviceType.GetConstant())); }
public void UpdateAssociatedServiceType(HMServiceType serviceType, Action <NSError> completion) { UpdateAssociatedServiceType(serviceType.GetConstant(), completion); }
static string DescriptionForServiceType (HMServiceType type) { string description; return serviceMap.TryGetValue (type, out description) ? description : type.ToString (); }
static string DescriptionForServiceType(HMServiceType type) { string description; return(serviceMap.TryGetValue(type, out description) ? description : type.ToString()); }
public static NSString Convert (HMServiceType s) { if (s == HMServiceType.LightBulb) return HMServiceKeys.LightBulb; if (s == HMServiceType.Switch) return HMServiceKeys.Switch; if (s == HMServiceType.Thermostat) return HMServiceKeys.Thermostat; if (s == HMServiceType.GarageDoorOpener) return HMServiceKeys.GarageDoorOpener; if (s == HMServiceType.AccessoryInformation) return HMServiceKeys.AccessoryInformation; if (s == HMServiceType.Fan) return HMServiceKeys.Fan; if (s == HMServiceType.Outlet) return HMServiceKeys.Outlet; if (s == HMServiceType.LockMechanism) return HMServiceKeys.LockMechanism; if (s == HMServiceType.LockManagement) return HMServiceKeys.LockManagement; // iOS 9 if (s == HMServiceType.AirQualitySensor) return HMServiceKeys.AirQualitySensor; if (s == HMServiceType.Battery) return HMServiceKeys.Battery; if (s == HMServiceType.CarbonDioxideSensor) return HMServiceKeys.CarbonDioxideSensor; if (s == HMServiceType.CarbonMonoxideSensor) return HMServiceKeys.CarbonMonoxideSensor; if (s == HMServiceType.ContactSensor) return HMServiceKeys.ContactSensor; if (s == HMServiceType.Door) return HMServiceKeys.Door; if (s == HMServiceType.HumiditySensor) return HMServiceKeys.HumiditySensor; if (s == HMServiceType.LeakSensor) return HMServiceKeys.LeakSensor; if (s == HMServiceType.LightSensor) return HMServiceKeys.LightSensor; if (s == HMServiceType.MotionSensor) return HMServiceKeys.MotionSensor; if (s == HMServiceType.OccupancySensor) return HMServiceKeys.OccupancySensor; if (s == HMServiceType.SecuritySystem) return HMServiceKeys.SecuritySystem; if (s == HMServiceType.StatefulProgrammableSwitch) return HMServiceKeys.StatefulProgrammableSwitch; if (s == HMServiceType.StatelessProgrammableSwitch) return HMServiceKeys.StatelessProgrammableSwitch; if (s == HMServiceType.SmokeSensor) return HMServiceKeys.SmokeSensor; if (s == HMServiceType.TemperatureSensor) return HMServiceKeys.TemperatureSensor; if (s == HMServiceType.Window) return HMServiceKeys.Window; if (s == HMServiceType.WindowCovering) return HMServiceKeys.WindowCovering; return null; }
public Task UpdateAssociatedServiceTypeAsync(HMServiceType serviceType) { return UpdateAssociatedServiceTypeAsync (GetName (serviceType)); }
public HMService [] GetServices(HMServiceType serviceTypes) { var arr = new List <NSString> (); if ((serviceTypes & HMServiceType.LightBulb) == HMServiceType.LightBulb) { arr.Add(HMServiceType.LightBulb.GetConstant()); } if ((serviceTypes & HMServiceType.Switch) == HMServiceType.Switch) { arr.Add(HMServiceType.Switch.GetConstant()); } if ((serviceTypes & HMServiceType.Thermostat) == HMServiceType.Thermostat) { arr.Add(HMServiceType.Thermostat.GetConstant()); } if ((serviceTypes & HMServiceType.GarageDoorOpener) == HMServiceType.GarageDoorOpener) { arr.Add(HMServiceType.GarageDoorOpener.GetConstant()); } if ((serviceTypes & HMServiceType.AccessoryInformation) == HMServiceType.AccessoryInformation) { arr.Add(HMServiceType.AccessoryInformation.GetConstant()); } if ((serviceTypes & HMServiceType.Fan) == HMServiceType.Fan) { arr.Add(HMServiceType.Fan.GetConstant()); } if ((serviceTypes & HMServiceType.Outlet) == HMServiceType.Outlet) { arr.Add(HMServiceType.Outlet.GetConstant()); } if ((serviceTypes & HMServiceType.LockMechanism) == HMServiceType.LockMechanism) { arr.Add(HMServiceType.LockMechanism.GetConstant()); } if ((serviceTypes & HMServiceType.LockManagement) == HMServiceType.LockManagement) { arr.Add(HMServiceType.LockManagement.GetConstant()); } // iOS 9 if ((serviceTypes & HMServiceType.AirQualitySensor) == HMServiceType.AirQualitySensor) { arr.Add(HMServiceType.AirQualitySensor.GetConstant()); } if ((serviceTypes & HMServiceType.SecuritySystem) == HMServiceType.SecuritySystem) { arr.Add(HMServiceType.SecuritySystem.GetConstant()); } if ((serviceTypes & HMServiceType.CarbonMonoxideSensor) == HMServiceType.CarbonMonoxideSensor) { arr.Add(HMServiceType.CarbonMonoxideSensor.GetConstant()); } if ((serviceTypes & HMServiceType.ContactSensor) == HMServiceType.ContactSensor) { arr.Add(HMServiceType.ContactSensor.GetConstant()); } if ((serviceTypes & HMServiceType.Door) == HMServiceType.Door) { arr.Add(HMServiceType.Door.GetConstant()); } if ((serviceTypes & HMServiceType.HumiditySensor) == HMServiceType.HumiditySensor) { arr.Add(HMServiceType.HumiditySensor.GetConstant()); } if ((serviceTypes & HMServiceType.LeakSensor) == HMServiceType.LeakSensor) { arr.Add(HMServiceType.LeakSensor.GetConstant()); } if ((serviceTypes & HMServiceType.LightSensor) == HMServiceType.LightSensor) { arr.Add(HMServiceType.LightSensor.GetConstant()); } if ((serviceTypes & HMServiceType.MotionSensor) == HMServiceType.MotionSensor) { arr.Add(HMServiceType.MotionSensor.GetConstant()); } if ((serviceTypes & HMServiceType.OccupancySensor) == HMServiceType.OccupancySensor) { arr.Add(HMServiceType.OccupancySensor.GetConstant()); } if ((serviceTypes & HMServiceType.StatefulProgrammableSwitch) == HMServiceType.StatefulProgrammableSwitch) { arr.Add(HMServiceType.StatefulProgrammableSwitch.GetConstant()); } if ((serviceTypes & HMServiceType.StatelessProgrammableSwitch) == HMServiceType.StatelessProgrammableSwitch) { arr.Add(HMServiceType.StatelessProgrammableSwitch.GetConstant()); } if ((serviceTypes & HMServiceType.SmokeSensor) == HMServiceType.SmokeSensor) { arr.Add(HMServiceType.SmokeSensor.GetConstant()); } if ((serviceTypes & HMServiceType.TemperatureSensor) == HMServiceType.TemperatureSensor) { arr.Add(HMServiceType.TemperatureSensor.GetConstant()); } if ((serviceTypes & HMServiceType.Window) == HMServiceType.Window) { arr.Add(HMServiceType.Window.GetConstant()); } if ((serviceTypes & HMServiceType.WindowCovering) == HMServiceType.WindowCovering) { arr.Add(HMServiceType.WindowCovering.GetConstant()); } // iOS 10.2 if ((serviceTypes & HMServiceType.AirPurifier) == HMServiceType.AirPurifier) { arr.Add(HMServiceType.AirPurifier.GetConstant()); } if ((serviceTypes & HMServiceType.VentilationFan) == HMServiceType.VentilationFan) { arr.Add(HMServiceType.VentilationFan.GetConstant()); } if ((serviceTypes & HMServiceType.FilterMaintenance) == HMServiceType.FilterMaintenance) { arr.Add(HMServiceType.FilterMaintenance.GetConstant()); } if ((serviceTypes & HMServiceType.HeaterCooler) == HMServiceType.HeaterCooler) { arr.Add(HMServiceType.HeaterCooler.GetConstant()); } if ((serviceTypes & HMServiceType.HumidifierDehumidifier) == HMServiceType.HumidifierDehumidifier) { arr.Add(HMServiceType.HumidifierDehumidifier.GetConstant()); } if ((serviceTypes & HMServiceType.Slats) == HMServiceType.Slats) { arr.Add(HMServiceType.Slats.GetConstant()); } return(GetServices(arr.ToArray())); }
public static NSString Convert(HMServiceType s) { if (s == HMServiceType.LightBulb) { return(HMServiceKeys.LightBulb); } if (s == HMServiceType.Switch) { return(HMServiceKeys.Switch); } if (s == HMServiceType.Thermostat) { return(HMServiceKeys.Thermostat); } if (s == HMServiceType.GarageDoorOpener) { return(HMServiceKeys.GarageDoorOpener); } if (s == HMServiceType.AccessoryInformation) { return(HMServiceKeys.AccessoryInformation); } if (s == HMServiceType.Fan) { return(HMServiceKeys.Fan); } if (s == HMServiceType.Outlet) { return(HMServiceKeys.Outlet); } if (s == HMServiceType.LockMechanism) { return(HMServiceKeys.LockMechanism); } if (s == HMServiceType.LockManagement) { return(HMServiceKeys.LockManagement); } // iOS 9 if (s == HMServiceType.AirQualitySensor) { return(HMServiceKeys.AirQualitySensor); } if (s == HMServiceType.Battery) { return(HMServiceKeys.Battery); } if (s == HMServiceType.CarbonDioxideSensor) { return(HMServiceKeys.CarbonDioxideSensor); } if (s == HMServiceType.CarbonMonoxideSensor) { return(HMServiceKeys.CarbonMonoxideSensor); } if (s == HMServiceType.ContactSensor) { return(HMServiceKeys.ContactSensor); } if (s == HMServiceType.Door) { return(HMServiceKeys.Door); } if (s == HMServiceType.HumiditySensor) { return(HMServiceKeys.HumiditySensor); } if (s == HMServiceType.LeakSensor) { return(HMServiceKeys.LeakSensor); } if (s == HMServiceType.LightSensor) { return(HMServiceKeys.LightSensor); } if (s == HMServiceType.MotionSensor) { return(HMServiceKeys.MotionSensor); } if (s == HMServiceType.OccupancySensor) { return(HMServiceKeys.OccupancySensor); } if (s == HMServiceType.SecuritySystem) { return(HMServiceKeys.SecuritySystem); } if (s == HMServiceType.StatefulProgrammableSwitch) { return(HMServiceKeys.StatefulProgrammableSwitch); } if (s == HMServiceType.StatelessProgrammableSwitch) { return(HMServiceKeys.StatelessProgrammableSwitch); } if (s == HMServiceType.SmokeSensor) { return(HMServiceKeys.SmokeSensor); } if (s == HMServiceType.TemperatureSensor) { return(HMServiceKeys.TemperatureSensor); } if (s == HMServiceType.Window) { return(HMServiceKeys.Window); } if (s == HMServiceType.WindowCovering) { return(HMServiceKeys.WindowCovering); } return(null); }