Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[homekit] Update for Xcode 9 beta 1 & 2 #2276

Merged
merged 4 commits into from
Jul 5, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 63 additions & 1 deletion src/HomeKit/HMEnums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ public enum HMError : nint {
NotAuthorizedForMicrophoneAccess = 89,
// iOS 10.2
IncompatibleNetwork = 90,
// iOS 11
NoHomeHub = 91,
IncompatibleHomeHub = 92, // HMErrorCodeNoCompatibleHomeHub introduced and deprecated on iOS 11. HMErrorCodeIncompatibleHomeHub = HMErrorCodeNoCompatibleHomeHub.
}


Expand Down Expand Up @@ -164,12 +167,21 @@ public enum HMCharacteristicType {
[Field ("HMCharacteristicTypeName")]
Name,

[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'HMAccessory.Manufacturer' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'HMAccessory.Manufacturer' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'HMAccessory.Manufacturer' instead.")]
[Field ("HMCharacteristicTypeManufacturer")]
Manufacturer,

[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'HMAccessory.Model' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'HMAccessory.Model' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'HMAccessory.Model' instead.")]
[Field ("HMCharacteristicTypeModel")]
Model,

[Deprecated (PlatformName.TvOS, 11, 0, message: "No longer supported.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "No longer supported.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "No longer supported.")]
[Field ("HMCharacteristicTypeSerialNumber")]
SerialNumber,

Expand Down Expand Up @@ -284,6 +296,9 @@ public enum HMCharacteristicType {
CurrentVerticalTilt,

[iOS (9,0)]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'HMAccessory.FirmwareVersion' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'HMAccessory.FirmwareVersion' instead.")]
[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'HMAccessory.FirmwareVersion' instead.")]
[Field ("HMCharacteristicTypeFirmwareVersion")]
FirmwareVersion,

Expand Down Expand Up @@ -557,6 +572,10 @@ public enum HMCharacteristicType {
[iOS (10,3), Watch (3,2), TV (10,2)]
[Field ("HMCharacteristicTypeLabelIndex")]
LabelIndex,

[iOS (11,0), Watch (4,0), TV (11,0)]
[Field ("HMCharacteristicTypeColorTemperature")]
ColorTemperature,
}

// conveniance enum (ObjC uses NSString)
Expand Down Expand Up @@ -1055,9 +1074,12 @@ public enum HMAccessoryCategoryType {

[iOS (9,0)]
[TV (10,0)]
// conveniance enum (ObjC uses NSString)
public enum HMSignificantEvent {

[Field ("HMSignificantEventSunrise")]
Sunrise,

[Field ("HMSignificantEventSunset")]
Sunset,
}

Expand Down Expand Up @@ -1229,4 +1251,44 @@ public enum HMCharacteristicValueLabelNamespace : nint {
Dot = 0,
Numeral,
}

[Watch (4,0), TV (11,0), iOS (11,0)]
[Native]
public enum HMEventTriggerActivationState : nuint {
Disabled = 0,
DisabledNoHomeHub = 1,
DisabledNoCompatibleHomeHub = 2,
DisabledNoLocationServicesAuthorization = 3,
Enabled = 4,
}

[Watch (4,0), TV (11,0), iOS (11,0)]
[Native]
public enum HMHomeHubState : nuint {
NotAvailable = 0,
Connected,
Disconnected,
}

[Watch (4,0), TV (11,0), iOS (11,0)]
public enum HMPresenceType {

[Field ("HMPresenceTypeCurrentUserAtHome")]
CurrentUserAtHome,

[Field ("HMPresenceTypeCurrentUserNotAtHome")]
CurrentUserNotAtHome,

[Field ("HMPresenceTypeAnyUserAtHome")]
AnyUserAtHome,

[Field ("HMPresenceTypeNoUserAtHome")]
NoUserAtHome,

[Field ("HMPresenceTypeUsersAtHome")]
UsersAtHome,

[Field ("HMPresenceTypeUsersNotAtHome")]
UsersNotAtHome,
}
}
22 changes: 8 additions & 14 deletions src/HomeKit/HMEventTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,20 @@ namespace XamCore.HomeKit {

partial class HMEventTrigger {

internal static NSString GetEnumConstant (HMSignificantEvent value)
{
switch (value) {
case HMSignificantEvent.Sunrise:
return HMSignificantEventInternal.Sunrise;
case HMSignificantEvent.Sunset:
return HMSignificantEventInternal.Sunset;
default:
return null;
}
}

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (HMSignificantTimeEvent)' instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (HMSignificantTimeEvent)' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (HMSignificantTimeEvent)' instead.")]
static public NSPredicate CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (HMSignificantEvent significantEvent, NSDateComponents offset)
{
return CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (GetEnumConstant (significantEvent), offset);
return CreatePredicateForEvaluatingTriggerOccurringBeforeSignificantEvent (significantEvent.GetConstant (), offset);
}

[Deprecated (PlatformName.iOS, 11, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (HMSignificantTimeEvent)' instead.")]
[Deprecated (PlatformName.TvOS, 11, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (HMSignificantTimeEvent)' instead.")]
[Deprecated (PlatformName.WatchOS, 4, 0, message: "Use 'CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (HMSignificantTimeEvent)' instead.")]
static public NSPredicate CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (HMSignificantEvent significantEvent, NSDateComponents offset)
{
return CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (GetEnumConstant (significantEvent), offset);
return CreatePredicateForEvaluatingTriggerOccurringAfterSignificantEvent (significantEvent.GetConstant (), offset);
}
}
}
17 changes: 17 additions & 0 deletions src/HomeKit/HMMutablePresenceEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using XamCore.ObjCRuntime;

namespace XamCore.HomeKit {

partial class HMMutablePresenceEvent {

public virtual HMPresenceType PresenceType {
get {
return (HMPresenceType) (HMPresenceTypeExtensions.GetValue (_PresenceType));
}
set {
_PresenceType = HMPresenceTypeExtensions.GetConstant (value);
}
}
}
}
17 changes: 17 additions & 0 deletions src/HomeKit/HMMutableSignificantTimeEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using XamCore.ObjCRuntime;

namespace XamCore.HomeKit {

partial class HMMutableSignificantTimeEvent {

public virtual HMSignificantEvent SignificantEvent {
get {
return (HMSignificantEvent) (HMSignificantEventExtensions.GetValue (_SignificantEvent));
}
set {
_SignificantEvent = HMSignificantEventExtensions.GetConstant (value);
}
}
}
}
17 changes: 17 additions & 0 deletions src/HomeKit/HMPresenceEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using XamCore.ObjCRuntime;

namespace XamCore.HomeKit {

partial class HMPresenceEvent {

public virtual HMPresenceType PresenceType {
get {
return (HMPresenceType) (HMPresenceTypeExtensions.GetValue (_PresenceType));
}
set {
_PresenceType = HMPresenceTypeExtensions.GetConstant (value);
}
}
}
}
17 changes: 17 additions & 0 deletions src/HomeKit/HMSignificantTimeEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using XamCore.ObjCRuntime;

namespace XamCore.HomeKit {

partial class HMSignificantTimeEvent {

public virtual HMSignificantEvent SignificantEvent {
get {
return (HMSignificantEvent) (HMSignificantEventExtensions.GetValue (_SignificantEvent));
}
set {
_SignificantEvent = HMSignificantEventExtensions.GetConstant (value);
}
}
}
}
4 changes: 4 additions & 0 deletions src/frameworks.sources
Original file line number Diff line number Diff line change
Expand Up @@ -811,6 +811,10 @@ HOMEKIT_SOURCES = \
HomeKit/HMCharacteristicProperties.cs \
HomeKit/HMEventTrigger.cs \
HomeKit/HMHome.cs \
HomeKit/HMPresenceEvent.cs \
HomeKit/HMSignificantTimeEvent.cs \
HomeKit/HMMutablePresenceEvent.cs \
HomeKit/HMMutableSignificantTimeEvent.cs \
HomeKit/HMService.cs \

# iAd
Expand Down
Loading