Package apple.homekit

Class HMHome

  • All Implemented Interfaces:
    NSObject

    public class HMHome
    extends NSObject
    Represents a home. This class represents a home and is the entry point to communicate and configure different accessories in the home. This is also used to manage all the rooms, zones, service groups, users, triggers, and action sets in the home.
    • Constructor Detail

      • HMHome

        protected HMHome​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • alloc

        public static HMHome alloc()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • accessories

        public NSArray<? extends HMAccessory> accessories()
        Array of HMAccessory objects that represents all accessories added to the home.
      • actionSets

        public NSArray<? extends HMActionSet> actionSets()
        Array of HMActionSet objects that represents all the action sets in the home.
      • addAccessoryCompletionHandler

        public void addAccessoryCompletionHandler​(HMAccessory accessory,
                                                  HMHome.Block_addAccessoryCompletionHandler completion)
        Adds a new accessory to the home.
        Parameters:
        accessory - Accessory to add to the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • addActionSetWithNameCompletionHandler

        public void addActionSetWithNameCompletionHandler​(java.lang.String actionSetName,
                                                          HMHome.Block_addActionSetWithNameCompletionHandler completion)
        Adds a new action set to the home.
        Parameters:
        actionSetName - Name of the action set to add to the home.
        completion - Block that is invoked once the request is processed. The HMActionSet parameter is the new action set added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addAndSetupAccessoriesWithCompletionHandler

        public void addAndSetupAccessoriesWithCompletionHandler​(HMHome.Block_addAndSetupAccessoriesWithCompletionHandler completion)
        Find nearby accessories and add them to the home. During this process, each of the accessories added to the home is assigned to a room and its services are configured.
        Parameters:
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • addRoomWithNameCompletionHandler

        public void addRoomWithNameCompletionHandler​(java.lang.String roomName,
                                                     HMHome.Block_addRoomWithNameCompletionHandler completion)
        Adds a room to the home.
        Parameters:
        roomName - Name of the room to add to the home.
        completion - Block that is invoked once the request is processed. The HMRoom is the new room added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addServiceGroupWithNameCompletionHandler

        public void addServiceGroupWithNameCompletionHandler​(java.lang.String serviceGroupName,
                                                             HMHome.Block_addServiceGroupWithNameCompletionHandler completion)
        Adds a service group to the home.
        Parameters:
        serviceGroupName - Name of the service group to add to the home.
        completion - Block that is invoked once the request is processed. The HMServiceGroup is the new service group added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addTriggerCompletionHandler

        public void addTriggerCompletionHandler​(HMTrigger trigger,
                                                HMHome.Block_addTriggerCompletionHandler completion)
        Adds a trigger to the home. Unless the trigger object is added to the home, it cannot be activated. Triggers are specific to an iOS device and are not synced across multiple devices to ensure that the action sets are executed only once.
        Parameters:
        trigger - Trigger to add to the home.
        completion - Block that is invoked once the request is processed. The HMTrigger parameter is the new trigger added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • addUserWithCompletionHandler

        @Deprecated
        public void addUserWithCompletionHandler​(HMHome.Block_addUserWithCompletionHandler completion)
        Deprecated.
        Adds a user to the home.
        Parameters:
        completion - Block that is invoked once the request is processed. The HMUser object provides a reference to the user that was added to the home. The NSError provides more information on the status of the request, error will be nil on success. The userInfo dictionary will contain the HMUserFailedAccessoriesKey which provides more details on the accessories that failed to add the user.
      • addZoneWithNameCompletionHandler

        public void addZoneWithNameCompletionHandler​(java.lang.String zoneName,
                                                     HMHome.Block_addZoneWithNameCompletionHandler completion)
        Adds a zone to the home.
        Parameters:
        zoneName - Name of the zone to add to the home.
        completion - Block that is invoked once the request is processed. The HMZone is the new zone added to the home. The NSError provides more information on the status of the request, error will be nil on success.
      • assignAccessoryToRoomCompletionHandler

        public void assignAccessoryToRoomCompletionHandler​(HMAccessory accessory,
                                                           HMRoom room,
                                                           HMHome.Block_assignAccessoryToRoomCompletionHandler completion)
        Assigns a new room for the accessory. When an accessory is added to a home, it is automatically assigned the room corresponding to + [HMHome roomForEntireHome]. This method is used to change the room assigned to an accessory.
        Parameters:
        accessory - Accessory whose rooms needs to modified
        room - New room for the accessory.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • builtinActionSetOfType

        public HMActionSet builtinActionSetOfType​(java.lang.String actionSetType)
        Retrieve a built-in action set for the home.
        Parameters:
        actionSetType - Type of the builtin action set. Supported action set types are HMActionSetTypeWakeUp, HMActionSetTypeSleep, HMActionSetTypeHomeDeparture and HMActionSetTypeHomeArrival.
        Returns:
        Reference to the built-in action set corresponding to type argument, nil if no matching action set is found.
      • currentUser

        public HMUser currentUser()
        HMUser object representing the current user of the home.
      • delegate

        public HMHomeDelegate delegate()
        Delegate that receives updates on the state of the home.
      • executeActionSetCompletionHandler

        public void executeActionSetCompletionHandler​(HMActionSet actionSet,
                                                      HMHome.Block_executeActionSetCompletionHandler completion)
        Executes all the actions within an action set.
        Parameters:
        actionSet - Action set to execute.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • homeAccessControlForUser

        public HMHomeAccessControl homeAccessControlForUser​(HMUser user)
        Retrieve the access level of the user associated with the home.
      • isPrimary

        public boolean isPrimary()
        Specifies whether this home is the primary home.
      • manageUsersWithCompletionHandler

        public void manageUsersWithCompletionHandler​(HMHome.Block_manageUsersWithCompletionHandler completion)
        Presents a view controller to manage users of the home. This API is available only for users that have administrator access to the home.
        Parameters:
        completion - Block that is invoked once user management is completed. The completion block is fired to allow clients to know when the user has dismissed the view. The NSError provides more information on the status of the request, error will be nil on success. If the user does not have administrator privileges the error code will be set to HMErrorCodeInsufficientPrivileges.
      • name

        public java.lang.String name()
        The name of the home.
      • removeAccessoryCompletionHandler

        public void removeAccessoryCompletionHandler​(HMAccessory accessory,
                                                     HMHome.Block_removeAccessoryCompletionHandler completion)
        Removes an accessory from the home.
        Parameters:
        accessory - Accessory to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeActionSetCompletionHandler

        public void removeActionSetCompletionHandler​(HMActionSet actionSet,
                                                     HMHome.Block_removeActionSetCompletionHandler completion)
        Removes an existing action set from the home.
        Parameters:
        actionSet - Action set to remove from the home. A builtin action set cannot be removed.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeRoomCompletionHandler

        public void removeRoomCompletionHandler​(HMRoom room,
                                                HMHome.Block_removeRoomCompletionHandler completion)
        Removes a room from the home. Any references to this room will be removed from all properties of the home. For example, the room will be removed from the zone. Any accessories associated contained by this room will be moved to the room provided by - [HMHome roomForEntireHome].
        Parameters:
        room - Room to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeServiceGroupCompletionHandler

        public void removeServiceGroupCompletionHandler​(HMServiceGroup group,
                                                        HMHome.Block_removeServiceGroupCompletionHandler completion)
        Removes a service group from the home.
        Parameters:
        group - Service group to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeTriggerCompletionHandler

        public void removeTriggerCompletionHandler​(HMTrigger trigger,
                                                   HMHome.Block_removeTriggerCompletionHandler completion)
        Removes a trigger from the home. If the trigger is active, they are automatically deactivated.
        Parameters:
        trigger - Trigger to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • removeUserCompletionHandler

        @Deprecated
        public void removeUserCompletionHandler​(HMUser user,
                                                HMHome.Block_removeUserCompletionHandler completion)
        Deprecated.
        Removes a user from the home.
        Parameters:
        user - HMUser whose access is being revoked.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success. The userInfo dictionary will contain the HMUserFailedAccessoriesKey which provides more details on the accessories that failed to remove the user.
      • removeZoneCompletionHandler

        public void removeZoneCompletionHandler​(HMZone zone,
                                                HMHome.Block_removeZoneCompletionHandler completion)
        Removes a zone from the home.
        Parameters:
        zone - Zone to remove from the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • roomForEntireHome

        public HMRoom roomForEntireHome()
        This method returns a room that represents the entire home. This can be used to assign a room to a service that is not necessarily located in one particular room.
        Returns:
        HMRoom that represents the home.
      • rooms

        public NSArray<? extends HMRoom> rooms()
        Array of HMRoom objects that represents all rooms in the home.
      • serviceGroups

        public NSArray<? extends HMServiceGroup> serviceGroups()
        Array of HMServiceGroup objects that represents all service groups in the home.
      • servicesWithTypes

        public NSArray<? extends HMService> servicesWithTypes​(NSArray<java.lang.String> serviceTypes)
        Queries all services that match the specified types.
        Parameters:
        serviceTypes - Array of NSString objects that specifies the service types to match.
        Returns:
        Array of HMService objects that match the specified service types, nil if no matching services were found.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(HMHomeDelegate value)
        Delegate that receives updates on the state of the home.
      • setDelegate

        public void setDelegate​(HMHomeDelegate value)
        Delegate that receives updates on the state of the home.
      • triggers

        public NSArray<? extends HMTrigger> triggers()
        Array of HMTrigger objects that represents all the triggers in the home.
      • unblockAccessoryCompletionHandler

        public void unblockAccessoryCompletionHandler​(HMAccessory accessory,
                                                      HMHome.Block_unblockAccessoryCompletionHandler completion)
        unblock a blocked accessory. A misbehaving accessory will automatically be blocked. After that all requests to the accessory will fail. This API must be used to explicitly unblock the accessory
        Parameters:
        accessory - accessory to be unblocked
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • uniqueIdentifier

        public NSUUID uniqueIdentifier()
        A unique identifier for the home.
      • updateNameCompletionHandler

        public void updateNameCompletionHandler​(java.lang.String name,
                                                HMHome.Block_updateNameCompletionHandler completion)
        This method is used to change the name of the home.
        Parameters:
        name - New name for the home.
        completion - Block that is invoked once the request is processed. The NSError provides more information on the status of the request, error will be nil on success.
      • users

        @Deprecated
        public NSArray<? extends HMUser> users()
        Deprecated.
        Array of HMUser objects that represent all users associated with the home.
      • zones

        public NSArray<? extends HMZone> zones()
        Array of HMZone objects that represents all the zones in the home.
      • homeHubState

        public long homeHubState()
        Specifies the state of the home hub.
      • addAndSetupAccessoriesWithPayloadCompletionHandler

        public void addAndSetupAccessoriesWithPayloadCompletionHandler​(HMAccessorySetupPayload payload,
                                                                       HMHome.Block_addAndSetupAccessoriesWithPayloadCompletionHandler completion)
        Add accessory with the given setup payload to the home. [@note] This SPI requires entitlement: com.apple.homekit.developer.allow-setup-payload
        Parameters:
        completion - Block that is invoked once the request is processed. Accessories provides the list of added accessories. The NSError provides more information on the status of the request, error will be nil on success.
      • supportsAddingNetworkRouter

        public boolean supportsAddingNetworkRouter()
        True if this home supports all of the requirements for adding a network router.